PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 2.8.23.5
Pods – Custom Content Types and Fields v2.8.23.5
2.7.31.4 2.8.23.5 2.9.19.5 3.0.10.5 3.1.4.3 3.2.8.4 3.3.9.2 2.8.23.4 2.9.19.4 3.0.10.4 3.1.4.2 3.2.8.3 3.3.9.1 trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / tribe-common / src / Tribe / Template_Factory.php
pods / tribe-common / src / Tribe Last commit date
Admin 1 week ago Ajax 1 week ago Asset 1 week ago Context 1 week ago Customizer 1 week ago Debug_Bar 1 week ago Dialog 1 week ago Documentation 1 week ago Duplicate 1 week ago Editor 1 week ago Image 1 week ago JSON_LD 1 week ago Languages 1 week ago Log 1 week ago Meta 1 week ago Models 1 week ago PUE 1 week ago Process 1 week ago Promoter 1 week ago REST 1 week ago Repository 1 week ago Service_Providers 1 week ago Shortcode 1 week ago Support 1 week ago Tabbed_View 1 week ago Tooltip 1 week ago Traits 1 week ago Utils 1 week ago Validator 1 week ago Widget 1 week ago Abstract_Deactivation.php 1 week ago Abstract_Plugin_Register.php 1 week ago App_Shop.php 1 week ago Assets.php 1 week ago Assets_Pipeline.php 1 week ago Autoloader.php 1 week ago Cache.php 1 week ago Cache_Listener.php 1 week ago Changelog_Reader.php 1 week ago Container.php 1 week ago Context.php 1 week ago Cost_Utils.php 1 week ago Credits.php 1 week ago Customizer.php 1 week ago DB_Lock.php 1 week ago Data.php 1 week ago Date_Utils.php 1 week ago Db.php 1 week ago Debug.php 1 week ago Dependency.php 1 week ago Deprecation.php 1 week ago Editor.php 1 week ago Error.php 1 week ago Exception.php 1 week ago Extension.php 1 week ago Extension_Loader.php 1 week ago Feature_Detection.php 1 week ago Field.php 1 week ago Field_Conditional.php 1 week ago Freemius.php 1 week ago Log.php 1 week ago Main.php 1 week ago Notices.php 1 week ago Plugin_Meta_Links.php 1 week ago Plugins.php 1 week ago Plugins_API.php 1 week ago Post_History.php 1 week ago Post_Transient.php 1 week ago Promise.php 1 week ago Repository.php 1 week ago Rewrite.php 1 week ago Settings.php 1 week ago Settings_Manager.php 1 week ago Settings_Tab.php 1 week ago Simple_Table.php 1 week ago Support.php 1 week ago Tabbed_View.php 1 week ago Template.php 1 week ago Template_Factory.php 1 week ago Template_Part_Cache.php 1 week ago Templates.php 1 week ago Terms.php 1 week ago Timezones.php 1 week ago Tracker.php 1 week ago Updater.php 1 week ago Validate.php 1 week ago View_Helpers.php 1 week ago
Template_Factory.php
220 lines
1 <?php
2 /**
3 * Template Factory
4 *
5 * The parent class for managing the view methods in core and addons
6 *
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 die( '-1' );
11 }
12
13 if ( class_exists( 'Tribe__Template_Factory' ) ) {
14 return;
15 }
16
17 class Tribe__Template_Factory {
18
19 /**
20 * Array of asset packages needed for this template
21 *
22 * @deprecated 4.7.18
23 *
24 * @var array
25 **/
26 protected $asset_packages = [];
27
28 /**
29 * Static variable that holds array of vendor script handles, for adding to later deps.
30 *
31 * @deprecated 4.7.18
32 *
33 * @static
34 * @var array
35 */
36 protected static $vendor_scripts = [];
37
38 /**
39 * Constant that holds the ajax hook suffix for the view
40 *
41 * @deprecated 4.7.18
42 *
43 * @static
44 * @var string
45 */
46 const AJAX_HOOK = '';
47
48 /**
49 * Run include packages, set up hooks
50 *
51 * @deprecated 4.7.18
52 *
53 * @return void
54 **/
55 public function __construct() {
56 $this->asset_packages();
57 }
58
59 /**
60 * Manage the asset packages defined for this template
61 *
62 * @deprecated 4.7.18
63 *
64 * @return void
65 **/
66 protected function asset_packages() {
67 foreach ( $this->asset_packages as $asset_package ) {
68 $this->asset_package( $asset_package );
69 }
70 }
71
72 /**
73 * Handles an asset package request.
74 *
75 * @deprecated 4.7.18
76 *
77 * @param string $name The asset name in the `hyphen-separated-format`
78 * @param array $deps An array of dependency handles
79 * @param string $vendor_url URL to vendor scripts and styles dir
80 * @param string $prefix MT script and style prefix
81 * @param Tribe__Main $tec An instance of the main plugin class
82 */
83 protected static function handle_asset_package_request( $name, $deps, $vendor_url, $prefix, $tec ) {
84
85 $asset = self::get_asset_factory_instance( $name );
86
87 self::prepare_asset_package_request( $asset, $name, $deps, $vendor_url, $prefix, $tec );
88 }
89
90 /**
91 * initializes asset package request
92 *
93 * @deprecated 4.7.18
94 *
95 * @param object $asset The Tribe__*Asset object
96 * @param string $name The asset name in the `hyphen-separated-format`
97 * @param array $deps An array of dependency handles
98 * @param string $vendor_url URL to vendor scripts and styles dir
99 * @param string $prefix MT script and style prefix
100 * @param Tribe__Main $common An instance of the main plugin class
101 */
102 protected static function prepare_asset_package_request( $asset, $name, $deps, $vendor_url, $prefix, $common ) {
103 if ( ! $asset ) {
104 do_action( $prefix . '-' . $name );
105
106 return;
107 }
108
109 $asset->set_name( $name );
110 $asset->set_deps( $deps );
111 $asset->set_vendor_url( $vendor_url );
112 $asset->set_prefix( $prefix );
113 $asset->set_tec( $common );
114
115 $asset->handle();
116 }
117
118 /**
119 * Retrieves the appropriate asset factory instance
120 *
121 * @deprecated 4.7.18
122 *
123 */
124 protected static function get_asset_factory_instance( $name ) {
125 $asset = Tribe__Asset__Factory::instance()->make_for_name( $name );
126 return $asset;
127 }
128
129 /**
130 *
131 * @deprecated 4.7.18
132 *
133 * @param string $script_handle A registered script handle.
134 */
135 public static function add_vendor_script( $script_handle ) {
136 if ( in_array( $script_handle, self::$vendor_scripts ) ) {
137 return;
138 }
139 self::$vendor_scripts[] = $script_handle;
140 }
141
142 /**
143 * @return string[] An array of registered vendor script handles.
144 */
145 public static function get_vendor_scripts() {
146 return self::$vendor_scripts;
147 }
148
149 /**
150 * Asset calls for vendor packages
151 *
152 * @deprecated 4.7.18
153 *
154 * @param string $name
155 * @param array $deps Dependents
156 */
157 public static function asset_package( $name, $deps = [] ) {
158
159 $common = Tribe__Main::instance();
160 $prefix = 'tribe-events';
161
162 // setup plugin resources & 3rd party vendor urls
163 $vendor_url = trailingslashit( $common->plugin_url ) . 'vendor/';
164
165 self::handle_asset_package_request( $name, $deps, $vendor_url, $prefix, $common );
166 }
167
168 /**
169 * Returns the path to a minified version of a js or css file, if it exists.
170 * If the file does not exist, returns false.
171 *
172 * @deprecated 4.7.18
173 *
174 * @param string $url The path or URL to the un-minified file.
175 * @param bool $default_to_original Whether to just return original path if min version not found.
176 *
177 * @return string|false The path/url to minified version or false, if file not found.
178 */
179 public static function getMinFile( $url, $default_to_original = false ) {
180 if ( ! defined( 'SCRIPT_DEBUG' ) || SCRIPT_DEBUG === false ) {
181 if ( substr( $url, - 3, 3 ) == '.js' ) {
182 $url_new = substr_replace( $url, '.min', - 3, 0 );
183 }
184 if ( substr( $url, - 4, 4 ) == '.css' ) {
185 $url_new = substr_replace( $url, '.min', - 4, 0 );
186 }
187 }
188
189 if ( isset( $url_new ) && file_exists( str_replace( content_url(), WP_CONTENT_DIR, $url_new ) ) ) {
190 return $url_new;
191 } elseif ( $default_to_original ) {
192 return $url;
193 } else {
194 return false;
195 }
196 }
197
198 /**
199 * Playing ping-pong with WooCommerce. They keep changing their script.
200 *
201 * @deprecated 4.7.18
202 *
203 * @see https://github.com/woothemes/woocommerce/issues/3623
204 */
205 public static function get_placeholder_handle() {
206 $placeholder_handle = 'jquery-placeholder';
207
208 global $woocommerce;
209 if (
210 class_exists( 'Woocommerce' ) &&
211 version_compare( $woocommerce->version, '2.0.11', '>=' ) &&
212 version_compare( $woocommerce->version, '2.0.13', '<=' )
213 ) {
214 $placeholder_handle = 'tribe-placeholder';
215 }
216
217 return $placeholder_handle;
218 }
219 }
220