'.__( 'Topic SEO Content Optimization Tool', 'usetopic-plugin' ).'

'; $html .= '
'; $html .= ''; $html .= '
'; $html .= ''; echo $html; } public function topic_enqueue_assets() { wp_enqueue_script( 'topic-gutenberg-sidebar', plugins_url( 'build/index.js', __FILE__ ), array( 'wp-plugins', 'wp-edit-post', 'wp-i18n', 'wp-element' ) ); wp_enqueue_style('topic-sidebar-global', plugins_url( 'build/index.css', __FILE__ ), array(), time(), 'all'); } public function topic_enqueue_assets_classic() { wp_enqueue_script( 'topic-gutenberg-sidebar-classic', plugins_url( 'build/index-classic.js', __FILE__ ), array('wp-plugins'), time(), true ); wp_enqueue_style('topic-classic-sidebar', plugins_url( 'classic-editor/classic.css', __FILE__ ), array(), time(), 'all'); wp_enqueue_style('topic-sidebar-global', plugins_url( 'build/index.css', __FILE__ ), array(), time(), 'all'); } public function useTopicSeo_sidebar_box($data) { echo '
'.__( 'Topic SEO Content Optimization Tool', 'usetopic-plugin' ).'
'; } public function get_permalink_for_post_id(){ if(isset($_POST['post_id'])){ $post_id = $_POST['post_id']; $permalink = get_permalink(intval($post_id)); wp_send_json([ 'permalink' => $permalink ]); } wp_die(); } public function search_posts(){ if(isset($_POST['s'])){ $s = $_POST['s']; global $wpdb; $myposts = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' AND post_title LIKE '%s'", '%'. $wpdb->esc_like( $s ) .'%') ); $post_array = array(); foreach ( $myposts as $mypost ) { // $post = get_post($mypost); $permalink = get_permalink(intval($mypost->ID)); $mypost->permalink = $permalink; $mypost->post_content = ""; array_push($post_array, $mypost); } wp_send_json([ 'posts' => $post_array ]); } wp_die(); } } $wpUseTopic= new useTopicSeo();