Changeset 3434558
- Timestamp:
- 01/07/2026 05:30:25 PM (2 months ago)
- Location:
- topic
- Files:
-
- 25 added
- 2 edited
-
tags/1.0.39 (added)
-
tags/1.0.39/api (added)
-
tags/1.0.39/api/usetopicapi.php (added)
-
tags/1.0.39/assets (added)
-
tags/1.0.39/assets/banner-1544x500.png (added)
-
tags/1.0.39/assets/banner-772x250.png (added)
-
tags/1.0.39/assets/icon-128x128.png (added)
-
tags/1.0.39/assets/icon-256x256.png (added)
-
tags/1.0.39/assets/icon.svg (added)
-
tags/1.0.39/assets/screenshot-1.png (added)
-
tags/1.0.39/assets/screenshot-2.png (added)
-
tags/1.0.39/build (added)
-
tags/1.0.39/build/index-classic.7bb61b8c.js (added)
-
tags/1.0.39/build/index-classic.9753545b.asset.php (added)
-
tags/1.0.39/build/index-classic.css (added)
-
tags/1.0.39/build/index.302a7f6a.js (added)
-
tags/1.0.39/build/index.86eb8c11.asset.php (added)
-
tags/1.0.39/build/index.css (added)
-
tags/1.0.39/classic-editor (added)
-
tags/1.0.39/classic-editor/classic.css (added)
-
tags/1.0.39/classic-editor/fonts (added)
-
tags/1.0.39/classic-editor/fonts/Times.woff (added)
-
tags/1.0.39/classic-editor/fonts/Verdana.woff (added)
-
tags/1.0.39/index.php (added)
-
tags/1.0.39/readme.txt (added)
-
trunk/index.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
topic/trunk/index.php
r3370634 r3434558 1 1 <?php 2 2 /** 3 * Plugin Name: Topic4 * Plugin URI: https://www.usetopic.com/5 * Description: Topic helps editors and agencies create content briefs in half the time.6 * Author: Topic7 * License: GPL v2 or later8 * License URI: https://www.gnu.org/licenses/gpl-2.0.html9 * Version: 1.0.3810 */11 if ( ! defined( 'ABSPATH')) {12 exit;3 * Plugin Name: Topic 4 * Plugin URI: https://www.usetopic.com/ 5 * Description: Topic helps editors and agencies create content briefs in half the time. 6 * Author: Topic 7 * License: GPL v2 or later 8 * License URI: https://www.gnu.org/licenses/gpl-2.0.html 9 * Version: 1.0.39 10 */ 11 if (!defined('ABSPATH')) { 12 exit; 13 13 } 14 14 15 15 16 class useTopicSeo { 16 class useTopicSeo 17 { 17 18 18 19 public function __construct() {20 global $pagenow;21 if($pagenow == 'post.php' || $pagenow == 'post-new.php'){22 add_action( 'post_submitbox_misc_actions', array($this, 'add_usetopic_button_classic_editor') );23 add_action( 'admin_enqueue_scripts', array($this, 'topic_enqueue_assets_classic') );24 add_action('admin_footer', array($this, 'useTopicSeo_sidebar_box'));25 add_action( 'enqueue_block_editor_assets', array($this,'topic_enqueue_assets') );26 }27 add_action('wp_ajax_get_permalink_for_post_id', array($this, 'get_permalink_for_post_id'));28 add_action('wp_ajax_search_posts', array($this, 'search_posts'));29 }30 19 31 32 public function add_usetopic_button_classic_editor(){ 33 $html = '<div id="major-publishing-actions-use-topic" style="overflow:hidden"><p>'.__( 'Topic SEO Content Optimization Tool', 'usetopic-plugin' ).'</p>'; 34 $html .= '<div id="publishing-action-use-topic">'; 35 $html .= '<button type="button" aria-pressed="true" aria-expanded="true" id="usetopicMain" class="components-button is-pressed has-icon" aria-label="Topic SEO Content Optimization Tool">Grade Content</button>'; 36 $html .= '</div>'; 37 $html .= '</div>'; 38 echo $html; 20 public function __construct() 21 { 22 global $pagenow; 23 if ($pagenow == 'post.php' || $pagenow == 'post-new.php') { 24 add_action('post_submitbox_misc_actions', array($this, 'add_usetopic_button_classic_editor')); 25 add_action('admin_enqueue_scripts', array($this, 'topic_enqueue_assets_classic')); 26 add_action('admin_footer', array($this, 'useTopicSeo_sidebar_box')); 27 add_action('enqueue_block_editor_assets', array($this, 'topic_enqueue_assets')); 28 } 29 add_action('wp_ajax_get_permalink_for_post_id', array($this, 'get_permalink_for_post_id')); 30 add_action('wp_ajax_search_posts', array($this, 'search_posts')); 31 } 32 33 34 public function add_usetopic_button_classic_editor() 35 { 36 $html = '<div id="major-publishing-actions-use-topic" style="overflow:hidden"><p>' . __('Topic SEO Content Optimization Tool', 'usetopic-plugin') . '</p>'; 37 $html .= '<div id="publishing-action-use-topic">'; 38 $html .= '<button type="button" aria-pressed="true" aria-expanded="true" id="usetopicMain" class="components-button is-pressed has-icon" aria-label="Topic SEO Content Optimization Tool">Grade Content</button>'; 39 $html .= '</div>'; 40 $html .= '</div>'; 41 echo $html; 39 42 } 40 43 … … 44 47 * @param string $directory - The directory where the build files are located 45 48 * @return string|null - Returns the full file path or null if not found 46 */ 47 public function getHashedFilePath($filePattern, $directory = 'build') { 49 */ 50 public function getHashedFilePath($filePattern, $directory = 'build') 51 { 48 52 // Get the full path to the plugin directory 49 53 $plugin_dir = plugin_dir_path(__FILE__); … … 72 76 } 73 77 74 public function topic_enqueue_assets() { 78 public function topic_enqueue_assets() 79 { 75 80 $index_file_path = $this->getHashedFilePath('index'); 76 81 if ($index_file_path === null) { 77 $index_file_path = 'build/index.js'; 82 $index_file_path = 'build/index.js'; 78 83 } 79 84 wp_enqueue_script( 80 85 'topic-gutenberg-sidebar', 81 plugins_url( $index_file_path, __FILE__),82 array( 'wp-plugins', 'wp-edit-post', 'wp-i18n', 'wp-element'),86 plugins_url($index_file_path, __FILE__), 87 array('wp-plugins', 'wp-edit-post', 'wp-i18n', 'wp-element'), 83 88 null 84 89 ); 85 wp_enqueue_style('topic-sidebar-global', plugins_url( 'build/index.css', __FILE__), array(), 'all');90 wp_enqueue_style('topic-sidebar-global', plugins_url('build/index.css', __FILE__), array(), 'all'); 86 91 } 87 88 public function topic_enqueue_assets_classic() { 92 93 public function topic_enqueue_assets_classic() 94 { 89 95 $index_file_path = $this->getHashedFilePath('index-classic'); 90 96 if ($index_file_path === null) { 91 $index_file_path = 'build/index-classic.js'; 97 $index_file_path = 'build/index-classic.js'; 92 98 } 93 wp_enqueue_script( 94 'topic-gutenberg-sidebar-classic', 95 plugins_url( $index_file_path , __FILE__ ), array('wp-plugins'), null 96 ); 97 wp_enqueue_style('topic-classic-sidebar', plugins_url( 'classic-editor/classic.css', __FILE__ ), array(), 'all'); 98 wp_enqueue_style('topic-sidebar-global', plugins_url( 'build/index.css', __FILE__ ), array(), 'all'); 99 } 100 101 public function useTopicSeo_sidebar_box($data) { 102 echo '<div id="usetopicData"><div class="closeTopicdata"><strong>'.__( 'Topic SEO Content Optimization Tool', 'usetopic-plugin' ).'</strong><button type="button" class="close" aria-label="Close plugin"><svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="img" aria-hidden="true" focusable="false"><path d="M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"></path></svg><p class="usetopic-tooltip">Close Plugin</p></button></div><div class="content"></div></div>'; 99 wp_enqueue_script( 100 'topic-gutenberg-sidebar-classic', 101 plugins_url($index_file_path, __FILE__), 102 array('wp-plugins'), 103 null 104 ); 105 wp_enqueue_style('topic-classic-sidebar', plugins_url('classic-editor/classic.css', __FILE__), array(), 'all'); 106 wp_enqueue_style('topic-sidebar-global', plugins_url('build/index.css', __FILE__), array(), 'all'); 103 107 } 104 108 105 public function get_permalink_for_post_id(){ 106 if(isset($_POST['post_id'])){ 109 public function useTopicSeo_sidebar_box($data) 110 { 111 echo '<div id="usetopicData"><div class="closeTopicdata"><strong>' . __('Topic SEO Content Optimization Tool', 'usetopic-plugin') . '</strong><button type="button" class="close" aria-label="Close plugin"><svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="img" aria-hidden="true" focusable="false"><path d="M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"></path></svg><p class="usetopic-tooltip">Close Plugin</p></button></div><div class="content"></div></div>'; 112 } 113 114 public function get_permalink_for_post_id() 115 { 116 if (isset($_POST['post_id'])) { 107 117 $post_id = $_POST['post_id']; 108 118 $permalink = get_permalink(intval($post_id)); … … 115 125 } 116 126 117 public function search_posts(){ 118 if(isset($_POST['s'])){ 127 public function search_posts() 128 { 129 if (isset($_POST['s'])) { 119 130 $s = $_POST['s']; 120 131 121 132 global $wpdb; 122 $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 ) .'%'));133 $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) . '%')); 123 134 $post_array = array(); 124 foreach ( $myposts as $mypost ) 125 { 126 // $post = get_post($mypost); 127 $permalink = get_permalink(intval($mypost->ID)); 128 $mypost->permalink = $permalink; 129 $mypost->post_content = ""; 130 array_push($post_array, $mypost); 135 foreach ($myposts as $mypost) { 136 // $post = get_post($mypost); 137 $permalink = get_permalink(intval($mypost->ID)); 138 $mypost->permalink = $permalink; 139 $mypost->post_content = ""; 140 array_push($post_array, $mypost); 131 141 } 132 142 … … 140 150 141 151 } 142 143 $wpUseTopic = new useTopicSeo();152 153 $wpUseTopic = new useTopicSeo(); -
topic/trunk/readme.txt
r3370634 r3434558 84 84 85 85 == Changelog == 86 = 1.0.39 = 87 Release Date: SEP 30, 2025 88 Bug Fixes 89 86 90 = 1.0.38 = 87 91 Release Date: SEP 30, 2025
Note: See TracChangeset
for help on using the changeset viewer.