' .__('Please, set setting for Addurilka plugin.', 'addurilka') . '

'; delete_transient( 'addurl-admin-notice' ); } } $plugin_file = plugin_basename(__FILE__); add_filter("plugin_action_links_$plugin_file", 'addurl_plugin_settings_link' ); function addurl_plugin_settings_link($links) { $settings_link = '' . __('Settings', 'addurilka') . ''; array_unshift( $links, $settings_link ); return $links; } add_action('admin_bar_menu', 'wp_ya_addurl', 91); function wp_ya_addurl($wp_ya_addurl_admin_bar) { function addurl_get_check_URL() { $check_url = get_permalink(); $check_url = preg_replace('~^https?://(?:www\.)?|/$~', '', $check_url); $check_url = rawurlencode($check_url); return $check_url; } $linkforcheckyandex = 'http://yandex.ru/yandsearch?text=url%3A%28www.'.addurl_get_check_URL().'%29+%7C+url%3A%28'.addurl_get_check_URL().'%29'; $linkforcheckgoogle = 'https://www.google.ru/?q=site:'.addurl_get_check_URL().'#newwindow=1&q=site:'.addurl_get_check_URL().''; function addurl_get_sent_URL() { $sent_url = get_permalink(); $sent_url = rawurlencode($sent_url); return $sent_url; } $linkforsenttoyandex = 'http://webmaster.yandex.ru/addurl.xml?url='.addurl_get_sent_URL(); $linkforsenttogoogle = 'https://www.google.com/webmasters/tools/submit-url?urlnt='.addurl_get_sent_URL(); if (get_option('wp_ya_addurl_setting_autocheck') == true) { $addurilkacheck = '○ '; if (get_option('wp_ya_addurl_setting_user') && get_option('wp_ya_addurl_setting_user_key') && get_option('wp_ya_addurl_setting_user_ip')) { $url = 'https://yandex.ru/search/xml?user=' . get_option('wp_ya_addurl_setting_user') . '&key=' . get_option('wp_ya_addurl_setting_user_key') . '&query='. get_permalink() . ''; $ip = get_option('wp_ya_addurl_setting_user_ip'); function addurl_autocheckyandex ($url, $ip) { $checkyandex = 0; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_NOBODY, false); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (Windows; U; Windows NT 5.0; En; rv:1.8.0.2) Gecko/20070306 Firefox/1.0.0.4"); curl_setopt($ch, CURLOPT_INTERFACE, $ip); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $xml_data = curl_exec($ch); curl_close($ch); $xml = new SimpleXMLElement($xml_data); if (isset($xml->response->results->grouping->group->doc->url)) $xml_url = $xml->response->results->grouping->group->doc->url; if ($xml_url = get_permalink()) $checkyandex = 1; return $checkyandex; } $checkyandex = addurl_autocheckyandex ($url, $ip); } else { $checkyandex = 0; if( get_transient( 'addurl-admin-notice-2' ) ){ echo '

' .__('Please, enter all setting for Yandex.XML. Automatic check link for Yandex not working.', 'addurilka') . '

