X7ROOT File Manager
Current Path:
/home/oakwood/public_html/wp-content/plugins/popup-maker/classes
home
/
oakwood
/
public_html
/
wp-content
/
plugins
/
popup-maker
/
classes
/
ðŸ“
..
ðŸ“
Abstract
📄
Activator.php
(796 B)
ðŸ“
Admin
📄
Admin.php
(3.72 KB)
📄
Ajax.php
(1.66 KB)
📄
Analytics.php
(7.79 KB)
📄
AssetCache.php
(19.99 KB)
ðŸ“
Batch
📄
Cache.php
(252 B)
📄
ConditionCallbacks.php
(6.35 KB)
📄
Conditions.php
(14.26 KB)
📄
Cookies.php
(7.67 KB)
ðŸ“
DB
📄
DataStorage.php
(382 B)
📄
Deactivator.php
(594 B)
ðŸ“
Extension
📄
Extensions.php
(5.34 KB)
📄
GA.php
(2.31 KB)
📄
Helpers.php
(8.04 KB)
📄
Install.php
(7.92 KB)
ðŸ“
Integration
📄
Integrations.php
(12.69 KB)
ðŸ“
Interface
📄
Licensing.php
(7.69 KB)
📄
ListTable.php
(41.08 KB)
📄
Logging.php
(266 B)
ðŸ“
Model
ðŸ“
Newsletter
📄
Newsletters.php
(8.85 KB)
📄
Options.php
(308 B)
📄
Popup.php
(240 B)
📄
Popups.php
(787 B)
📄
Previews.php
(3.62 KB)
📄
Privacy.php
(16.22 KB)
ðŸ“
Repository
ðŸ“
Shortcode
📄
Shortcode.php
(11.61 KB)
📄
Shortcodes.php
(1.28 KB)
ðŸ“
Site
📄
Site.php
(4.67 KB)
📄
Telemetry.php
(10.31 KB)
📄
Triggers.php
(10.33 KB)
📄
Types.php
(7.59 KB)
ðŸ“
Upgrade
📄
Upgrades.php
(348 B)
📄
Upsell.php
(7.52 KB)
ðŸ“
Utils
📄
index.php
(116 B)
Editing: ConditionCallbacks.php
<?php /** * ConditionCallbacks class * * @package PopupMaker * @copyright Copyright (c) 2024, Code Atlantic LLC */ class PUM_ConditionCallbacks { /** * Checks if this is one of the selected post_type items. * * @param array $condition * * @return bool */ public static function post_type( $condition = [] ) { global $post; $target = explode( '_', $condition['target'] ); // Modifier should be the last key. $modifier = array_pop( $target ); // Post type is the remaining keys combined. $post_type = implode( '_', $target ); $selected = ! empty( $condition['settings']['selected'] ) ? $condition['settings']['selected'] : []; switch ( $modifier ) { case 'index': if ( is_post_type_archive( $post_type ) ) { return true; } break; case 'all': // Checks for valid post type, if $post_type is page, then include the front page as most users simply expect this. if ( self::is_post_type( $post_type ) || ( 'page' === $post_type && is_front_page() ) ) { return true; } break; case 'ID': case 'selected': if ( self::is_post_type( $post_type ) && is_singular( $post_type ) && in_array( $post->ID, wp_parse_id_list( $selected ), true ) ) { return true; } break; case 'children': if ( ! is_post_type_hierarchical( $post_type ) || ! is_singular( $post_type ) ) { return false; } // Chosen parents. $selected = wp_parse_id_list( $selected ); foreach ( $selected as $id ) { if ( $post->post_parent === $id ) { return true; } } break; case 'ancestors': if ( ! is_post_type_hierarchical( $post_type ) || ! is_singular( $post_type ) ) { return false; } // Ancestors of the current page. $ancestors = get_post_ancestors( $post->ID ); // Chosen parent/grandparents. $selected = wp_parse_id_list( $selected ); foreach ( $selected as $id ) { if ( in_array( $id, $ancestors, true ) ) { return true; } } break; case 'template': if ( is_page() && is_page_template( $selected ) ) { return true; } break; } return false; } /** * Checks if this is one of the selected taxonomy term. * * @param array $condition * * @return bool */ public static function taxonomy( $condition = [] ) { $target = explode( '_', $condition['target'] ); // Remove the tax_ prefix. array_shift( $target ); // Assign the last key as the modifier _all, _selected $modifier = array_pop( $target ); // Whatever is left is the taxonomy. $taxonomy = implode( '_', $target ); if ( 'category' === $taxonomy ) { return self::category( $condition ); } elseif ( 'post_tag' === $taxonomy ) { return self::post_tag( $condition ); } switch ( $modifier ) { case 'all': if ( is_tax( $taxonomy ) ) { return true; } break; case 'ID': case 'selected': $selected = ! empty( $condition['settings']['selected'] ) ? $condition['settings']['selected'] : []; if ( is_tax( $taxonomy, wp_parse_id_list( $selected ) ) ) { return true; } break; } return false; } /** * Checks if this is one of the selected categories. * * @param array $condition * * @return bool */ public static function category( $condition = [] ) { $target = explode( '_', $condition['target'] ); // Assign the last key as the modifier _all, _selected $modifier = array_pop( $target ); switch ( $modifier ) { case 'all': if ( is_category() ) { return true; } break; case 'selected': $selected = ! empty( $condition['settings']['selected'] ) ? $condition['settings']['selected'] : []; if ( is_category( wp_parse_id_list( $selected ) ) ) { return true; } break; } return false; } /** * Checks if this is one of the selected tags. * * @param array $condition * * @return bool */ public static function post_tag( $condition = [] ) { $target = explode( '_', $condition['target'] ); // Assign the last key as the modifier _all, _selected $modifier = array_pop( $target ); switch ( $modifier ) { case 'all': if ( is_tag() ) { return true; } break; case 'selected': $selected = ! empty( $condition['settings']['selected'] ) ? $condition['settings']['selected'] : []; if ( is_tag( wp_parse_id_list( $selected ) ) ) { return true; } break; } return false; } /** * Checks if the post_type has the selected categories. * * @param array $condition * * @return bool */ public static function post_type_tax( $condition = [] ) { $target = explode( '_w_', $condition['target'] ); // First key is the post type. $post_type = array_shift( $target ); // Last Key is the taxonomy $taxonomy = array_pop( $target ); if ( 'category' === $taxonomy ) { return self::post_type_category( $condition ); } elseif ( 'post_tag' === $taxonomy ) { return self::post_type_tag( $condition ); } $selected = ! empty( $condition['settings']['selected'] ) ? $condition['settings']['selected'] : []; if ( self::is_post_type( $post_type ) && has_term( wp_parse_id_list( $selected ), $taxonomy ) ) { return true; } return false; } /** * Checks if the post_type has the selected categories. * * @param array $condition * * @return bool */ public static function post_type_category( $condition = [] ) { $target = explode( '_w_', $condition['target'] ); // First key is the post type. $post_type = array_shift( $target ); $selected = ! empty( $condition['settings']['selected'] ) ? $condition['settings']['selected'] : []; if ( self::is_post_type( $post_type ) && has_category( wp_parse_id_list( $selected ) ) ) { return true; } return false; } /** * Checks is a post_type has the selected tags. * * @param array $condition * * @return bool */ public static function post_type_tag( $condition = [] ) { $target = explode( '_w_', $condition['target'] ); // First key is the post type. $post_type = array_shift( $target ); $selected = ! empty( $condition['settings']['selected'] ) ? $condition['settings']['selected'] : []; if ( self::is_post_type( $post_type ) && has_tag( wp_parse_id_list( $selected ) ) ) { return true; } return false; } public static function is_post_type( $post_type ) { global $post; return is_object( $post ) && ( is_singular( $post_type ) || $post->post_type === $post_type ); } }
Upload File
Create Folder