| 1 |
<?php |
| 2 |
/** |
| 3 |
* This file is used to load widget builder files and the builder. |
| 4 |
* |
| 5 |
* @link https://posimyth.com/ |
| 6 |
* @since 1.0.0 |
| 7 |
* |
| 8 |
* @package Wdesignkit |
| 9 |
*/ |
| 10 |
|
| 11 |
/** |
| 12 |
* Exit if accessed directly. |
| 13 |
* */ |
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit; |
| 16 |
} |
| 17 |
|
| 18 |
use wdkit\Wdkit_Wdesignkit; |
| 19 |
|
| 20 |
if ( ! class_exists( 'Wdkit_Dynamic_Listing_Files' ) ) { |
| 21 |
|
| 22 |
/** |
| 23 |
* This class used for widget load |
| 24 |
* |
| 25 |
* @since 1.0.0 |
| 26 |
*/ |
| 27 |
class Wdkit_Dynamic_Listing_Files { |
| 28 |
|
| 29 |
/** |
| 30 |
* |
| 31 |
* Ensures only one instance of the class is loaded or can be loaded. |
| 32 |
* |
| 33 |
* @var instance |
| 34 |
* @since 1.0.0 |
| 35 |
*/ |
| 36 |
private static $instance = null; |
| 37 |
|
| 38 |
/** |
| 39 |
* This instance is used to load class |
| 40 |
* |
| 41 |
* @since 1.0.0 |
| 42 |
*/ |
| 43 |
public static function instance() { |
| 44 |
|
| 45 |
if ( is_null( self::$instance ) ) { |
| 46 |
self::$instance = new self(); |
| 47 |
} |
| 48 |
|
| 49 |
return self::$instance; |
| 50 |
} |
| 51 |
|
| 52 |
/** |
| 53 |
* This constructor is used to load builder files. |
| 54 |
* |
| 55 |
* @since 1.0.0 |
| 56 |
*/ |
| 57 |
public function Get_post_list() { |
| 58 |
$args = array( |
| 59 |
'public' => true, |
| 60 |
); |
| 61 |
|
| 62 |
$post_types = get_post_types($args, 'objects'); |
| 63 |
$new_object = array(); |
| 64 |
|
| 65 |
if(!empty($post_types)){ |
| 66 |
foreach ($post_types as $key => $value) { |
| 67 |
$exclude = array( 'attachment', 'elementor_library' ); |
| 68 |
if( TRUE === in_array( $value->name, $exclude ) ) |
| 69 |
continue; |
| 70 |
|
| 71 |
$sub_data = array( |
| 72 |
'name' => $value->name, |
| 73 |
'label' => $value->label |
| 74 |
); |
| 75 |
|
| 76 |
$new_object[$key] = $sub_data; |
| 77 |
} |
| 78 |
} |
| 79 |
|
| 80 |
return $new_object; |
| 81 |
} |
| 82 |
|
| 83 |
/** |
| 84 |
* To get Order By filter list. |
| 85 |
* |
| 86 |
* @since 1.0.0 |
| 87 |
*/ |
| 88 |
public function Get_orderBy_List() { |
| 89 |
$args = array( |
| 90 |
[ "name" => 'none', "label" => 'None' ], |
| 91 |
[ "name" => 'id', "label" => 'ID' ], |
| 92 |
[ "name" => 'author', "label" => 'Author' ], |
| 93 |
[ "name" => 'title', "label" => 'Title' ], |
| 94 |
[ "name" => 'slug', "label" => 'Name (slug)' ], |
| 95 |
[ "name" => 'date', "label" => 'Date' ], |
| 96 |
[ "name" => 'modified', "label" => 'Modified' ], |
| 97 |
// [ "name" => 'rand', "label" => 'Random' ], |
| 98 |
// [ "name" => 'comment_count', "label" => 'Comment Count' ], |
| 99 |
// [ "name" => 'menu_order', "label" => 'Default Menu Order' ], |
| 100 |
); |
| 101 |
|
| 102 |
return $args; |
| 103 |
} |
| 104 |
} |
| 105 |
|
| 106 |
Wdkit_Dynamic_Listing_Files::instance(); |
| 107 |
} |
| 108 |
|