custom-sidebars
Last commit date
assets
7 years ago
inc
7 years ago
languages
7 years ago
views
7 years ago
customsidebars.php
7 years ago
license.txt
10 years ago
readme.txt
7 years ago
customsidebars.php
134 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.2.1 |
| 7 | * Author: WPMU DEV |
| 8 | * Author URI: http://premium.wpmudev.org/ |
| 9 | * Textdomain: custom-sidebars |
| 10 | * WDP ID: 910520 |
| 11 | */ |
| 12 | |
| 13 | /* |
| 14 | Copyright Incsub (http://incsub.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 | |
| 30 | /* |
| 31 | This plugin was originally developed by Javier Marquez. |
| 32 | http://arqex.com/ |
| 33 | */ |
| 34 | |
| 35 | function inc_sidebars_init() { |
| 36 | if ( class_exists( 'CustomSidebars' ) ) { |
| 37 | return; |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Do not load plugin when saving file in WP Editor |
| 42 | */ |
| 43 | if ( isset( $_REQUEST['action'] ) && 'edit-theme-plugin-file' == $_REQUEST['action'] ) { |
| 44 | return; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * if admin, load only on proper pages |
| 49 | */ |
| 50 | if ( is_admin() && isset( $_SERVER['SCRIPT_FILENAME'] ) ) { |
| 51 | $file = basename( $_SERVER['SCRIPT_FILENAME'] ); |
| 52 | $allowed = array( |
| 53 | 'edit.php', |
| 54 | 'admin-ajax.php', |
| 55 | 'post.php', |
| 56 | 'post-new.php', |
| 57 | 'widgets.php', |
| 58 | ); |
| 59 | if ( ! in_array( $file, $allowed ) ) { |
| 60 | return; |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | $plugin_dir = dirname( __FILE__ ); |
| 65 | $plugin_dir_rel = dirname( plugin_basename( __FILE__ ) ); |
| 66 | $plugin_url = plugin_dir_url( __FILE__ ); |
| 67 | |
| 68 | define( 'CSB_PLUGIN', __FILE__ ); |
| 69 | define( 'CSB_IS_PRO', false ); |
| 70 | define( 'CSB_VIEWS_DIR', $plugin_dir . '/views/' ); |
| 71 | define( 'CSB_INC_DIR', $plugin_dir . '/inc/' ); |
| 72 | define( 'CSB_JS_URL', $plugin_url . 'assets/js/' ); |
| 73 | define( 'CSB_CSS_URL', $plugin_url . 'assets/css/' ); |
| 74 | define( 'CSB_IMG_URL', $plugin_url . 'assets/img/' ); |
| 75 | |
| 76 | // Include function library. |
| 77 | $modules[] = CSB_INC_DIR . 'external/wpmu-lib/core.php'; |
| 78 | $modules[] = CSB_INC_DIR . 'class-custom-sidebars.php'; |
| 79 | |
| 80 | $modules[] = CSB_INC_DIR . 'external/wdev-frash/module.php'; |
| 81 | |
| 82 | |
| 83 | |
| 84 | // Free-version configuration - no drip campaign yet... |
| 85 | $cta_label = false; |
| 86 | $drip_param = false; |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | foreach ( $modules as $path ) { |
| 92 | if ( file_exists( $path ) ) { require_once $path; } |
| 93 | } |
| 94 | |
| 95 | // Register the current plugin, for pro and free plugins! |
| 96 | do_action( |
| 97 | 'wdev-register-plugin', |
| 98 | /* Plugin ID */ plugin_basename( __FILE__ ), |
| 99 | /* Plugin Title */ 'CustomSidebars', |
| 100 | /* https://wordpress.org */ '/plugins/custom-sidebars/', |
| 101 | /* Email Button CTA */ $cta_label, |
| 102 | /* getdrip Plugin param */ $drip_param |
| 103 | ); |
| 104 | |
| 105 | // Initialize the plugin |
| 106 | CustomSidebars::instance(); |
| 107 | } |
| 108 | |
| 109 | inc_sidebars_init(); |
| 110 | |
| 111 | if ( ! class_exists( 'CustomSidebarsEmptyPlugin' ) ) { |
| 112 | class CustomSidebarsEmptyPlugin extends WP_Widget { |
| 113 | public function __construct() { |
| 114 | parent::__construct( false, $name = 'CustomSidebarsEmptyPlugin' ); |
| 115 | } |
| 116 | public function form( $instance ) { |
| 117 | //Nothing, just a dummy plugin to display nothing |
| 118 | } |
| 119 | public function update( $new_instance, $old_instance ) { |
| 120 | //Nothing, just a dummy plugin to display nothing |
| 121 | } |
| 122 | public function widget( $args, $instance ) { |
| 123 | echo ''; |
| 124 | } |
| 125 | } //end class |
| 126 | } //end if class exists |
| 127 | |
| 128 | |
| 129 | // Translation. |
| 130 | function inc_sidebars_init_translation() { |
| 131 | load_plugin_textdomain( 'custom-sidebars', false, basename( dirname( __FILE__ ) ) . '/languages' ); |
| 132 | } |
| 133 | add_action( 'plugins_loaded', 'inc_sidebars_init_translation' ); |
| 134 |