Plugin Directory

Changeset 2931411


Ignore:
Timestamp:
06/27/2023 11:46:27 AM (3 years ago)
Author:
skyminds
Message:

Release FlashSpeed v2.0.0

Location:
flashspeed/trunk
Files:
370 added
5 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • flashspeed/trunk/admin/advanced.php

    r2905369 r2931411  
    1111 */
    1212
    13 namespace FlashSpeed\Plugin\Admin\Advanced;
     13namespace FlashSpeed\Admin;
     14
     15use ZenSettings\Fields\Fields;
    1416
    1517if (! defined('ABSPATH')) {
     
    2426function Flashspeed_Settings_Advanced_init()
    2527{
     28    global $zen_settings;
     29    $slug   = $zen_settings->getSlug();
     30    define("TAB6_OPTION", $zen_settings->getOptionName());
     31    define("TAB6_PAGE", $slug . "_advanced");
     32    define("TAB6_SECTION1", $slug . "_advanced_section");
     33    define("TAB6_SECTION2", $slug . "_resources_section");
     34    define("TAB6_SECTION3", $slug . "_custom_headers_section");
     35
    2636    register_setting(
    27         'advanced',           // Settings group name
    28         'flashspeed_settings'   // name of an option to sanitize and save.
     37        TAB6_PAGE,             // Settings group name
     38        TAB6_OPTION   // name of an option to sanitize and save.
    2939    );
    3040
    3141    add_settings_section(
    32         'flashspeed_advanced_section',            // Section ID
    33         __('Advanced settings', 'flashspeed'),     // Title
     42        TAB6_SECTION1,                 // Section ID
     43        __('Advanced settings', 'flashspeed'), // Title
    3444        '', // cache or empty string
    35         'advanced'                                // Page to display the section in.
     45        TAB6_PAGE                      // Page to display the section in.
    3646    );
    3747
     
    4050        __('Remove jQuery Migrate', 'flashspeed'),
    4151        __NAMESPACE__ . '\\Flashspeed_JqueryMigrate_render',
    42         'advanced',
    43         'flashspeed_advanced_section',
     52        TAB6_PAGE,
     53        TAB6_SECTION1,
    4454        [
    4555            'label_for' => 'jquery-migrate',
     
    5262        __('Remove jQuery', 'flashspeed'),
    5363        __NAMESPACE__ . '\\Flashspeed_Jquery_render',
    54         'advanced',
    55         'flashspeed_advanced_section',
     64        TAB6_PAGE,
     65        TAB6_SECTION1,
    5666        [
    5767            'label_for' => 'jquery',
     
    6575        __('Schemeless assets URLs', 'flashspeed'),
    6676        __NAMESPACE__ . '\\Flashspeed_Schemeless_render',
    67         'advanced',
    68         'flashspeed_advanced_section',
     77        TAB6_PAGE,
     78        TAB6_SECTION1,
    6979        [
    7080            'label_for' => 'schemeless',
     
    7484
    7585    add_settings_section(
    76         'flashspeed_resources_section',            // Section ID
     86        TAB6_SECTION2,
    7787        __('Optimize resources', 'flashspeed'),     // Title
    7888        '', // cache or empty string
    79         'advanced'                                // Page to display the section in.
     89        TAB6_PAGE
    8090    );
    8191
     
    8494        __('Number of post revisions', 'flashspeed'),
    8595        __NAMESPACE__ . '\\Flashspeed_Revisions_render',
    86         'advanced',
    87         'flashspeed_resources_section',
     96        TAB6_PAGE,
     97        TAB6_SECTION2,
    8898        [
    8999            'label_for' => 'revisions',
     
    100110        __('Autosave interval', 'flashspeed'),
    101111        __NAMESPACE__ . '\\Flashspeed_Autosave_render',
    102         'advanced',
    103         'flashspeed_resources_section',
     112        TAB6_PAGE,
     113        TAB6_SECTION2,
    104114        [
    105115            'label_for' => 'autosave',
     
    195205function Flashspeed_UpdatePlugins_render($args)
    196206{
    197     \FlashSpeed\Plugin\Fields\checkmate('updates-plugins');
     207    $fields = new Fields(TAB6_OPTION);
     208    $fields->checkmate('updates-plugins');
    198209}
    199210
     
    207218function Flashspeed_UpdateThemes_render($args)
    208219{
    209     \FlashSpeed\Plugin\Fields\checkmate('updates-themes');
     220    $fields = new Fields(TAB6_OPTION);
     221    $fields->checkmate('updates-themes');
    210222}
    211223
     
    219231function Flashspeed_UpdateTranslations_render($args)
    220232{
    221     \FlashSpeed\Plugin\Fields\checkmate('updates-translations');
     233    $fields = new Fields(TAB6_OPTION);
     234    $fields->checkmate('updates-translations');
    222235}
    223236
     
    231244function Flashspeed_UpdateEmails_render($args)
    232245{
    233     \FlashSpeed\Plugin\Fields\checkmate('updates-no-emails');
     246    $fields = new Fields(TAB6_OPTION);
     247    $fields->checkmate('updates-no-emails');
    234248}
    235249
     
    248262        'false' => __('Disable all core updates', 'flashspeed'),
    249263    ];
    250 
    251     \FlashSpeed\Plugin\Fields\dropDown('updates-core', $array);
     264    $fields = new Fields(TAB6_OPTION);
     265    $fields->dropDown('updates-core', $array);
    252266}
    253267
     
    261275function Flashspeed_Jquery_render($args)
    262276{
    263     \FlashSpeed\Plugin\Fields\checkmate('jquery');
     277    $fields = new Fields(TAB6_OPTION);
     278    $fields->checkmate('jquery');
    264279}
    265280
     
    273288function Flashspeed_JqueryMigrate_render($args)
    274289{
    275     \FlashSpeed\Plugin\Fields\checkmate('jquery-migrate');
     290    $fields = new Fields(TAB6_OPTION);
     291    $fields->checkmate('jquery-migrate');
    276292}
    277293
     
    285301function Flashspeed_Schemeless_render($args)
    286302{
    287     \FlashSpeed\Plugin\Fields\checkmate('schemeless');
     303    $fields = new Fields(TAB6_OPTION);
     304    $fields->checkmate('schemeless');
    288305}
    289306
     
    297314function Flashspeed_Revisions_render($args)
    298315{
    299     \FlashSpeed\Plugin\Fields\numberInput('revisions', $args);
     316    $fields = new Fields(TAB6_OPTION);
     317    $fields->numberInput('revisions', $args);
    300318}
    301319
     
    309327function Flashspeed_Autosave_render($args)
    310328{
    311     \FlashSpeed\Plugin\Fields\numberInput('autosave', $args);
    312 }
     329    $fields = new Fields(TAB6_OPTION);
     330    $fields->numberInput('autosave', $args);
     331}
  • flashspeed/trunk/admin/agency.php

    r2897643 r2931411  
    1111 */
    1212
    13 namespace FlashSpeed\Plugin\Admin\Agency;
     13namespace FlashSpeed\Admin;
     14
     15use ZenSettings\Fields\Fields;
    1416
    1517if (! defined('ABSPATH')) {
  • flashspeed/trunk/admin/analytics.php

    r2905369 r2931411  
    1111 */
    1212
    13 namespace FlashSpeed\Plugin\Admin\Analytics;
     13namespace FlashSpeed\Admin;
     14
     15use ZenSettings\Fields\Fields;
    1416
    1517if (! defined('ABSPATH')) {
     
    2426function Flashspeed_Settings_Analytics_init()
    2527{
     28
     29    global $zen_settings;
     30    $slug   = $zen_settings->getSlug();
     31    define("TAB3_OPTION", $zen_settings->getOptionName());
     32    define("TAB3_PAGE", $slug . "_analytics");
     33    define("TAB3_SECTION1", $slug . "_analytics_section");
     34    define("TAB3_SECTION2", $slug . "_tracking_section");
     35
    2636    register_setting(
    27         'analytics',           // Settings group name
    28         'flashspeed_settings'   // name of an option to sanitize and save.
     37        TAB3_PAGE,             // Settings group name
     38        TAB3_OPTION   // name of an option to sanitize and save.
    2939    );
    3040
    3141    add_settings_section(
    32         'flashspeed_analytics_section',            // Section ID
    33         __('Google Analytics', 'flashspeed'),    // Title
    34         '', // Callback or empty string
    35         'analytics'                                // Page to display the section in.
     42        TAB3_SECTION1,                 // Section ID
     43        __('Analytics', 'flashspeed'), // Title
     44        '', // cache or empty string
     45        TAB3_PAGE                      // Page to display the section in.
    3646    );
    3747
     
    4050        __('Google Analytics 4 ID', 'flashspeed'),
    4151        __NAMESPACE__ . '\\Flashspeed_GAID_render',
    42         'analytics',
    43         'flashspeed_analytics_section',
     52        TAB3_PAGE,                              // Page
     53        TAB3_SECTION1,           // Section
    4454        [
    4555            'label_for' => 'ga_ID',
     
    5262        __('Activate on the frontend', 'flashspeed'), // Title
    5363        __NAMESPACE__ . '\\Flashspeed_GA_render', // Callback or empty string
    54         'analytics',                              // Page
    55         'flashspeed_analytics_section',           // Section
     64        TAB3_PAGE,                              // Page
     65        TAB3_SECTION1,           // Section
    5666        [
    5767            'label_for' => 'local_ga',
     
    6474        __('Anonymize IPs', 'flashspeed'),
    6575        __NAMESPACE__ . '\\Flashspeed_GAip_render',
    66         'analytics',
    67         'flashspeed_analytics_section',
     76        TAB3_PAGE,                              // Page
     77        TAB3_SECTION1,           // Section
    6878        [
    6979            'label_for' => 'ga_ip_anon',
     
    7686        __('Disable tracking for admins', 'flashspeed'),
    7787        __NAMESPACE__ . '\\Flashspeed_GAadmin_render',
    78         'analytics',
    79         'flashspeed_analytics_section',
     88        TAB3_PAGE,                              // Page
     89        TAB3_SECTION1,           // Section
    8090        [
    8191            'label_for' => 'ga_no_admin_tracking',
     
    8898            'Tracking code position',
    8999            __NAMESPACE__ . '\\Flashspeed_GAloc_render',
    90             'analytics',
    91             'flashspeed_analytics_section',
     100            TAB3_PAGE,                              // Page
     101            TAB3_SECTION1,           // Section
    92102            [
    93103                'label_for' => 'ga_loc',
     
    112122    /* Additional tracking */
    113123    add_settings_section(
    114         'flashspeed_tracking_section',            // Section ID
    115         __('Additional tracking', 'flashspeed'),     // Title
    116         '', // Callback or empty string
    117         'analytics'                                // Page to display the section in.
     124        TAB3_SECTION2, // Section ID
     125        __('Additional tracking', 'flashspeed'), // Title
     126        '', // cache or empty string
     127        TAB3_PAGE      // Page to display the section in.
    118128    );
    119129
     
    122132        __('Tracking code in head', 'flashspeed'),
    123133        __NAMESPACE__ . '\\Flashspeed_TrackingHead_render',
    124         'analytics',
    125         'flashspeed_tracking_section',
     134        TAB3_PAGE,     // Page
     135        TAB3_SECTION2, // Section
    126136        [
    127137            'label_for' => 'tracking_head',
     
    135145        __('Tracking code in body', 'flashspeed'),
    136146        __NAMESPACE__ . '\\Flashspeed_TrackingBody_render',
    137         'analytics',
    138         'flashspeed_tracking_section',
     147        TAB3_PAGE,     // Page
     148        TAB3_SECTION2, // Section
    139149        [
    140150            'label_for' => 'tracking_body',
     
    148158        __('Tracking code in footer', 'flashspeed'),
    149159        __NAMESPACE__ . '\\Flashspeed_TrackingFooter_render',
    150         'analytics',
    151         'flashspeed_tracking_section',
     160        TAB3_PAGE,     // Page
     161        TAB3_SECTION2, // Section
    152162        [
    153163            'label_for' => 'tracking_footer',
     
    168178function Flashspeed_GA_render($args)
    169179{
    170     \FlashSpeed\Plugin\Fields\checkmate('local_ga');
     180    $fields = new Fields(TAB3_OPTION);
     181    $fields->checkmate('local_ga');
    171182}
    172183
     
    180191function Flashspeed_GAID_render($args)
    181192{
    182     \FlashSpeed\Plugin\Fields\textInput('ga_ID');
     193    $fields = new Fields(TAB3_OPTION);
     194    $fields->textInput('ga_ID');
    183195}
    184196
     
    192204function Flashspeed_GAip_render($args)
    193205{
    194     \FlashSpeed\Plugin\Fields\checkmate('ga_ip_anon');
     206    $fields = new Fields(TAB3_OPTION);
     207    $fields->checkmate('ga_ip_anon');
    195208}
    196209
     
    204217function Flashspeed_GAadmin_render($args)
    205218{
    206     \FlashSpeed\Plugin\Fields\checkmate('ga_no_admin_tracking');
     219    $fields = new Fields(TAB3_OPTION);
     220    $fields->checkmate('ga_no_admin_tracking');
    207221}
    208222
     
    267281function Flashspeed_TrackingHead_render($args)
    268282{
    269     \FlashSpeed\Plugin\Fields\textArea('tracking_head', 'codemirror-js', $args['help']);
     283    $fields = new Fields(TAB3_OPTION);
     284    $fields->textArea('tracking_head', 'codemirror-js', $args['help']);
    270285}
    271286
     
    279294function Flashspeed_TrackingBody_render($args)
    280295{
    281     \FlashSpeed\Plugin\Fields\textArea('tracking_body', 'codemirror-js', $args['help']);
     296    $fields = new Fields(TAB3_OPTION);
     297    $fields->textArea('tracking_body', 'codemirror-js', $args['help']);
    282298}
    283299
     
    291307function Flashspeed_TrackingFooter_render($args)
    292308{
    293     \FlashSpeed\Plugin\Fields\textArea('tracking_footer', 'codemirror-js', $args['help']);
    294 }
     309    $fields = new Fields(TAB3_OPTION);
     310    $fields->textArea('tracking_footer', 'codemirror-js', $args['help']);
     311}
  • flashspeed/trunk/admin/assets.php

    r2905369 r2931411  
    1111 */
    1212
    13 namespace FlashSpeed\Plugin\Admin\Assets;
     13namespace FlashSpeed\Admin;
     14
     15use ZenSettings\Fields\Fields;
    1416
    1517if (! defined('ABSPATH')) {
     
    2426function Flashspeed_Settings_Assets_init()
    2527{
     28    global $zen_settings;
     29    $slug   = $zen_settings->getSlug();
     30    define("TAB2_OPTION", $zen_settings->getOptionName());
     31    define("TAB2_PAGE", $slug . "_assets");
     32    define("TAB2_SECTION1", $slug . "_assets_section");
     33
    2634    register_setting(
    27         'assets',           // Settings group name
    28         'flashspeed_settings'   // name of an option to sanitize and save.
     35        TAB2_PAGE,             // Settings group name
     36        TAB2_OPTION   // name of an option to sanitize and save.
    2937    );
    3038
    3139    add_settings_section(
    32         'flashspeed_assets_section',            // Section ID
     40        TAB2_SECTION1,            // Section ID
    3341        __('Disable assets', 'flashspeed'),     // Title
    3442        '', // cache or empty string
    35         'assets'                                // Page to display the section in.
     43        TAB2_PAGE                                // Page to display the section in.
    3644    );
    3745
     
    3947        'dashicons',                              // Field ID
    4048        __('Disable Dashicons', 'flashspeed'),    // Title
    41         __NAMESPACE__ . '\\Flashspeed_Dashicons_render',            // cache or empty string
    42         'assets',                                 // Page
    43         'flashspeed_assets_section'               // Section
     49        __NAMESPACE__ . '\\Flashspeed_Dashicons_render', // cache or empty string
     50        TAB2_PAGE,                                 // Page
     51        TAB2_SECTION1               // Section
    4452    );
    4553
     
    4856        __('Disable Embeds', 'flashspeed'),
    4957        __NAMESPACE__ . '\\Flashspeed_Embeds_render',
    50         'assets',
    51         'flashspeed_assets_section'
     58        TAB2_PAGE,
     59        TAB2_SECTION1
    5260    );
    5361
     
    5664        __('Disable Emojis', 'flashspeed'),
    5765        __NAMESPACE__ . '\\Flashspeed_Emojis_render',
    58         'assets',
    59         'flashspeed_assets_section'
     66        TAB2_PAGE,
     67        TAB2_SECTION1
    6068    );
    6169
     
    6472        __('Disable Google Fonts', 'flashspeed'),
    6573        __NAMESPACE__ . '\\Flashspeed_Gfonts_render',
    66         'assets',
    67         'flashspeed_assets_section'
     74        TAB2_PAGE,
     75        TAB2_SECTION1
    6876    );
    6977
     
    7280        __('Disable Google Maps', 'flashspeed'),
    7381        __NAMESPACE__ . '\\Flashspeed_Gmaps_render',
    74         'assets',
    75         'flashspeed_assets_section'
     82        TAB2_PAGE,
     83        TAB2_SECTION1
    7684    );
    7785
     
    8088        __('Disable XML-RPC', 'flashspeed'),
    8189        __NAMESPACE__ . '\\Flashspeed_Xmlrpc_render',
    82         'assets',
    83         'flashspeed_assets_section'
     90        TAB2_PAGE,
     91        TAB2_SECTION1
    8492    );
    8593
     
    8896        __('Disable password strength meter', 'flashspeed'),
    8997        __NAMESPACE__ . '\\Flashspeed_Passmeter_render',
    90         'assets',
    91         'flashspeed_assets_section'
     98        TAB2_PAGE,
     99        TAB2_SECTION1
    92100    );
    93101
     
    96104        __('Disable self-pings', 'flashspeed'),
    97105        __NAMESPACE__ . '\\Flashspeed_Selfpings_render',
    98         'assets',
    99         'flashspeed_assets_section'
     106        TAB2_PAGE,
     107        TAB2_SECTION1
    100108    );
    101109
     
    104112        __('Remove query strings', 'flashspeed'),
    105113        __NAMESPACE__ . '\\Flashspeed_Qs_render',
    106         'assets',
    107         'flashspeed_assets_section'
     114        TAB2_PAGE,
     115        TAB2_SECTION1
    108116    );
    109117}
     
    119127function Flashspeed_Dashicons_render($args)
    120128{
    121     \FlashSpeed\Plugin\Fields\checkmate('dashicons');
     129    $fields = new Fields(TAB2_OPTION);
     130    $fields->checkmate('dashicons');
    122131}
    123132
     
    131140function Flashspeed_Embeds_render($args)
    132141{
    133     \FlashSpeed\Plugin\Fields\checkmate('embeds');
     142    $fields = new Fields(TAB2_OPTION);
     143    $fields->checkmate('embeds');
    134144}
    135145
     
    143153function Flashspeed_Emojis_render($args)
    144154{
    145     \FlashSpeed\Plugin\Fields\checkmate('emojis');
     155    $fields = new Fields(TAB2_OPTION);
     156    $fields->checkmate('emojis');
    146157}
    147158
     
    155166function Flashspeed_Gfonts_render($args)
    156167{
    157     \FlashSpeed\Plugin\Fields\checkmate('gfonts');
     168    $fields = new Fields(TAB2_OPTION);
     169    $fields->checkmate('gfonts');
    158170}
    159171
     
    167179function Flashspeed_Gmaps_render($args)
    168180{
    169     \FlashSpeed\Plugin\Fields\checkmate('gmaps');
     181    $fields = new Fields(TAB2_OPTION);
     182    $fields->checkmate('gmaps');
    170183}
    171184
     
    179192function Flashspeed_Xmlrpc_render($args)
    180193{
    181     \FlashSpeed\Plugin\Fields\checkmate('xmlrpc');
     194    $fields = new Fields(TAB2_OPTION);
     195    $fields->checkmate('xmlrpc');
    182196}
    183197
     
    191205function Flashspeed_Qs_render($args)
    192206{
    193     \FlashSpeed\Plugin\Fields\checkmate('qs');
     207    $fields = new Fields(TAB2_OPTION);
     208    $fields->checkmate('qs');
    194209}
    195210
     
    203218function Flashspeed_Passmeter_render($args)
    204219{
    205     \FlashSpeed\Plugin\Fields\checkmate('passmeter');
     220    $fields = new Fields(TAB2_OPTION);
     221    $fields->checkmate('passmeter');
    206222}
    207223
     
    215231function Flashspeed_Selfpings_render($args)
    216232{
    217     \FlashSpeed\Plugin\Fields\checkmate('selfpings');
    218 }
     233    $fields = new Fields(TAB2_OPTION);
     234    $fields->checkmate('selfpings');
     235}
  • flashspeed/trunk/admin/cache.php

    r2905369 r2931411  
    1111 */
    1212
    13 namespace FlashSpeed\Plugin\Admin\Cache;
     13namespace FlashSpeed\Admin;
     14
     15use ZenSettings\Fields\Fields;
    1416
    1517if (! defined('ABSPATH')) {
     
    1719}
    1820
    19 
    2021/**
    2122 * Load cache tab
     
    2526function Flashspeed_Settings_Cache_init()
    2627{
     28    global $zen_settings;
     29    $slug   = $zen_settings->getSlug();
     30    define("TAB4_OPTION", $zen_settings->getOptionName());
     31    define("TAB4_PAGE", $slug . "_cache");
     32    define("TAB4_SECTION1", $slug . "_cache_section");
     33    define("TAB4_SECTION2", $slug . "_hints_section");
     34
    2735    register_setting(
    28         'cache',           // Settings group name
    29         'flashspeed_settings'   // name of an option to sanitize and save.
     36        TAB4_PAGE,             // Settings group name
     37        TAB4_OPTION   // name of an option to sanitize and save.
    3038    );
    3139
    3240    add_settings_section(
    33         'flashspeed_cache_section',         // Section ID
    34         __('Preload pages', 'flashspeed'),  // Title
    35         '', // Callback or empty string
    36         'cache'                             // Page to display the section in.
     41        TAB4_SECTION1,                 // Section ID
     42        __('Preload pages', 'flashspeed'), // Title
     43        '', // cache or empty string
     44        TAB4_PAGE                      // Page to display the section in.
    3745    );
    3846
     
    4149        __('Enable Instant Page', 'flashspeed'),
    4250        __NAMESPACE__ . '\\Flashspeed_IpageOn_render',
    43         'cache',
    44         'flashspeed_cache_section',
     51        TAB4_PAGE,     // Page
     52        TAB4_SECTION1, // Section
    4553        [
    4654            'label_for' => 'ipage_on',
     
    5361        __('Preload links that contain query strings', 'flashspeed'),
    5462        __NAMESPACE__ . '\\Flashspeed_IpageQs_render',
    55         'cache',
    56         'flashspeed_cache_section',
     63        TAB4_PAGE,     // Page
     64        TAB4_SECTION1, // Section
    5765        [
    5866            'label_for' => 'ipage_qs',
     
    6573        __('Preload external links', 'flashspeed'),
    6674        __NAMESPACE__ . '\\Flashspeed_IpageExt_render',
    67         'cache',
    68         'flashspeed_cache_section',
     75        TAB4_PAGE,     // Page
     76        TAB4_SECTION1, // Section
    6977        [
    7078            'label_for' => 'ipage_external',
     
    7785        __('Trigger a click when the mouse is pressed', 'flashspeed'),
    7886        __NAMESPACE__ . '\\Flashspeed_IpageMousedown_render',
    79         'cache',
    80         'flashspeed_cache_section',
     87        TAB4_PAGE,     // Page
     88        TAB4_SECTION1, // Section
    8189        [
    8290            'label_for' => 'ipage_mousedown',
     
    8997        __('Intensity', 'flashspeed'),
    9098        __NAMESPACE__ . '\\Flashspeed_Intensity_render',
    91         'cache',
    92         'flashspeed_cache_section',
     99        TAB4_PAGE,     // Page
     100        TAB4_SECTION1, // Section
    93101        [
    94102            'label_for' => 'ipage_intensity',
     
    101109        __('Custom delay (in ms)', 'flashspeed'),
    102110        __NAMESPACE__ . '\\Flashspeed_Delay_render',
    103         'cache',
    104         'flashspeed_cache_section',
     111        TAB4_PAGE,     // Page
     112        TAB4_SECTION1, // Section
    105113        [
    106114            'label_for' => 'ipage_delay',
     
    110118
    111119    add_settings_section(
    112         'flashspeed_hints_section',         // Section ID
     120        TAB4_SECTION2,         // Section ID
    113121        __('Resources hints', 'flashspeed'),  // Title
    114122        '', // Callback or empty string
    115         'cache'                             // Page to display the section in.
     123        TAB4_PAGE                            // Page to display the section in.
    116124    );
    117125
     
    120128        __('DNS Preconnect', 'flashspeed'),
    121129        __NAMESPACE__ . '\\Flashspeed_Preconnect_render',
    122         'cache',
    123         'flashspeed_hints_section',
     130        TAB4_PAGE,     // Page
     131        TAB4_SECTION2, // Section
    124132        [
    125133            'label_for' => 'preconnect',
     
    133141        __('Preload assets URLs', 'flashspeed'),
    134142        __NAMESPACE__ . '\\Flashspeed_Preload_render',
    135         'cache',
    136         'flashspeed_hints_section',
     143        TAB4_PAGE,     // Page
     144        TAB4_SECTION2, // Section
    137145        [
    138146            'label_for' => 'preload',
     
    153161function Flashspeed_Preconnect_render($args)
    154162{
    155     \FlashSpeed\Plugin\Fields\textArea('preconnect', 'codemirror-js', $args['help']);
     163    $fields = new Fields(TAB4_OPTION);
     164    $fields->textArea('preconnect', 'codemirror-js', $args['help']);
    156165}
    157166
     
    165174function Flashspeed_Preload_render($args)
    166175{
    167     \FlashSpeed\Plugin\Fields\textArea('preload', 'codemirror-js', $args['help']);
     176    $fields = new Fields(TAB4_OPTION);
     177    $fields->textArea('preload', 'codemirror-js', $args['help']);
    168178}
    169179
     
    177187function Flashspeed_IpageOn_render($args)
    178188{
    179     \FlashSpeed\Plugin\Fields\checkmate('ipage_on');
     189    $fields = new Fields(TAB4_OPTION);
     190    $fields->checkmate('ipage_on');
    180191}
    181192
     
    189200function Flashspeed_IpageQs_render($args)
    190201{
    191     \FlashSpeed\Plugin\Fields\checkmate('ipage_qs');
     202    $fields = new Fields(TAB4_OPTION);
     203    $fields->checkmate('ipage_qs');
    192204}
    193205
     
    201213function Flashspeed_IpageExt_render($args)
    202214{
    203     \FlashSpeed\Plugin\Fields\checkmate('ipage_ext');
     215    $fields = new Fields(TAB4_OPTION);
     216    $fields->checkmate('ipage_ext');
    204217}
    205218
     
    213226function Flashspeed_IpageMousedown_render($args)
    214227{
    215     \FlashSpeed\Plugin\Fields\checkmate('ipage_mousedown');
     228    $fields = new Fields(TAB4_OPTION);
     229    $fields->checkmate('ipage_mousedown');
    216230}
    217231
     
    225239function Flashspeed_Intensity_render($args)
    226240{
    227     $options = get_option('flashspeed_settings');
     241    //$options = get_option('flashspeed_settings');
    228242    $key = 'ipage_intensity';
    229243
     
    237251    ];
    238252
    239     \FlashSpeed\Plugin\Fields\dropDown($key, $array);
     253    $fields = new Fields(TAB4_OPTION);
     254    $fields->dropDown($key, $array);
    240255}
    241256
     
    250265{
    251266    $args['default'] = 'default';
    252     \FlashSpeed\Plugin\Fields\numberInput('ipage_delay', $args);
    253 }
     267    $fields = new Fields(TAB4_OPTION);
     268    $fields->numberInput('ipage_delay', $args);
     269}
  • flashspeed/trunk/admin/metatags.php

    r2905369 r2931411  
    1111 */
    1212
    13 namespace FlashSpeed\Plugin\Admin\Metatags;
     13namespace FlashSpeed\Admin;
     14
     15use ZenSettings\Fields\Fields;
    1416
    1517if (! defined('ABSPATH')) {
     
    1719}
    1820
    19 
    2021/**
    2122 * Load Metatags tab
     
    2526function Flashspeed_Settings_Metatags_init()
    2627{
     28    global $zen_settings;
     29    $slug = $zen_settings->getSlug();
     30    define("TAB1_PAGE", $slug . "_meta");
     31    define("TAB1_SECTION1", $slug . "_meta_section");
     32    define("OPTION_NAME", $slug . '_settings'); // your option name
     33
    2734    register_setting(
    28         'metatags',             // Settings group name
    29         'flashspeed_settings'   // name of an option to sanitize and save.
     35        TAB1_PAGE,             // Settings group name
     36        OPTION_NAME   // name of an option to sanitize and save.
    3037    );
    3138
    3239    add_settings_section(
    33         'flashspeed_metatags_section',          // Section ID
    34         __('Remove meta-tags', 'flashspeed'),   // Title
     40        TAB1_SECTION1,          // Section ID
     41        __('Remove meta tags', 'flashspeed'),   // Title
    3542        '', // Callback or empty string
    36         'metatags'                              // Page to display the section in.
     43        TAB1_PAGE                              // Page to display the section in.
    3744    );
    3845
     
    4148        __('Remove adjacent post links', 'flashspeed'), // Title
    4249        __NAMESPACE__ . '\\Flashspeed_Adjacent_Post_Links_render',        // Callback or empty string
    43         'metatags',                                     // Page
    44         'flashspeed_metatags_section'                   // Section
     50        TAB1_PAGE,                                     // Page
     51        TAB1_SECTION1
    4552    );
    4653
     
    4956        __('Remove feed links', 'flashspeed'),
    5057        __NAMESPACE__ . '\\Flashspeed_Feed_Links_render',
    51         'metatags',
    52         'flashspeed_metatags_section'
     58        TAB1_PAGE,
     59        TAB1_SECTION1
    5360    );
    5461
     
    5764        __('Remove RSD tag', 'flashspeed'),
    5865        __NAMESPACE__ . '\\Flashspeed_Rsd_render',
    59         'metatags',
    60         'flashspeed_metatags_section'
     66        TAB1_PAGE,
     67        TAB1_SECTION1
    6168    );
    6269
     
    6572        __('Remove WLM manifest tag', 'flashspeed'),
    6673        __NAMESPACE__ . '\\Flashspeed_Wlm_render',
    67         'metatags',
    68         'flashspeed_metatags_section'
     74        TAB1_PAGE,
     75        TAB1_SECTION1
    6976    );
    7077
     
    7380        __('Remove generator tags', 'flashspeed'),
    7481        __NAMESPACE__ . '\\Flashspeed_Generator_render',
    75         'metatags',
    76         'flashspeed_metatags_section'
     82        TAB1_PAGE,
     83        TAB1_SECTION1
    7784    );
    7885
     
    8289        __('Remove shortlink tag', 'flashspeed'),
    8390        __NAMESPACE__ . '\\Flashspeed_Shortlink_render',
    84         'metatags',
    85         'flashspeed_metatags_section'
     91        TAB1_PAGE,
     92        TAB1_SECTION1
    8693    );
    8794
     
    9198        __('Remove robots tag', 'flashspeed'),
    9299        __NAMESPACE__ . '\\Flashspeed_Robots_render',
    93         'metatags',
    94         'flashspeed_metatags_section'
     100        TAB1_PAGE,
     101        TAB1_SECTION1
    95102    );
    96103
     
    98105    add_settings_field(
    99106        'restapi',
    100         __('Remove Rest API tag', 'flashspeed'),
     107        __('Remove REST API tag', 'flashspeed'),
    101108        __NAMESPACE__ . '\\Flashspeed_RestApi_render',
    102         'metatags',
    103         'flashspeed_metatags_section'
    104     );
     109        TAB1_PAGE,
     110        TAB1_SECTION1
     111    );
     112
     113    // Remove Pinback link to xmlrpc
     114    add_settings_field(
     115        'pingback_link',
     116        __('Remove Pingback tag', 'flashspeed'),
     117        __NAMESPACE__ . '\\Flashspeed_Pingback_render',
     118        TAB1_PAGE,
     119        TAB1_SECTION1
     120    );
     121
    105122}
    106123add_action('admin_init', __NAMESPACE__ . '\\Flashspeed_Settings_Metatags_init');
     
    115132function Flashspeed_Adjacent_Post_Links_render($args)
    116133{
    117     \FlashSpeed\Plugin\Fields\checkmate('adjacent_post_links');
     134    $fields = new Fields(OPTION_NAME);
     135    $fields->checkmate('adjacent_post_links');
    118136}
    119137
     
    127145function Flashspeed_Feed_Links_render($args)
    128146{
    129     \FlashSpeed\Plugin\Fields\checkmate('feed_links');
     147    $fields = new Fields(OPTION_NAME);
     148    $fields->checkmate('feed_links');
    130149}
    131150
     
    139158function Flashspeed_Rsd_render($args)
    140159{
    141     \FlashSpeed\Plugin\Fields\checkmate('rsd');
     160    $fields = new Fields(OPTION_NAME);
     161    $fields->checkmate('rsd');
    142162}
    143163
     
    151171function Flashspeed_Wlm_render($args)
    152172{
    153     \FlashSpeed\Plugin\Fields\checkmate('wlm');
     173    $fields = new Fields(OPTION_NAME);
     174    $fields->checkmate('wlm');
    154175}
    155176
     
    163184function Flashspeed_Generator_render($args)
    164185{
    165     \FlashSpeed\Plugin\Fields\checkmate('wp_generator');
     186    $fields = new Fields(OPTION_NAME);
     187    $fields->checkmate('wp_generator');
    166188}
    167189
     
    175197function Flashspeed_Shortlink_render($args)
    176198{
    177     \FlashSpeed\Plugin\Fields\checkmate('shortlink');
     199    $fields = new Fields(OPTION_NAME);
     200    $fields->checkmate('shortlink');
    178201}
    179202
     
    187210function Flashspeed_Robots_render($args)
    188211{
    189     \FlashSpeed\Plugin\Fields\checkmate('robots');
    190 }
    191 
    192 /**
    193  * Rest Api tag
     212    $fields = new Fields(OPTION_NAME);
     213    $fields->checkmate('robots');
     214}
     215
     216/**
     217 * REST API tag
    194218 *
    195219 * @param array $args args
     
    199223function Flashspeed_RestApi_render($args)
    200224{
    201     \FlashSpeed\Plugin\Fields\checkmate('restapi');
    202 }
     225    $fields = new Fields(OPTION_NAME);
     226    $fields->checkmate('restapi');
     227}
     228
     229/**
     230 * Pingback tag
     231 *
     232 * @param array $args args
     233 *
     234 * @return html
     235 */
     236function Flashspeed_Pingback_render($args)
     237{
     238    $fields = new Fields(OPTION_NAME);
     239    $fields->checkmate('pingback_link');
     240}
  • flashspeed/trunk/changelog.txt

    r2905369 r2931411  
     1= 2.0.0 - 2023-06-27 =
     2*   New - complete plugin rewrite for much improved performance
     3*   New - brand-new UI
     4*   New - add more options and field types
     5*   Enhancement - refactor and improve fields functions
     6*   Enhancement - more escaping and sanitizing in the admin functions
     7*   Enhancement - many speed improvements over version 1.x
     8*   Update - Instant Page
     9*   Update - FS
     10
     11= 1.1.2 - 2023-05-29 =
     12*   Enhancement - refactor and improve fields functions
     13*   Enhancement - more escaping and sanitizing in the admin functions
     14*   New - add some more fields
     15
    116= 1.1.1 - 2023-04-27 =
    217*   Enhancement - group all jQuery options together
  • flashspeed/trunk/flashspeed.php

    r2905369 r2931411  
    55 * Plugin URI: https://utopique.net/products/flashspeed/
    66 * Description: FlashSpeed disables unused assets and optimizes resources, resulting in a lightning-fast site. Say goodbye to slow loading times and hello to a blazingly fast user experience!
    7  * Version: 1.1.1
     7 * Version: 2.0.0
    88 * Author: Utopique
    99 * Author URI: https://utopique.net/
     
    1212 * License: GPLv2 or later
    1313 * Requires at least: 5.2
    14  * Tested up to: 6.2.0
     14 * Tested up to: 6.3.0
    1515 * Requires PHP: 7.0
    1616 * WC requires at least: 3.3
    17  * WC tested up to: 7.6.1
     17 * WC tested up to: 7.8.0
    1818 * PHP version 7
    1919 *
     
    2424 * @link            https://utopique.net
    2525 */
    26 define( 'FLASHSPEED_VERSION', '1.1.1' );
     26namespace FlashSpeed;
    2727
    28 if ( function_exists( 'flashspeed_fs' ) ) {
     28// Plugin version
     29define( 'FLASHSPEED_VERSION', '2.0.0' );
     30// Plugin root path
     31define( "FLASHSPEED_ROOT", trailingslashit( plugin_dir_path( __FILE__ ) ) );
     32// Initialize Freemius SDK
     33
     34if ( function_exists( __NAMESPACE__ . '\\flashspeed_fs' ) ) {
    2935    flashspeed_fs()->set_basename( false, __FILE__ );
    3036} else {
    3137   
    32     if ( !function_exists( 'flashspeed_fs' ) ) {
     38    if ( !function_exists( __NAMESPACE__ . '\\flashspeed_fs' ) ) {
    3339        /**
    3440         * Define Freemius function: flashspeed_fs
     
    4147           
    4248            if ( !isset( $flashspeed_fs ) ) {
    43                 include_once dirname( __FILE__ ) . '/freemius/start.php';
     49                include_once FLASHSPEED_ROOT . '/vendor/freemius/wordpress-sdk/start.php';
    4450                $flashspeed_fs = fs_dynamic_init( array(
    4551                    'id'             => '5233',
     
    6874    }
    6975   
    70     // define cache
    71     if ( !defined( 'WP_CACHE' ) ) {
    72         define( 'WP_CACHE', true );
    73     }
     76    //require_once plugin_dir_path(__FILE__) . '/vendor/autoload.php';
     77    include_once plugin_dir_path( __FILE__ ) . 'vendor/zen-settings/zen-settings.php';
    7478    /**
    75      * Logic
    76      *
    77      * @param $classes array classes
    78      *
    79      * @return void
     79     * Load plugin config
    8080     */
    81     function Flashspeed_Get_plan( $classes )
    82     {
    83         $array = [
    84             'toplevel_page_flashspeed',
    85             'flashspeed_page_flashspeed-account',
    86             'flashspeed_page_flashspeed-contact',
    87             'flashspeed_page_flashspeed-pricing'
    88         ];
    89        
    90         if ( in_array( get_plugin_page_hook( 'flashspeed', 'flashspeed' ), $array ) ) {
    91             if ( flashspeed_fs()->is_plan( 'agency', true ) ) {
    92                 $plan = ' plan-agency ';
    93             }
    94             if ( flashspeed_fs()->is_plan( 'pro', true ) ) {
    95                 $plan = ' plan-pro ';
    96             }
    97             if ( flashspeed_fs()->is_plan( 'growth', true ) ) {
    98                 $plan = ' plan-growth ';
    99             }
    100             if ( flashspeed_fs()->is_plan( 'starter', true ) ) {
    101                 $plan = ' plan-starter ';
    102             }
    103             if ( flashspeed_fs()->is_not_paying() || flashspeed_fs()->is_free_plan() ) {
    104                 $plan = ' plan-free ';
    105             }
    106             $classes .= $plan;
    107         }
    108        
    109         return $classes;
    110     }
    111    
    112     add_filter( 'admin_body_class', 'Flashspeed_Get_plan' );
     81    include_once plugin_dir_path( __FILE__ ) . 'includes/config.php';
    11382    /**
    114      * Create option page
    115      *
    116      * @return null
     83     * Run Zen Settings
    11784     */
    118     function Flashspeed_Add_Admin_menu()
    119     {
    120         add_menu_page(
    121             'FlashSpeed',
    122             // Page title
    123             'FlashSpeed',
    124             // Menu title
    125             'manage_options',
    126             // Capabilities
    127             'flashspeed',
    128             // Slug
    129             'Flashspeed_Options_page',
    130             // Display callback
    131             'none',
    132             // Icon
    133             31
    134         );
    135     }
    136    
    137     add_action( 'admin_menu', 'Flashspeed_Add_Admin_menu' );
     85    $zen_settings = new \ZenSettings\ZenSettings(
     86        $args,
     87        $menu_icon,
     88        $tabs,
     89        $icons,
     90        $features
     91    );
     92    add_action( 'init', array( $zen_settings, 'init' ) );
    13893    /**
    139      * Include all fields functions
    140      *
    141      * @return void
     94     * Load functions
    14295     */
    143     include_once 'lib/fields.php';
    144     /**
    145      * Getter : retrieve cached options from transient
    146      *
    147      * @param mixed $key  the key to retrieve
    148      * @param bool  $echo false by default
    149      *
    150      * @return mixed the value for a given key
    151      */
    152     function carbonade( $key, $echo = 'false' )
    153     {
    154         $options = get_option( 'flashspeed_settings' );
    155        
    156         if ( $echo === true ) {
    157             echo  esc_html( $options[$key] ) ?? '' ;
    158         } else {
    159             return $options[$key] ?? '';
    160         }
    161    
    162     }
    163    
    164     /**
    165      * Load admin pages
    166      *
    167      * @return null
    168      */
    169     include_once 'admin/metatags.php';
    170     include_once 'admin/assets.php';
    171     include_once 'admin/analytics.php';
    172     include_once 'admin/cache.php';
    173     include_once 'admin/security-headers.php';
    174     include_once 'admin/advanced.php';
    175     include_once 'admin/agency.php';
    176     /**
    177      * Run scripts
    178      *
    179      * @return null
    180      */
    181     include_once 'includes/metatags.php';
    182     include_once 'includes/assets.php';
    183     /**
    184      * Enqueue scripts
    185      *
    186      * @param mixed $hook the current admin hook
    187      *
    188      * @return mixed styles and scripts
    189      */
    190     function FlashSpeed_Add_assets( $hook )
    191     {
    192         $svg = "data:image/svg+xml,%3Csvg xmlns='http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg' width='1em' height='1em' preserveAspectRatio='xMidYMid meet' viewBox='0 0 48 48'%3E%3Cpath fill='%23FFC107' d='M33 22h-9.4L30 5H19l-6 21h8.6L17 45z'%2F%3E%3C%2Fsvg%3E";
    193         wp_add_inline_style( 'dashicons', "@keyframes shake {\n            10%, 90% { transform: translate3d(-1px, 0, 0); }\n            20%, 80% { transform: translate3d(2px, 0, 0); }\n            30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }\n            40%, 60% { transform: translate3d(4px, 0, 0); }\n        }\n                    \n        #toplevel_page_flashspeed .wp-menu-image {\n            mask-image: url(\"{$svg}\");\n            mask-repeat: no-repeat;\n            mask-position: center;\n            mask-size: 22px;\n            background-color: #FFC107;\n            -webkit-mask-image: url(\"{$svg}\");\n            -webkit-mask-repeat: no-repeat;\n            -webkit-mask-position: center;\n            -webkit-mask-size: 22px;\n        }\n            \n        #toplevel_page_flashspeed .wp-menu-image:hover,\n        a.toplevel_page_flashspeed:hover div.wp-menu-image {\n            animation: shake 0.82s cubic-bezier(.36,.07,.19,.97) both;\n            transform: translate3d(0, 0, 0);\n            backface-visibility: hidden;\n            perspective: 1000px;\n        }" );
    194         $array = [
    195             'toplevel_page_flashspeed',
    196             'flashspeed_page_flashspeed-account',
    197             'flashspeed_page_flashspeed-contact',
    198             'flashspeed_page_flashspeed-pricing'
    199         ];
    200         // Only on our plugin page
    201        
    202         if ( $hook === $array[0] ) {
    203             // CodeMirror CSS Editor
    204             $cm_css['codeEditor'] = wp_enqueue_code_editor( [
    205                 'type' => 'text/css',
    206             ] );
    207             wp_localize_script( 'jquery', 'cm_css', $cm_css );
    208             // CodeMirror JS Editor
    209             $cm_js['codeEditor'] = wp_enqueue_code_editor( [
    210                 'type' => 'text/html',
    211             ] );
    212             wp_localize_script( 'jquery', 'cm_js', $cm_js );
    213             // Load scripts
    214             wp_enqueue_script( 'wp-theme-plugin-editor' );
    215             wp_enqueue_style( 'wp-codemirror' );
    216             wp_enqueue_style(
    217                 'utopique-elements',
    218                 plugins_url( 'lib/css/elements.css', __FILE__ ),
    219                 false,
    220                 FLASHSPEED_VERSION,
    221                 'all'
    222             );
    223             wp_enqueue_style(
    224                 'flashspeed-css',
    225                 plugins_url( 'lib/css/flashspeed.css', __FILE__ ),
    226                 false,
    227                 FLASHSPEED_VERSION,
    228                 'all'
    229             );
    230             wp_enqueue_style(
    231                 'flashspeed-tabs',
    232                 plugins_url( 'lib/css/tabs.css', __FILE__ ),
    233                 false,
    234                 FLASHSPEED_VERSION,
    235                 'all'
    236             );
    237             wp_enqueue_script(
    238                 'flashspeed-tabs',
    239                 plugins_url( 'lib/js/tabs.js', __FILE__ ),
    240                 false,
    241                 FLASHSPEED_VERSION,
    242                 true
    243             );
    244             wp_enqueue_script(
    245                 'flashspeed-js',
    246                 plugins_url( 'lib/js/flashspeed.js', __FILE__ ),
    247                 false,
    248                 FLASHSPEED_VERSION,
    249                 true
    250             );
    251             wp_localize_script( 'flashspeed-js', 'FSO', [
    252                 'upgrade_url' => flashspeed_fs()->get_upgrade_url(),
    253             ] );
    254             // remove WP emoji on our pages
    255             remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
    256             remove_action( 'admin_print_styles', 'print_emoji_styles' );
    257             return;
    258         }
    259    
    260     }
    261    
    262     add_action( 'admin_enqueue_scripts', 'FlashSpeed_Add_assets' );
    263     /**
    264      * Create admin tabs
    265      *
    266      * See: https://onedesigns.com/tutorials/separate-multiple-theme-options-pages-using-tabs/
    267      *
    268      * @param string $current current tab
    269      *
    270      * @return html
    271      */
    272     function Flashspeed_Admin_tabs( $current = 'meta' )
    273     {
    274         $tabs = array(
    275             'meta'             => 'Meta Tags',
    276             'assets'           => 'Assets',
    277             'analytics'        => 'Analytics',
    278             'cache'            => 'Cache',
    279             'security_headers' => 'Headers',
    280             'advanced'         => 'Advanced',
    281         );
    282         include_once 'lib/svg-icons.php';
    283         $links = array();
    284         $i = 1;
    285         foreach ( $tabs as $tab => $name ) {
    286            
    287             if ( $tab == $current ) {
    288                 $links[] = "<li class='active' onclick='setTabNo(this)' id='{$i}'>{$icons[$tab]}<span><a href='#tab-{$i}'>{$name}</a></span></li>";
    289             } else {
    290                 $links[] = "<li onclick='setTabNo(this)' id='{$i}'>{$icons[$tab]}<span><a href='#tab-{$i}'>{$name}</a></span></li>";
    291             }
    292            
    293             $i++;
    294         }
    295         echo  '<ul class="nav nav-tabs">' ;
    296         foreach ( $links as $link ) {
    297             echo  $link ;
    298         }
    299         echo  '</ul>' ;
    300     }
    301    
    302     /**
    303      * Build settings page sidebar
    304      *
    305      * @return html
    306      */
    307     function Settings_Page_sidebar()
    308     {
    309         // See: http://www.satoripress.com/2011/10/wordpress/plugin-development/clean-2-column-page-layout-for-plugins-70/
    310         ?>
    311     <div class="inner-sidebar utopique-submit">
    312         <div class="postbox">
    313         <h3>Actions</h3>
    314             <div class="inside">
    315             <?php
    316         submit_button();
    317         ?>
    318             </div>
    319         </div>
    320     </div> <!-- .inner-sidebar -->
    321         <?php
    322     }
    323    
    324     /**
    325      * Promo box in sidebar
    326      *
    327      * @return html
    328      */
    329     function Settings_Promo_sidebar()
    330     {
    331         /* business users : bail early */
    332         if ( flashspeed_fs()->is_plan( 'agency' ) ) {
    333             //return;
    334         }
    335         /* define all plans */
    336         $features = [];
    337         $starter = [ __( 'Local Google Analytics 4', 'flashspeed' ), __( 'Custom code blocks', 'flashspeed' ) ];
    338         $growth = [ __( 'Caching and Page preloading', 'flashspeed' ) ];
    339         $pro = [ __( 'Security headers', 'flashspeed' ), __( 'Content Security Policy', 'flashspeed' ), __( 'Optimize resources', 'flashspeed' ) ];
    340         $agency = [ __( 'Advanced options for agencies and clients', 'flashspeed' ) ];
    341         /* Free plan or non-paying user */
    342         if ( flashspeed_fs()->is_not_paying() || flashspeed_fs()->is_free_plan() ) {
    343             //$features = [...$starter, ...$growth, ...$pro, ...$agency];
    344             // PHP < 7.4
    345             $features = array_merge(
    346                 $starter,
    347                 $growth,
    348                 $pro,
    349                 $agency
    350             );
    351         }
    352         /* Starter */
    353         if ( flashspeed_fs()->is_plan( 'starter', true ) ) {
    354             //$features = [...$growth, ...$pro, ...$agency];
    355             // PHP < 7.4
    356             $features = array_merge( $growth, $pro, $agency );
    357         }
    358         /* Growth */
    359         if ( flashspeed_fs()->is_plan( 'growth', true ) ) {
    360             //$features = [...$pro, ...$agency];
    361             // PHP < 7.4
    362             $features = array_merge( $pro, $agency );
    363         }
    364         /* Pro */
    365         if ( flashspeed_fs()->is_plan( 'pro', true ) ) {
    366             //$features = [...$agency];
    367             // PHP < 7.4
    368             $features = $agency;
    369         }
    370         /* common features for all plans */
    371         $all_plans = [ 'Priority premium support' ];
    372         $features = array_merge( $features, $all_plans );
    373         ?>
    374     <div class="inner-sidebar">
    375         <div class="postbox">
    376         <h3><?php
    377         _e( 'Upgrade your plan', 'flashspeed' );
    378         ?></h3>
    379             <div class="inside">
    380                 <div id="promo-box" class="wp-core-ui"><h2>🚀</h2>
    381                 <div id="buy"><a class="button" href="<?php
    382         echo  flashspeed_fs()->get_upgrade_url() ;
    383         ?>"><span class="trolley">🛒  </span> <?php
    384         _e( 'Upgrade', 'flashspeed' );
    385         ?></a></div>
    386                 <p><strong><?php
    387         _e( 'And get access to:', 'flashspeed' );
    388         ?></strong></p>
    389                 <ul>
    390                 <?php
    391         foreach ( $features as $f ) {
    392             printf( '<li>✔ ' . $f . '</li>' );
    393         }
    394         ?>
    395                 </ul>
    396             </div>
    397             </div>
    398         </div>
    399     </div> <!-- .inner-sidebar -->
    400         <?php
    401     }
    402    
    403     /**
    404      * Settings page for tab1
    405      *
    406      * @return html
    407      */
    408     function Settings_Page_tab1()
    409     {
    410         ?>
    411     <div id="post-body">
    412         <div id="post-body-content">
    413             <div class="postbox">
    414                 <h3><span>Metabox in Tab1</span></h3>
    415                 <div class="inside">
    416                     <p>Hi, I'm content visible in the first Tab!</p>
    417                 </div> <!-- .inside -->
    418             </div>
    419         </div> <!-- #post-body-content -->
    420     </div> <!-- #post-body --> 
    421         <?php
    422     }
    423    
    424     /**
    425      * Build settings page
    426      *
    427      * @return void
    428      */
    429     function Flashspeed_Options_page()
    430     {
    431         ?>
    432     <div class="wrap slider-checkbox flashspeed">
    433     <h1>FlashSpeed ⚡</h1>
    434        
    435         <?php
    436         settings_errors();
    437         ?> 
    438         <?php
    439         Flashspeed_Admin_tabs();
    440         ?>
    441 
    442     <form method="post" action="options.php">
    443     <div id="main-content" class="main">
    444         <div class="tab-content">
    445        
    446             <div id="tab-1" class="tab-pane active metatags">
    447         <?php
    448         settings_fields( 'metatags' );
    449         do_settings_sections( 'metatags' );
    450         ?>
    451             </div>
    452        
    453             <div id="tab-2" class="tab-pane assets">
    454         <?php
    455         settings_fields( 'assets' );
    456         do_settings_sections( 'assets' );
    457         ?>
    458             </div>
    459        
    460             <div id="tab-3" class="tab-pane analytics">
    461         <?php
    462         settings_fields( 'analytics' );
    463         do_settings_sections( 'analytics' );
    464         ?>
    465             </div>
    466        
    467             <div id="tab-4" class="tab-pane cache">
    468         <?php
    469         settings_fields( 'cache' );
    470         do_settings_sections( 'cache' );
    471         ?>
    472             </div>
    473        
    474             <div id="tab-5" class="tab-pane security-headers">
    475         <?php
    476         settings_fields( 'headers' );
    477         do_settings_sections( 'headers' );
    478         ?>
    479             </div>
    480 
    481             <div id="tab-6" class="tab-pane advanced">
    482         <?php
    483         settings_fields( 'advanced' );
    484         do_settings_sections( 'advanced' );
    485         ?>
    486             </div>
    487 
    488             <div id="tab-7" class="tab-pane agency">
    489         <?php
    490         settings_fields( 'agency' );
    491         do_settings_sections( 'agency' );
    492         ?>
    493             </div>
    494 
    495         </div>
    496        
    497        
    498         <div class="metabox-holder has-right-sidebar" id="sidebar">
    499         <?php
    500         Settings_Page_sidebar();
    501         Settings_Promo_sidebar();
    502         //submit_button();
    503         //if ($tab == 'tab1') {
    504         //Settings_Page_tab1();
    505         //}
    506         // else {
    507         //Settings_Page_tab2();
    508         //}
    509         ?>
    510         </div> <!-- .metabox-holder -->
    511         </div>
    512     </form>
    513     </div>
    514         <?php
    515     }
    516    
    517     /**
    518      * Localization
    519      *
    520      * @return mixed
    521      */
    522     function FlashSpeed_Load_Plugin_textdomain()
    523     {
    524         load_plugin_textdomain( 'flashspeed', false, basename( dirname( __FILE__ ) ) . '/languages/' );
    525     }
    526    
    527     add_action( 'plugins_loaded', __NAMESPACE__ . '\\FlashSpeed_Load_Plugin_textdomain' );
    528     /**
    529      * Add settings link to plugins page
    530      *
    531      * @param mixed $links existing links
    532      *
    533      * @return mixed $links modified links
    534      */
    535     function FlashSpeed_Settings_link( $links )
    536     {
    537         $settings_link = '<a href="admin.php?page=flashspeed">Settings</a>';
    538         array_unshift( $links, $settings_link );
    539         // or array_push
    540         return (array) $links;
    541     }
    542    
    543     $plugin = plugin_basename( __FILE__ );
    544     add_filter(
    545         "plugin_action_links_{$plugin}",
    546         __NAMESPACE__ . '\\FlashSpeed_Settings_link',
    547         10,
    548         1
    549     );
    550     /**
    551      * Add additional useful links to plugins page
    552      *
    553      * @param mixed $links existing links
    554      * @param mixed $file  the current plugin file
    555      *
    556      * @return mixed $links modified links
    557      */
    558     function FlashSpeed_Row_meta( $links, $file )
    559     {
    560        
    561         if ( $file === plugin_basename( __FILE__ ) ) {
    562             $row_meta = array(
    563                 'docs'    => '<a href="' . esc_url( apply_filters( 'FlashSpeed_docs_url', 'https://utopique.net/products/' ) ) . '" title="' . esc_attr( __( 'Documentation', 'flashspeed' ) ) . '">' . __( 'Documentation', 'flashspeed' ) . '</a>',
    564                 'support' => '<a href="' . esc_url( apply_filters( 'FlashSpeed_support_url', 'https://utopique.net/support/' ) ) . '" title="' . esc_attr( __( 'Customer Support', 'flashspeed' ) ) . '">' . __( 'Customer Support', 'flashspeed' ) . '</a>',
    565                 'rate'    => '<a href="' . esc_url( apply_filters( 'FlashSpeed_rate', 'https://wordpress.org/plugins/flashspeed/reviews#new-post' ) ) . '" target="_blank" title="' . esc_attr( __( 'Rate FlashSpeed', 'flashspeed' ) ) . '">' . __( 'Rate FlashSpeed', 'flashspeed' ) . '</a>',
    566             );
    567             return array_merge( $links, $row_meta );
    568         }
    569        
    570         return (array) $links;
    571     }
    572    
    573     add_filter(
    574         'plugin_row_meta',
    575         __NAMESPACE__ . '\\FlashSpeed_Row_meta',
    576         10,
    577         2
    578     );
     96    include_once plugin_dir_path( __FILE__ ) . 'includes/functions.php';
    57997}
    58098
    581 // end freemius
     99//end FS
  • flashspeed/trunk/readme.txt

    r2905369 r2931411  
    44Tags: speed optimization, assets, metatags, security headers, analytics, flashspeed, flash speed, utopique
    55Requires at least: 5.2
    6 Tested up to: 6.2.0
     6Tested up to: 6.3.0
    77Requires PHP: 7.0
    8 Stable tag: 1.1.1
     8Stable tag: 2.0.0
    99License: GPLv3 or later
    1010
     
    1212
    1313== Description ==
     14
     15Have you ever wanted to take control back over your WordPress - disable unwanted features and assets, to get your site speed back and serve your pages faster? Now you can!
    1416
    1517[FlashSpeed](https://utopique.net/products/flash-speed-pro/ "FlashSpeed Optimizer") aims at getting your WordPress and WooCommerce sites up-to-speed as it removes unused assets and allows you to fine-tune what WordPress loads.
     
    2022
    2123*   remove useless meta tags (depending on your use case)
    22 *   set a custom favicon for frontend and backend
    2324*   disable unneeded assets
    2425*   limit posts revisions
     
    4849== Changelog ==
    4950
    50 = 1.1.1 - 2023-04-27 =
    51 *   Enhancement - group all jQuery options together
    52 *   Enhancement - namespace admin fields to reduce conflicts with other plugins
    53 *   Fix - solve warning in Permission Policy module
    54 *   Fix - order assets dependencies in a consistent order
    55 
    56 = 1.1.0 - 2023-04-12 =
    57 *   Enhancement - brand-new user interface
    58 *   Enhancement - improve code logic for security headers to ensure they are not output twice
    59 *   Enhancement - add help text to textarea options
    60 *   Enhancement - use prepare() for queries
    61 *   Enhancement - only load assets for our plugin page
    62 *   Update - upgrade instant.page
    63 *   Update - POT file and translations
    64 *   Update - tested comptability with WP 6.2.0
    65 *   Update - FS library
    66 
     51= 2.0.0 - 2023-06-27 =
     52*   New - complete plugin rewrite for much improved performance
     53*   New - brand-new UI
     54*   New - add more options and field types
     55*   Enhancement - refactor and improve fields functions
     56*   Enhancement - more escaping and sanitizing in the admin functions
     57*   Enhancement - many speed improvements over version 1.x
     58*   Update - Instant Page
     59*   Update - FS
    6760
    6861Older versions changes can be found in [the changelog](https://utopique.net/products/flash-speed-pro/#changelog "FlashSpeed Optimizer changelog")
Note: See TracChangeset for help on using the changeset viewer.