Changeset 3323793
- Timestamp:
- 07/07/2025 04:42:59 PM (9 months ago)
- Location:
- order-list-table-elementor-widget
- Files:
-
- 11 added
- 4 edited
-
tags/3.0.0 (added)
-
tags/3.0.0/css (added)
-
tags/3.0.0/css/custom-style.css (added)
-
tags/3.0.0/css/fontawesome.min.css (added)
-
tags/3.0.0/date-ago-function.php (added)
-
tags/3.0.0/index.php (added)
-
tags/3.0.0/order-list-table-elementor-widget.php (added)
-
tags/3.0.0/order-list-table-register.php (added)
-
tags/3.0.0/readme.txt (added)
-
tags/3.0.0/widgets-loader.php (added)
-
trunk/date-ago-function.php (modified) (1 diff)
-
trunk/index.php (added)
-
trunk/order-list-table-elementor-widget.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/widgets-loader.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
order-list-table-elementor-widget/trunk/date-ago-function.php
r3205036 r3323793 1 1 <?php 2 2 if ( ! defined( 'ABSPATH' ) ) { 3 exit; // Exit if accessed directly 4 } 3 5 //Convert PHP Date to Ago time format like facebook 4 6 if (get_option( 'timezone_string' )) { -
order-list-table-elementor-widget/trunk/order-list-table-elementor-widget.php
r3323680 r3323793 4 4 * Description: Order List Table use for to show Woocommerce recent order list on a table, just use this Elementor Widget/Addon. 5 5 * Plugin URI: https://wpmethods.com/order-list-table-elementor-widget 6 * Version: 2.0.26 * Version: 3.0.0 7 7 * Author: WP Methods 8 8 * Author URI: https://wpmethods.com/ … … 10 10 * License: GPL v2 or later 11 11 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt 12 * Elementor tested up to: 3.29.2 13 * Elementor Pro tested up to: 3.29.2 12 * Requires PHP: 7.4 13 * Requires at least: 5.9 14 * Tested up to: 6.9 15 * Requires Plugins: elementor, woocommerce 16 * Elementor tested up to: 3.30.1 17 * Elementor Pro tested up to: 3.30.0 14 18 */ 15 19 -
order-list-table-elementor-widget/trunk/readme.txt
r3323680 r3323793 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.4 7 Stable tag: 2.0.27 Stable tag: 3.0.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
order-list-table-elementor-widget/trunk/widgets-loader.php
r3323680 r3323793 1 <?php 1 <?php 2 2 namespace OltewOrderListTableEle; 3 3 … … 6 6 } 7 7 8 /**9 * Plugin class.10 *11 * The main class that initiates and runs the addon.12 *13 * @since 2.0.014 */15 8 final class Plugin { 16 9 17 /** 18 * Addon Version 19 * 20 * @since 2.0.0 21 * @var string The addon version. 22 */ 23 const VERSION = '2.0.1'; 24 25 /** 26 * Minimum Elementor Version 27 * 28 * @since 2.0.0 29 * @var string Minimum Elementor version required to run the addon. 30 */ 10 const VERSION = '3.0.0'; 31 11 const MINIMUM_ELEMENTOR_VERSION = '3.7.0'; 32 33 /**34 * Minimum PHP Version35 *36 * @since 2.0.037 * @var string Minimum PHP version required to run the addon.38 */39 12 const MINIMUM_PHP_VERSION = '7.4'; 40 13 41 /**42 * Instance43 *44 * @since 2.0.045 * @access private46 * @static47 * @var \OltewOrderListTableEle\Plugin The single instance of the class.48 */49 14 private static $_instance = null; 50 15 51 /**52 * Instance53 *54 * Ensures only one instance of the class is loaded or can be loaded.55 *56 * @since 2.0.057 * @access public58 * @static59 * @return \OltewOrderListTableEle\Plugin An instance of the class.60 */61 16 public static function instance() { 62 63 17 if ( is_null( self::$_instance ) ) { 64 18 self::$_instance = new self(); 65 19 } 66 20 return self::$_instance; 67 68 21 } 69 22 70 /**71 * Constructor72 *73 * Perform some compatibility checks to make sure basic requirements are meet.74 * If all compatibility checks pass, initialize the functionality.75 *76 * @since 2.0.077 * @access public78 */79 23 public function __construct() { 24 // Fallback only for older WordPress versions without plugin dependencies 25 if ( ! function_exists( 'wp_get_active_and_valid_plugins' ) ) { 26 add_action( 'admin_init', [ $this, 'maybe_deactivate' ] ); 27 return; 28 } 80 29 30 // If compatible, hook into Elementor init 81 31 if ( $this->is_compatible() ) { 82 32 add_action( 'elementor/init', [ $this, 'init' ] ); 83 33 } 84 85 34 } 86 35 87 /** 88 * Compatibility Checks 89 * 90 * Checks whether the site meets the addon requirement. 91 * 92 * @since 2.0.0 93 * @access public 94 */ 95 public function is_compatible() { 36 private function is_compatible() { 96 37 97 // Check if Elementor installed and activated98 38 if ( ! did_action( 'elementor/loaded' ) ) { 99 add_action( 'admin_notices', [ $this, ' admin_notice_missing_main_plugin' ] );39 add_action( 'admin_notices', [ $this, 'notice_missing_elementor' ] ); 100 40 return false; 101 41 } 102 42 103 // Check if WooCommerce installed and activated 104 if ( !in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { 105 add_action( 'admin_notices',[$this, 'admin_notice_missing_woo_plugin'] ); 106 return false; 107 } 108 109 // Check for required Elementor version 110 if ( ! version_compare( ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '>=' ) ) { 111 add_action( 'admin_notices', [ $this, 'admin_notice_minimum_elementor_version' ] ); 43 if ( ! class_exists( 'WooCommerce' ) ) { 44 add_action( 'admin_notices', [ $this, 'notice_missing_woocommerce' ] ); 112 45 return false; 113 46 } 114 47 115 // Check for required PHP version 48 if ( version_compare( ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '<' ) ) { 49 add_action( 'admin_notices', [ $this, 'notice_minimum_elementor' ] ); 50 return false; 51 } 52 116 53 if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) { 117 add_action( 'admin_notices', [ $this, ' admin_notice_minimum_php_version' ] );54 add_action( 'admin_notices', [ $this, 'notice_minimum_php' ] ); 118 55 return false; 119 56 } 120 57 121 58 return true; 122 123 59 } 124 60 125 61 // ❌ Fallback: Deactivate if dependencies not met (for old WP versions) 62 public function maybe_deactivate() { 63 if ( ! is_admin() || ! current_user_can( 'activate_plugins' ) ) { 64 return; 65 } 126 66 127 /** 128 * Admin notice 129 * 130 * Warning when the site doesn't have Elementor installed or activated. 131 * 132 * @since 2.0.0 133 * @access public 134 */ 135 public function admin_notice_missing_main_plugin() { 67 $deactivate = false; 68 69 if ( ! class_exists( 'WooCommerce' ) || ! did_action( 'elementor/loaded' ) ) { 70 $deactivate = true; 71 } 72 73 if ( $deactivate ) { 74 deactivate_plugins( plugin_basename( __FILE__ ) ); 75 add_action( 'admin_notices', [ $this, 'notice_dependency_missing_deactivated' ] ); 76 } 77 } 78 79 public function init() { 80 add_action( 'elementor/widgets/register', [ $this, 'register_widgets' ] ); 81 } 82 83 public function register_widgets( $widgets_manager ) { 84 require_once __DIR__ . '/order-list-table-register.php'; 85 $widgets_manager->register( new \Oltew_Order_List_table_Ele_Widget() ); 86 } 87 88 // Admin Notices 89 90 public function notice_missing_elementor() { 91 $this->print_notice( 92 sprintf( 93 esc_html__( '"%1$s" requires %2$s to be installed and activated.', 'order-list-table-elementor-widget' ), 94 '<strong>' . esc_html__( 'Woocommerce Order List Table', 'order-list-table-elementor-widget' ) . '</strong>', 95 '<strong>' . esc_html__( 'Elementor', 'order-list-table-elementor-widget' ) . '</strong>' 96 ) 97 ); 98 } 99 100 public function notice_missing_woocommerce() { 101 $this->print_notice( 102 sprintf( 103 esc_html__( '"%1$s" requires %2$s to be installed and activated.', 'order-list-table-elementor-widget' ), 104 '<strong>' . esc_html__( 'Woocommerce Order List Table', 'order-list-table-elementor-widget' ) . '</strong>', 105 '<strong>' . esc_html__( 'WooCommerce', 'order-list-table-elementor-widget' ) . '</strong>' 106 ) 107 ); 108 } 109 110 public function notice_minimum_elementor() { 111 $this->print_notice( 112 sprintf( 113 esc_html__( '"%1$s" requires %2$s version %3$s or greater.', 'order-list-table-elementor-widget' ), 114 '<strong>' . esc_html__( 'Woocommerce Order List Table', 'order-list-table-elementor-widget' ) . '</strong>', 115 '<strong>' . esc_html__( 'Elementor', 'order-list-table-elementor-widget' ) . '</strong>', 116 self::MINIMUM_ELEMENTOR_VERSION 117 ) 118 ); 119 } 120 121 public function notice_minimum_php() { 122 $this->print_notice( 123 sprintf( 124 esc_html__( '"%1$s" requires %2$s version %3$s or greater.', 'order-list-table-elementor-widget' ), 125 '<strong>' . esc_html__( 'Woocommerce Order List Table', 'order-list-table-elementor-widget' ) . '</strong>', 126 '<strong>' . esc_html__( 'PHP', 'order-list-table-elementor-widget' ) . '</strong>', 127 self::MINIMUM_PHP_VERSION 128 ) 129 ); 130 } 131 132 public function notice_dependency_missing_deactivated() { 133 $this->print_notice( 134 esc_html__( 'Plugin deactivated because required dependencies are missing.', 'order-list-table-elementor-widget' ) 135 ); 136 } 137 138 private function print_notice( $message ) { 136 139 // phpcs:ignore WordPress.Security.NonceVerification.Recommended 137 140 if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] ); 138 $message = sprintf(139 /* translators: 2: Plugin name 2: Elementor */140 esc_html__( '"%1$s" requires "%2$s" to be installed and activated.', 'order-list-table-elementor-widget' ),141 '<strong>' . esc_html__( 'Woocommerce Order List Table', 'order-list-table-elementor-widget' ) . '</strong>',142 '<strong>' . esc_html__( 'Elementor', 'order-list-table-elementor-widget' ) . '</strong>'143 );144 141 145 142 printf( 146 143 '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', 147 esc_html( $message )144 wp_kses_post( $message ) 148 145 ); 149 150 151 146 } 152 153 /**154 * Admin notice155 *156 * Warning when the site doesn't have WooCommerce installed or activated.157 *158 * @since 1.0.0159 * @access public160 */161 162 public function admin_notice_missing_woo_plugin() {163 // phpcs:ignore WordPress.Security.NonceVerification.Recommended164 if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] );165 166 $message = sprintf(167 /* translators: 1: Plugin name 2: WooCommerce */168 esc_html__( '"%1$s" requires "%2$s" to be installed and activated.', 'order-list-table-elementor-widget' ),169 '<strong>' . esc_html__( 'Woocommerce Order List Table', 'order-list-table-elementor-widget' ) . '</strong>',170 '<strong>' . esc_html__( 'WooCommerce', 'order-list-table-elementor-widget' ) . '</strong>'171 );172 173 printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', esc_html( $message ) );174 175 }176 177 /**178 * Admin notice179 *180 * Warning when the site doesn't have a minimum required Elementor version.181 *182 * @since 1.0.0183 * @access public184 */185 public function admin_notice_minimum_elementor_version() {186 // phpcs:ignore WordPress.Security.NonceVerification.Recommended187 if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] );188 189 $message = sprintf(190 /* translators: 1: Plugin name 2: Elementor 3: Required Elementor version */191 esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'order-list-table-elementor-widget' ),192 '<strong>' . esc_html__( 'Woocommerce Order List Table', 'order-list-table-elementor-widget' ) . '</strong>',193 '<strong>' . esc_html__( 'Elementor', 'order-list-table-elementor-widget' ) . '</strong>',194 self::MINIMUM_ELEMENTOR_VERSION195 );196 197 printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', esc_html( $message ) );198 199 }200 201 /**202 * Admin notice203 *204 * Warning when the site doesn't have a minimum required PHP version.205 *206 * @since 1.0.0207 * @access public208 */209 public function admin_notice_minimum_php_version() {210 // phpcs:ignore WordPress.Security.NonceVerification.Recommended211 if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] );212 213 $message = sprintf(214 /* translators: 1: Plugin name 2: PHP 3: Required PHP version */215 esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'order-list-table-elementor-widget' ),216 '<strong>' . esc_html__( 'Woocommerce Order List Table', 'order-list-table-elementor-widget' ) . '</strong>',217 '<strong>' . esc_html__( 'PHP', 'order-list-table-elementor-widget' ) . '</strong>',218 self::MINIMUM_PHP_VERSION219 );220 221 printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', esc_html( $message ) );222 223 }224 225 226 227 /**228 * Initialize229 *230 * Load the addons functionality only after Elementor is initialized.231 *232 * Fired by `elementor/init` action hook.233 *234 * @since 1.0.0235 * @access public236 */237 public function init() {238 239 add_action( 'elementor/widgets/register', [ $this, 'register_widgets' ] );240 241 }242 243 /**244 * Register Widgets245 *246 * Load widgets files and register new Elementor widgets.247 *248 * Fired by `elementor/widgets/register` action hook.249 *250 * @param \Elementor\Widgets_Manager $widgets_manager Elementor widgets manager.251 */252 public function register_widgets( $widgets_manager ) {253 254 require_once( __DIR__ . '/order-list-table-register.php' );255 256 $widgets_manager->register( new \Oltew_Order_List_table_Ele_Widget() );257 258 }259 260 147 }
Note: See TracChangeset
for help on using the changeset viewer.