Plugin Directory

Changeset 3230681


Ignore:
Timestamp:
01/28/2025 03:39:34 PM (14 months ago)
Author:
globaliser
Message:

Globaliser 0.9.5 Version

Location:
globaliser
Files:
89 added
7 edited

Legend:

Unmodified
Added
Removed
  • globaliser/trunk/app/apis/globaliser-api.php

    r3209200 r3230681  
    1919      // GENERAL INFO
    2020      $this->data = [
    21         'globaliser_version' => get_file_data(PLUGIN_FILE, ['Version' => 'Version'], 'plugin')['Version'],
     21        'globaliser_version' => PLUGIN_VER,
    2222        'wp_content_dir' => WP_CONTENT_DIR,
    2323        'wp_content_url' => WP_CONTENT_URL,
  • globaliser/trunk/app/controllers/hooks-controller.php

    r3202469 r3230681  
    1717        $this->general_hooks();
    1818        $this->settings_hooks();
     19        $this->toolbar_menu_hooks();
     20        $this->register_ajaxs();
     21        $this->register_assets();
    1922    }
    2023
     
    2528                $this->bind_general_hook(intval($i), $hook);
    2629    }
     30    private function settings_hooks()
     31    {
     32        foreach (GLOBALISER_SETTINGS_HOOKS as $setting)
     33            $this->on('update_option_' . $setting, 'handle_all', 10, 3);
     34    }
     35    private function toolbar_menu_hooks()
     36    {
     37        $this->on('admin_bar_menu', 'add_toolbar_menu', 100);
     38    }
     39    private function register_ajaxs()
     40    {
     41        $this->on('wp_ajax_globaliser_clear_cache', 'clear_cache');
     42    }
     43    private function register_assets()
     44    {
     45        $this->on('admin_enqueue_scripts', 'register_statics');
     46    }
     47
     48    function register_statics()
     49    {
     50        wp_enqueue_script('globaliser-general-js', plugin_dir_url(PLUGIN_FILE) . 'assets/js/globaliser.js', array('jquery'), PLUGIN_VER, true);
     51        wp_add_inline_script('jquery', 'const GLOBALISER = ' . json_encode(array(
     52            'ajaxurl' => admin_url('admin-ajax.php')
     53        )), 'before');
     54    }
     55
    2756    private function bind_general_hook($i, $hook)
    2857    {
     
    3867        }
    3968    }
    40     private function settings_hooks()
     69    function add_toolbar_menu($admin_bar)
    4170    {
    42         foreach (GLOBALISER_SETTINGS_HOOKS as $setting)
    43             $this->on('update_option_' . $setting, 'handle_all', 10, 3);
     71        if (current_user_can('manage_options')) :
     72
     73            $admin_bar->add_menu(array(
     74                'id'    => 'globaliser-topnav',
     75                'title' => 'Globaliser',
     76                'href'  => '#',
     77                'meta'  => array(
     78                    'title' => __('Globaliser'),
     79                ),
     80            ));
     81            $admin_bar->add_menu(array(
     82                'id'    => 'globaliser-topnav-clear-cache',
     83                'parent' => 'globaliser-topnav',
     84                'title' => 'Clear Cache',
     85                'href'  =>  '#',
     86                'meta'  => array(
     87                    'title' => __('Clear Cache'),
     88                    'target' => '',
     89                    'class' => 'globaliser-topnav-clear-cache'
     90                ),
     91            ));
     92
     93
     94        endif;
    4495    }
    4596
     
    59110        $this->service->add_hook($type, param($arr));
    60111    }
     112
     113    function clear_cache()
     114    {
     115        $this->service->clear_cache();
     116    }
    61117}
  • globaliser/trunk/app/services/globaliser-service.php

    r3209200 r3230681  
    9494        return $links;
    9595    }
     96    function clear_cache()
     97    {
     98        try {
     99            $this->add_hook('2', "");
     100            $this->add_hook('5', "");
     101            wp_send_json_success();
     102        } catch (\Exception $e) {
     103            wp_send_json_error($e->getMessage());
     104        }
     105    }
    96106}
  • globaliser/trunk/app/services/polylang-service.php

    r3204097 r3230681  
    2929        $data = [];
    3030
    31         $languages = PLL()->model->get_languages_list();
     31        $pll_languages = PLL()->model->get_languages_list();
     32
     33        $languages = clone $pll_languages;
    3234
    3335        foreach ($languages as $lang) {
  • globaliser/trunk/constants/hooks-settings.php

    r3204097 r3230681  
    77    ['wp_update_nav_menu'],
    88    ['create_category', 'create_post_tag', 'activated_plugin', 'deactivated_plugin', 'upgrader_process_complete'],
    9     ['post_updated', 'transition_post_status', 'transition_comment_status', 'wp_insert_comment', 'wp_trash_post', 'delete_attachment', 'edited_category', 'edited_post_tag'],
     9    ['save_post', 'post_updated', 'transition_post_status', 'transition_comment_status', 'wp_insert_comment', 'wp_trash_post', 'delete_attachment', 'edited_category', 'edited_post_tag'],
    1010    ['delete_category', 'delete_post_tag'],
    1111    ['wp_save_image_editor_file', 'wp_handle_upload']
  • globaliser/trunk/globaliser.php

    r3209200 r3230681  
    44   Plugin URI: https://www.globaliser.com/wordpress-hosting/
    55   Description:  This plugin enables Globaliser Cloud Speed, Security, and Reliability features for WordPress sites. It is intended for Globaliser clients only.
    6    Version: 0.9.4
     6   Version: 0.9.5
    77   Author: Globaliser, Inc.
    88   Author URI: https://www.globaliser.com
     
    2020define('Globaliser\PLUGIN_FILE', __FILE__);
    2121define('Globaliser\PLUGIN_PATH', plugin_dir_path(PLUGIN_FILE));
     22define('Globaliser\PLUGIN_VER', get_file_data(PLUGIN_FILE, ['Version' => 'Version'], 'plugin')['Version']);
    2223
    2324require_once  PLUGIN_PATH . '/inc/main.php';
  • globaliser/trunk/readme.txt

    r3209276 r3230681  
    55License: GPLv2 or later
    66Tested up to: 6.7.1
    7 Stable tag: 0.9.4
     7Stable tag: 0.9.5
    88Requires PHP: 8.1
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2828== Changelog ==
    2929
     30= 0.9.5 =
     31* Clear Cache Option is Added
     32* Fixed Creation of dynamic property PHP Deprecation Warning
     33* Fixed Cache Update Bug for Pages
     34
    3035= 0.9.4 =
    3136* Structural changes.
Note: See TracChangeset for help on using the changeset viewer.