Plugin Directory

Changeset 2965871


Ignore:
Timestamp:
09/12/2023 11:59:22 AM (2 years ago)
Author:
parselearn
Message:

Release V1.4

  • Add a Tools tab to enhance WordPress functionality
  • Add an Optimizer tab to improve WordPress database performance
  • Show the size of each plugin table in the tables tab
Location:
meta-optimizer
Files:
29 added
14 edited

Legend:

Unmodified
Added
Removed
  • meta-optimizer/trunk/WPMetaOptimizer.php

    r2963196 r2965871  
    33/*!
    44 * Plugin Name: Meta Optimizer
    5  * Version: 1.3
     5 * Version: 1.4
    66 * Plugin URI: https://parsakafi.github.io/wp-meta-optimizer
    77 * Description: You can use Meta Optimizer to make your WordPress website load faster if you use metadata. For example, Post/Comment/User/Term metas.
     
    1717
    1818require_once __DIR__ . '/inc/Base.php';
    19 require_once __DIR__ . '/inc/Install.php';
    20 require_once __DIR__ . '/inc/DBIndexes.php';
    21 require_once __DIR__ . '/inc/Helpers.php';
    22 require_once __DIR__ . '/inc/Options.php';
    23 require_once __DIR__ . '/inc/Actions.php';
    24 require_once __DIR__ . '/inc/Queries.php';
    25 require_once __DIR__ . '/inc/MetaQuery.php';
    26 require_once __DIR__ . '/inc/PostQueries.php';
    27 require_once __DIR__ . '/inc/CommentQueries.php';
    28 require_once __DIR__ . '/inc/UserQueries.php';
    29 require_once __DIR__ . '/inc/TermQueries.php';
    30 require_once __DIR__ . '/inc/Integration.php';
    3119
    3220define( 'WPMETAOPTIMIZER_PLUGIN_KEY', 'wp-meta-optimizer' );
     
    4735        parent::__construct();
    4836
     37        $this->include();
     38
    4939        $this->Helpers = Helpers::getInstance();
    5040        $this->Options = Options::getInstance();
     
    5242        Queries::getInstance();
    5343        Integration::getInstance();
     44        Tools::getInstance();
    5445
    5546        $actionPriority = 99999999;
     
    548539    }
    549540
     541    private function include() {
     542        require_once __DIR__ . '/inc/Install.php';
     543        require_once __DIR__ . '/inc/DBIndexes.php';
     544        require_once __DIR__ . '/inc/Optimize.php';
     545        require_once __DIR__ . '/inc/Tools.php';
     546        require_once __DIR__ . '/inc/Helpers.php';
     547        require_once __DIR__ . '/inc/Options.php';
     548        require_once __DIR__ . '/inc/Actions.php';
     549        require_once __DIR__ . '/inc/Queries.php';
     550        require_once __DIR__ . '/inc/MetaQuery.php';
     551        require_once __DIR__ . '/inc/PostQueries.php';
     552        require_once __DIR__ . '/inc/CommentQueries.php';
     553        require_once __DIR__ . '/inc/UserQueries.php';
     554        require_once __DIR__ . '/inc/TermQueries.php';
     555        require_once __DIR__ . '/inc/Integration.php';
     556    }
     557
    550558    /**
    551559     * Returns an instance of class
  • meta-optimizer/trunk/assets/style.min.css

    r2963196 r2965871  
    1 .wpmo-wrap{line-height:2em}.wpmo-wrap .wp-heading-inline{margin-bottom:30px;display:flex !important;align-items:center}.wpmo-wrap .wp-heading-inline span{line-height:1;font-size:2em;width:45px;height:45px;margin-right:10px;background-color:#000;background-image:linear-gradient(65deg, #0aaee1, #7d0d74);background-size:100%;background-repeat:repeat;-webkit-background-clip:text;-webkit-text-fill-color:rgba(0,0,0,0);-moz-background-clip:text;-moz-text-fill-color:rgba(0,0,0,0)}.wpmo-wrap table{border-collapse:collapse;width:100%}.wpmo-wrap table.table-sticky-head{position:relative}.wpmo-wrap table.table-sticky-head thead{position:sticky;top:32px;z-index:1;background-color:#fff;-webkit-box-shadow:0 1px 0 0 #e2e2e2;box-shadow:0 1px 0 0 #e2e2e2}.wpmo-wrap table td,.wpmo-wrap table th{padding:15px 10px;vertical-align:top;text-align:start}.wpmo-wrap table td:first-child,.wpmo-wrap table th:first-child{width:200px}.wpmo-wrap table td label+label{margin-left:15px}.wpmo-wrap table tr.black-list-column{opacity:.7;border-left:2px solid #a108f9}.wpmo-wrap table .column-name{direction:ltr;text-align:left;display:inline-block}.wpmo-wrap table .translated-column-name{font-weight:bold}.wpmo-wrap a,.wpmo-wrap span{display:inline-block}.wpmo-wrap strong{font-weight:700}.wpmo-wrap select{min-width:300px}.wpmo-wrap select[multiple]{min-width:300px;max-height:200px}.wpmo-wrap textarea{max-width:100%}.wpmo-wrap input.small-text{width:100px}.wpmo-wrap .nav-tab-wrapper{border-bottom:none}.wpmo-wrap .nav-tab-wrapper .nav-tab{border:1px solid #e0e0e0;border-bottom:none;color:#787878;border-radius:5px 5px 0 0}.wpmo-wrap .nav-tab-wrapper .nav-tab:not(.nav-tab-active){background-color:#f1f1f1;cursor:pointer}.wpmo-wrap .nav-tab-wrapper .nav-tab:focus{box-shadow:none}.wpmo-wrap .nav-tab-wrapper .nav-tab-active,.wpmo-wrap .nav-tab-wrapper .nav-tab-active:focus,.wpmo-wrap .nav-tab-wrapper .nav-tab-active:focus:active,.wpmo-wrap .nav-tab-wrapper .nav-tab-active:hover{background-color:#fff;border-bottom-color:#fff;cursor:default}.wpmo-wrap .wpmo-tab-content{padding:20px;background-color:#fff;margin-bottom:20px}.wpmo-wrap .description{color:#8a8a8a}.wpmo-wrap .description .description-notice{padding:5px 5px 5px 8px;border-left:3px solid #feb93a;background-color:#fffbf6;border-radius:3px}.wpmo-wrap .change-icons span{cursor:pointer}.wpmo-wrap .change-icons span:not(:last-child){margin-right:15px}.wpmo-wrap .dashicons-trash{color:#fe3a3a}.wpmo-wrap .dashicons-edit{color:#1c7f1f}.wpmo-wrap .dashicons-remove{color:#a108f9}.wpmo-wrap .dashicons-insert{color:#f97008}.wpmo-wrap .color-red{color:#fe3a3a}.wpmo-wrap .blue-alert{background-color:#f3fdff;padding:15px;border-radius:5px;margin-top:10px}.wpmo-wrap .change-table-index{color:#969696;text-shadow:-1px 0 #707070,0 1px #707070,1px 0 #707070,0 -1px #707070;transform:rotate(45deg);width:25px;height:25px;display:inline-flex;justify-content:center;align-items:center}.wpmo-wrap .change-table-index.active{color:#f3d767;text-shadow:-1px 0 #e1a860,0 1px #e1a860,1px 0 #e1a860,0 -1px #e1a860}.wpmo-wrap .success-blink{animation:successBlinking 250ms infinite}.wpmo-wrap .error-blink{animation:errorBlinking 250ms infinite}.wpmo-wrap .reset-db-table{background-color:#fff3f3;border-radius:5px}.wpmo-wrap .reset-db-table strong{display:block}.wpmo-wrap .reset-db-table .description{margin-bottom:20px}.wpmo-wrap .reset-db-table .button-primary{background-color:#ab1717;border:1px solid #800a0a}.wpmo-wrap .reset-db-table .button-primary:focus,.wpmo-wrap .reset-db-table .button-primary:hover{background-color:#9a0f0f;border:1px solid #5d0505}body.rtl .wpmo-wrap .wp-heading-inline span{margin-left:10px;margin-right:0}body.rtl .wpmo-wrap table tr.black-list-column{border-left:none;border-right:2px solid #a108f9}body.rtl .wpmo-wrap table td label+label{margin-right:15px;margin-left:0}body.rtl .wpmo-wrap .change-icons span:not(:last-child){margin-left:15px;margin-right:0}body.rtl .wpmo-wrap .description .description-notice{padding:5px 8px 5px 5px;border-right:3px solid #feb93a;border-left:none}.wpmo-tooltip{display:none;position:absolute;padding:5px 15px;color:#2f2f2f;background:#f6f7f7;background:linear-gradient(0deg, rgb(246, 247, 247) 0%, rgb(253, 255, 229) 100%);box-shadow:2px 2px 0 0 rgba(184,184,184,.75);-webkit-box-shadow:2px 2px 0 0 rgba(184,184,184,.75);-moz-box-shadow:2px 2px 0 0 rgba(184,184,184,.75);border-radius:5px;max-width:250px;z-index:999999}@keyframes successBlinking{0%{background-color:initial}100%{background-color:#d6ffe6}}@keyframes errorBlinking{0%{background-color:initial}100%{background-color:#fbdfdf}}/*# sourceMappingURL=style.min.css.map */
     1.wpmo-wrap{line-height:2em}.wpmo-wrap *,.wpmo-wrap *:before,.wpmo-wrap *:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.wpmo-wrap .wp-heading-inline{margin-bottom:30px;display:flex !important;align-items:center}.wpmo-wrap .wp-heading-inline span{line-height:1;font-size:2em;width:45px;height:45px;margin-right:10px;background-color:#000;background-image:linear-gradient(65deg, #0aaee1, #7d0d74);background-size:100%;background-repeat:repeat;-webkit-background-clip:text;-webkit-text-fill-color:rgba(0,0,0,0);-moz-background-clip:border}.wpmo-wrap table{border-collapse:collapse;width:100%}.wpmo-wrap table.table-sticky-head{position:relative}.wpmo-wrap table.table-sticky-head thead{position:sticky;top:32px;z-index:1;background-color:#fff;-webkit-box-shadow:0 1px 0 0 #e2e2e2;box-shadow:0 1px 0 0 #e2e2e2}.wpmo-wrap table td,.wpmo-wrap table th{padding:15px 10px;vertical-align:top;text-align:start}.wpmo-wrap table td:first-child,.wpmo-wrap table th:first-child{width:200px}.wpmo-wrap table td label+label{margin-left:15px}.wpmo-wrap table tr.black-list-column{opacity:.7;border-left:2px solid #a108f9}.wpmo-wrap table .column-name{direction:ltr;text-align:left;display:inline-block}.wpmo-wrap table .translated-column-name{font-weight:bold}.wpmo-wrap a,.wpmo-wrap span{display:inline-block}.wpmo-wrap strong{font-weight:700}.wpmo-wrap select{min-width:300px}.wpmo-wrap select[multiple]{min-width:300px;max-height:200px}.wpmo-wrap textarea{max-width:100%}.wpmo-wrap input.small-text{width:100px}.wpmo-wrap .nav-tab-wrapper{border-bottom:none}.wpmo-wrap .nav-tab-wrapper .nav-tab{border:1px solid #e0e0e0;border-bottom:none;color:#787878;border-radius:5px 5px 0 0}.wpmo-wrap .nav-tab-wrapper .nav-tab:not(.nav-tab-active){background-color:#f1f1f1;cursor:pointer}.wpmo-wrap .nav-tab-wrapper .nav-tab:focus{box-shadow:none}.wpmo-wrap .nav-tab-wrapper .nav-tab-active,.wpmo-wrap .nav-tab-wrapper .nav-tab-active:focus,.wpmo-wrap .nav-tab-wrapper .nav-tab-active:focus:active,.wpmo-wrap .nav-tab-wrapper .nav-tab-active:hover{background-color:#fff;border-bottom-color:#fff;cursor:default}.wpmo-wrap .wpmo-tab-content{padding:20px;background-color:#fff;margin-bottom:20px}.wpmo-wrap .description{color:#6c5646}.wpmo-wrap .description .description-notice{padding:5px 5px 5px 8px;border-left:3px solid #feb93a;background-color:#fffbf6;border-radius:3px}.wpmo-wrap .change-icons span{cursor:pointer}.wpmo-wrap .change-icons span:not(:last-child){margin-right:15px}.wpmo-wrap .dashicons-trash{color:#fe3a3a}.wpmo-wrap .dashicons-edit{color:#1c7f1f}.wpmo-wrap .dashicons-remove{color:#a108f9}.wpmo-wrap .dashicons-insert{color:#f97008}.wpmo-wrap .color-red{color:#fe3a3a}.wpmo-wrap .blue-alert{background-color:#f3fdff;padding:15px;border-radius:5px;display:inline-block;margin-bottom:20px;margin-top:10px}.wpmo-wrap .change-table-index{color:#969696;text-shadow:-1px 0 #707070,0 1px #707070,1px 0 #707070,0 -1px #707070;transform:rotate(45deg);width:25px;height:25px;display:inline-flex;justify-content:center;align-items:center}.wpmo-wrap .change-table-index.active{color:#f3d767;text-shadow:-1px 0 #e1a860,0 1px #e1a860,1px 0 #e1a860,0 -1px #e1a860}.wpmo-wrap .success-blink{animation:successBlinking 250ms infinite}.wpmo-wrap .error-blink{animation:errorBlinking 250ms infinite}.wpmo-wrap .reset-db-table{background-color:#fff3f3;border-radius:5px}.wpmo-wrap .reset-db-table strong{display:block}.wpmo-wrap .reset-db-table .description{margin-bottom:20px}.wpmo-wrap .reset-db-table .button-primary{background-color:#ab1717;border:1px solid #800a0a}.wpmo-wrap .reset-db-table .button-primary:focus,.wpmo-wrap .reset-db-table .button-primary:hover{background-color:#9a0f0f;border:1px solid #5d0505}.wpmo-wrap .badge{padding:5px 7px;border-radius:10px;border:1px solid #f5f5f5;background-color:#fff;line-height:1}.wpmo-wrap .badge.green-badge{background-color:#2dc420;border-color:#209b15;color:#fff}.wpmo-wrap .badge.blue-badge{background-color:#2271b1;border-color:#1b639d;color:#fff}body.rtl .wpmo-wrap .wp-heading-inline span{margin-left:10px;margin-right:0}body.rtl .wpmo-wrap table tr.black-list-column{border-left:none;border-right:2px solid #a108f9}body.rtl .wpmo-wrap table td label+label{margin-right:15px;margin-left:0}body.rtl .wpmo-wrap .change-icons span:not(:last-child){margin-left:15px;margin-right:0}body.rtl .wpmo-wrap .description .description-notice{padding:5px 8px 5px 5px;border-right:3px solid #feb93a;border-left:none}body.rtl .wpmo-wrap .wpmo-checkbox label{padding:10px 58px 10px 20px}body.rtl .wpmo-wrap .wpmo-checkbox label:before{right:12px;left:inherit}body.rtl .wpmo-wrap .wpmo-checkbox input:checked+label:after{right:22px;left:inherit}.wpmo-checkbox input{padding:0;height:initial;width:initial;margin-bottom:0;display:none;cursor:pointer}.wpmo-checkbox label{padding:10px 20px 10px 58px;display:block;background-color:#f3fdff;border-radius:5px;border:1px solid #f3fdff;user-select:none;position:relative}.wpmo-checkbox label .label,.wpmo-checkbox label .description{display:block}.wpmo-checkbox label:before{content:"";display:block;position:absolute;top:calc(50% - 13px);left:12px;width:26px;height:26px;border:2px solid #2271b1;border-radius:50%}.wpmo-checkbox label .badge{margin-top:10px;opacity:.7}.wpmo-checkbox label .item-count{display:inline-flex;justify-content:center;align-items:center;background-color:#2271b1;color:#fff;padding:10px;border-radius:50%;width:30px;height:30px;margin-top:10px}.wpmo-checkbox label .item-count:empty{display:none}.wpmo-checkbox label .item-count:empty+span{display:none}.wpmo-checkbox input:checked+label{border-color:#c2e3ea;box-shadow:0 1px 2px rgba(0,0,0,.05),inset 0px -15px 10px -12px rgba(0,0,0,.05)}.wpmo-checkbox input:checked+label:after{content:"";display:block;position:absolute;top:calc(50% - 9px);left:22px;width:6px;height:14px;border:solid #2271b1;border-width:0 2px 2px 0;transform:rotate(45deg)}.wpmo-checkbox input:disabled+label{background-color:#fafafa;border-color:#f5f5f5;color:#737373;pointer-events:none;cursor:default}.wpmo-checkbox input:disabled+label:before{border-color:#b0b0b0}.wpmo-checkbox input:disabled+label .item-count{background-color:#b0b0b0}.wpmo-checkbox input:disabled:checked+label{border-color:#b0b0b0 !important}.wpmo-checkbox input:disabled:checked+label:after{border-color:#b0b0b0 !important}.wpmo-checkbox.wpmo-checkbox-red label{background-color:#ffebeb;border-color:#fff7f3}.wpmo-checkbox.wpmo-checkbox-red label:before{border-color:#d63638}.wpmo-checkbox.wpmo-checkbox-red label .item-count{background-color:#d63638}.wpmo-checkbox.wpmo-checkbox-red input:checked+label{border-color:#ead0c2}.wpmo-checkbox.wpmo-checkbox-red input:checked+label:after{border-color:#d63638}.wpmo-checkbox.wpmo-inline label{display:inline-block}.wpmo-tooltip{display:none;position:absolute;padding:5px 15px;color:#2f2f2f;background:#f6f7f7;background:linear-gradient(0deg, rgb(246, 247, 247) 0%, rgb(253, 255, 229) 100%);box-shadow:2px 2px 0 0 rgba(184,184,184,.75);-webkit-box-shadow:2px 2px 0 0 rgba(184,184,184,.75);-moz-box-shadow:2px 2px 0 0 rgba(184,184,184,.75);border-radius:5px;max-width:250px;z-index:999999}@keyframes successBlinking{0%{background-color:initial}100%{background-color:#d6ffe6}}@keyframes errorBlinking{0%{background-color:initial}100%{background-color:#fbdfdf}}/*# sourceMappingURL=style.min.css.map */
  • meta-optimizer/trunk/assets/wpmo.js

    r2963196 r2965871  
    176176
    177177    $(".wpmo-wrap form").on('submit', function () {
    178         $(this).find('input[type="checkbox"]').removeAttr('disabled');
     178        $(this).find('input[type="checkbox"]').not('.dont-enabled').removeAttr('disabled');
    179179        return true;
    180180    });
  • meta-optimizer/trunk/inc/Base.php

    r2960316 r2965871  
    2121    ),
    2222        $cantChangeWPMetaKeys = array(
    23         'post'    => [ '_thumbnail_id', '_encloseme', '_wp_old_slug', '_pingme', '_wp_page_template' ],
     23        'post'    => [
     24            '_thumbnail_id',
     25            '_encloseme',
     26            '_wp_old_slug',
     27            '_pingme',
     28            '_wp_page_template',
     29            '_wp_attachment_metadata',
     30            '_wp_attached_file'
     31        ],
    2432        'comment' => [],
    2533        'user'    => [
     
    7381        $this->tables = array(
    7482            'post'    => [
    75                 'table' => $wpdb->postmeta . '_wpmo',
    76                 'name'  => __( 'Post' ),
    77                 'title' => __( 'Post Meta', 'meta-optimizer' )
     83                'table'       => $wpdb->postmeta . '_wpmo',
     84                'name'        => __( 'Post' ),
     85                'plural_name' => __( 'Posts', 'meta-optimizer' ),
     86                'title'       => __( 'Post Meta', 'meta-optimizer' )
    7887            ],
    7988            'comment' => [
    80                 'table' => $wpdb->commentmeta . '_wpmo',
    81                 'name'  => __( 'Comment' ),
    82                 'title' => __( 'Comment Meta', 'meta-optimizer' )
     89                'table'       => $wpdb->commentmeta . '_wpmo',
     90                'name'        => __( 'Comment' ),
     91                'plural_name' => __( 'Comments', 'meta-optimizer' ),
     92                'title'       => __( 'Comment Meta', 'meta-optimizer' )
    8393            ],
    8494            'user'    => [
    85                 'table' => $wpdb->usermeta . '_wpmo',
    86                 'name'  => __( 'User' ),
    87                 'title' => __( 'User Meta', 'meta-optimizer' )
     95                'table'       => $wpdb->usermeta . '_wpmo',
     96                'name'        => __( 'User' ),
     97                'plural_name' => __( 'Users', 'meta-optimizer' ),
     98                'title'       => __( 'User Meta', 'meta-optimizer' )
    8899            ],
    89100            'term'    => [
    90                 'table' => $wpdb->termmeta . '_wpmo',
    91                 'name'  => __( 'Term' ),
    92                 'title' => __( 'Term Meta', 'meta-optimizer' )
     101                'table'       => $wpdb->termmeta . '_wpmo',
     102                'name'        => __( 'Term', 'meta-optimizer' ),
     103                'plural_name' => __( 'Terms', 'meta-optimizer' ),
     104                'title'       => __( 'Term Meta', 'meta-optimizer' )
    93105            ]
    94106        );
  • meta-optimizer/trunk/inc/Helpers.php

    r2963196 r2965871  
    498498    }
    499499
     500    public function getTableSize( $table, $humanSize = false ) {
     501        global $wpdb;
     502
     503        $size = intval( $wpdb->get_var( "SELECT (DATA_LENGTH + INDEX_LENGTH) AS `size` FROM information_schema.TABLES WHERE TABLE_SCHEMA = '$wpdb->dbname' AND TABLE_NAME = '$table'" ) );
     504
     505        if ( $humanSize )
     506            $size = $this->humanFileSize( $size, 1 );
     507
     508        return $size;
     509    }
     510
     511    function humanFileSize( $bytes, $dec = 2 ): string {
     512        $size   = array( 'B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB' );
     513        $factor = floor( ( strlen( $bytes ) - 1 ) / 3 );
     514        if ( $factor == 0 )
     515            $dec = 0;
     516
     517        return sprintf( "%.{$dec}f %s", $bytes / ( 1024 ** $factor ), $size[ $factor ] );
     518    }
     519
    500520    /**
    501521     * Get meta table name base on a type
  • meta-optimizer/trunk/inc/Install.php

    r2963196 r2965871  
    6868            );
    6969
    70             update_option( 'wp_meta_optimizer', $defaultPluginOptions );
     70            update_option( 'wp_meta_optimizer', $defaultPluginOptions, false );
    7171        } else {
    7272            $oldVersion = get_option( 'wp_meta_optimizer_version', '1.0' );
     
    8383                }
    8484
    85                 update_option( 'wp_meta_optimizer', $newPluginOptions );
     85                update_option( 'wp_meta_optimizer', $newPluginOptions, false );
    8686
    8787                wp_cache_delete( 'options', WPMETAOPTIMIZER_PLUGIN_KEY );
     
    9292            require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    9393        $pluginData = get_plugin_data( WPMETAOPTIMIZER_PLUGIN_FILE_PATH );
    94         update_option( 'wp_meta_optimizer_version', $pluginData['Version'] );
     94        update_option( 'wp_meta_optimizer_version', $pluginData['Version'], false );
    9595    }
    9696}
  • meta-optimizer/trunk/inc/Options.php

    r2963196 r2965871  
    6363        $updateMessage = '';
    6464        $currentTab    = 'tables';
     65
    6566        if ( isset( $_POST[ WPMETAOPTIMIZER_PLUGIN_KEY ] ) ) {
     67            $currentTab = isset( $_POST['current_tab'] ) ? sanitize_text_field( $_POST['current_tab'] ) : $currentTab;
     68            $postData   = $_POST;
     69            unset( $postData[ WPMETAOPTIMIZER_PLUGIN_KEY ] );
     70            unset( $postData['current_tab'] );
     71
    6672            if ( wp_verify_nonce( $_POST[ WPMETAOPTIMIZER_PLUGIN_KEY ], 'settings_submit' ) ) {
    67                 $currentTab   = sanitize_text_field( $_POST['current_tab'] );
    6873                $checkBoxList = [];
    69                 unset( $_POST[ WPMETAOPTIMIZER_PLUGIN_KEY ] );
    70                 unset( $_POST['current_tab'] );
    7174
    7275                $options = $this->getOption( null, [], false );
    7376
    74                 foreach ( $_POST as $key => $value ) {
     77                foreach ( $postData as $key => $value ) {
    7578                    if ( strpos( $key, '_white_list' ) !== false || strpos( $key, '_black_list' ) !== false )
    7679                        $value = sanitize_textarea_field( $value );
     
    8891                        'original_meta_actions'
    8992                    ];
     93                else if ( $currentTab == 'tools' )
     94                    $checkBoxList = [ 'disable_quick_draft_widget', 'disable_post_revisions' ];
    9095
    9196                foreach ( $checkBoxList as $checkbox ) {
    92                     $options[ $checkbox ] = isset( $_POST[ $checkbox ] ) ? sanitize_text_field( $_POST[ $checkbox ] ) : 0;
    93                 }
    94 
    95                 update_option( WPMETAOPTIMIZER_OPTION_KEY, $options );
     97                    $options[ $checkbox ] = isset( $postData[ $checkbox ] ) ? sanitize_text_field( $postData[ $checkbox ] ) : 0;
     98                }
     99
     100                update_option( WPMETAOPTIMIZER_OPTION_KEY, $options, false );
    96101                $updateMessage = $this->getNoticeMessageHTML( __( 'Settings saved.' ) );
    97102
    98103                // Reset Import
    99104                foreach ( $this->tables as $type => $table ) {
    100                     if ( isset( $_POST[ 'reset_import_' . $type ] ) )
     105                    if ( isset( $postData[ 'reset_import_' . $type ] ) )
    101106                        $this->setOption( 'import_' . $type . '_latest_id', null );
    102107                }
     
    111116                $reset = false;
    112117                foreach ( $types as $type ) {
    113                     if ( isset( $_POST[ 'reset_plugin_table_' . $type ] ) ) {
     118                    if ( isset( $postData[ 'reset_plugin_table_' . $type ] ) ) {
    114119                        $Helpers->resetMetaTable( $type );
    115120
    116                         if ( isset( $_POST[ 'reset_import_' . $type ] ) ) {
     121                        if ( isset( $postData[ 'reset_import_' . $type ] ) ) {
    117122                            $importTables[ $type ] = 1;
    118123                            $this->setOption( 'import_' . $type . '_latest_id', null );
     
    128133                $this->setOption( 'import', $importTables );
    129134            }
     135
     136            if ( wp_verify_nonce( $_POST[ WPMETAOPTIMIZER_PLUGIN_KEY ], 'optimize_submit' ) ) {
     137                $effectedItems = 0;
     138                $types         = array_keys( $this->tables );
     139                foreach ( $types as $type ) {
     140                    if ( isset( $postData[ 'orphaned_' . $type . '_meta' ] ) ) {
     141                        Optimize::deleteOrphanedMeta( $type );
     142                        $effectedItems ++;
     143                    }
     144                }
     145
     146                if ( isset( $postData['delete_orphaned_term_relationships'] ) ) {
     147                    Optimize::deleteOrphanedRelationships();
     148                    $effectedItems ++;
     149                }
     150
     151                if ( isset( $postData['delete_revisions_posts'] ) ) {
     152                    Optimize::deletePosts( 'revision' );
     153                    $effectedItems ++;
     154                }
     155
     156                if ( isset( $postData['delete_trash_posts'] ) ) {
     157                    Optimize::deletePosts( null, 'trash' );
     158                    $effectedItems ++;
     159                }
     160
     161                if ( isset( $postData['delete_auto_draft_posts'] ) ) {
     162                    Optimize::deletePosts( null, 'auto-draft' );
     163                    $effectedItems ++;
     164                }
     165
     166                if ( isset( $postData['delete_expired_transients'] ) ) {
     167                    Optimize::deleteExpiredTransients();
     168                    $effectedItems ++;
     169                }
     170
     171                if ( $effectedItems )
     172                    $updateMessage .= $this->getNoticeMessageHTML( __( 'Optimize selected items.', 'meta-optimizer' ) );
     173
     174                if ( isset( $postData['optimize_db_tables'] ) ) {
     175                    Optimize::optimizeDatabaseTables();
     176                    $updateMessage .= $this->getNoticeMessageHTML( __( 'Your WordPress database tables optimized.', 'meta-optimizer' ) );
     177                }
     178            }
    130179        }
    131180
     
    137186        ?>
    138187        <div class="wrap wpmo-wrap">
    139             <h1 class="wp-heading-inline"><span
    140                         class="dashicons dashicons-editor-table"></span> <?php _e( 'Meta Optimizer', 'meta-optimizer' ) ?>
     188            <h1 class="wp-heading-inline">
     189                <span class="dashicons dashicons-editor-table"></span>
     190                <?php _e( 'Meta Optimizer', 'meta-optimizer' ) ?>
    141191            </h1>
    142192            <?php echo wp_kses( $updateMessage, array( 'div' => [ 'class' => [] ], 'p' => [] ) ); ?>
     
    144194            <div class="nav-tab-wrapper">
    145195                <a id="tables-tab"
    146                    class="wpmo-tab nav-tab <?php echo $currentTab == 'tables' ? 'nav-tab-active' : '' ?>"><?php _e( 'Tables', 'meta-optimizer' ) ?></a>
     196                   class="wpmo-tab nav-tab <?php echo $currentTab == 'tables' ? 'nav-tab-active' : '' ?>">
     197                    <?php _e( 'Tables', 'meta-optimizer' ) ?>
     198                </a>
    147199                <a id="settings-tab"
    148                    class="wpmo-tab nav-tab <?php echo $currentTab == 'settings' ? 'nav-tab-active' : '' ?>"><?php _e( 'Settings' ) ?></a>
     200                   class="wpmo-tab nav-tab <?php echo $currentTab == 'settings' ? 'nav-tab-active' : '' ?>">
     201                    <?php _e( 'Settings' ) ?>
     202                </a>
    149203                <a id="import-tab"
    150                    class="wpmo-tab nav-tab <?php echo $currentTab == 'import' ? 'nav-tab-active' : '' ?>"><?php _e( 'Import', 'meta-optimizer' ) ?></a>
     204                   class="wpmo-tab nav-tab <?php echo $currentTab == 'import' ? 'nav-tab-active' : '' ?>">
     205                    <?php _e( 'Import', 'meta-optimizer' ) ?>
     206                </a>
     207                <a id="tools-tab"
     208                   class="wpmo-tab nav-tab <?php echo $currentTab == 'tools' ? 'nav-tab-active' : '' ?>">
     209                    <?php _e( 'Tools', 'meta-optimizer' ) ?>
     210                </a>
     211                <a id="optimize-tab"
     212                   class="wpmo-tab nav-tab <?php echo $currentTab == 'optimize' ? 'nav-tab-active' : '' ?>">
     213                    <?php _e( 'Optimize', 'meta-optimizer' ) ?>
     214                </a>
    151215            </div>
    152216
     
    157221                    $columns       = $Helpers->getTableColumns( $table['table'], $type );
    158222                    sort( $columns );
     223                    $tableSize = $Helpers->getTableSize( $table['table'], true );
    159224                    ?>
    160225                    <h2><?php echo esc_html( $table['title'] ) ?></h2>
    161                     <p>
     226                    <p class="description">
    162227                        <?php
     228                        _e( 'Table Size:', 'meta-optimizer' );
     229                        echo ' ' . $tableSize . ' | ';
    163230                        _e( 'Number of Columns:', 'meta-optimizer' );
    164                         echo ' ' . ( is_array( $columns ) ? count( $columns ) : 0 ) . ' - ';
     231                        echo ' ' . ( is_array( $columns ) ? count( $columns ) : 0 ) . ' | ';
    165232                        _e( 'Number of rows:', 'meta-optimizer' );
    166233                        echo ' ' . $Helpers->getTableRowsCount( $table['table'] );
     
    171238                        <thead>
    172239                        <tr>
    173                             <th style="width:30px">#</th>
     240                            <th style="width:40px">#</th>
    174241                            <th><?php _e( 'Field Name', 'meta-optimizer' ) ?></th>
    175242                            <th><?php _e( 'Type', 'meta-optimizer' ) ?></th>
     
    211278                                echo "<span class='dashicons dashicons-edit rename-table-column tooltip-title' title='" . __( 'Rename', 'meta-optimizer' ) . "' data-type='" . esc_html( $type ) . "' data-meta-table='plugin' data-column='" . esc_html( $column ) . "'></span>";
    212279                                echo "<span class='dashicons dashicons-trash delete-table-column tooltip-title' title='" . __( 'Delete' ) . "' data-type='" . esc_html( $type ) . "' data-meta-table='plugin' data-column='" . esc_html( $column ) . "'></span>";
    213                                 echo "<span span class='dashicons dashicons-" . esc_html( $listAction ) . " add-remove-black-list tooltip-title' title='" . esc_html( $listActionTitle ) . "' data-action='" . esc_html( $listAction ) . "' data-type='" . esc_html( $type ) . "' data-meta-table='plugin' data-column='" . esc_html( $column ) . "'></span>";
     280                                echo "<span class='dashicons dashicons-" . esc_html( $listAction ) . " add-remove-black-list tooltip-title' title='" . esc_html( $listActionTitle ) . "' data-action='" . esc_html( $listAction ) . "' data-type='" . esc_html( $type ) . "' data-meta-table='plugin' data-column='" . esc_html( $column ) . "'></span>";
    214281                                echo "<span class='dashicons dashicons-post-status change-table-index tooltip-title" . ( $indexExists ? ' active' : '' ) . "' title='" . __( 'Index', 'meta-optimizer' ) . "' data-type='" . esc_html( $type ) . "' data-column='" . esc_html( $column ) . "'></span>";
    215282                                echo "</td>";
     
    241308                <form action="" method="post">
    242309                    <?php wp_nonce_field( 'reset_tables_submit', WPMETAOPTIMIZER_PLUGIN_KEY, false ); ?>
     310                    <input type="hidden" name="current_tab" value="tables">
    243311                    <table class="reset-db-table">
    244312                        <tr>
     
    246314                            <td>
    247315                                <strong>
    248                                     <?php _e( 'You can use this option to delete all plugin meta fields as well as data, then restart the import process.', 'meta-optimizer' ) ?>
     316                                    <?php _e( 'You can use this option to delete all plugin meta fields as well as data, then restart the import process . ', 'meta-optimizer' ) ?>
    249317                                </strong>
    250318                                <p class="description">
    251319                                    <span class="description-notice">
    252                                         <?php _e( 'Be very careful with this command. It will empty the contents of your database table and there is no undo.', 'meta-optimizer' ) ?>
     320                                        <?php _e( 'Be very careful with this command . It will empty the contents of your database table and there is no undo . ', 'meta-optimizer' ) ?>
    253321                                    </span>
    254322                                </p>
     
    260328                                        <input type="checkbox" name="reset_plugin_table_<?php echo esc_attr( $type ) ?>"
    261329                                               value="1">
    262                                         <?php echo esc_html( $table['name'] ) . ' (' . $Helpers->getMetaTableName( $type ) . ')' ?>
     330                                        <?php echo esc_html( $table['name'] ) . ' ( ' . $Helpers->getMetaTableName( $type ) . ' )' ?>
    263331                                    </label>
    264332                                    <label>
     
    318386                                    ?>
    319387                                    <label>
    320                                         <input type="checkbox" name="meta_save_types[<?php echo esc_attr( $type ) ?>]"
     388                                        <input type="checkbox"
     389                                               name="meta_save_types[<?php echo esc_attr( $type ) ?>]"
    321390                                               value="1" <?php checked( isset( $metaSaveTypes[ $type ] ) ) ?>>
    322391                                        <?php echo esc_html( $table['name'] ) ?>
     
    376445                            </td>
    377446                            <td>
    378                                 <label><input type="checkbox" name="original_meta_actions" id="original_meta_actions"
     447                                <label><input type="checkbox" name="original_meta_actions"
     448                                              id="original_meta_actions"
    379449                                              value="1" <?php checked( $this->getOption( 'original_meta_actions', false ) == 1 ) ?>><?php _e( 'Active', 'meta-optimizer' ) ?>
    380450                                </label>
     
    400470                            <th><?php _e( 'White List', 'meta-optimizer' ) ?></th>
    401471                            <th><?php _e( 'Black List', 'meta-optimizer' ) ?></th>
    402                         </tr>
    403472                        </tr>
    404473                        </thead>
     
    436505            </div>
    437506
    438             <div id="import-tab-content" class="wpmo-tab-content <?php echo $currentTab != 'import' ? 'hidden' : '' ?>">
     507            <div id="import-tab-content"
     508                 class="wpmo-tab-content <?php echo $currentTab != 'import' ? 'hidden' : '' ?>">
    439509                <form action="" method="post">
    440510                    <input type="hidden" name="current_tab" value="import">
     
    527597                            <td colspan="2">
    528598                                <p class="description"><?php _e( 'Importing runs in the background without requiring a website to be open.', 'meta-optimizer' ) ?></p>
     599                                <?php if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
     600                                    echo '<p class="description"><span class="description-notice">' . __( 'WP Cron disabled by <code>define(\'DISABLE_WP_CRON\', true);</code> in wp-config.php, Please make sure your site run WP cron manually.', 'meta-optimizer' ) . '</span></p>';
     601                                } ?>
    529602                            </td>
    530603                        </tr>
     
    536609                        </tr>
    537610                        </tbody>
     611                    </table>
     612                </form>
     613            </div>
     614            <div id="tools-tab-content"
     615                 class="wpmo-tab-content <?php echo $currentTab != 'tools' ? 'hidden' : '' ?>">
     616                <form action="" method="post">
     617                    <input type="hidden" name="current_tab" value="tools">
     618                    <?php wp_nonce_field( 'settings_submit', WPMETAOPTIMIZER_PLUGIN_KEY, false ); ?>
     619                    <table>
     620                        <tr>
     621                            <th colspan="2"><?php _e( 'Optimize WordPress', 'meta-optimizer' ) ?></th>
     622                        </tr>
     623                        <tr>
     624                            <td><?php _e( 'Quick draft widget', 'meta-optimizer' ) ?></td>
     625                            <td>
     626                                <?php
     627                                $this->customCheckbox( array(
     628                                    'name'        => 'disable_quick_draft_widget',
     629                                    'title'       => __( 'Disable quick draft dashboard widget', 'meta-optimizer' ),
     630                                    'description' => __( 'Auto draft records will not appear in the post database table when the quick draft widget is disabled.', 'meta-optimizer' ),
     631                                    'badge'       => __( 'Recommended', 'meta-optimizer' ),
     632                                    'badge_class' => 'blue-badge',
     633                                    'checked'     => $this->getOption( 'disable_quick_draft_widget', false ) == 1
     634                                ) );
     635                                ?>
     636                            </td>
     637                        </tr>
     638                        <tr>
     639                            <td><?php _e( 'Post Revisions', 'meta-optimizer' ) ?></td>
     640                            <td>
     641                                <?php
     642                                $this->customCheckbox( array(
     643                                    'name'        => 'disable_post_revisions',
     644                                    'title'       => __( 'Disable post revisions', 'meta-optimizer' ),
     645                                    'description' => __( 'Revisions are old versions of posts and pages. You can prevent the creation of revisions.', 'meta-optimizer' ),
     646                                    'badge_class' => 'blue-badge',
     647                                    'checked'     => $this->getOption( 'disable_post_revisions', false ) == 1
     648                                ) );
     649                                ?>
     650                            </td>
     651                        </tr>
     652                        <tr>
     653                            <td colspan="2">
     654                                <input type="submit" class="button button-primary button-large"
     655                                       value="<?php _e( 'Save' ) ?>">
     656                            </td>
     657                        </tr>
     658                    </table>
     659                </form>
     660            </div>
     661            <div id="optimize-tab-content"
     662                 class="wpmo-tab-content <?php echo $currentTab != 'optimize' ? 'hidden' : '' ?>">
     663                <?php
     664                $optimizeItems = 0;
     665
     666                $orphanedRelationships = Optimize::getOrphanedRelationshipsCount();
     667                $optimizeItems         = $orphanedRelationships > 0 ? ++ $optimizeItems : $optimizeItems;
     668                $revisionsCount        = Optimize::getPostsCount( 'revision' );
     669                $optimizeItems         = $revisionsCount > 0 ? ++ $optimizeItems : $optimizeItems;
     670                $trashCount            = Optimize::getPostsCount( null, 'trash' );
     671                $optimizeItems         = $trashCount > 0 ? ++ $optimizeItems : $optimizeItems;
     672                $autoDraftCount        = Optimize::getPostsCount( null, 'auto-draft' );
     673                $optimizeItems         = $autoDraftCount > 0 ? ++ $optimizeItems : $optimizeItems;
     674                $transientExpiredCount = Optimize::getExpiredTransientsCount();
     675                $optimizeItems         = $transientExpiredCount > 0 ? ++ $optimizeItems : $optimizeItems;
     676                $dbTablesCount         = Optimize::getDatabaseTablesCount();
     677                $optimizeItems         = $dbTablesCount > 0 ? ++ $optimizeItems : $optimizeItems;
     678                ?>
     679                <form action="" method="post">
     680                    <input type="hidden" name="current_tab" value="optimize">
     681                    <?php wp_nonce_field( 'optimize_submit', WPMETAOPTIMIZER_PLUGIN_KEY, false ); ?>
     682                    <table>
     683                        <tr>
     684                            <th colspan="2"><?php _e( 'Optimize your WordPress database', 'meta-optimizer' ) ?></th>
     685                        </tr>
     686                        <?php foreach ( $this->tables as $type => $table ) {
     687                            $orphanedMetaCount = Optimize::getOrphanedMetaCount( $type );
     688                            $optimizeItems     = $orphanedMetaCount && $orphanedMetaCount > 0 ? ++ $optimizeItems : $optimizeItems;
     689                            ?>
     690                            <tr>
     691                                <th><?php
     692                                    echo sprintf( __( 'Orphaned %s', 'meta-optimizer' ), $table['title'] ); ?></th>
     693                                <td>
     694                                    <?php
     695                                    $this->customCheckbox( array(
     696                                        'name'         => 'orphaned_' . $type . '_meta',
     697                                        'title'        => sprintf( __( 'Orphaned %s are data about deleted %s. This data is safe to delete.', 'meta-optimizer' ), $table['title'], $table['plural_name'] ),
     698                                        'count'        => $orphanedMetaCount,
     699                                        'badge'        => __( 'Optimized', 'meta-optimizer' ),
     700                                        'disabled'     => $orphanedMetaCount == 0,
     701                                        'class'        => 'wpmo-checkbox-red',
     702                                        'enabled_save' => false
     703                                    ) );
     704                                    ?>
     705                                </td>
     706                            </tr>
     707                        <?php } ?>
     708                        <tr>
     709                            <th><?php _e( 'Orphaned Term Relationships', 'meta-optimizer' ) ?></th>
     710                            <td>
     711                                <?php
     712                                $this->customCheckbox( array(
     713                                    'name'         => 'delete_orphaned_term_relationships',
     714                                    'title'        => __( 'Orphaned term relationships. This data is safe to delete.', 'meta-optimizer' ),
     715                                    'count'        => $orphanedRelationships,
     716                                    'badge'        => __( 'Optimized', 'meta-optimizer' ),
     717                                    'disabled'     => $orphanedRelationships == 0,
     718                                    'class'        => 'wpmo-checkbox-red',
     719                                    'enabled_save' => false
     720                                ) );
     721                                ?>
     722                            </td>
     723                        </tr>
     724                        <tr>
     725                            <th><?php _e( 'Revisions', 'meta-optimizer' ) ?></th>
     726                            <td>
     727                                <?php
     728                                $this->customCheckbox( array(
     729                                    'name'         => 'delete_revisions_posts',
     730                                    'title'        => __( 'Revisions are old versions of posts and pages. You can safely delete these unless you know you have screwed something up and need to revert to an older version.', 'meta-optimizer' ),
     731                                    'count'        => $revisionsCount,
     732                                    'badge'        => __( 'Optimized', 'meta-optimizer' ),
     733                                    'disabled'     => $revisionsCount == 0,
     734                                    'class'        => 'wpmo-checkbox-red',
     735                                    'enabled_save' => false
     736                                ) );
     737                                ?>
     738                            </td>
     739                        </tr>
     740                        <tr>
     741                            <th><?php _e( 'Trashed Posts', 'meta-optimizer' ) ?></th>
     742                            <td>
     743                                <?php
     744                                $this->customCheckbox( array(
     745                                    'name'         => 'delete_trash_posts',
     746                                    'title'        => __( 'Trashed posts refer to posts, pages, and other types of posts that have been trashed and are awaiting permanent deletion.', 'meta-optimizer' ),
     747                                    'count'        => $trashCount,
     748                                    'badge'        => __( 'Optimized', 'meta-optimizer' ),
     749                                    'disabled'     => $trashCount == 0,
     750                                    'class'        => 'wpmo-checkbox-red',
     751                                    'enabled_save' => false
     752                                ) );
     753                                ?>
     754                            </td>
     755                        </tr>
     756                        <tr>
     757                            <th><?php _e( 'Auto-drafts', 'meta-optimizer' ) ?></th>
     758                            <td>
     759                                <?php
     760                                $this->customCheckbox( array(
     761                                    'name'         => 'delete_auto_draft_posts',
     762                                    'title'        => __( 'The auto-drafts are automatically saved when you begin editing posts or pages in WordPress. Eventually, you may have many auto-drafts that you won\'t publish, so you can delete them.', 'meta-optimizer' ),
     763                                    'count'        => $autoDraftCount,
     764                                    'badge'        => __( 'Optimized', 'meta-optimizer' ),
     765                                    'disabled'     => $autoDraftCount == 0,
     766                                    'class'        => 'wpmo-checkbox-red',
     767                                    'enabled_save' => false
     768                                ) );
     769                                ?>
     770                            </td>
     771                        </tr>
     772                        <tr>
     773                            <th><?php _e( 'Expired Transients', 'meta-optimizer' ) ?></th>
     774                            <td>
     775                                <?php
     776                                $this->customCheckbox( array(
     777                                    'name'         => 'delete_expired_transients',
     778                                    'title'        => __( 'Temporary data is stored in a database as transients. There is no need for expired transients.', 'meta-optimizer' ),
     779                                    'count'        => $transientExpiredCount,
     780                                    'badge'        => __( 'Optimized', 'meta-optimizer' ),
     781                                    'disabled'     => $transientExpiredCount == 0,
     782                                    'class'        => 'wpmo-checkbox-red',
     783                                    'enabled_save' => false
     784                                ) );
     785                                ?>
     786                            </td>
     787                        </tr>
     788                        <tr>
     789                            <th><?php _e( 'Optimize Tables', 'meta-optimizer' ) ?></th>
     790                            <td>
     791                                <?php
     792                                $this->customCheckbox( array(
     793                                    'name'         => 'optimize_db_tables',
     794                                    'title'        => __( 'Reduces storage space and improves database speed by reorganizing the physical storage of database data.', 'meta-optimizer' ),
     795                                    'count'        => $dbTablesCount,
     796                                    'count_title'  => __( 'Database Tables', 'meta-optimizer' ),
     797                                    'enabled_save' => false
     798                                ) );
     799                                ?>
     800                            </td>
     801                        </tr>
     802                        <tr>
     803                            <td colspan="2">
     804                                <input type="submit" class="button button-primary button-large"
     805                                       value="<?php _e( 'Optimize Database', 'meta-optimizer' ) ?>" <?php disabled( $optimizeItems == 0 ) ?>>
     806                            </td>
     807                        </tr>
    538808                    </table>
    539809                </form>
     
    543813    }
    544814
     815    /**
     816     * Print custom checkbox
     817     *
     818     * @param array $args
     819     *
     820     * @return string|void
     821     */
     822    function customCheckbox( $args ) {
     823        $defaults = array(
     824            'name'         => '',
     825            'title'        => '',
     826            'description'  => '',
     827            'value'        => 1,
     828            'count'        => 0,
     829            'count_title'  => __( 'Items', 'meta-optimizer' ),
     830            'badge'        => '',
     831            'badge_class'  => 'green-badge',
     832            'checked'      => false,
     833            'disabled'     => false,
     834            'enabled_save' => true,
     835            'class'        => '',
     836            'echo'         => true
     837        );
     838
     839        $args = wp_parse_args( $args, $defaults );
     840
     841        if ( empty( $args['name'] ) || empty( $args['title'] ) )
     842            return '';
     843
     844        ob_start();
     845        ?>
     846        <div class="wpmo-checkbox <?php echo $args['class'] ?>">
     847            <input type="checkbox" name="<?php echo $args['name'] ?>"
     848                   id="<?php echo $args['name'] ?>" <?php echo $args['enabled_save'] ? '' : 'class="dont-enabled"' ?>
     849                   value="<?php echo $args['value'] ?>" <?php disabled( $args['disabled'] ) ?> <?php checked( $args['checked'] ) ?> >
     850            <label for="<?php echo $args['name'] ?>">
     851                <span class="label"><?php echo $args['title'] ?></span>
     852                <?php
     853                if ( ! empty( $args['description'] ) )
     854                    echo '<span class="description">' . $args['description'] . '</span>';
     855                ?>
     856                <?php if ( $args['count'] > 0 ) { ?>
     857                    <span class="item-count"><?php echo $args['count'] ?></span>
     858                    <?php
     859                    if ( ! empty( $args['count_title'] ) )
     860                        echo '<span>' . $args['count_title'] . '</span>';
     861                    ?>
     862                <?php } elseif ( ! empty( $args['badge'] ) ) { ?>
     863                    <span class="badge <?php echo $args['badge_class'] ?>"><?php echo $args['badge'] ?></span>
     864                <?php } ?>
     865            </label>
     866        </div>
     867        <?php
     868
     869        $html = ob_get_clean();
     870
     871        if ( $args['echo'] )
     872            echo $html;
     873        else
     874            return $html;
     875    }
     876
     877    /**
     878     * Get estimate import time
     879     *
     880     * @param int $leftItems Left items count
     881     *
     882     * @return false|string
     883     */
    545884    function estimateImportTime( $leftItems ) {
    546885        $leftItems = intval( $leftItems );
     
    594933        wp_cache_delete( 'options', WPMETAOPTIMIZER_PLUGIN_KEY );
    595934
    596         return update_option( WPMETAOPTIMIZER_OPTION_KEY, $options );
     935        return update_option( WPMETAOPTIMIZER_OPTION_KEY, $options, false );
    597936    }
    598937
  • meta-optimizer/trunk/readme.txt

    r2963196 r2965871  
    55Requires at least: 5.0
    66Tested up to: 6.3.1
    7 Stable tag: 1.3
    8 Requires PHP: 7.0
     7Stable tag: 1.4
     8Requires PHP: 7.3
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1111
    12 You can use Meta Optimizer to make your WordPress website load faster if you use meta information. For example, Post / Comment / User / Term metas.
     12Meta Optimizer is a WordPress plugin that helps you speed up your website by using meta data. It lets you optimize the meta tables for your posts, comments, users, and terms.
    1313
    1414== Description ==
    1515
    16 WordPress saves every post / comment / user / term meta in new row. with this plugin, you can save all of them to single row, and each column will be a meta key.
     16This plugin optimizes WordPress meta data storage by saving all meta data for each post, comment, user, or term in a single row with separate columns for each meta key. This reduces the number of rows and improves the query performance and data export. The plugin works seamlessly with WordPress core functions and hooks, and supports any plugins that use them. Some of the features of this plugin are:
    1717
    18 Plugin work with default WordPress functions and support all plugins use WordPress standard functions and hooks.
    19 
    20 ## Features
    21 - Create database tables for each of WordPress meta tables (Post / Comment / User / Meta).
    22 - Support WordPress Queries
    23 - Faster Queries & Easy Export
    24 - Import old data from default WordPress meta table
    25 - Bypass core meta tables for specific fields
    26 - Export all the data easier by exporting only one table
    27 
    28 ## Integration
    29 - [Advanced Custom Fields](https://wordpress.org/plugins/advanced-custom-fields/) and Pro version
    30 - [Meta Box – WordPress Custom Fields Framework](https://wordpress.org/plugins/meta-box/) and Pro version
    31 - [CMB2](https://wordpress.org/plugins/cmb2/)
    32 - And all plugins and themes use WordPress standard functions and hooks.
     18- Custom database tables for each type of meta data (post, comment, user, term)
     19- Compatibility with WordPress queries
     20- Faster queries and easy data export
     21- Data migration from default WordPress meta tables
     22- Option to exclude specific fields from core meta tables
     23- Support for popular plugins and themes such as Advanced Custom Fields, Meta Box, CMB2, and more.
    3324
    3425== Frequently Asked Questions ==
     
    5344
    54451. Tables tab, You can manage meta table columns.
    55 2. Settings tab, Plugin options.
    56 3. Import tab, Import options.
    57 4. Preview of table structures
     462. Reset section in tables tab, You can reset Meta Optimizer DB tables and import again meta data.
     473. Settings tab, Plugin options.
     484. Import tab, Import options.
     495. Tools tab, Optimize WordPress functionality
     506. Optimizer tab, Optimize WordPress Database
     517. Preview of table structures
    5852
    5953== Changelog ==
     54= 1.4 =
     55* Add a Tools tab to enhance WordPress functionality
     56* Add an Optimizer tab to improve WordPress database performance
     57* Show the size of each plugin table in the tables tab
     58
    6059= 1.3 =
    6160* Add a filter for changing import item numbers ([Documentation](https://parsakafi.github.io/wp-meta-optimizer/#plugin-hooks))
Note: See TracChangeset for help on using the changeset viewer.