PluginProbe
Essential Widgets / 2.2.2
Essential Widgets v2.2.2
3.2.1 3.3 3.2 trunk 1.0.0 1.0.1 1.1 1.2 1.2.1 1.2.2 1.3 1.4 1.4.1 1.5 1.6 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.8 1.9 2.0 2.1 2.2 All 31 releases
essential-widgets / essential-widgets.php

essential-widgets.php in Essential Widgets 2.2.2, at essential-widgets.php

169 lines 5.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * The plugin bootstrap file
5 *
6 * This file is read by WordPress to generate the plugin information in the plugin
7 * admin area. This file also includes all of the dependencies used by the plugin,
8 * registers the activation and deactivation functions, and defines a function
9 * that starts the plugin.
10 *
11 * @link https://catchplugins.com
12 * @since 1.0.0
13 * @package Essential_Widgets
14 *
15 * @wordpress-plugin
16 * Plugin Name: Essential Widgets
17 * Plugin URI: https://catchplugins.com/plugins/essential-widgets/
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: 2.2.2
20 * Author: Catch Plugins
21 * Author URI: https://catchplugins.com/
22 * License: GPL-2.0+
23 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
24 * Text Domain: essential-widgets
25 * Domain Path: /languages
26 */
27
28 // If this file is called directly, abort.
29 if ( ! defined( 'WPINC' ) ) {
30 die;
31 }
32
33 // Define Version
34 define( 'ESSENTIAL_WIDGETS_VERSION', '2.2.2' );
35
36 /**
37 * The code that runs during plugin activation.
38 * This action is documented in includes/class-essential-widgets-activator.php
39 */
40 if ( ! defined( 'ESSENTIAL_WIDGETS_URL' ) ) {
41 define( 'ESSENTIAL_WIDGETS_URL', plugin_dir_url( __FILE__ ) );
42 }
43
44
45 // The absolute path of the directory that contains the file
46 if ( ! defined( 'ESSENTIAL_WIDGETS_PATH' ) ) {
47 define( 'ESSENTIAL_WIDGETS_PATH', plugin_dir_path( __FILE__ ) );
48 }
49
50
51 // Gets the path to a plugin file or directory, relative to the plugins directory, without the leading and trailing slashes.
52 if ( ! defined( 'ESSENTIAL_WIDGETS_BASENAME' ) ) {
53 define( 'ESSENTIAL_WIDGETS_BASENAME', plugin_basename( __FILE__ ) );
54 }
55 function activate_essential_widgets() {
56 $required = 'essential-widgets-pro/essential-widgets-pro.php';
57 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&laquo; 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 );
61 }
62 require_once plugin_dir_path( __FILE__ ) . 'includes/class-essential-widgets-activator.php';
63 Essential_Widgets_Activator::activate();
64 }
65
66 /**
67 * The code that runs during plugin deactivation.
68 * This action is documented in includes/class-essential-widgets-deactivator.php
69 */
70 function deactivate_essential_widgets() {
71 require_once plugin_dir_path( __FILE__ ) . 'includes/class-essential-widgets-deactivator.php';
72 Essential_Widgets_Deactivator::deactivate();
73 }
74
75 register_activation_hook( __FILE__, 'activate_essential_widgets' );
76 register_deactivation_hook( __FILE__, 'deactivate_essential_widgets' );
77
78 /**
79 * The core plugin class that is used to define internationalization,
80 * admin-specific hooks, and public-facing site hooks.
81 */
82 require plugin_dir_path( __FILE__ ) . 'includes/class-essential-widgets.php';
83
84
85 function essential_widgets_sanitize_checkbox( $checked ) {
86 // Boolean check.
87 return ( ( isset( $checked ) && true == $checked ) ? true : false );
88 }
89
90 if ( ! function_exists( 'essential_widgets_get_options' ) ) :
91 function essential_widgets_get_options() {
92 $defaults = essential_widgets_default_options();
93 $options = get_option( 'essential_widgets_options', $defaults );
94
95 return wp_parse_args( $options, $defaults );
96 }
97 endif; // essential_widgets_get_options
98
99
100 if ( ! function_exists( 'essential_widgets_default_options' ) ) :
101 /**
102 * Return array of default options
103 *
104 * @since 1.0
105 * @return array default options.
106 */
107 function essential_widgets_default_options( $option = null ) {
108 $widget_list = essential_widgets_list();
109 $default_options = array();
110
111 foreach ( $widget_list as $key => $value ) {
112 $default_options[ $key ] = 1;
113 }
114
115 if ( null == $option ) {
116 return apply_filters( 'essential_widgets_options', $default_options );
117 } else {
118 return $default_options[ $option ];
119 }
120 }
121 endif; // essential_widgets_default_options
122
123
124 if ( ! function_exists( 'essential_widgets_list' ) ) :
125 function essential_widgets_list() {
126 $widget_list = array(
127 'ew_authors' => 'EW: Authors',
128 'ew_categories' => 'EW: Category',
129 'ew_menus' => 'EW: Menu',
130 'ew_pages' => 'EW: Pages',
131 'ew_posts' => 'EW: Post',
132 'ew_archives' => 'EW: Recent Posts',
133 'ew_tags' => 'EW: Tags',
134 );
135 return $widget_list;
136 }
137 endif;
138
139 /**
140 * Begins execution of the plugin.
141 *
142 * Since everything within the plugin is registered via hooks,
143 * then kicking off the plugin from this point in the file does
144 * not affect the page life cycle.
145 *
146 * @since 1.0.0
147 */
148 function run_essential_widgets() {
149
150 $plugin = new Essential_Widgets();
151 $plugin->run();
152
153 }
154 run_essential_widgets();
155
156 /* CTP tabs removal options */
157 require plugin_dir_path( __FILE__ ) . 'includes/ctp-tabs-removal.php';
158
159 $ctp_options = ctp_get_options();
160 if ( 1 == $ctp_options['theme_plugin_tabs'] ) {
161 /* Adds Catch Themes tab in Add theme page and Themes by Catch Themes in Customizer's change theme option. */
162 if ( ! class_exists( 'CatchThemesThemePlugin' ) && ! function_exists( 'add_our_plugins_tab' ) ) {
163 require plugin_dir_path( __FILE__ ) . 'includes/CatchThemesThemePlugin.php';
164 }
165 }
166
167 /** Add EW Blocks */
168 require plugin_dir_path( __FILE__ ) . 'includes/ew-block/index.php';
169