Plugin Directory

Changeset 3370858


Ignore:
Timestamp:
10/01/2025 05:55:12 AM (6 months ago)
Author:
brainywpbd
Message:

Disable theme update notice added

Location:
minifly
Files:
290 added
4 edited

Legend:

Unmodified
Added
Removed
  • minifly/trunk/minifly.php

    r3369066 r3370858  
    11<?php
    2 
    32/*
    43 * Plugin Name:       Minifly
    54 * Plugin URI:        https://brainywp.com/minifly/
    65 * Description:       Minifly is your favorite, lightweight companion for better performance. Supercharge your site with tiny tools that make a big difference.
    7  * Version:           1.0.20
     6 * Version:           1.0.21
    87 * Requires at least: 5.2
    98 * Requires PHP:      7.2
     
    1514 * Domain Path:       /languages
    1615 */
    17 if ( !defined( 'ABSPATH' ) ) {
     16
     17if (!defined('ABSPATH')) {
    1818    exit;
    1919    // Exit if accessed directly.
    2020}
    21 if ( function_exists( 'minfly_fs' ) ) {
    22     minfly_fs()->set_basename( false, __FILE__ );
     21
     22if (function_exists('minfly_fs')) {
     23    minfly_fs()->set_basename(false, __FILE__);
    2324} else {
    2425    /**
     
    2728     */
    2829    // The key prefix Upper-case: SAPMFLY, lower-case: sapmfly
    29     if ( !function_exists( 'minfly_fs' ) ) {
     30    if (!function_exists('minfly_fs')) {
    3031        // Create a helper function for easy SDK access.
    31         function minfly_fs() {
     32        function minfly_fs()
     33        {
    3234            global $minfly_fs;
    33             if ( !isset( $minfly_fs ) ) {
     35            if (!isset($minfly_fs)) {
    3436                // Include Freemius SDK.
    35                 require_once dirname( __FILE__ ) . '/vendor/freemius/start.php';
    36                 $minfly_fs = fs_dynamic_init( array(
     37                require_once dirname(__FILE__) . '/vendor/freemius/start.php';
     38                $minfly_fs = fs_dynamic_init(array(
    3739                    'id'             => '19727',
    3840                    'slug'           => 'minifly',
     
    4951                    ),
    5052                    'is_live'        => true,
    51                 ) );
     53                ));
    5254            }
    5355            return $minfly_fs;
     
    5759        minfly_fs();
    5860        // Signal that SDK was initiated.
    59         do_action( 'minfly_fs_loaded' );
    60     }
    61     if ( !defined( 'ABSPATH' ) ) {
     61        do_action('minfly_fs_loaded');
     62    }
     63
     64    if (!defined('ABSPATH')) {
    6265        exit;
    6366        // Exit if accessed directly.
    6467    }
    6568    // Define constants
    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/' );
     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
    6973    // Enqueue admin CSS and JS files
    70     function sapmfly_enqueue_admin_assets() {
     74    function sapmfly_enqueue_admin_assets()
     75    {
    7176        // Enqueue CSS file
    7277        wp_enqueue_style(
     
    101106    }
    102107
    103     add_action( 'admin_enqueue_scripts', 'sapmfly_enqueue_admin_assets' );
     108    add_action('admin_enqueue_scripts', 'sapmfly_enqueue_admin_assets');
    104109    // Enqueue Front End CSS and JS files
    105     function sapmfly_enqueue_user_assets() {
     110    function sapmfly_enqueue_user_assets()
     111    {
    106112        // Enqueue CSS file
    107113        wp_enqueue_style(
     
    122128    }
    123129
    124     add_action( 'wp_enqueue_scripts', 'sapmfly_enqueue_user_assets' );
     130    add_action('wp_enqueue_scripts', 'sapmfly_enqueue_user_assets');
    125131    // Admin dashboard main menu hook
    126     add_action( 'admin_menu', 'sapmfly_register_menus' );
     132    add_action('admin_menu', 'sapmfly_register_menus');
    127133    /**
    128134     * Register the Minifly menu and submenus
    129135     */
    130     function sapmfly_register_menus() {
     136    function sapmfly_register_menus()
     137    {
    131138        $sapmfly_capability = 'manage_options';
    132139        $sapmfly_parent_slug = 'minifly';
    133140        // Conditional menu for upgrade to pro or license page
    134         if ( !function_exists( 'is_plugin_active' ) ) {
     141        if (!function_exists('is_plugin_active')) {
    135142            include_once ABSPATH . 'wp-admin/includes/plugin.php';
    136143        }
    137144        $pro_plugin_file = 'minifly-pro/minifly-pro.php';
    138         $pro_active = is_plugin_active( $pro_plugin_file );
     145        $pro_active = is_plugin_active($pro_plugin_file);
    139146        // Plugin top-level menu
    140147        add_menu_page(
    141             esc_html__( 'Minifly', 'minifly' ),
    142             esc_html__( 'Minifly', 'minifly' ),
     148            esc_html__('Minifly', 'minifly'),
     149            esc_html__('Minifly', 'minifly'),
    143150            $sapmfly_capability,
    144151            $sapmfly_parent_slug,
     
    150157        add_submenu_page(
    151158            $sapmfly_parent_slug,
    152             esc_html__( 'Admin', 'minifly' ),
    153             esc_html__( 'Admin', 'minifly' ),
     159            esc_html__('Admin', 'minifly'),
     160            esc_html__('Admin', 'minifly'),
    154161            $sapmfly_capability,
    155162            $sapmfly_parent_slug,
     
    158165        add_submenu_page(
    159166            $sapmfly_parent_slug,
    160             esc_html__( 'Website', 'minifly' ),
    161             esc_html__( 'Website', 'minifly' ),
     167            esc_html__('Website', 'minifly'),
     168            esc_html__('Website', 'minifly'),
    162169            $sapmfly_capability,
    163170            $sapmfly_parent_slug . '-user',
     
    166173        add_submenu_page(
    167174            $sapmfly_parent_slug,
    168             esc_html__( 'eCommerce', 'minifly' ),
    169             esc_html__( 'eCommerce', 'minifly' ),
     175            esc_html__('eCommerce', 'minifly'),
     176            esc_html__('eCommerce', 'minifly'),
    170177            $sapmfly_capability,
    171178            $sapmfly_parent_slug . '-store',
     
    174181        add_submenu_page(
    175182            $sapmfly_parent_slug,
    176             esc_html__( 'White Label', 'minifly' ),
     183            esc_html__('White Label', 'minifly'),
    177184            // Page title always same
    178             esc_html__( 'White Label', 'minifly' ),
     185            esc_html__('White Label', 'minifly'),
    179186            // Page title always same
    180187            $sapmfly_capability,
     
    184191        add_submenu_page(
    185192            $sapmfly_parent_slug,
    186             esc_html__( 'Help Center', 'minifly' ),
    187             esc_html__( 'Help Center', 'minifly' ),
     193            esc_html__('Help Center', 'minifly'),
     194            esc_html__('Help Center', 'minifly'),
    188195            $sapmfly_capability,
    189196            $sapmfly_parent_slug . '-help-center',
     
    192199        add_submenu_page(
    193200            $sapmfly_parent_slug,
    194             esc_html__( 'Power Tools', 'minifly' ),
    195             esc_html__( 'Power Tools', 'minifly' ),
     201            esc_html__('Power Tools', 'minifly'),
     202            esc_html__('Power Tools', 'minifly'),
    196203            $sapmfly_capability,
    197204            $sapmfly_parent_slug . '-more-tools',
     
    213220        'extra-hooks.php',
    214221    ];
    215     foreach ( $sapmfly_templates as $template ) {
     222    foreach ($sapmfly_templates as $template) {
    216223        $template_path = SAPMFLY_TEMPLATES . $template;
    217         if ( file_exists( $template_path ) ) {
     224        if (file_exists($template_path)) {
    218225            require_once $template_path;
    219226        }
    220227    }
     228
    221229    // Add some update while active the plugin
    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' );
     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');
    231240        }
    232241    }
     
    236245     * Register a custom REST API endpoint
    237246     */
    238     add_action( 'rest_api_init', function () {
    239         register_rest_route( 'myplugin/v1', '/info', array(
     247    add_action('rest_api_init', function () {
     248        register_rest_route('myplugin/v1', '/info', array(
    240249            'methods'             => 'GET',
    241250            'callback'            => 'myplugin_get_info',
    242251            'permission_callback' => '__return_true',
    243         ) );
    244     } );
     252        ));
     253    });
    245254    /**
    246255     * Callback function to return plugin data
    247256     */
    248     function myplugin_get_info(  $request  ) {
     257    function myplugin_get_info($request)
     258    {
    249259        // Path to this plugin's main file
    250         $plugin_file = plugin_basename( __FILE__ );
     260        $plugin_file = plugin_basename(__FILE__);
    251261        // Get all plugin data from header
    252         if ( !function_exists( 'get_plugin_data' ) ) {
     262        if (!function_exists('get_plugin_data')) {
    253263            require_once ABSPATH . 'wp-admin/includes/plugin.php';
    254264        }
    255         $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin_file );
     265        $plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_file);
    256266        return array(
    257267            'site_url'       => get_site_url(),
     
    260270        );
    261271    }
    262 
    263272}
  • minifly/trunk/readme.txt

    r3369066 r3370858  
    11=== Minifly - Site Enhancement, White Label and Custom Dashboard Solution  ===
    2 Contributors: brainywpbd, freemius
     2Contributors: brainywpbd
    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.20
     6Stable tag: 1.0.21
    77Requires PHP: 7.2
    88License: GPLv2 or later
     
    3636* **Hide Admin Toolbar (Pro)** You can hide admin panel toolbar to make your site more professional. While you hide admin panel toolbar, a logout button will be added in the left admin menu automatically.
    3737* **Enable external link** - You can now add an external URL in any of you page/post. The post will be in your site but the URL will redirect to other site.
     38* **Disable theme update notice** - You can completely disable update notifications for all themes on your website.
    3839* **Disable plugin update notice** - Enable this option to completely disable update notifications for all plugins on your website.
    3940
  • minifly/trunk/templates/admin/admin-settings.php

    r3369066 r3370858  
    4343            update_option('sapmfly_external_link', $external_link);
    4444
     45            $disable_theme_update = isset($_POST['sapmfly_disable_theme_update']) ? 'yes' : 'no';
     46            update_option('sapmfly_disable_theme_update', $disable_theme_update);
     47
    4548            $disable_plugin_update = isset($_POST['sapmfly_disable_plugin_update']) ? 'yes' : 'no';
    4649            update_option('sapmfly_disable_plugin_update', $disable_plugin_update);
     
    6366    $gravatar_img_change = get_option('sapmfly_gravatar_img_change', 'no');
    6467    $external_link = get_option('sapmfly_external_link', 'no');
     68    $disable_theme_update = get_option('sapmfly_disable_theme_update', 'no');
    6569    $disable_plugin_update = get_option('sapmfly_disable_plugin_update', 'no');
    6670
     
    187191                                ?>
    188192
     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
    189201                                <!-- Disable all plugin update -->
    190202                                <?php
  • minifly/trunk/templates/admin/all-admin-hooks.php

    r3369066 r3370858  
    428428});
    429429
     430// Hide update notices for ALL themes if disabled in settings
     431add_filter('site_transient_update_themes', function ($transient) {
     432    if (get_option('sapmfly_disable_theme_update', 'no') === 'yes') {
     433        if (isset($transient->response)) {
     434            $transient->response = [];
     435        }
     436    }
     437    return $transient;
     438});
     439
    430440// Hide all the plugin update notice
    431441add_filter('site_transient_update_plugins', function ($transient) {
Note: See TracChangeset for help on using the changeset viewer.