Plugin Directory

Changeset 3413502


Ignore:
Timestamp:
12/07/2025 01:03:13 PM (3 months ago)
Author:
awesomefootnotes
Message:

Adding the first version of my plugin

Location:
0-day-analytics
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • 0-day-analytics/tags/4.3.1/advanced-analytics.php

    r3413453 r3413502  
    1111 * Plugin Name:     0 Day Analytics
    1212 * Description:     Take full control of error log, crons, transients, plugins, requests, mails and DB tables.
    13  * Version:         4.3.0
     13 * Version:         4.3.1
    1414 * Author:          Stoil Dobrev
    1515 * Author URI:      https://github.com/sdobreff/
     
    3838// Constants.
    3939if ( ! defined( 'ADVAN_VERSION' ) ) {
    40     define( 'ADVAN_VERSION', '4.3.0' );
     40    define( 'ADVAN_VERSION', '4.3.1' );
    4141    define( 'ADVAN_TEXTDOMAIN', '0-day-analytics' );
    4242    define( 'ADVAN_NAME', '0 Day Analytics' );
  • 0-day-analytics/tags/4.3.1/classes/vendor/controllers/classes-snippets-controller.php

    r3413453 r3413502  
    1414use ADVAN\Helpers\Snippet_Condition_Evaluator;
    1515use ADVAN\Helpers\Settings;
     16
     17use function Safe\error_log;
    1618
    1719if ( ! defined( 'ABSPATH' ) ) {
     
    161163            );
    162164
    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
    164176            self::$runtime_snippets = is_array( $results ) ? $results : array();
    165177
  • 0-day-analytics/tags/4.3.1/classes/vendor/entities/class-snippet-entity.php

    r3413453 r3413502  
    138138
    139139            $sql = 'CREATE TABLE `' . $table . '` (
    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)
     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)
    163163            ) ' . $collate . ';';
    164164
  • 0-day-analytics/tags/4.3.1/js/admin/snippets-editor.js

    r3413453 r3413502  
    140140
    141141    form.addEventListener('submit', function (event) {
    142       const value = (getEditorValue() || '').trim();
     142      const value = (syncAndGetValue() || '').trim();
    143143      if (value === '') {
    144144        event.preventDefault();
     
    152152
    153153      hideError();
    154       syncEditor(value);
    155154    });
    156155
     
    159158      editor.codemirror.on('change', hideError);
    160159    });
    161 
    162     function getEditorValue() {
    163       const editor = getEditor();
    164       if (editor && editor.codemirror) {
    165         return editor.codemirror.getValue();
    166       }
    167       return codeField.value;
    168     }
    169160
    170161    function focusEditor() {
     
    177168    }
    178169
    179     function syncEditor(value) {
     170    function syncAndGetValue() {
    180171      const editor = getEditor();
    181172      if (editor && editor.codemirror) {
    182173        editor.codemirror.save();
    183       } else {
    184         codeField.value = value;
    185       }
     174        return editor.codemirror.getValue();
     175      }
     176      return codeField.value;
    186177    }
    187178
     
    213204
    214205  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    }
    215223    if (!window.wp || !wp.codeEditor || !wp.codeEditor.editors) {
    216224      return null;
  • 0-day-analytics/tags/4.3.1/readme.txt

    r3413453 r3413502  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 4.3.0
     7Stable tag: 4.3.1
    88License: GPLv3 or later
    99License URI: https://www.gnu.org/licenses/gpl-3.0.txt
     
    9292== Changelog ==
    9393
     94= 4.3.1 =
     95* Maintenance update - fixes problem with saving snippet for the first time.
     96
    9497= 4.3.0 =
    9598* Maintenance, WP 6.9 compatibility, performance tweaks, added Code Snippets
  • 0-day-analytics/trunk/advanced-analytics.php

    r3413453 r3413502  
    1111 * Plugin Name:     0 Day Analytics
    1212 * Description:     Take full control of error log, crons, transients, plugins, requests, mails and DB tables.
    13  * Version:         4.3.0
     13 * Version:         4.3.1
    1414 * Author:          Stoil Dobrev
    1515 * Author URI:      https://github.com/sdobreff/
     
    3838// Constants.
    3939if ( ! defined( 'ADVAN_VERSION' ) ) {
    40     define( 'ADVAN_VERSION', '4.3.0' );
     40    define( 'ADVAN_VERSION', '4.3.1' );
    4141    define( 'ADVAN_TEXTDOMAIN', '0-day-analytics' );
    4242    define( 'ADVAN_NAME', '0 Day Analytics' );
  • 0-day-analytics/trunk/classes/vendor/controllers/classes-snippets-controller.php

    r3413453 r3413502  
    1414use ADVAN\Helpers\Snippet_Condition_Evaluator;
    1515use ADVAN\Helpers\Settings;
     16
     17use function Safe\error_log;
    1618
    1719if ( ! defined( 'ABSPATH' ) ) {
     
    161163            );
    162164
    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
    164176            self::$runtime_snippets = is_array( $results ) ? $results : array();
    165177
  • 0-day-analytics/trunk/classes/vendor/entities/class-snippet-entity.php

    r3413453 r3413502  
    138138
    139139            $sql = 'CREATE TABLE `' . $table . '` (
    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)
     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)
    163163            ) ' . $collate . ';';
    164164
  • 0-day-analytics/trunk/js/admin/snippets-editor.js

    r3413453 r3413502  
    140140
    141141    form.addEventListener('submit', function (event) {
    142       const value = (getEditorValue() || '').trim();
     142      const value = (syncAndGetValue() || '').trim();
    143143      if (value === '') {
    144144        event.preventDefault();
     
    152152
    153153      hideError();
    154       syncEditor(value);
    155154    });
    156155
     
    159158      editor.codemirror.on('change', hideError);
    160159    });
    161 
    162     function getEditorValue() {
    163       const editor = getEditor();
    164       if (editor && editor.codemirror) {
    165         return editor.codemirror.getValue();
    166       }
    167       return codeField.value;
    168     }
    169160
    170161    function focusEditor() {
     
    177168    }
    178169
    179     function syncEditor(value) {
     170    function syncAndGetValue() {
    180171      const editor = getEditor();
    181172      if (editor && editor.codemirror) {
    182173        editor.codemirror.save();
    183       } else {
    184         codeField.value = value;
    185       }
     174        return editor.codemirror.getValue();
     175      }
     176      return codeField.value;
    186177    }
    187178
     
    213204
    214205  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    }
    215223    if (!window.wp || !wp.codeEditor || !wp.codeEditor.editors) {
    216224      return null;
  • 0-day-analytics/trunk/readme.txt

    r3413453 r3413502  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 4.3.0
     7Stable tag: 4.3.1
    88License: GPLv3 or later
    99License URI: https://www.gnu.org/licenses/gpl-3.0.txt
     
    9292== Changelog ==
    9393
     94= 4.3.1 =
     95* Maintenance update - fixes problem with saving snippet for the first time.
     96
    9497= 4.3.0 =
    9598* Maintenance, WP 6.9 compatibility, performance tweaks, added Code Snippets
Note: See TracChangeset for help on using the changeset viewer.