admin_url( 'admin-ajax.php' ), 'ajax_nonce' => wp_create_nonce('lgntfy_ajax_nonce_' . wp_salt()), )); } add_action( 'wp_enqueue_scripts', 'loginpompake_form_enqueue_scripts' ); function loginpompake_form_admin_enqueue_scripts($hook) { if($hook!= 'toplevel_page_loginfly_panel') { return; } wp_enqueue_style( 'lgntfy-admin-bootstrap4-css', plugins_url( '/assets/css/bootstrap.min.css', __FILE__ ) ); wp_enqueue_style( 'lgntfy-admin-style', plugins_url( '/assets/css/lgntfy_form_admin.css', __FILE__ ) ); wp_enqueue_style( 'lgntfy-admin-colorpicker', plugins_url( '/assets/css/tinycolorpicker.css', __FILE__ ) ); wp_enqueue_script( 'lgntfy-admin-fa-icon', plugins_url( '/assets/js/all.js', __FILE__ ) , array(), '5.14.0', true); wp_enqueue_script( 'lgntfy-admin-bootstrap4-js', plugins_url( '/assets/js/bootstrap.bundle.min.js', __FILE__ ) , array(), false, true ); wp_enqueue_script( 'lgntfy-admin-colorpicker-js', plugins_url( '/assets/js/jquery.tinycolorpicker.js', __FILE__ ) , array(), false, true ); wp_enqueue_script( 'lgntfy-admin-js', plugins_url( '/assets/js/lgntfy_admin.js', __FILE__ ) , array(), false, true ); } add_action( 'admin_enqueue_scripts', 'loginpompake_form_admin_enqueue_scripts' ); function loginpompake_form_ajax() { check_ajax_referer( 'lgntfy_ajax_nonce', 'security' ); $lgntfy_apikey = sanitize_text_field(get_option("lgntfy_apikey")); $lgntfy_phone = sanitize_text_field(get_option("lgntfy_phone")); if( !$_POST['data'] ) { return false; } wp_die(); } add_action( 'wp_ajax_nopriv_lgntfy_form_ajax', 'loginpompake_form_ajax' ); add_action( 'wp_ajax_lgntfy_form_ajax', 'loginpompake_form_ajax' ); function send_security_notification($user_login, $user, $is_failed_attempt = false, $error_message = '') { $lgntfy_status = get_option("lgntfy_status", "off"); if ($lgntfy_status !== 'on') { return; } $lgntfy_apikey = get_option("lgntfy_apikey"); $lgntfy_phone = get_option("lgntfy_phone"); $target_url = "https://wapiwp.com/api/loginpush/?apikey=" . urlencode($lgntfy_apikey); $ip_address = sanitize_text_field($_SERVER['REMOTE_ADDR']); $event_type = $is_failed_attempt ? 'Failed Login Attempt' : 'Successful Login'; $siteUrl = get_site_url(); $data = array( 'event' => $event_type, 'user_login' => sanitize_text_field($user_login), 'ip_address' => sanitize_text_field($ip_address), 'adminPhone' => sanitize_text_field($lgntfy_phone), 'siteUrl' => esc_url($siteUrl), ); if ($is_failed_attempt && is_string($error_message)) { $data['error_message'] = wp_kses($error_message, array()); } $response = wp_remote_post($target_url, array( 'body' => $data, )); if (is_wp_error($response)) { error_log('Güvenlik bildirimi gönderme hatası: ' . $response->get_error_message()); } elseif (isset($response['response']) && $response['response']['code'] !== 200) { error_log('Güvenlik bildirimi gönderme hatası: HTTP ' . $response['response']['code']); } } add_action('wp_login', function($user_login, $user) { send_security_notification($user_login, $user); }, 10, 2); add_action('wp_login_failed', function($username, $error) { send_security_notification($username, null, true, $error); }, 10, 2); function send_comment_notification($comment_ID) { $comment_status = get_option('lgntfy_comment_status', 'off'); $comment_status = sanitize_text_field($comment_status); if ($comment_status === 'off') { return; } $lgntfy_apikey = get_option("lgntfy_apikey"); $lgntfy_phone = get_option("lgntfy_phone"); $comment = get_comment($comment_ID); $post = get_post($comment->comment_post_ID); $target_url = "https://wapiwp.com/api/commentpush/?apikey=" . urlencode($lgntfy_apikey); $post_title = sanitize_text_field($post->post_title); $comment_content = sanitize_text_field($comment->comment_content); $permalink = sanitize_text_field(get_permalink($post->ID)); $comment_author = sanitize_text_field($comment->comment_author); $comment_author_email = sanitize_text_field($comment->comment_author_email); $comment_author_url = sanitize_text_field($comment->comment_author_url); $comment_author_IP = sanitize_text_field($comment->comment_author_IP); $data = array( 'adminPhone' => $lgntfy_phone, 'post_title' => $post_title, 'comment_content' => $comment_content, 'permalink' => $permalink, 'comment_author' => $comment_author, 'comment_author_email' => $comment_author_email, 'comment_author_url' => $comment_author_url, 'comment_author_IP' => $comment_author_IP, ); $sanitized_data = array_map('sanitize_text_field', $data); $response = wp_remote_post($target_url, array( 'body' => $sanitized_data, )); } add_action('comment_post', 'send_comment_notification'); function gclid_notification() { $lgntfy_ads_status = get_option('lgntfy_ads_status', 'off'); $lgntfy_ads_status = sanitize_text_field($lgntfy_ads_status); if ($lgntfy_ads_status === 'off') { return; } $referer = isset($_SERVER['HTTP_REFERER']) ? sanitize_text_field($_SERVER['HTTP_REFERER']) : ''; $request_uri = isset($_SERVER['REQUEST_URI']) ? sanitize_text_field($_SERVER['REQUEST_URI']) : ''; if (preg_match('/gad_source/i', $referer) || preg_match('/gad_source/i', $request_uri)) { $ip = sanitize_text_field($_SERVER['REMOTE_ADDR']); $userAgent = sanitize_text_field($_SERVER['HTTP_USER_AGENT']); $zaman = date('Y-m-d H:i:s'); $siteUrl = get_site_url(); $lgntfy_apikey = get_option("lgntfy_apikey"); $lgntfy_phone = get_option("lgntfy_phone"); $target_url = "https://wapiwp.com/api/adspush/?apikey=" . urlencode($lgntfy_apikey); $postData = array( 'adminPhone' => $lgntfy_phone, 'siteUrl' => $siteUrl, 'datex' => $zaman, 'ipx' => $ip, 'Referer' => $referer, 'UserAgent' => $userAgent, ); $response = wp_remote_post($target_url, array( 'body' => $postData, )); } } add_action('init', 'gclid_notification'); function freeapikey() { $default_phone_number = '905310000000'; if (empty(get_option('lgntfy_phone'))) { update_option('lgntfy_phone', $default_phone_number); } $default_lgntfy_status = 'off'; if (empty(get_option('lgntfy_status'))) { update_option('lgntfy_status', $default_lgntfy_status); } $default_lgntfy_ads_status = 'off'; if (empty(get_option('lgntfy_ads_status'))) { update_option('lgntfy_ads_status', $default_lgntfy_ads_status); } $default_comment_status = 'off'; if (empty(get_option('lgntfy_comment_status'))) { update_option('lgntfy_comment_status', $default_comment_status); } $default_api_key = '75EE49897ED5C7E82E15T8A1F7C0FE6BF1404211B'; if (empty(get_option('lgntfy_apikey'))) { update_option('lgntfy_apikey', $default_api_key); } } register_activation_hook(__FILE__, 'freeapikey'); function loginpompakeload_dashicons(){ wp_enqueue_style('dashicons'); } add_action('wp_enqueue_scripts', 'loginpompakeload_dashicons'); add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'loginpompakeadd_action_links' ); function loginpompakeadd_action_links ( $links ) { $lgntfy_adsettings = array( 'Options', '' . esc_html__( 'Add Credits', 'login-notification' ) . '', '' . esc_html__( 'Installation Guide', 'login-notification' ) . '' ); return array_merge( $links, $lgntfy_adsettings ); } add_filter( 'plugin_row_meta', 'loginpompakewk_plugin_row_meta', 10 ,2); function loginpompakewk_plugin_row_meta( $links, $file ) { if ( plugin_basename( __FILE__ ) == $file ) { $row_meta = array( 'docs' => '' . esc_html__( 'Rate', 'login-notification' ) . '', 'sorun' => '' . esc_html__( 'Report a Problem', 'login-notification' ) . '' ); return array_merge( $links, $row_meta ); } return (array) $links; } ?>