/** * 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)); }
/** * 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)); }
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(); } }
} $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.