'wordpress', 'widget_id' => get_option('hc_wid'), 'request_url' => $file_path, 'result_url' => admin_url('index.php').'?hc_action=delete_xml&xml='.$file_name, 'result' => 'success' ); if($json_arr){ echo json_encode($json_arr); }else{ echo json_encode(array('result'=>'success')); } die(); } break; case 'save_wid': update_option('hc_wid', $_GET['wid']); update_option('hc_access', $_GET['access']); echo $_GET['access']; die(); break; case 'delete_xml': if(isset($_GET['result']) && $_GET['result'] == 'success'){ $filename = HC_XML_PATH.'/'.$_GET['xml']; unlink($filename); return json_encode(array('result'=>'success')); }else{ return json_encode(array('result'=>'error')); } exit(); break; } } } add_action('init', 'hc_request_handler'); function hc_admin_head(){ ?> guid); $url = str_replace('https://','',str_replace('http://','',str_replace('www.','',str_replace($parse['host'], get_option('home'), $post->guid)))); ?>
guid); $url = str_replace($parse['scheme'].'://'.$parse['host'], get_option('home'), $post->guid); return ''.$comment_text.''; } // action function for above hook function hc_admin_page() { // добавления подменю в раздел Параметры add_options_page('HyperComments', 'HyperComments', 8, 'hypercomments', 'hc_options_page'); } // Отображает страницу для настроек function hc_options_page() { if( $_POST['hc_form_counter_sub'] == 'Y' ) { update_option( 'hc_selector', $_POST['hc_form_selector'] ); if(isset($_POST['hc_title_widget'])){ update_option( 'hc_title_widget', $_POST['hc_title_widget'] ); }else{ delete_option('hc_title_widget'); } echo '

Options saved

'; } include_once(dirname(__FILE__) . '/manage.php'); } function hc_add_pages() { add_submenu_page( 'edit-comments.php', 'HyperComments', 'HyperComments', 'moderate_comments', 'hypercomments', 'hc_options_page' ); } add_action('admin_menu', 'hc_add_pages', 10); add_action('admin_notices', 'hc_messages'); function hc_messages() { $page = (isset($_GET['page']) ? $_GET['page'] : null); if ( !get_option('hc_wid') && $page != 'hypercomments') { echo '

'.__('You must configure the plugin to enable HyperComments.', 'hypercomments').'

'; } } function hc_enableParams() { global $wpdb; $results = $wpdb->get_results( "SELECT guid FROM $wpdb->posts WHERE post_type !='revision' AND post_status = 'publish' LIMIT 1"); foreach ( $results as $result ) { $link = $result->guid; } return strstr($link,'?'); } function hc_get_language() { $local = get_locale(); $local_lang = explode('_',$local); return $local_lang[0]; } add_filter( 'the_content', 'hc_the_content_filter', 20 ); /** * Add a icon to the beginning of every post page. */ function hc_the_content_filter( $content ) { global $post; $parse = parse_url($post->guid); $url = str_replace('https://','',str_replace('http://','',str_replace('www.','',str_replace($parse['host'], get_option('home'), $post->guid)))); if(get_option('hc_title_widget')){ if ( !is_single() ) // Add image to the end of each page $content = sprintf( '%s
', $content ); } // Returns the content. return $content; } ?>