Changeset 3372633
- Timestamp:
- 10/03/2025 11:18:58 PM (6 months ago)
- Location:
- oc3-semantic-box/trunk
- Files:
-
- 6 edited
-
lib/controllers/AdminConfigController.php (modified) (6 diffs)
-
lib/controllers/AdminController.php (modified) (2 diffs)
-
lib/controllers/AdminSearchController.php (modified) (2 diffs)
-
lib/controllers/BaseController.php (modified) (1 diff)
-
oc3-semantic-box.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
oc3-semantic-box/trunk/lib/controllers/AdminConfigController.php
r3263660 r3372633 15 15 16 16 public function __construct() { 17 17 18 18 add_action('wp_ajax_oc3sb_store_general_tab', [$this, 'processSettingsSubmit']); 19 19 add_action('wp_ajax_oc3sb_gpt_conf_models', [$this, 'gptGetModels']); … … 40 40 41 41 // Ensure this is the correct page 42 if ($current_screen->id !== ' toplevel_page_oc3semanticb_settings') {42 if ($current_screen->id !== 'oc3-semantic-box_page_oc3semanticb_settings') { 43 43 return; 44 44 } 45 45 46 46 // Enqueue a script as a placeholder 47 wp_enqueue_script('oc3-semantic-box-config',OC3SEMANTICB_URL . '/views/resources/js/oc3-semantic -box-dummy.js', [], '1.0.0', true);47 wp_enqueue_script('oc3-semantic-box-config',OC3SEMANTICB_URL . '/views/resources/js/oc3-semanticbox-dummy.js', [], '1.0.0', true); 48 48 } 49 49 … … 52 52 53 53 // Ensure this is the correct page 54 if ($current_screen->id !== ' toplevel_page_oc3semanticb_settings') {54 if ($current_screen->id !== 'oc3-semantic-box_page_oc3semanticb_settings') { 55 55 return; 56 56 } … … 77 77 $current_screen = get_current_screen(); 78 78 79 if ($current_screen->id !== ' toplevel_page_oc3semanticb_settings') {79 if ($current_screen->id !== 'oc3-semantic-box_page_oc3semanticb_settings') { 80 80 return; 81 81 } … … 227 227 });" 228 228 . ""; 229 229 //var_dump($inline_js); 230 //die(); 230 231 wp_add_inline_script('oc3-semantic-box-config', $inline_js); 231 232 … … 514 515 515 516 if (!Oc3Semanticb_Utils::checkEditInstructionAccess()) { 516 return;517 } 518 517 //return; 518 } 519 519 520 $oc3semanticb_open_ai_gpt_key = get_option(OC3SEMANTICB_PREFIX_LOW . 'open_ai_gpt_key', ''); 520 521 $oc3semanticb_pinecone_key = get_option(OC3SEMANTICB_PREFIX_LOW . 'opinecone_key', ''); -
oc3-semantic-box/trunk/lib/controllers/AdminController.php
r3234031 r3372633 8 8 const ADMIN_MENU = OC3SEMANTICB_PREFIX_LOW . 'settings'; // 9 9 const ADMIN_MENU_CALLBACK = null; //can be view file or some callback function 10 10 const MENU_SLUG = 'oc3semanticb'; // top-level menu slug 11 const PAGE_SETTINGS = 'oc3semanticb_settings'; // settings page slug 12 const PAGE_SEARCH = 'oc3semanticb_search'; // search page slug 13 11 14 12 15 public $config_controller = false; … … 96 99 } 97 100 98 public function registerAdminMenu() { 101 public function registerAdminMenu() 102 { 103 // 1) Top-level menu (redirected to Settings) 104 $top_hook = add_menu_page( 105 __('OC3 Semantic Box', 'oc3-semantic-box'), 106 __('OC3 Semantic Box', 'oc3-semantic-box'), 107 'edit_posts', 108 self::MENU_SLUG, 109 '__return_null', 110 $this->admlogo 111 ); 99 112 100 add_menu_page('Settings', 101 'OC3 Semantic Box', 102 'edit_posts', self::ADMIN_MENU, null, 103 $this->admlogo); 104 $this->config_controller->registerAdminMenu(); 105 106 add_submenu_page(self::ADMIN_MENU, __('Search', 'oc3-semantic-box'), 107 __('Search', 'oc3-semantic-box'), 'edit_posts', 108 OC3SEMANTICB_PREFIX_LOW . 'search', [$this->search_controller, 'showMainView']); 109 110 if (!Oc3Semanticb_Utils::checkEditInstructionAccess()) { 111 return; 112 } 113 114 113 add_action('load-' . $top_hook, function () { 114 $url = menu_page_url(self::PAGE_SETTINGS, false); 115 if ($url) { wp_safe_redirect($url); exit; } 116 }); 117 118 // 2) SETTINGS submenu — REGISTER IT HERE so it always exists 119 $settings_cb = [$this->config_controller, 'showSettings']; 120 if (!is_callable($settings_cb)) { 121 $settings_cb = function () { 122 echo '<div class="wrap"><h1>Settings</h1><p>Settings view callback missing.</p></div>'; 123 }; 115 124 } 125 126 $settings_hook = add_submenu_page( 127 self::MENU_SLUG, 128 __('Settings', 'oc3-semantic-box'), 129 __('Settings', 'oc3-semantic-box'), 130 'edit_posts', 131 self::PAGE_SETTINGS, 132 $settings_cb 133 ); 134 135 // Wire processing handler (lives in config controller) 136 if (method_exists($this->config_controller, 'processSettingsSubmit')) { 137 add_action('load-' . $settings_hook, [$this->config_controller, 'processSettingsSubmit']); 138 } 139 140 // 3) SEARCH submenu 141 $search_cb = [$this->search_controller, 'showMainView']; 142 if (!is_callable($search_cb)) { 143 $search_cb = function () { 144 echo '<div class="wrap"><h1>Search</h1><p>Search view callback missing.</p></div>'; 145 }; 146 } 147 148 add_submenu_page( 149 self::MENU_SLUG, 150 __('Search', 'oc3-semantic-box'), 151 __('Search', 'oc3-semantic-box'), 152 'edit_posts', 153 self::PAGE_SEARCH, 154 $search_cb 155 ); 156 157 // 4) Remove WP’s auto “duplicate parent” submenu so "Settings" appears first 158 add_action('admin_menu', function () { 159 remove_submenu_page(self::MENU_SLUG, self::MENU_SLUG); 160 }, 999); 161 } 162 163 116 164 117 165 function showSettings() { -
oc3-semantic-box/trunk/lib/controllers/AdminSearchController.php
r3234031 r3372633 153 153 } 154 154 155 wp_enqueue_script('oc3-semantic-box-search',OC3SEMANTICB_URL . '/views/resources/js/oc3-semantic -box-dummy.js', [], '1.0.0', true);155 wp_enqueue_script('oc3-semantic-box-search',OC3SEMANTICB_URL . '/views/resources/js/oc3-semanticbox-dummy.js', [], '1.0.0', true); 156 156 157 157 $inline_js = "const oc3sengineajaxAction = '".esc_url(admin_url('admin-ajax.php'))."';\n". … … 181 181 function showSearchSettings() { 182 182 if (!Oc3Semanticb_Utils::checkEditInstructionAccess()) { 183 return;183 //return; 184 184 } 185 185 -
oc3-semantic-box/trunk/lib/controllers/BaseController.php
r3234031 r3372633 38 38 39 39 public function render() { 40 40 41 extract($this->view_vars, EXTR_SKIP); 41 42 -
oc3-semantic-box/trunk/oc3-semantic-box.php
r3263672 r3372633 8 8 Text Domain: oc3-semantic-box 9 9 Domain Path: /lang 10 Version: 1.0. 410 Version: 1.0.5 11 11 License: GPL-2.0+ 12 12 License URI: http://www.gnu.org/licenses/gpl-2.0.txt -
oc3-semantic-box/trunk/readme.txt
r3263672 r3372633 4 4 Tags: AI, Semantic search, search, RAG, AI embedding 5 5 Requires at least: 5.6 6 Tested up to: 6. 76 Tested up to: 6.8 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html 10 Stable tag: 1.0. 410 Stable tag: 1.0.5 11 11 12 12 Semantic search of website content with meaning... … … 87 87 == Changelog == 88 88 89 = 1.0.5 = 90 * Fix menu items creation & conflict with other plugins 91 89 92 = 1.0.4 = 90 93 * Fix readme
Note: See TracChangeset
for help on using the changeset viewer.