'; delete_transient( 'addurl-admin-notice-2' ); } } $checkgoogle = 0; $url = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=site:'. get_permalink(); $body = file_get_contents($url); $json = json_decode($body); if ($json!="") { foreach ($json->responseData->results as $resultjson) { $result_google['urls']= $resultjson->url; if ($result_google = get_permalink()) {$checkgoogle = 1;} } } if ($checkyandex and $checkgoogle) $addurilkacheck = '● '; if ($checkyandex and !$checkgoogle) $addurilkacheck = '◖ '; if (!$checkyandex and $checkgoogle) $addurilkacheck = '◗ '; if (get_option('wp_ya_addurl_setting_short_name') == true) { $addurilkatitle = $addurilkacheck . __('A', 'addurilka'); } else { $addurilkatitle = $addurilkacheck . __('Addurilka', 'addurilka'); } } else { if (get_option('wp_ya_addurl_setting_short_name') == true) { $addurilkatitle = __('A', 'addurilka'); } else { $addurilkatitle = __('Addurilka', 'addurilka'); } } $args = array( 'id' => 'addurilka', 'title' => $addurilkatitle, 'meta' => array( 'class' => 'addurilka', 'target' => '_blank', 'title' => __('Add url in search engine', 'addurilka') ) ); $wp_ya_addurl_admin_bar->add_node($args); $args = array( 'id' => 'addurlcheck', 'title' => __('Check the link in', 'addurilka'), 'parent' => 'addurilka', 'meta' => array( 'class' => 'addurlcheck', 'target' => '_blank', 'menu_icon' => 'dashicons-products', 'title' => __('Checking the url to indexing', 'addurilka') ) ); $wp_ya_addurl_admin_bar->add_node($args); if (get_option('wp_ya_addurl_setting_show_yandex') == true) { $args = array( 'id' => 'yandexurlcheck', 'title' => __('Yandex', 'addurilka'), 'href' => $linkforcheckyandex, 'parent' => 'addurlcheck', 'meta' => array( 'class' => 'yandexurlcheck', 'target' => '_blank', 'title' => __('Checking the url to indexing in Yandex', 'addurilka') ) ); $wp_ya_addurl_admin_bar->add_node($args); } if (get_option('wp_ya_addurl_setting_show_google') == true) { $args = array( 'id' => 'googleurlcheck', 'title' => __('Google', 'addurilka'), 'href' => $linkforcheckgoogle, 'parent' => 'addurlcheck', 'meta' => array( 'class' => 'googleurlcheck', 'target' => '_blank', 'title' => __('Checking the url to indexing in Google', 'addurilka') ) ); $wp_ya_addurl_admin_bar->add_node($args); } $args = array( 'id' => 'addurlsent', 'title' => __('Send the link to', 'addurilka'), 'parent' => 'addurilka', 'meta' => array( 'class' => 'addurlsent', 'target' => '_blank', 'title' => __('Send the url in search engine', 'addurilka') ) ); $wp_ya_addurl_admin_bar->add_node($args); if (get_option('wp_ya_addurl_setting_show_yandex') == true) { $args = array( 'id' => 'yandexaddurlsent', 'title' => __('Yandex', 'addurilka'), 'href' => $linkforsenttoyandex, 'parent' => 'addurlsent', 'meta' => array( 'class' => 'yandexaddurlsent', 'target' => '_blank', 'title' => __('Send this url to Yandex.Webmaster', 'addurilka') ) ); $wp_ya_addurl_admin_bar->add_node($args); } if (get_option('wp_ya_addurl_setting_show_google') == true) { $args = array( 'id' => 'googleaddurlsent', 'title' => __('Google', 'addurilka'), 'href' => $linkforsenttogoogle, 'parent' => 'addurlsent', 'meta' => array( 'class' => 'googleaddurlsent', 'target' => '_blank', 'title' => __('Send this url to Google', 'addurilka') ) ); $wp_ya_addurl_admin_bar->add_node($args); } if (get_option('wp_ya_addurl_setting_webmaster_tool') == true) { $args = array( 'id' => 'addsite', 'title' => __('Add the site to', 'addurilka'), 'parent' => 'addurilka', 'meta' => array( 'class' => 'addsite', 'target' => '_blank', 'title' => __('Add the site in search engine webmaster', 'addurilka') ) ); $wp_ya_addurl_admin_bar->add_node($args); } $args = array( 'id' => 'googleWebmaster', 'title' => __('Google Webmaster', 'addurilka'), 'href' => 'https://www.google.com/Webmaster/tools/home', 'parent' => 'addsite', 'meta' => array( 'class' => 'googleWebmaster', 'target' => '_blank', 'title' => __('Send site to Google Webmaster', 'addurilka') ) ); $wp_ya_addurl_admin_bar->add_node($args); $args = array( 'id' => 'yaWebmaster', 'title' => __('Yandex Webmaster', 'addurilka'), 'href' => 'https://webmaster.yandex.ru/?tab=1', 'parent' => 'addsite', 'meta' => array( 'class' => 'yaWebmaster', 'target' => '_blank', 'title' => __('Open Yandex Webmaster', 'addurilka') ) ); $wp_ya_addurl_admin_bar->add_node($args); $args = array( 'id' => 'yasitesent', 'title' => __('Yandex add site', 'addurilka'), 'href' => 'https://webmaster.yandex.ru/site/?wizard=add.site', 'parent' => 'yaWebmaster', 'meta' => array( 'class' => 'yasitesent', 'target' => '_blank', 'title' => __('Send site to Yandex Webmaster', 'addurilka') ) ); $wp_ya_addurl_admin_bar->add_node($args); $args = array( 'id' => 'bingwebmaster', 'title' => __('Bing Webmaster', 'addurilka'), 'href' => 'http://www.bing.com/toolbox/webmaster', 'parent' => 'addsite', 'meta' => array( 'class' => 'bingwebmaster', 'target' => '_blank', 'title' => __('Open Bing Webmaster', 'addurilka') ) ); $wp_ya_addurl_admin_bar->add_node($args); $args = array( 'id' => 'bingsitesent', 'title' => __('Bing add site', 'addurilka'), 'href' => 'http://www.bing.com/toolbox/submit-site-url?url=' . home_url() . '', 'parent' => 'bingwebmaster', 'meta' => array( 'class' => 'bingsitesent', 'target' => '_blank', 'title' => __('Send site to Bing', 'addurilka') ) ); $wp_ya_addurl_admin_bar->add_node($args); $args = array( 'id' => 'baiduWebmaster', 'title' => __('Baidu Webmaster', 'addurilka'), 'href' => 'http://zhanzhang.baidu.com/linksubmit/url', 'parent' => 'addsite', 'meta' => array( 'class' => 'baiduWebmaster', 'target' => '_blank', 'title' => __('Send site to Baidu Webmaster', 'addurilka') ) ); $wp_ya_addurl_admin_bar->add_node($args); $args = array( 'id' => 'mailWebmaster', 'title' => __('Mail.ru Webmaster', 'addurilka'), 'href' => 'http://webmaster.mail.ru/', 'parent' => 'addsite', 'meta' => array( 'class' => 'mailWebmaster', 'target' => '_blank', 'title' => __('Open Mail.ru Webmaster', 'addurilka') ) ); $wp_ya_addurl_admin_bar->add_node($args); $args = array( 'id' => 'sputnikWebmaster', 'title' => __('Sputnik Webmaster', 'addurilka'), 'href' => 'http://corp.sputnik.ru/webmaster', 'parent' => 'addsite', 'meta' => array( 'class' => 'sputnikWebmaster', 'target' => '_blank', 'title' => __('Open Sputnik Webmaster', 'addurilka') ) ); $wp_ya_addurl_admin_bar->add_node($args); } add_action( 'admin_init', 'wp_ya_addurl_settings_init' ); function wp_ya_addurl_settings_init() { add_settings_field( 'wp_ya_addurl_setting_user', __('User', 'addurilka'), 'wp_ya_addurl_setting_user', 'reading', 'wp_ya_addurl_plugin_menu' ); register_setting( 'reading', 'wp_ya_addurl_setting_user' ); add_settings_field( 'wp_ya_addurl_setting_user_key', __('Key', 'addurilka'), 'wp_ya_addurl_setting_user_key', 'reading', 'wp_ya_addurl_plugin_menu' ); register_setting( 'reading', 'wp_ya_addurl_setting_user_key' ); add_settings_field( 'wp_ya_addurl_setting_user_ip', __('IP', 'addurilka'), 'wp_ya_addurl_setting_user_ip', 'reading', 'wp_ya_addurl_plugin_menu' ); register_setting( 'reading', 'wp_ya_addurl_setting_user_ip' ); add_settings_field( 'wp_ya_addurl_setting_autocheck', __('Аutocheck', 'addurilka'), 'wp_ya_addurl_setting_autocheck', 'reading', 'wp_ya_addurl_plugin_menu' ); register_setting( 'reading', 'wp_ya_addurl_setting_autocheck' ); add_settings_field( 'wp_ya_addurl_setting_short_name', __('Short name', 'addurilka'), 'wp_ya_addurl_setting_short_name', 'reading', 'wp_ya_addurl_plugin_menu' ); register_setting( 'reading', 'wp_ya_addurl_setting_short_name' ); add_settings_field( 'wp_ya_addurl_setting_show_yandex', __('Show Yandex', 'addurilka'), 'wp_ya_addurl_setting_show_yandex', 'reading', 'wp_ya_addurl_plugin_menu' ); register_setting( 'reading', 'wp_ya_addurl_setting_show_yandex' ); add_settings_field( 'wp_ya_addurl_setting_show_google', __('Show Google', 'addurilka'), 'wp_ya_addurl_setting_show_google', 'reading', 'wp_ya_addurl_plugin_menu' ); register_setting( 'reading', 'wp_ya_addurl_setting_show_google' ); add_settings_field( 'wp_ya_addurl_setting_webmaster_tool', __('Show Webmaster Tools', 'addurilka'), 'wp_ya_addurl_setting_webmaster_tool', 'reading', 'wp_ya_addurl_plugin_menu' ); register_setting( 'reading', 'wp_ya_addurl_setting_webmaster_tool' ); } add_action('admin_menu', 'wp_ya_addurl_plugin_menu'); function wp_ya_addurl_plugin_menu() { add_options_page(__('Addurilka', 'addurilka'), __('Addurilka', 'addurilka'), 'manage_options', 'wp_ya_addurl-plugin', 'wp_ya_addurl_plugin_page'); } function wp_ya_addurl_plugin_page(){ echo ''; echo ''; ?>
'; echo '
'; echo "

" . __('Settings for Addurilka', 'addurilka') . "

"; echo "

" . __('Values ​​display for automatic check url (test)', 'addurilka') . "

"; echo "

● " . __('Addurilka - url in Yandex and Google', 'addurilka') . "

"; echo "

◖ " . __('Addurilka - url in Yandex', 'addurilka') . "

"; echo "

◗ " . __('Addurilka - url in Google', 'addurilka') . "

"; echo "

○ " . __('Addurilka - no url in Yandex and Google', 'addurilka') . "

"; echo "

" . __('Main options', 'addurilka') . "

"; echo '
'; wp_nonce_field('update-options'); echo '
' . __('Enable short name', 'addurilka') . '

' . __('Show "A"', 'addurilka') . '

'; echo ''; echo '
' . __('Enable show Webmaster tool', 'addurilka') . ' '; echo ''; echo '
' . __('Enable check Yandex', 'addurilka') . ' '; echo ''; echo '
' . __('Enable check Google', 'addurilka') . ' '; echo ''; echo '
' . __('Enable automatic check', 'addurilka') . '

' . __('Only for Yandex & Google', 'addurilka') . '

'; echo ''; echo '

' . __('Setting for Yandex', 'addurilka') . '

' . __('In Yandex all very uncomfortable and paranoid, so try to set up autocheck. It can work, but maybe not.', 'addurilka') . '

' . __('Yandex user', 'addurilka') . ' '; echo '

' . __('Get a user from https://xml.yandex.ru/settings/', 'addurilka') . "

"; echo '
' . __('Secret Key', 'addurilka') . ' '; echo '

' . __('Get a key from https://xml.yandex.ru/settings/', 'addurilka') . "

"; echo '
' . __('Your IP', 'addurilka') . ' '; echo '

' . __('Get a IP from https://xml.yandex.ru/settings/', 'addurilka') . "

"; echo '
'; echo '

'; echo '

Thank you for using my plugin!
I hope it is useful for your site.', 'addurilka') ?>

– how can I thank you?', 'addurilka') ?>

  • Buy me a cup of coffee to stay awake and work on this plugin', 'addurilka'), "https://www.paypal.me/jon4god") ?>
  • Give 5 stars over at the WordPress Plugin Directory', 'addurilka'), "https://wordpress.org/support/view/plugin-reviews/addurilka") ?>

support forum or plugin\'s site for help.', 'addurilka'), "https://wordpress.org/support/plugin/addurilka", "http://wp.starcoms.ru/plugin-addurilka/") ?>