PluginProbe
Display Post Types – Post Grid, post list and post sliders / 3.4.0
Display Post Types – Post Grid, post list and post sliders v3.4.0
3.4.3 3.4.2 3.4.1 3.4.0 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.6.0 1.7.0 1.8.0 1.9.0 2.0.0 2.1.0 2.2.0 2.3.0 2.4.0 2.4.1 2.5.0 2.6.0 2.6.1 2.6.2 All 49 releases
display-post-types / display-post-types.php

display-post-types.php in Display Post Types – Post Grid, post list and post sliders 3.4.0, at display-post-types.php

109 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The plugin bootstrap file
4 *
5 * This file is read by WordPress to generate the plugin information in the plugin
6 * admin area. This file also includes all of the dependencies used by the plugin,
7 * registers the activation and deactivation functions, and defines a function
8 * that starts the plugin.
9 *
10 * @link https://easyprolabs.com
11 * @since 1.0.0
12 * @package Display_Post_Types
13 *
14 * @wordpress-plugin
15 * Plugin Name: Display Post Types
16 * Description: Filter, sort and display post, page or any post type.
17 * Version: 3.4.0
18 * Author: easyprolabs
19 * Author URI: https://easyprolabs.com/display-post-types/
20 * License: GPL-3.0+
21 * License URI: http://www.gnu.org/licenses/gpl-3.0.txt
22 * Text Domain: display-post-types
23 * Domain Path: /lang
24 */
25
26 // If this file is called directly, abort.
27 if ( ! defined( 'WPINC' ) ) {
28 die;
29 }
30
31 // Currently plugin version.
32 if ( ! defined( 'DISPLAY_POST_TYPES_VERSION' ) ) {
33 define( 'DISPLAY_POST_TYPES_VERSION', '3.4.0' );
34 }
35
36 // Define plugin constants.
37 if ( ! defined( 'DISPLAY_POST_TYPES_DIR' ) ) {
38 define( 'DISPLAY_POST_TYPES_DIR', plugin_dir_path( __FILE__ ) );
39 }
40
41 // Define plugin constants.
42 if ( ! defined( 'DISPLAY_POST_TYPES_URL' ) ) {
43 define( 'DISPLAY_POST_TYPES_URL', plugin_dir_url( __FILE__ ) );
44 }
45
46 // Define plugin constants.
47 if ( ! defined( 'DISPLAY_POST_TYPES_BASENAME' ) ) {
48 define( 'DISPLAY_POST_TYPES_BASENAME', plugin_basename( __FILE__ ) );
49 }
50
51 // Register PHP autoloader.
52 spl_autoload_register(
53 function( $class ) {
54 $namespace = 'Display_Post_Types\\';
55
56 // Bail if the class is not in our namespace.
57 if ( 0 !== strpos( $class, $namespace ) ) {
58 return;
59 }
60
61 // Get classname without namespace.
62 $carray = array_values( explode( '\\', $class ) );
63 $clast = count( $carray ) - 1;
64
65 // Return if proper array is not available. (Just in case).
66 if ( ! $clast ) {
67 return;
68 }
69
70 // Prepend actual classname with 'class-' prefix.
71 $carray[ $clast ] = 'class-' . $carray[ $clast ];
72 $class = implode( '\\', $carray );
73
74 // Generate file path from classname.
75 $path = strtolower(
76 str_replace(
77 array( $namespace, '_' ),
78 array( '', '-' ),
79 $class
80 )
81 );
82
83 // Build full filepath.
84 $file = DISPLAY_POST_TYPES_DIR . DIRECTORY_SEPARATOR . str_replace( '\\', DIRECTORY_SEPARATOR, $path ) . '.php';
85
86 // If the file exists for the class name, load it.
87 if ( file_exists( $file ) ) {
88 include $file;
89 }
90 }
91 );
92
93 add_action(
94 'plugins_loaded',
95 function() {
96 // Register Display Post Types front-end hooks.
97 Display_Post_Types\Frontend\Register::init();
98
99 // Register Display Post Types back-end hooks.
100 Display_Post_Types\Backend\Register::init();
101 },
102 8
103 );
104
105 // Load premium features (if exist).
106 if ( file_exists( DISPLAY_POST_TYPES_DIR . '/dpt-pro/dpt-pro.php' ) ) {
107 require_once DISPLAY_POST_TYPES_DIR . '/dpt-pro/dpt-pro.php';
108 }
109