PluginProbe ʕ •ᴥ•ʔ
Custom Sidebars – Dynamic Sidebar Classic Widget Area Manager / 3.35
Custom Sidebars – Dynamic Sidebar Classic Widget Area Manager v3.35
trunk 2.1.2.0 3.0.0.0 3.0.0.1 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.7.1 3.0.8 3.0.8.1 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.3 3.31 3.32 3.35 3.36 3.37 3.38
custom-sidebars / customsidebars.php
custom-sidebars Last commit date
assets 4 years ago inc 4 years ago languages 5 years ago views 5 years ago customsidebars.php 4 years ago license.txt 5 years ago readme.txt 4 years ago
customsidebars.php
154 lines
1 <?php
2 /**
3 * Plugin Name: Custom Sidebars
4 * Plugin URI: https://wordpress.org/plugins/custom-sidebars/
5 * Description: Allows you to create widgetized areas and custom sidebars. Replace whole sidebars or single widgets for specific posts and pages.
6 * Version: 3.35
7 * Author: WebFactory Ltd
8 * Author URI: https://www.webfactoryltd.com/
9 * Textdomain: custom-sidebars
10 */
11
12 /*
13 Copyright Incsub 2017 - 2020 (https://incsub.com)
14 Copyright WebFactory Ltd 2020 - 2022 (https://www.webfactoryltd.com/)
15
16 This program is free software; you can redistribute it and/or modify
17 it under the terms of the GNU General Public License (Version 2 - GPLv2) as published by
18 the Free Software Foundation.
19
20 This program is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with this program; if not, write to the Free Software
27 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
29 This plugin was originally developed by Javier Marquez. http://arqex.com/
30 */
31
32 function inc_sidebars_init() {
33 if ( class_exists( 'CustomSidebars' ) ) {
34 return;
35 }
36
37 /**
38 * Do not load plugin when saving file in WP Editor
39 */
40 if ( isset( $_REQUEST['action'] ) && 'edit-theme-plugin-file' == $_REQUEST['action'] ) {
41 return;
42 }
43
44 /**
45 * if admin, load only on proper pages
46 */
47 if ( is_admin() && isset( $_SERVER['SCRIPT_FILENAME'] ) ) {
48 $file = basename( $_SERVER['SCRIPT_FILENAME'] );
49 $allowed = array(
50 'edit.php',
51 'admin-ajax.php',
52 'post.php',
53 'plugins.php',
54 'post-new.php',
55 'widgets.php',
56 );
57 /**
58 * Allowed pages array.
59 *
60 * To change where Custom Sidebars is loaded, use this filter.
61 *
62 * @since 3.2.3
63 *
64 * @param array $allowed Allowed pages list.
65 */
66 $allowed = apply_filters( 'custom_sidebars_allowed_pages_array', $allowed );
67 if ( ! in_array( $file, $allowed ) ) {
68 return;
69 }
70 }
71
72 $plugin_dir = dirname( __FILE__ );
73 $plugin_dir_rel = dirname( plugin_basename( __FILE__ ) );
74 $plugin_url = plugin_dir_url( __FILE__ );
75
76 define( 'CSB_PLUGIN', __FILE__ );
77 define( 'CSB_IS_PRO', false );
78 define( 'CSB_VIEWS_DIR', $plugin_dir . '/views/' );
79 define( 'CSB_INC_DIR', $plugin_dir . '/inc/' );
80 define( 'CSB_JS_URL', $plugin_url . 'assets/js/' );
81 define( 'CSB_CSS_URL', $plugin_url . 'assets/css/' );
82 define( 'CSB_IMG_URL', $plugin_url . 'assets/img/' );
83
84 // Include function library.
85 $modules[] = CSB_INC_DIR . 'external/wpmu-lib/core.php';
86 $modules[] = CSB_INC_DIR . 'class-custom-sidebars.php';
87
88 $modules[] = CSB_INC_DIR . 'external/wdev-frash/module.php';
89
90
91
92 // Free-version configuration - no drip campaign yet...
93 $cta_label = false;
94 $drip_param = false;
95
96
97
98
99 foreach ( $modules as $path ) {
100 if ( file_exists( $path ) ) { require_once $path; }
101 }
102
103 // Register the current plugin, for pro and free plugins!
104 do_action(
105 'wdev-register-plugin',
106 /* Plugin ID */ plugin_basename( __FILE__ ),
107 /* Plugin Title */ 'CustomSidebars',
108 /* https://wordpress.org */ '/plugins/custom-sidebars/',
109 /* Email Button CTA */ $cta_label,
110 /* getdrip Plugin param */ $drip_param
111 );
112
113 // Initialize the plugin
114 CustomSidebars::instance();
115 }
116
117 inc_sidebars_init();
118
119 if ( ! class_exists( 'CustomSidebarsEmptyPlugin' ) ) {
120 class CustomSidebarsEmptyPlugin extends WP_Widget {
121 public function __construct() {
122 parent::__construct( false, $name = 'CustomSidebarsEmptyPlugin' );
123 }
124 public function form( $instance ) {
125 //Nothing, just a dummy plugin to display nothing
126 }
127 public function update( $new_instance, $old_instance ) {
128 //Nothing, just a dummy plugin to display nothing
129 }
130 public function widget( $args, $instance ) {
131 echo '';
132 }
133 } //end class
134 } //end if class exists
135
136
137 // Translation.
138 function inc_sidebars_init_translation() {
139 load_plugin_textdomain( 'custom-sidebars', false, basename( dirname( __FILE__ ) ) . '/languages' );
140 }
141 add_action( 'plugins_loaded', 'inc_sidebars_init_translation' );
142
143 // since the notification needs to be global and show everywhere we'll add it outside the plugin's class
144 add_action('init', function() {
145 add_action('admin_notices', function() {
146 global $wp_version;
147
148 if ((false == is_plugin_active('classic-widgets/classic-widgets.php') && apply_filters('use_widgets_block_editor', true)) && version_compare($wp_version, '5.8', '>=') == true) {
149 echo '<div class="error notice" style="max-width: 700px;"><p><b>🔥 IMPORTANT 🔥</b><br><br>Custom Sidebars plugin is NOT compatible with the new widgets edit screen (powered by Gutenberg).
150 <br>Install the official <a href="' . admin_url('plugin-install.php?s=classic%20widgets&tab=search&type=term') . '">Classic Widgets</a> plugin if you want to continue using it.</p></div>';
151 }
152 });
153 }, 1000, 0);
154