PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 2.9.19.4
Pods – Custom Content Types and Fields v2.9.19.4
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 2 weeks ago Ajax 2 weeks ago Asset 2 weeks ago Context 2 weeks ago Customizer 2 weeks ago Debug_Bar 2 weeks ago Dialog 2 weeks ago Documentation 2 weeks ago Duplicate 2 weeks ago Editor 2 weeks ago Image 2 weeks ago JSON_LD 2 weeks ago Languages 2 weeks ago Log 2 weeks ago Meta 2 weeks ago Models 2 weeks ago PUE 2 weeks ago Process 2 weeks ago Promoter 2 weeks ago REST 2 weeks ago Repository 2 weeks ago Service_Providers 2 weeks ago Shortcode 2 weeks ago Support 2 weeks ago Tabbed_View 2 weeks ago Tooltip 2 weeks ago Traits 2 weeks ago Utils 2 weeks ago Validator 2 weeks ago Widget 2 weeks ago Abstract_Deactivation.php 2 weeks ago Abstract_Plugin_Register.php 2 weeks ago App_Shop.php 2 weeks ago Assets.php 2 weeks ago Assets_Pipeline.php 2 weeks ago Autoloader.php 2 weeks ago Cache.php 2 weeks ago Cache_Listener.php 2 weeks ago Changelog_Reader.php 2 weeks ago Container.php 2 weeks ago Context.php 2 weeks ago Cost_Utils.php 2 weeks ago Credits.php 2 weeks ago Customizer.php 2 weeks ago DB_Lock.php 2 weeks ago Data.php 2 weeks ago Date_Utils.php 2 weeks ago Db.php 2 weeks ago Debug.php 2 weeks ago Dependency.php 2 weeks ago Deprecation.php 2 weeks ago Editor.php 2 weeks ago Error.php 2 weeks ago Exception.php 2 weeks ago Extension.php 2 weeks ago Extension_Loader.php 2 weeks ago Feature_Detection.php 2 weeks ago Field.php 2 weeks ago Field_Conditional.php 2 weeks ago Freemius.php 2 weeks ago Log.php 2 weeks ago Main.php 2 weeks ago Notices.php 2 weeks ago Plugin_Meta_Links.php 2 weeks ago Plugins.php 2 weeks ago Plugins_API.php 2 weeks ago Post_History.php 2 weeks ago Post_Transient.php 2 weeks ago Promise.php 2 weeks ago Repository.php 2 weeks ago Rewrite.php 2 weeks ago Settings.php 2 weeks ago Settings_Manager.php 2 weeks ago Settings_Tab.php 2 weeks ago Simple_Table.php 2 weeks ago Support.php 2 weeks ago Tabbed_View.php 2 weeks ago Template.php 2 weeks ago Template_Factory.php 2 weeks ago Template_Part_Cache.php 2 weeks ago Templates.php 2 weeks ago Terms.php 2 weeks ago Timezones.php 2 weeks ago Tracker.php 2 weeks ago Updater.php 2 weeks ago Validate.php 2 weeks ago View_Helpers.php 2 weeks 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