/** * Register the custom post-type details. * * @since 4.6 */ private static function setup_posttype() { // Code generated at http://generatewp.com/post-type/ $manage_popups = true == IncPopup::correct_level(); // Register Custom Post Type $labels = array('name' => _x('PopUps', 'Post Type General Name', PO_LANG), 'singular_name' => _x('PopUp', 'Post Type Singular Name', PO_LANG), 'menu_name' => __('PopUp', PO_LANG), 'parent_item_colon' => __('Parent Item:', PO_LANG), 'all_items' => __('PopUps', PO_LANG), 'view_item' => __('View Item', PO_LANG), 'add_new_item' => __('Add New PopUp', PO_LANG), 'add_new' => __('Add New', PO_LANG), 'edit_item' => __('Edit PopUp', PO_LANG), 'update_item' => __('Update PopUp', PO_LANG), 'search_items' => __('Search PopUp', PO_LANG), 'not_found' => __('Not found', PO_LANG), 'not_found_in_trash' => __('No PopUp found in Trash', PO_LANG)); if (IncPopup::use_global()) { $labels['name'] = _x('Global PopUps', 'Post Type General Name', PO_LANG); $labels['singular_name'] = _x('Global PopUp', 'Post Type Singular Name', PO_LANG); $labels['all_items'] = __('Global PopUps', PO_LANG); } $args = array('label' => __('PopUp', PO_LANG), 'description' => __('Display PopUp messages on your website!', PO_LANG), 'labels' => $labels, 'supports' => array(''), 'hierarchical' => false, 'public' => false, 'show_ui' => $manage_popups, 'show_in_menu' => $manage_popups, 'show_in_nav_menus' => false, 'show_in_admin_bar' => $manage_popups, 'menu_position' => self::$menu_pos, 'menu_icon' => PO_IMG_URL . 'icon.png', 'can_export' => true, 'has_archive' => false, 'exclude_from_search' => true, 'publicly_queryable' => false, 'rewrite' => false, 'capabilities' => array('edit_post' => self::$perms, 'read_post' => self::$perms, 'delete_posts' => self::$perms, 'edit_posts' => self::$perms, 'edit_others_posts' => self::$perms, 'publish_posts' => self::$perms, 'read_private_posts' => self::$perms)); register_post_type(IncPopupItem::POST_TYPE, $args); }
/** * Initialize the rule object. * * @since 4.6 */ protected function init() { $this->filename = basename(__FILE__); if (IncPopup::use_global()) { return; } // 'category' rule. $this->add_rule('category', __('On post category', PO_LANG), __('Shows the PopUp on pages that match any of the specified categories.', PO_LANG), 'no_category', 30); // 'no_category' rule. $this->add_rule('no_category', __('Not on post category', PO_LANG), __('Shows the PopUp on pages that do not match any of the specified categories.', PO_LANG), 'category', 30); // -- Initialize rule. add_filter('popup-ajax-data', array($this, 'inject_ajax_category')); $this->categories = get_terms('category', array('hide_empty' => false), 'objects'); $this->url_types = array('singular' => __('Singular', PO_LANG), 'plural' => __('Archive', PO_LANG)); }
/** * Initialize the rule object. * * @since 4.6 */ protected function init() { $this->filename = basename(__FILE__); if (IncPopup::use_global()) { return; } // 'posttype' rule. $this->add_rule('posttype', __('For specific Post Types', PO_LANG), __('Shows the PopUp on pages that match any of the specified Post Types.', PO_LANG), 'no_posttype', 30); // 'no_posttype' rule. $this->add_rule('no_posttype', __('Not for specific Post Types', PO_LANG), __('Shows the PopUp on pages that do not match any of the specified Post Type.', PO_LANG), 'posttype', 30); // -- Initialize rule. add_filter('popup-ajax-data', array($this, 'inject_ajax_posttype')); $this->posttypes = get_post_types(array('public' => true), 'objects'); $this->url_types = array('singular' => __('Singular', PO_LANG), 'plural' => __('Archive', PO_LANG)); }
/** Plugin Name: WordPress PopUp Plugin URI: http://premium.wpmudev.org/project/the-pop-over-plugin/ Description: Allows you to display a fancy PopUp to visitors sitewide or per blog. A *very* effective way of advertising a mailing list, special offer or running a plain old ad. Version: 4.7.1.1 Author: WPMU DEV Author URI: http://premium.wpmudev.org Textdomain: popover WDP ID: 123 Copyright 2007-2013 Incsub (http://incsub.com) Author - Barry (Incsub) Contributors - Marko Miljus (Incsub), Ve Bailovity (Incsub) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License (Version 2 - GPLv2) as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ function inc_popup_free_init() { // Check if the PRO plugin is present and activated. if (defined('PO_VERSION') && 'pro' == PO_VERSION) { return false; } if (!defined('PO_LANG')) { // Used for more readable i18n functions: __( 'text', PO_LANG ); define('PO_LANG', 'popover'); define('PO_VERSION', '4.7'); /** * The current DB/build version. NOT THE SAME AS THE PLUGIN VERSION! * Increase this when DB structure changes, migration code is required, etc. * See IncPopupDatabase: db_is_current() and db_update() */ define('PO_BUILD', 6); $plugin_dir = trailingslashit(dirname(__FILE__)); $plugin_dir_rel = trailingslashit(dirname(plugin_basename(__FILE__))); $plugin_url = plugin_dir_url(__FILE__); define('PO_LANG_DIR', $plugin_dir_rel . 'lang/'); define('PO_TPL_DIR', $plugin_dir . 'css/tpl/'); define('PO_INC_DIR', $plugin_dir . 'inc/'); define('PO_JS_DIR', $plugin_dir . 'js/'); define('PO_CSS_DIR', $plugin_dir . 'css/'); define('PO_VIEWS_DIR', $plugin_dir . 'views/'); define('PO_TPL_URL', $plugin_url . 'css/tpl/'); define('PO_JS_URL', $plugin_url . 'js/'); define('PO_CSS_URL', $plugin_url . 'css/'); define('PO_IMG_URL', $plugin_url . 'img/'); // Include function library. require_once PO_INC_DIR . 'external/wpmu-lib/core.php'; lib2()->translate_plugin(PO_LANG, PO_LANG_DIR); require_once PO_INC_DIR . 'external/wdev-frash/module.php'; // Register the current plugin. do_action('wdev-register-plugin', plugin_basename(__FILE__), 'WordPress PopUp', '/plugins/wordpress-popup/', __('Get Tips!', PO_LANG), ''); // All done! require_once PO_INC_DIR . 'config-defaults.php'; if (is_admin()) { // Defines class 'IncPopup'. require_once PO_INC_DIR . 'class-popup-admin.php'; } else { // Defines class 'IncPopup'. require_once PO_INC_DIR . 'class-popup-public.php'; } // Initialize the plugin as soon as we have identified the current user. IncPopup::instance(); } }
/** * Initialize the rule object. * * @since 4.6 */ protected function init() { $this->filename = basename(__FILE__); if (IncPopup::use_global()) { return; } if (!defined('POP_UP_TAXONOMY')) { lib2()->ui->admin_message(__('Please define pop up taxonomy by adding <code>define("POP_UP_TAXONOMY", "custom_taxonomy_name");</code> in your wpconfig.php file.'), 'err'); } // 'taxonomy' rule. $this->add_rule('taxonomy', __('On custom taxonomy', PO_LANG), sprintf(__('Shows the PopUp on pages that match any of the specified <strong>%s</strong>-taxonomies.', PO_LANG), esc_html(POP_UP_TAXONOMY)), 'no_taxonomy', 30); // 'no_taxonomy' rule. $this->add_rule('no_taxonomy', __('Not on custom taxonomy', PO_LANG), sprintf(__('Hides the PopUp on pages that match any of the specified <strong>%s</strong>-taxonomies.', PO_LANG), esc_html(POP_UP_TAXONOMY)), 'taxonomy', 30); // -- Initialize rule. add_filter('popup-ajax-data', array($this, 'inject_ajax_taxonomy')); $this->taxonomies = get_terms(POP_UP_TAXONOMY, array('hide_empty' => false), 'objects'); $this->url_types = array('singular' => __('Singular', PO_LANG), 'plural' => __('Archive', PO_LANG)); }
/** Plugin Name: PopUp Pro Plugin URI: http://premium.wpmudev.org/project/the-pop-over-plugin/ Description: Allows you to display a fancy PopUp to visitors sitewide or per blog. A *very* effective way of advertising a mailing list, special offer or running a plain old ad. Version: 4.7.1.1 Author: WPMU DEV Author URI: http://premium.wpmudev.org Textdomain: popover WDP ID: 123 Copyright 2007-2013 Incsub (http://incsub.com) Author - Barry (Incsub) Contributors - Marko Miljus (Incsub), Ve Bailovity (Incsub) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License (Version 2 - GPLv2) as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ function inc_popup_pro_init() { if (!defined('PO_LANG')) { // Used for more readable i18n functions: __( 'text', PO_LANG ); define('PO_LANG', 'popover'); define('PO_VERSION', 'pro'); /** * The current DB/build version. NOT THE SAME AS THE PLUGIN VERSION! * Increase this when DB structure changes, migration code is required, etc. * See IncPopupDatabase: db_is_current() and db_update() */ define('PO_BUILD', 6); $plugin_dir = trailingslashit(dirname(__FILE__)); $plugin_dir_rel = trailingslashit(dirname(plugin_basename(__FILE__))); $plugin_url = plugin_dir_url(__FILE__); define('PO_LANG_DIR', $plugin_dir_rel . 'lang/'); define('PO_TPL_DIR', $plugin_dir . 'css/tpl/'); define('PO_INC_DIR', $plugin_dir . 'inc/'); define('PO_JS_DIR', $plugin_dir . 'js/'); define('PO_CSS_DIR', $plugin_dir . 'css/'); define('PO_VIEWS_DIR', $plugin_dir . 'views/'); define('PO_TPL_URL', $plugin_url . 'css/tpl/'); define('PO_JS_URL', $plugin_url . 'js/'); define('PO_CSS_URL', $plugin_url . 'css/'); define('PO_IMG_URL', $plugin_url . 'img/'); // Include function library. require_once PO_INC_DIR . 'external/wpmu-lib/core.php'; lib2()->translate_plugin(PO_LANG, PO_LANG_DIR); require_once PO_INC_DIR . 'config-defaults.php'; if (is_admin()) { // Defines class 'IncPopup'. require_once PO_INC_DIR . 'class-popup-admin.php'; } else { // Defines class 'IncPopup'. require_once PO_INC_DIR . 'class-popup-public.php'; } // Initialize the plugin as soon as we have identified the current user. IncPopup::instance(); } }
if (!isset($shortcodes[$code])) { $shortcodes[$code] = ''; } $shortcodes[$code] .= 'sc-front '; } foreach ($shortcodes as $code => $compat) { foreach ($limited as $pattern) { if (preg_match('/^' . $pattern . '$/i', $code)) { $shortcodes[$code] = $compat . 'sc-limited '; } } } echo '<p>'; _e('You can use all your shortcodes inside the PopUp contents, ' . 'however some Plugins or Themes might provide shortcodes that ' . 'only work with the loading method "Page Footer".<br /> ' . 'This list explains which shortcodes can be used with each ' . 'loading method:', PO_LANG); echo '</p>'; if (IncPopup::use_global()) { ?> <p><em> <?php _e('Important notice for shortcodes in <strong>Global ' . 'PopUps</strong>:<br />' . 'Shortcodes can be provided by a plugin or theme, so ' . 'each blog can have a different list of shortcodes. The ' . 'following list is valid for the current blog only!', PO_LANG); ?> </em></p> <?php } ?> <div class="tbl-shortcodes"> <table class="widefat load-<?php echo esc_attr($cur_method); ?> "> <thead>
/** * Selects the correct database, in case the PO_GLOBAL flag is true. * * @since 4.6 */ public static function after_db() { if (IncPopup::use_global()) { restore_current_blog(); } }
/** * Save the popup data to database * * @since 4.6.0 * @param int $post_id Post ID that was saved/created * @param WP_Post $post Post object that was saved/created * @param bool $update True means the post was updated (not created) */ public static function form_save($post_id, $post, $update) { $popup = IncPopupDatabase::get($post_id); // Make sure the POST collection contains all required fields. if (0 !== lib2()->array->equip_post('popup-nonce', 'post_type', 'po-action')) { return; } // Autosave is not processed. if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return; } // The nonce is invalid. if (!wp_verify_nonce($_POST['popup-nonce'], 'save-popup')) { return; } // This save event is for a different post type... ?? if (IncPopupItem::POST_TYPE != $_POST['post_type']) { return; } // Global PopUp modified in a Network-Blog that is not the Main-Blog. if (!IncPopup::correct_level()) { return; } // User does not have permissions for this. if (!current_user_can(IncPopupPosttype::$perms)) { return; } $action = $_POST['po-action']; $status = false; switch ($action) { case 'save': // Don't force a status... break; case 'activate': $status = 'active'; break; case 'deactivate': $status = 'inactive'; break; default: // Unknown action. return; } // Populate the popup. $data = self::prepare_formdata($_POST); $data['id'] = $post_id; $data['order'] = $popup->order; if ($status) { $data['status'] = $status; } $popup->populate($data); // Prevent infinite loop when saving. remove_action('save_post_' . IncPopupItem::POST_TYPE, array('IncPopup', 'form_save'), 10); $popup->save(); add_action('save_post_' . IncPopupItem::POST_TYPE, array('IncPopup', 'form_save'), 10, 3); // Removes the 'message' from the redirect URL. add_filter('redirect_post_location', array('IncPopup', 'form_redirect'), 10, 2); // Update the PopUp object in WP-Cache. IncPopupDatabase::get($post_id, true); }
<?php /** * Metabox "Appearance" * * Used in class-popup-admin.php * Available variables: $popup */ $styles = apply_filters('popup-styles', array()); $animations = IncPopup::get_animations(); ?> <div class="wpmui-grid-12"> <div class="col-12"> <label for="po-style"> <strong> <?php _e('Select which style you want to use:', PO_LANG); ?> </strong> </label> </div> </div> <div class="wpmui-grid-12"> <div class="col-7"> <input type="hidden" class="po-orig-style" name="po_orig_style" value="<?php echo esc_attr($popup->style); ?> " />
} $data['limit'] = explode(',', $data['limit']); $data['limit'] = array_map('trim', $data['limit']); $name = __(trim($data['name']), PO_LANG); $ordered_rules[$name] = $data; $ordered_rules[$name]['key'] = $rule; $ordered_rules[$name]['name'] = $name; $ordered_rules[$name]['active'] = $is_active; $ordered_rules[$name]['desc'] = __(trim($data['desc']), PO_LANG); if ('pro' != PO_VERSION && in_array('pro', $data['limit'])) { $ordered_rules[$name]['disabled'] = sprintf(__('Available in the <a href="%s" target="_blank">PRO version</a>', PO_LANG), 'http://premium.wpmudev.org/project/the-pop-over-plugin/'); } else { if (IncPopup::use_global() && in_array('no global', $data['limit'])) { $ordered_rules[$name]['disabled'] = __('Not available for global PopUps', PO_LANG); } else { if (!IncPopup::use_global() && in_array('global', $data['limit'])) { $ordered_rules[$name]['disabled'] = true; } else { $ordered_rules[$name]['disabled'] = false; } } } } ?> <?php ksort($ordered_rules); ?> <?php foreach ($ordered_rules as $data) { // Ignore Addons that have no name.