| Server IP : 43.130.17.34 / Your IP : 216.73.217.6 Web Server : nginx/1.28.0 System : Linux VM-4-12-opencloudos 6.6.92-34.1.oc9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 25 21:32:13 CST 2025 x86_64 User : www ( 1000) PHP Version : 8.0.26 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/yespkg.com/wp-content/plugins/elementor-pro/modules/theme-builder/conditions/ |
Upload File : |
<?php
namespace ElementorPro\Modules\ThemeBuilder\Conditions;
use ElementorPro\Modules\QueryControl\Module as QueryModule;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Post extends Condition_Base {
private $post_type;
private $post_taxonomies;
public static function get_type() {
return 'singular';
}
public static function get_priority() {
return 40;
}
public function __construct( $data ) {
$this->post_type = get_post_type_object( $data['post_type'] );
$taxonomies = get_object_taxonomies( $data['post_type'], 'objects' );
$this->post_taxonomies = wp_filter_object_list( $taxonomies, [
'public' => true,
'show_in_nav_menus' => true,
] );
parent::__construct();
}
public function get_name() {
return $this->post_type->name;
}
public function get_label() {
return $this->post_type->labels->singular_name;
}
public function get_all_label() {
return $this->post_type->label;
}
public function check( $args ) {
if ( isset( $args['id'] ) ) {
$id = (int) $args['id'];
if ( $id ) {
return is_singular() && get_queried_object_id() === $id;
}
}
return is_singular( $this->post_type->name );
}
public function register_sub_conditions() {
foreach ( $this->post_taxonomies as $slug => $object ) {
$in_taxonomy = new In_Taxonomy( [
'object' => $object,
] );
$this->register_sub_condition( $in_taxonomy );
if ( $object->hierarchical ) {
$in_sub_term = new In_Sub_Term( [
'object' => $object,
] );
$this->register_sub_condition( $in_sub_term );
}
}
$by_author = new Post_Type_By_Author( $this->post_type );
$this->register_sub_condition( $by_author );
}
protected function register_controls() {
$this->add_control(
'post_id',
[
'section' => 'settings',
'type' => QueryModule::QUERY_CONTROL_ID,
'select2options' => [
'dropdownCssClass' => 'elementor-conditions-select2-dropdown',
],
'autocomplete' => [
'object' => QueryModule::QUERY_OBJECT_POST,
'query' => [
'post_type' => $this->get_name(),
],
],
]
);
}
}