| Server IP : 89.39.208.18 / Your IP : 216.73.217.74 Web Server : LiteSpeed System : User : ( ) PHP Version : 7.4.33 Disable Function : eval,./,ln,passthru,dl,system,exec,popen,shell_exec,posix_getpwuid,posix_uname,ftp_exec,posix_uname,posix_getpwuid,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,get_current_user,getmyuid,getmygid,listen,chgrp,apache_note,apache_setenv,apache_child_terminate,closelog,debugger_off,debugge_on,ini_restore,netscript,escapeshellarg,cmd,backtick,virtual,show_sourc,show_source,pclose,pcntl_exec,datasec,old_offset,ctrl_dir,ini_alter,leak,listen,chgrp,apache_setenv,define_syslog_variables,root,diskfreespace,disk_free_space,disk_total_space,posix_kill,getmyuid,getmygid,apache_child_terminate,php_ini_scanned_files,ls,ps_aux,chown,getrusage,posixc,posame,chgrp,posix_setuid,posix_setsid,posix_setgid,apache_note,apache_setenv,x_getuid,e_ini_file,nfo,SQL,mysql_li,t_dbs,filegroup,highlight_file,ilegetcontents,get_dir,popen,popens,pfsockopen,dos_conv,apache_get_modules,crack_check,crack_closedict,rar_open,bzopen,bzread,bzwrite,shellcode,posix_isatty,posix_getservbyname,escapeshellarg,hypot,pg_host,pos,posix_access,inurl,posix_times,posix_mknod,pclose,ps_fill,symlink,id,escapeshellcmd,php_uname,phpinfo MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home3/mahyarcake/www/wp-content/plugins/elementor/core/common/modules/finder/categories/ |
Upload File : |
<?php
namespace Elementor\Core\Common\Modules\Finder\Categories;
use Elementor\Core\Common\Modules\Finder\Base_Category;
use Elementor\Plugin;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Create Category
*
* Provides items related to creation of new posts/pages/templates etc.
*/
class Create extends Base_Category {
/**
* Get title.
*
* @since 2.3.0
* @access public
*
* @return string
*/
public function get_title() {
return esc_html__( 'Create', 'elementor' );
}
public function get_id() {
return 'create';
}
/**
* Get category items.
*
* @since 2.3.0
* @access public
*
* @param array $options
*
* @return array
*/
public function get_category_items( array $options = [] ) {
$result = [];
$registered_document_types = Plugin::$instance->documents->get_document_types();
// TODO: Remove - Support 'post' backwards compatibility - See `Documents_Manager::register_default_types()`.
unset( $registered_document_types['post'] );
$elementor_supported_post_types = array_flip( get_post_types_by_support( 'elementor' ) );
foreach ( $registered_document_types as $document_name => $document_class ) {
$document_properties = $document_class::get_properties();
if ( empty( $document_properties['show_in_finder'] ) ) {
continue;
}
if ( ! empty( $document_properties['cpt'] ) ) {
foreach ( $document_properties['cpt'] as $cpt ) {
unset( $elementor_supported_post_types[ $cpt ] );
}
}
$result[ $document_name ] = $this->create_item_url_by_document_class( $document_class );
}
foreach ( $elementor_supported_post_types as $post_type => $val ) {
$result[ $post_type ] = $this->create_item_url_by_post_type( $post_type );
}
return $result;
}
private function create_item_url_by_post_type( $post_type ) {
$post_type_object = get_post_type_object( $post_type );
// If there is an old post type from inactive plugins.
if ( ! $post_type_object ) {
return false;
}
return $this->get_create_new_template(
sprintf( __( 'Add New %s', 'elementor' ), $post_type_object->labels->singular_name ),
Plugin::$instance->documents->get_create_new_post_url( $post_type )
);
}
private function create_item_url_by_document_class( $document_class ) {
$result = $this->get_create_new_template(
$document_class::get_add_new_title(),
$document_class::get_create_url()
);
$lock_behavior = $document_class::get_lock_behavior_v2();
$is_locked = ! empty( $lock_behavior ) && $lock_behavior->is_locked();
if ( $is_locked ) {
$result['lock'] = $lock_behavior->get_config();
}
return $result;
}
private function get_create_new_template( $add_new_title, $url ) {
return [
'title' => $add_new_title,
'icon' => 'plus-circle-o',
'url' => $url,
'keywords' => [ $add_new_title, 'post', 'page', 'template', 'new', 'create' ],
];
}
}