PluginProbe ʕ •ᴥ•ʔ
Hustle – Email Marketing, Lead Generation, Optins, Popups / 7.8.9
Hustle – Email Marketing, Lead Generation, Optins, Popups v7.8.9
7.8.14 7.8.14.1 7.8.13 7.8.13.1 trunk 3.0 3.1 3.1.1 3.1.2 3.1.3 3.1.4 4.3.2 4.4.4 4.4.5 4.4.5.1 4.4.5.4 4.6 4.6.1.1 4.6.1.4 4.7.0.2 4.7.0.3 4.7.0.7 4.7.0.9 4.7.1.0 4.7.1.1 4.8.0.0 5.0.0 5.0.1 5.0.1.1 5.0.1.2 5.1 5.1.1 5.1.2 5.1.3 5.1.3.1 5.1.3.2 5.1.4 5.1.5 6.0 6.0.1 6.0.2 6.0.3 6.0.4.2 6.0.5 6.0.6.1 6.0.7 6.0.8.1 6.0.9 7.0.0.1 7.0.2 7.0.3 7.0.4 7.1.0 7.1.1 7.2.0 7.2.1 7.3.0 7.3.1 7.3.3 7.3.5 7.3.6 7.3.7 7.4.0 7.4.1 7.4.11 7.4.13 7.4.13.1 7.4.2 7.4.3 7.4.4 7.4.5 7.4.5.1 7.4.5.2 7.4.6 7.4.7 7.5.0 7.6.0 7.6.1 7.6.3 7.6.4 7.6.6 7.7.0 7.7.1 7.8.0 7.8.1 7.8.10 7.8.10.1 7.8.10.2 7.8.11 7.8.12 7.8.12.1 7.8.2 7.8.3 7.8.4 7.8.5 7.8.6 7.8.7 7.8.8 7.8.9 7.8.9.1 7.8.9.2 7.8.9.3
wordpress-popup / inc / display-conditions / class-opt-in-condition-posts.php
wordpress-popup / inc / display-conditions Last commit date
class-opt-in-condition-abstract.php 4 years ago class-opt-in-condition-archive-pages.php 4 years ago class-opt-in-condition-categories.php 3 years ago class-opt-in-condition-cookie-set.php 3 years ago class-opt-in-condition-cpt.php 4 years ago class-opt-in-condition-from-referrer.php 4 years ago class-opt-in-condition-on-browser.php 3 years ago class-opt-in-condition-on-url.php 3 years ago class-opt-in-condition-page-templates.php 4 years ago class-opt-in-condition-pages.php 4 years ago class-opt-in-condition-posts.php 4 years ago class-opt-in-condition-shown-less-than.php 3 years ago class-opt-in-condition-source-of-arrival.php 3 years ago class-opt-in-condition-tags.php 3 years ago class-opt-in-condition-user-registration.php 6 years ago class-opt-in-condition-user-roles.php 6 years ago class-opt-in-condition-visitor-commented.php 5 years ago class-opt-in-condition-visitor-country.php 5 years ago class-opt-in-condition-visitor-device.php 6 years ago class-opt-in-condition-visitor-logged-in-status.php 6 years ago class-opt-in-condition-wc-archive-pages.php 4 years ago class-opt-in-condition-wc-categories.php 4 years ago class-opt-in-condition-wc-pages.php 4 years ago class-opt-in-condition-wc-static-pages.php 4 years ago class-opt-in-condition-wc-tags.php 4 years ago class-opt-in-condition-wp-conditions.php 4 years ago
class-opt-in-condition-posts.php
56 lines
1 <?php
2 /**
3 * Opt_In_Condition_Posts class.
4 *
5 * @package Hustle
6 * @since unknwon
7 */
8
9 /**
10 * Opt_In_Condition_Posts.
11 * Handles the post post type.
12 *
13 * @since unknwon
14 */
15 class Opt_In_Condition_Posts extends Opt_In_Condition_Abstract {
16
17 /**
18 * Returns whether the condition was met.
19 *
20 * @since unknown
21 */
22 public function is_allowed() {
23 $post = self::get_post();
24
25 $all = false;
26 $none = false;
27 $posts = ! empty( $this->args->posts ) ? (array) $this->args->posts : array();
28 $filter_type = isset( $this->args->filter_type ) && in_array( $this->args->filter_type, array( 'only', 'except' ), true )
29 ? $this->args->filter_type : 'except';
30
31 if ( ! isset( $post ) || ! ( $post instanceof WP_Post ) || 'post' !== $post->post_type || ! self::check( 'is_single' ) ) {
32 return false;
33 }
34 if ( empty( $posts ) ) {
35 if ( 'except' === $filter_type ) {
36 $all = true;
37 } else {
38 $none = true;
39 }
40 }
41
42 if ( $none ) {
43 return false;
44 }
45
46 switch ( $filter_type ) {
47 case 'only':
48 return $all || in_array( strval( $post->ID ), $posts, true );
49
50 case 'except':
51 default:
52 return $all || ! in_array( strval( $post->ID ), $posts, true );
53 }
54 }
55 }
56