function validate_positive() { $page = get_queried_object(); return is_a($page, 'WP_Post') && $page->post_type == 'wplms-assignment' ? in_array($page->ID, $this->data) : parent::validate_positive(); }
/** * Validates the rule on positive assertion. * * @access public * @return boolean TRUE if assertion is successfull, otherwise FALSE. */ public function validate_positive($args = null) { $page = get_queried_object(); $page_ids = $this->get_dripped_page_ids($this->data); if (is_array($args) && $args[0]['cascade'] && isset($page->ID)) { if ($this->validate_parent($page->ID, $page_ids)) { return true; } } return is_a($page, 'WP_Post') && $page->post_type == 'page' ? in_array($page->ID, $page_ids) : parent::validate_positive(); }
/** * Validates the rule on positive assertion. * * @access public * @return boolean TRUE if assertion is successfull, otherwise FALSE. */ public function validate_positive($args = null) { $this->cat_ids = $this->get_dripped_category_ids($this->data); if ($this->is_post_valid($args)) { return true; } if (is_single() && in_array('category', get_object_taxonomies(get_post_type()))) { $categories = wp_get_post_categories(get_the_ID()); $intersect = array_intersect($categories, $this->cat_ids); return !empty($intersect); } if (is_category()) { return in_array(get_queried_object_id(), $this->cat_ids); } return parent::validate_positive(); }
public function validate_positive($args = null) { global $bp; if (bp_current_component() != 'groups') { return parent::validate_positive(); } return isset($bp->groups->current_group) && is_a($bp->groups->current_group, 'BP_Groups_Group') ? in_array($bp->groups->current_group, $this->data) : parent::validate_positive(); }
public function validate_positive($args = null) { $component = bp_current_component(); if ($component) { $pages = bp_core_get_directory_page_ids(); if (!empty($pages[$component])) { return in_array($pages[$component], $this->data); } } return parent::validate_positive(); }
public function validate_positive($args = null) { if ($this->is_category_valid($args)) { return true; } $page = get_queried_object(); $this->post_ids = $this->get_dripped_post_ids($this->data); return is_a($page, 'WP_Post') && $page->post_type == 'post' ? in_array($page->ID, $this->post_ids) : parent::validate_positive(); }