| @@ -15,9 +15,9 @@ | ||
| 15 | 15 | * @wordpress-plugin |
| 16 | 16 | * Plugin Name: Essential Widgets |
| 17 | 17 | * Plugin URI: https://catchplugins.com/plugins/essential-widgets/ |
| 18 | 18 | * Description: Essential Widgets is a WordPress plugin for widgets that allows you to create and add amazing widgets with high customization option on your website without affecting your wallet. |
| 19 | - * Version: 1.7 | |
| 19 | + * Version: 3.1 | |
| 20 | 20 | * Author: Catch Plugins |
| 21 | 21 | * Author URI: https://catchplugins.com/ |
| 22 | 22 | * License: GPL-2.0+ |
| 23 | 23 | * License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| @@ -30,9 +30,9 @@ | ||
| 30 | 30 | die; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | // Define Version |
| 34 | -define( 'ESSENTIAL_WIDGETS_VERSION', '1.7' ); | |
| 34 | +define( 'ESSENTIAL_WIDGETS_VERSION', '3.1' ); | |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * The code that runs during plugin activation. |
| 38 | 38 | * This action is documented in includes/class-essential-widgets-activator.php |
| @@ -51,15 +51,25 @@ | ||
| 51 | 51 | // Gets the path to a plugin file or directory, relative to the plugins directory, without the leading and trailing slashes. |
| 52 | 52 | if ( ! defined( 'ESSENTIAL_WIDGETS_BASENAME' ) ) { |
| 53 | 53 | define( 'ESSENTIAL_WIDGETS_BASENAME', plugin_basename( __FILE__ ) ); |
| 54 | 54 | } |
| 55 | -function activate_essential_widgets() { | |
| 55 | + | |
| 56 | +function essential_widgets_activate() { | |
| 56 | 57 | $required = 'essential-widgets-pro/essential-widgets-pro.php'; |
| 57 | 58 | if ( is_plugin_active( $required ) ) { |
| 58 | - $message = esc_html__( 'Sorry, Pro version is already active. No need to activate Free version. If you still want to activate the Free version, please deactivate the Pro version first. %1$s« Return to Plugins%2$s.', 'essential-widgets' ); | |
| 59 | - $message = sprintf( $message, '<br><a href="' . esc_url( admin_url( 'plugins.php' ) ) . '">', '</a>' ); | |
| 60 | - wp_die( $message ); | |
| 59 | + // Translators: %1$s and %2$s wrap the "Return to Plugins" link. The message informs the user that the Pro version is active. | |
| 60 | + $message = __( 'Sorry, Pro version is already active. No need to activate Free version. If you still want to activate the Free version, please deactivate the Pro version first. %1$s« Return to Plugins%2$s.', 'essential-widgets' ); | |
| 61 | + | |
| 62 | + $message = sprintf( | |
| 63 | + $message, | |
| 64 | + '<br><a href="' . esc_url( admin_url( 'plugins.php' ) ) . '">', | |
| 65 | + '</a>' | |
| 66 | + ); | |
| 67 | + | |
| 68 | + // Escape all HTML output before printing | |
| 69 | + wp_die( wp_kses_post( $message ) ); | |
| 61 | 70 | } |
| 71 | + | |
| 62 | 72 | require_once plugin_dir_path( __FILE__ ) . 'includes/class-essential-widgets-activator.php'; |
| 63 | 73 | Essential_Widgets_Activator::activate(); |
| 64 | 74 | } |
| 65 | 75 | |
| @@ -66,15 +76,15 @@ | ||
| 66 | 76 | /** |
| 67 | 77 | * The code that runs during plugin deactivation. |
| 68 | 78 | * This action is documented in includes/class-essential-widgets-deactivator.php |
| 69 | 79 | */ |
| 70 | -function deactivate_essential_widgets() { | |
| 80 | +function essential_widgets_deactivate() { | |
| 71 | 81 | require_once plugin_dir_path( __FILE__ ) . 'includes/class-essential-widgets-deactivator.php'; |
| 72 | 82 | Essential_Widgets_Deactivator::deactivate(); |
| 73 | 83 | } |
| 74 | 84 | |
| 75 | -register_activation_hook( __FILE__, 'activate_essential_widgets' ); | |
| 76 | -register_deactivation_hook( __FILE__, 'deactivate_essential_widgets' ); | |
| 85 | +register_activation_hook( __FILE__, 'essential_widgets_activate' ); | |
| 86 | +register_deactivation_hook( __FILE__, 'essential_widgets_deactivate' ); | |
| 77 | 87 | |
| 78 | 88 | /** |
| 79 | 89 | * The core plugin class that is used to define internationalization, |
| 80 | 90 | * admin-specific hooks, and public-facing site hooks. |
| @@ -83,9 +93,9 @@ | ||
| 83 | 93 | |
| 84 | 94 | |
| 85 | 95 | function essential_widgets_sanitize_checkbox( $checked ) { |
| 86 | 96 | // Boolean check. |
| 87 | - return ( ( isset( $checked ) && true == $checked ) ? true : false ); | |
| 97 | + return ( ( isset( $checked ) && true === $checked ) ? true : false ); | |
| 88 | 98 | } |
| 89 | 99 | |
| 90 | 100 | if ( ! function_exists( 'essential_widgets_get_options' ) ) : |
| 91 | 101 | function essential_widgets_get_options() { |
| @@ -105,13 +115,15 @@ | ||
| 105 | 115 | * @return array default options. |
| 106 | 116 | */ |
| 107 | 117 | function essential_widgets_default_options( $option = null ) { |
| 108 | 118 | $widget_list = essential_widgets_list(); |
| 119 | + $default_options = array(); | |
| 120 | + | |
| 109 | 121 | foreach ( $widget_list as $key => $value ) { |
| 110 | 122 | $default_options[ $key ] = 1; |
| 111 | 123 | } |
| 112 | 124 | |
| 113 | - if ( null == $option ) { | |
| 125 | + if ( null === $option ) { | |
| 114 | 126 | return apply_filters( 'essential_widgets_options', $default_options ); |
| 115 | 127 | } else { |
| 116 | 128 | return $default_options[ $option ]; |
| 117 | 129 | } |
| @@ -121,15 +133,15 @@ | ||
| 121 | 133 | |
| 122 | 134 | if ( ! function_exists( 'essential_widgets_list' ) ) : |
| 123 | 135 | function essential_widgets_list() { |
| 124 | 136 | $widget_list = array( |
| 125 | - 'ew_authors' => esc_html__( 'EW: Authors', 'essential-widgets' ), | |
| 126 | - 'ew_categories' => esc_html__( 'EW: Category', 'essential-widgets' ), | |
| 127 | - 'ew_menus' => esc_html__( 'EW: Menu', 'essential-widgets' ), | |
| 128 | - 'ew_pages' => esc_html__( 'EW: Pages', 'essential-widgets' ), | |
| 129 | - 'ew_posts' => esc_html__( 'EW: Post', 'essential-widgets' ), | |
| 130 | - 'ew_archives' => esc_html__( 'EW: Recent Posts', 'essential-widgets' ), | |
| 131 | - 'ew_tags' => esc_html__( 'EW: Tags', 'essential-widgets' ), | |
| 137 | + 'ew_authors' => 'EW: Authors', | |
| 138 | + 'ew_categories' => 'EW: Category', | |
| 139 | + 'ew_menus' => 'EW: Menu', | |
| 140 | + 'ew_pages' => 'EW: Pages', | |
| 141 | + 'ew_posts' => 'EW: Post', | |
| 142 | + 'ew_archives' => 'EW: Recent Posts', | |
| 143 | + 'ew_tags' => 'EW: Tags', | |
| 132 | 144 | ); |
| 133 | 145 | return $widget_list; |
| 134 | 146 | } |
| 135 | 147 | endif; |
| @@ -142,22 +154,25 @@ | ||
| 142 | 154 | * not affect the page life cycle. |
| 143 | 155 | * |
| 144 | 156 | * @since 1.0.0 |
| 145 | 157 | */ |
| 146 | -function run_essential_widgets() { | |
| 158 | +function essential_widgets_run() { | |
| 147 | 159 | |
| 148 | 160 | $plugin = new Essential_Widgets(); |
| 149 | 161 | $plugin->run(); |
| 150 | 162 | |
| 151 | 163 | } |
| 152 | -run_essential_widgets(); | |
| 164 | +essential_widgets_run(); | |
| 153 | 165 | |
| 154 | 166 | /* CTP tabs removal options */ |
| 155 | 167 | require plugin_dir_path( __FILE__ ) . 'includes/ctp-tabs-removal.php'; |
| 156 | 168 | |
| 157 | -$ctp_options = ctp_get_options(); | |
| 158 | -if ( 1 == $ctp_options['theme_plugin_tabs'] ) { | |
| 169 | +$ctp_options = ctp_get_options(); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Used immediately on the next line; ctp_ prefix kept for cross-plugin compatibility. | |
| 170 | +if ( 1 === (int) $ctp_options['theme_plugin_tabs'] ) { | |
| 159 | 171 | /* Adds Catch Themes tab in Add theme page and Themes by Catch Themes in Customizer's change theme option. */ |
| 160 | 172 | if ( ! class_exists( 'CatchThemesThemePlugin' ) && ! function_exists( 'add_our_plugins_tab' ) ) { |
| 161 | 173 | require plugin_dir_path( __FILE__ ) . 'includes/CatchThemesThemePlugin.php'; |
| 162 | 174 | } |
| 163 | 175 | } |
| 176 | + | |
| 177 | +/** Add EW Blocks */ | |
| 178 | +require plugin_dir_path( __FILE__ ) . 'includes/ew-block/index.php'; | |