Changeset 3413502
- Timestamp:
- 12/07/2025 01:03:13 PM (3 months ago)
- Location:
- 0-day-analytics
- Files:
-
- 10 edited
- 1 copied
-
tags/4.3.1 (copied) (copied from 0-day-analytics/trunk)
-
tags/4.3.1/advanced-analytics.php (modified) (2 diffs)
-
tags/4.3.1/classes/vendor/controllers/classes-snippets-controller.php (modified) (2 diffs)
-
tags/4.3.1/classes/vendor/entities/class-snippet-entity.php (modified) (1 diff)
-
tags/4.3.1/js/admin/snippets-editor.js (modified) (5 diffs)
-
tags/4.3.1/readme.txt (modified) (2 diffs)
-
trunk/advanced-analytics.php (modified) (2 diffs)
-
trunk/classes/vendor/controllers/classes-snippets-controller.php (modified) (2 diffs)
-
trunk/classes/vendor/entities/class-snippet-entity.php (modified) (1 diff)
-
trunk/js/admin/snippets-editor.js (modified) (5 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
0-day-analytics/tags/4.3.1/advanced-analytics.php
r3413453 r3413502 11 11 * Plugin Name: 0 Day Analytics 12 12 * Description: Take full control of error log, crons, transients, plugins, requests, mails and DB tables. 13 * Version: 4.3. 013 * Version: 4.3.1 14 14 * Author: Stoil Dobrev 15 15 * Author URI: https://github.com/sdobreff/ … … 38 38 // Constants. 39 39 if ( ! defined( 'ADVAN_VERSION' ) ) { 40 define( 'ADVAN_VERSION', '4.3. 0' );40 define( 'ADVAN_VERSION', '4.3.1' ); 41 41 define( 'ADVAN_TEXTDOMAIN', '0-day-analytics' ); 42 42 define( 'ADVAN_NAME', '0 Day Analytics' ); -
0-day-analytics/tags/4.3.1/classes/vendor/controllers/classes-snippets-controller.php
r3413453 r3413502 14 14 use ADVAN\Helpers\Snippet_Condition_Evaluator; 15 15 use ADVAN\Helpers\Settings; 16 17 use function Safe\error_log; 16 18 17 19 if ( ! defined( 'ABSPATH' ) ) { … … 161 163 ); 162 164 163 $results = $wpdb->get_results( $query, ARRAY_A ); 165 $wpdb->suppress_errors( true ); 166 $results = $wpdb->get_results( $query, ARRAY_A ); 167 if ( '' !== $wpdb->last_error ) { 168 if ( 1146 === Snippet_Entity::get_last_sql_error( $wpdb ) ) { 169 if ( Snippet_Entity::create_table( $wpdb ) ) { 170 $results = array(); 171 } 172 } 173 } 174 $wpdb->suppress_errors( false ); 175 164 176 self::$runtime_snippets = is_array( $results ) ? $results : array(); 165 177 -
0-day-analytics/tags/4.3.1/classes/vendor/entities/class-snippet-entity.php
r3413453 r3413502 138 138 139 139 $sql = 'CREATE TABLE `' . $table . '` ( 140 id BIGINTUNSIGNED NOT NULL AUTO_INCREMENT,141 blog_id BIGINT UNSIGNED NOT NULL DEFAULT 0,142 name VARCHAR(190) NOT NULL,143 slug VARCHAR(190) NOT NULL,144 type VARCHAR(40) NOT NULL DEFAULT "php",145 status TINYINT(1) NOT NULL DEFAULT 0,146 code LONGTEXT NOT NULL,147 tags VARCHAR(255) DEFAULT NULL,148 execution_scope VARCHAR(20) NOT NULL DEFAULT "global",149 execution_hook VARCHAR(190) NOT NULL DEFAULT "init",150 hook_priority INT NOT NULL DEFAULT 10,151 shortcode_tag VARCHAR(100) DEFAULT NULL,152 run_conditions LONGTEXT NULL,153 last_run_at DATETIME NULL,154 last_run_status VARCHAR(40) NOT NULL DEFAULT "never",155 last_run_message TEXT NULL,156 created_at DATETIME NOT NULL,157 updated_at DATETIME NOT NULL,158 PRIMARY KEY (id),159 KEY idx_status(status),160 KEY idx_blog(blog_id),161 UNIQUE KEY uniq_blog_slug(blog_id, slug),162 UNIQUE KEY uniq_blog_shortcode(blog_id, shortcode_tag)140 id bigint UNSIGNED NOT NULL AUTO_INCREMENT, 141 blog_id BIGINT UNSIGNED NOT NULL DEFAULT 0, 142 name VARCHAR(190) NOT NULL, 143 slug VARCHAR(190) NOT NULL, 144 type VARCHAR(40) NOT NULL DEFAULT "php", 145 status TINYINT(1) NOT NULL DEFAULT 0, 146 code LONGTEXT NOT NULL, 147 tags VARCHAR(255) DEFAULT NULL, 148 execution_scope VARCHAR(20) NOT NULL DEFAULT "global", 149 execution_hook VARCHAR(190) NOT NULL DEFAULT "init", 150 hook_priority INT NOT NULL DEFAULT 10, 151 shortcode_tag VARCHAR(100) DEFAULT NULL, 152 run_conditions LONGTEXT NULL, 153 last_run_at DATETIME NULL, 154 last_run_status VARCHAR(40) NOT NULL DEFAULT "never", 155 last_run_message TEXT NULL, 156 created_at DATETIME NOT NULL, 157 updated_at DATETIME NOT NULL, 158 PRIMARY KEY (id), 159 KEY `idx_status` (status), 160 KEY `idx_blog` (blog_id), 161 UNIQUE KEY `uniq_blog_slug` (blog_id, slug), 162 UNIQUE KEY `uniq_blog_shortcode` (blog_id, shortcode_tag) 163 163 ) ' . $collate . ';'; 164 164 -
0-day-analytics/tags/4.3.1/js/admin/snippets-editor.js
r3413453 r3413502 140 140 141 141 form.addEventListener('submit', function (event) { 142 const value = ( getEditorValue() || '').trim();142 const value = (syncAndGetValue() || '').trim(); 143 143 if (value === '') { 144 144 event.preventDefault(); … … 152 152 153 153 hideError(); 154 syncEditor(value);155 154 }); 156 155 … … 159 158 editor.codemirror.on('change', hideError); 160 159 }); 161 162 function getEditorValue() {163 const editor = getEditor();164 if (editor && editor.codemirror) {165 return editor.codemirror.getValue();166 }167 return codeField.value;168 }169 160 170 161 function focusEditor() { … … 177 168 } 178 169 179 function sync Editor(value) {170 function syncAndGetValue() { 180 171 const editor = getEditor(); 181 172 if (editor && editor.codemirror) { 182 173 editor.codemirror.save(); 183 } else {184 codeField.value = value;185 }174 return editor.codemirror.getValue(); 175 } 176 return codeField.value; 186 177 } 187 178 … … 213 204 214 205 function getEditor() { 206 const field = document.getElementById('snippet-code'); 207 if (field) { 208 // Try common CodeMirror attachment points used by wp.codeEditor. 209 if (field.CodeMirror) { 210 return { codemirror: field.CodeMirror }; 211 } 212 213 // The wrapper created by CodeMirror typically stores the instance on a sibling element. 214 if (field.nextElementSibling && field.nextElementSibling.CodeMirror) { 215 return { codemirror: field.nextElementSibling.CodeMirror }; 216 } 217 218 const wrapper = field.parentElement ? field.parentElement.querySelector('.CodeMirror') : null; 219 if (wrapper && wrapper.CodeMirror) { 220 return { codemirror: wrapper.CodeMirror }; 221 } 222 } 215 223 if (!window.wp || !wp.codeEditor || !wp.codeEditor.editors) { 216 224 return null; -
0-day-analytics/tags/4.3.1/readme.txt
r3413453 r3413502 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 4.3. 07 Stable tag: 4.3.1 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.txt … … 92 92 == Changelog == 93 93 94 = 4.3.1 = 95 * Maintenance update - fixes problem with saving snippet for the first time. 96 94 97 = 4.3.0 = 95 98 * Maintenance, WP 6.9 compatibility, performance tweaks, added Code Snippets -
0-day-analytics/trunk/advanced-analytics.php
r3413453 r3413502 11 11 * Plugin Name: 0 Day Analytics 12 12 * Description: Take full control of error log, crons, transients, plugins, requests, mails and DB tables. 13 * Version: 4.3. 013 * Version: 4.3.1 14 14 * Author: Stoil Dobrev 15 15 * Author URI: https://github.com/sdobreff/ … … 38 38 // Constants. 39 39 if ( ! defined( 'ADVAN_VERSION' ) ) { 40 define( 'ADVAN_VERSION', '4.3. 0' );40 define( 'ADVAN_VERSION', '4.3.1' ); 41 41 define( 'ADVAN_TEXTDOMAIN', '0-day-analytics' ); 42 42 define( 'ADVAN_NAME', '0 Day Analytics' ); -
0-day-analytics/trunk/classes/vendor/controllers/classes-snippets-controller.php
r3413453 r3413502 14 14 use ADVAN\Helpers\Snippet_Condition_Evaluator; 15 15 use ADVAN\Helpers\Settings; 16 17 use function Safe\error_log; 16 18 17 19 if ( ! defined( 'ABSPATH' ) ) { … … 161 163 ); 162 164 163 $results = $wpdb->get_results( $query, ARRAY_A ); 165 $wpdb->suppress_errors( true ); 166 $results = $wpdb->get_results( $query, ARRAY_A ); 167 if ( '' !== $wpdb->last_error ) { 168 if ( 1146 === Snippet_Entity::get_last_sql_error( $wpdb ) ) { 169 if ( Snippet_Entity::create_table( $wpdb ) ) { 170 $results = array(); 171 } 172 } 173 } 174 $wpdb->suppress_errors( false ); 175 164 176 self::$runtime_snippets = is_array( $results ) ? $results : array(); 165 177 -
0-day-analytics/trunk/classes/vendor/entities/class-snippet-entity.php
r3413453 r3413502 138 138 139 139 $sql = 'CREATE TABLE `' . $table . '` ( 140 id BIGINTUNSIGNED NOT NULL AUTO_INCREMENT,141 blog_id BIGINT UNSIGNED NOT NULL DEFAULT 0,142 name VARCHAR(190) NOT NULL,143 slug VARCHAR(190) NOT NULL,144 type VARCHAR(40) NOT NULL DEFAULT "php",145 status TINYINT(1) NOT NULL DEFAULT 0,146 code LONGTEXT NOT NULL,147 tags VARCHAR(255) DEFAULT NULL,148 execution_scope VARCHAR(20) NOT NULL DEFAULT "global",149 execution_hook VARCHAR(190) NOT NULL DEFAULT "init",150 hook_priority INT NOT NULL DEFAULT 10,151 shortcode_tag VARCHAR(100) DEFAULT NULL,152 run_conditions LONGTEXT NULL,153 last_run_at DATETIME NULL,154 last_run_status VARCHAR(40) NOT NULL DEFAULT "never",155 last_run_message TEXT NULL,156 created_at DATETIME NOT NULL,157 updated_at DATETIME NOT NULL,158 PRIMARY KEY (id),159 KEY idx_status(status),160 KEY idx_blog(blog_id),161 UNIQUE KEY uniq_blog_slug(blog_id, slug),162 UNIQUE KEY uniq_blog_shortcode(blog_id, shortcode_tag)140 id bigint UNSIGNED NOT NULL AUTO_INCREMENT, 141 blog_id BIGINT UNSIGNED NOT NULL DEFAULT 0, 142 name VARCHAR(190) NOT NULL, 143 slug VARCHAR(190) NOT NULL, 144 type VARCHAR(40) NOT NULL DEFAULT "php", 145 status TINYINT(1) NOT NULL DEFAULT 0, 146 code LONGTEXT NOT NULL, 147 tags VARCHAR(255) DEFAULT NULL, 148 execution_scope VARCHAR(20) NOT NULL DEFAULT "global", 149 execution_hook VARCHAR(190) NOT NULL DEFAULT "init", 150 hook_priority INT NOT NULL DEFAULT 10, 151 shortcode_tag VARCHAR(100) DEFAULT NULL, 152 run_conditions LONGTEXT NULL, 153 last_run_at DATETIME NULL, 154 last_run_status VARCHAR(40) NOT NULL DEFAULT "never", 155 last_run_message TEXT NULL, 156 created_at DATETIME NOT NULL, 157 updated_at DATETIME NOT NULL, 158 PRIMARY KEY (id), 159 KEY `idx_status` (status), 160 KEY `idx_blog` (blog_id), 161 UNIQUE KEY `uniq_blog_slug` (blog_id, slug), 162 UNIQUE KEY `uniq_blog_shortcode` (blog_id, shortcode_tag) 163 163 ) ' . $collate . ';'; 164 164 -
0-day-analytics/trunk/js/admin/snippets-editor.js
r3413453 r3413502 140 140 141 141 form.addEventListener('submit', function (event) { 142 const value = ( getEditorValue() || '').trim();142 const value = (syncAndGetValue() || '').trim(); 143 143 if (value === '') { 144 144 event.preventDefault(); … … 152 152 153 153 hideError(); 154 syncEditor(value);155 154 }); 156 155 … … 159 158 editor.codemirror.on('change', hideError); 160 159 }); 161 162 function getEditorValue() {163 const editor = getEditor();164 if (editor && editor.codemirror) {165 return editor.codemirror.getValue();166 }167 return codeField.value;168 }169 160 170 161 function focusEditor() { … … 177 168 } 178 169 179 function sync Editor(value) {170 function syncAndGetValue() { 180 171 const editor = getEditor(); 181 172 if (editor && editor.codemirror) { 182 173 editor.codemirror.save(); 183 } else {184 codeField.value = value;185 }174 return editor.codemirror.getValue(); 175 } 176 return codeField.value; 186 177 } 187 178 … … 213 204 214 205 function getEditor() { 206 const field = document.getElementById('snippet-code'); 207 if (field) { 208 // Try common CodeMirror attachment points used by wp.codeEditor. 209 if (field.CodeMirror) { 210 return { codemirror: field.CodeMirror }; 211 } 212 213 // The wrapper created by CodeMirror typically stores the instance on a sibling element. 214 if (field.nextElementSibling && field.nextElementSibling.CodeMirror) { 215 return { codemirror: field.nextElementSibling.CodeMirror }; 216 } 217 218 const wrapper = field.parentElement ? field.parentElement.querySelector('.CodeMirror') : null; 219 if (wrapper && wrapper.CodeMirror) { 220 return { codemirror: wrapper.CodeMirror }; 221 } 222 } 215 223 if (!window.wp || !wp.codeEditor || !wp.codeEditor.editors) { 216 224 return null; -
0-day-analytics/trunk/readme.txt
r3413453 r3413502 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 4.3. 07 Stable tag: 4.3.1 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.txt … … 92 92 == Changelog == 93 93 94 = 4.3.1 = 95 * Maintenance update - fixes problem with saving snippet for the first time. 96 94 97 = 4.3.0 = 95 98 * Maintenance, WP 6.9 compatibility, performance tweaks, added Code Snippets
Note: See TracChangeset
for help on using the changeset viewer.