Plugin Directory

Changeset 3372734


Ignore:
Timestamp:
10/04/2025 07:23:42 AM (6 months ago)
Author:
brainywpbd
Message:

Themes and plugin notice code updated

Location:
minifly
Files:
289 added
5 edited

Legend:

Unmodified
Added
Removed
  • minifly/trunk/minifly.php

    r3370858 r3372734  
    11<?php
     2
    23/*
    34 * Plugin Name:       Minifly
    45 * Plugin URI:        https://brainywp.com/minifly/
    56 * Description:       Minifly is your favorite, lightweight companion for better performance. Supercharge your site with tiny tools that make a big difference.
    6  * Version:           1.0.21
     7 * Version:           1.0.22
    78 * Requires at least: 5.2
    89 * Requires PHP:      7.2
     
    1415 * Domain Path:       /languages
    1516 */
    16 
    17 if (!defined('ABSPATH')) {
     17if ( !defined( 'ABSPATH' ) ) {
    1818    exit;
    1919    // Exit if accessed directly.
    2020}
    21 
    22 if (function_exists('minfly_fs')) {
    23     minfly_fs()->set_basename(false, __FILE__);
     21if ( function_exists( 'minfly_fs' ) ) {
     22    minfly_fs()->set_basename( false, __FILE__ );
    2423} else {
    2524    /**
     
    2827     */
    2928    // The key prefix Upper-case: SAPMFLY, lower-case: sapmfly
    30     if (!function_exists('minfly_fs')) {
     29    if ( !function_exists( 'minfly_fs' ) ) {
    3130        // Create a helper function for easy SDK access.
    32         function minfly_fs()
    33         {
     31        function minfly_fs() {
    3432            global $minfly_fs;
    35             if (!isset($minfly_fs)) {
     33            if ( !isset( $minfly_fs ) ) {
    3634                // Include Freemius SDK.
    37                 require_once dirname(__FILE__) . '/vendor/freemius/start.php';
    38                 $minfly_fs = fs_dynamic_init(array(
     35                require_once dirname( __FILE__ ) . '/vendor/freemius/start.php';
     36                $minfly_fs = fs_dynamic_init( array(
    3937                    'id'             => '19727',
    4038                    'slug'           => 'minifly',
     
    5149                    ),
    5250                    'is_live'        => true,
    53                 ));
     51                ) );
    5452            }
    5553            return $minfly_fs;
     
    5957        minfly_fs();
    6058        // Signal that SDK was initiated.
    61         do_action('minfly_fs_loaded');
    62     }
    63 
    64     if (!defined('ABSPATH')) {
     59        do_action( 'minfly_fs_loaded' );
     60    }
     61    if ( !defined( 'ABSPATH' ) ) {
    6562        exit;
    6663        // Exit if accessed directly.
    6764    }
    6865    // Define constants
    69     define('SAPMFLY_VERSION', '0.0.1');
    70     define('SAPMFLY_ASSETS', plugin_dir_url(__FILE__) . 'assets/');
    71     define('SAPMFLY_TEMPLATES', plugin_dir_path(__FILE__) . 'templates/');
    72 
     66    define( 'SAPMFLY_VERSION', '0.0.1' );
     67    define( 'SAPMFLY_ASSETS', plugin_dir_url( __FILE__ ) . 'assets/' );
     68    define( 'SAPMFLY_TEMPLATES', plugin_dir_path( __FILE__ ) . 'templates/' );
    7369    // Enqueue admin CSS and JS files
    74     function sapmfly_enqueue_admin_assets()
    75     {
     70    function sapmfly_enqueue_admin_assets() {
    7671        // Enqueue CSS file
    7772        wp_enqueue_style(
     
    106101    }
    107102
    108     add_action('admin_enqueue_scripts', 'sapmfly_enqueue_admin_assets');
     103    add_action( 'admin_enqueue_scripts', 'sapmfly_enqueue_admin_assets' );
    109104    // Enqueue Front End CSS and JS files
    110     function sapmfly_enqueue_user_assets()
    111     {
     105    function sapmfly_enqueue_user_assets() {
    112106        // Enqueue CSS file
    113107        wp_enqueue_style(
     
    128122    }
    129123
    130     add_action('wp_enqueue_scripts', 'sapmfly_enqueue_user_assets');
     124    add_action( 'wp_enqueue_scripts', 'sapmfly_enqueue_user_assets' );
    131125    // Admin dashboard main menu hook
    132     add_action('admin_menu', 'sapmfly_register_menus');
     126    add_action( 'admin_menu', 'sapmfly_register_menus' );
    133127    /**
    134128     * Register the Minifly menu and submenus
    135129     */
    136     function sapmfly_register_menus()
    137     {
     130    function sapmfly_register_menus() {
    138131        $sapmfly_capability = 'manage_options';
    139132        $sapmfly_parent_slug = 'minifly';
    140133        // Conditional menu for upgrade to pro or license page
    141         if (!function_exists('is_plugin_active')) {
     134        if ( !function_exists( 'is_plugin_active' ) ) {
    142135            include_once ABSPATH . 'wp-admin/includes/plugin.php';
    143136        }
    144137        $pro_plugin_file = 'minifly-pro/minifly-pro.php';
    145         $pro_active = is_plugin_active($pro_plugin_file);
     138        $pro_active = is_plugin_active( $pro_plugin_file );
    146139        // Plugin top-level menu
    147140        add_menu_page(
    148             esc_html__('Minifly', 'minifly'),
    149             esc_html__('Minifly', 'minifly'),
     141            esc_html__( 'Minifly', 'minifly' ),
     142            esc_html__( 'Minifly', 'minifly' ),
    150143            $sapmfly_capability,
    151144            $sapmfly_parent_slug,
     
    157150        add_submenu_page(
    158151            $sapmfly_parent_slug,
    159             esc_html__('Admin', 'minifly'),
    160             esc_html__('Admin', 'minifly'),
     152            esc_html__( 'Admin', 'minifly' ),
     153            esc_html__( 'Admin', 'minifly' ),
    161154            $sapmfly_capability,
    162155            $sapmfly_parent_slug,
     
    165158        add_submenu_page(
    166159            $sapmfly_parent_slug,
    167             esc_html__('Website', 'minifly'),
    168             esc_html__('Website', 'minifly'),
     160            esc_html__( 'Website', 'minifly' ),
     161            esc_html__( 'Website', 'minifly' ),
    169162            $sapmfly_capability,
    170163            $sapmfly_parent_slug . '-user',
     
    173166        add_submenu_page(
    174167            $sapmfly_parent_slug,
    175             esc_html__('eCommerce', 'minifly'),
    176             esc_html__('eCommerce', 'minifly'),
     168            esc_html__( 'eCommerce', 'minifly' ),
     169            esc_html__( 'eCommerce', 'minifly' ),
    177170            $sapmfly_capability,
    178171            $sapmfly_parent_slug . '-store',
     
    181174        add_submenu_page(
    182175            $sapmfly_parent_slug,
    183             esc_html__('White Label', 'minifly'),
     176            esc_html__( 'White Label', 'minifly' ),
    184177            // Page title always same
    185             esc_html__('White Label', 'minifly'),
     178            esc_html__( 'White Label', 'minifly' ),
    186179            // Page title always same
    187180            $sapmfly_capability,
     
    191184        add_submenu_page(
    192185            $sapmfly_parent_slug,
    193             esc_html__('Help Center', 'minifly'),
    194             esc_html__('Help Center', 'minifly'),
     186            esc_html__( 'Help Center', 'minifly' ),
     187            esc_html__( 'Help Center', 'minifly' ),
    195188            $sapmfly_capability,
    196189            $sapmfly_parent_slug . '-help-center',
     
    199192        add_submenu_page(
    200193            $sapmfly_parent_slug,
    201             esc_html__('Power Tools', 'minifly'),
    202             esc_html__('Power Tools', 'minifly'),
     194            esc_html__( 'Power Tools', 'minifly' ),
     195            esc_html__( 'Power Tools', 'minifly' ),
    203196            $sapmfly_capability,
    204197            $sapmfly_parent_slug . '-more-tools',
     
    220213        'extra-hooks.php',
    221214    ];
    222     foreach ($sapmfly_templates as $template) {
     215    foreach ( $sapmfly_templates as $template ) {
    223216        $template_path = SAPMFLY_TEMPLATES . $template;
    224         if (file_exists($template_path)) {
     217        if ( file_exists( $template_path ) ) {
    225218            require_once $template_path;
    226219        }
    227220    }
    228 
    229221    // Add some update while active the plugin
    230     register_activation_hook(__FILE__, 'sapmfly_set_default_back_top_color');
    231     function sapmfly_set_default_back_top_color()
    232     {
    233         $currentbg = get_option('sapmfly_back_top_bg_color');
    234         $currenthv = get_option('sapmfly_back_top_hv_color');
    235         if (empty($currentbg)) {
    236             update_option('sapmfly_back_top_bg_color', '#4CAF50');
    237         }
    238         if (empty($currenthv)) {
    239             update_option('sapmfly_back_top_hv_color', '#4CAF50');
     222    register_activation_hook( __FILE__, 'sapmfly_set_default_back_top_color' );
     223    function sapmfly_set_default_back_top_color() {
     224        $currentbg = get_option( 'sapmfly_back_top_bg_color' );
     225        $currenthv = get_option( 'sapmfly_back_top_hv_color' );
     226        if ( empty( $currentbg ) ) {
     227            update_option( 'sapmfly_back_top_bg_color', '#4CAF50' );
     228        }
     229        if ( empty( $currenthv ) ) {
     230            update_option( 'sapmfly_back_top_hv_color', '#4CAF50' );
    240231        }
    241232    }
     
    245236     * Register a custom REST API endpoint
    246237     */
    247     add_action('rest_api_init', function () {
    248         register_rest_route('myplugin/v1', '/info', array(
     238    add_action( 'rest_api_init', function () {
     239        register_rest_route( 'myplugin/v1', '/info', array(
    249240            'methods'             => 'GET',
    250241            'callback'            => 'myplugin_get_info',
    251242            'permission_callback' => '__return_true',
    252         ));
    253     });
     243        ) );
     244    } );
    254245    /**
    255246     * Callback function to return plugin data
    256247     */
    257     function myplugin_get_info($request)
    258     {
     248    function myplugin_get_info(  $request  ) {
    259249        // Path to this plugin's main file
    260         $plugin_file = plugin_basename(__FILE__);
     250        $plugin_file = plugin_basename( __FILE__ );
    261251        // Get all plugin data from header
    262         if (!function_exists('get_plugin_data')) {
     252        if ( !function_exists( 'get_plugin_data' ) ) {
    263253            require_once ABSPATH . 'wp-admin/includes/plugin.php';
    264254        }
    265         $plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_file);
     255        $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin_file );
    266256        return array(
    267257            'site_url'       => get_site_url(),
     
    270260        );
    271261    }
     262
    272263}
  • minifly/trunk/readme.txt

    r3370858 r3372734  
    11=== Minifly - Site Enhancement, White Label and Custom Dashboard Solution  ===
    2 Contributors: brainywpbd
     2Contributors: brainywpbd, freemius
    33Tags: Site enhancement, White label, Custom dashboard, Page duplicate, minifly
    44Requires at least: 5.2
    55Tested up to: 6.8
    6 Stable tag: 1.0.21
     6Stable tag: 1.0.22
    77Requires PHP: 7.2
    88License: GPLv2 or later
  • minifly/trunk/templates/admin/admin-settings.php

    r3370858 r3372734  
    191191                                ?>
    192192
    193                                 <!-- Disable all theme update -->
    194                                 <?php
    195                                 $sapmfly_disable_all_theme_update = SAPMFLY_TEMPLATES . 'admin/features/disable-theme-update.php';
    196                                 if (file_exists($sapmfly_disable_all_theme_update)) {
    197                                     require_once $sapmfly_disable_all_theme_update;
    198                                 }
    199                                 ?>
    200 
    201193                                <!-- Disable all plugin update -->
    202194                                <?php
  • minifly/trunk/templates/admin/all-admin-hooks.php

    r3370858 r3372734  
    430430// Hide update notices for ALL themes if disabled in settings
    431431add_filter('site_transient_update_themes', function ($transient) {
    432     if (get_option('sapmfly_disable_theme_update', 'no') === 'yes') {
     432    if (get_option('sapmfly_disable_plugin_update', 'no') === 'yes') {
    433433        if (isset($transient->response)) {
    434434            $transient->response = [];
  • minifly/trunk/templates/admin/features/disable-plugin-update.php

    r3369066 r3372734  
    1010    <label class="sapmfly-switch-update">
    1111        <div class="disable-plugin-header toggle-header">
    12             <?php echo esc_html__('Disable all plugin update', 'minifly'); ?>
     12            <?php echo esc_html__('Disable themes/plugins update', 'minifly'); ?>
    1313            <input type="checkbox" class="sapmfly-setting-toggle" name="sapmfly_disable_plugin_update" <?php checked($disable_plugin_update, 'yes'); ?> />
    1414            <span class="sapmfly-slider"></span>
Note: See TracChangeset for help on using the changeset viewer.