PluginProbe
HootKit / trunk
HootKit vtrunk
trunk 2.0.21 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5
hootkit / include / functions-deprecated.php

functions-deprecated.php in HootKit trunk, at include/functions-deprecated.php

312 lines 9.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Deprecated Functions
4 * This file is loaded at after_setup_theme@89
5 */
6 global $hootkit_theme_customize;
7 $hootkit_theme_customize = apply_filters( 'hootkit_clspace_bridge', 'Hoot', 'customize' );
8 $hootkit_theme_customize = empty( $hootkit_theme_customize ) || ! is_string( $hootkit_theme_customize ) ? 'Hoot' : $hootkit_theme_customize;
9 if ( class_exists( $hootkit_theme_customize . '_Customize' ) ) {
10 $hootkit_theme_customize = $hootkit_theme_customize . '_Customize';
11 } elseif ( class_exists( $hootkit_theme_customize . '_FW_Customize' ) ) {
12 $hootkit_theme_customize = $hootkit_theme_customize . '_FW_Customize';
13 }
14 global $hootkit_theme_list;
15 $hootkit_theme_list = apply_filters( 'hootkit_clspace_bridge', 'Hoot', 'list' );
16 if ( class_exists( $hootkit_theme_list . '_List' ) ) {
17 $hootkit_theme_list = $hootkit_theme_list . '_List';
18 } elseif ( class_exists( $hootkit_theme_list . '_FW_List' ) ) {
19 $hootkit_theme_list = $hootkit_theme_list . '_FW_List';
20 }
21 if ( ! function_exists( 'hootkit_fnspace_bridge' ) ) :
22 function hootkit_fnspace_bridge( $fn, $default='', ...$args ) {
23 if ( defined( 'HOOT_DEBUG' ) ) {
24 _deprecated_function( __FUNCTION__, '3.0.0', "{$fn}()" );
25 return $default;
26 } else {
27 static $prefix = '';
28 if ( empty( $prefix ) ) {
29 $prefix = apply_filters( 'hootkit_fnspace_bridge', $prefix );
30 $prefix = ! empty( $prefix ) && is_string( $prefix ) ? $prefix : '';
31 }
32 $target = $prefix . '_' . $fn;
33 if ( function_exists( $target ) ) {
34 return $target( ...$args );
35 } else {
36 _deprecated_function( __FUNCTION__, '3.0.0', "{$target}()" );
37 return $default;
38 }
39 }
40 }
41 endif;
42
43 if ( ! function_exists( 'hootkit_theme_abouttags' ) ) :
44 function hootkit_theme_abouttags( ...$args ) {
45 return hootkit_fnspace_bridge( 'abouttag', '', ...$args );
46 }
47 endif;
48
49 if ( !function_exists( 'hoot_dashboard' ) ):
50 function hoot_dashboard( ...$args ) {
51 return hootkit_fnspace_bridge( 'fw_dashboard', '', ...$args );
52 }
53 endif;
54
55 /* template-functions.php */
56
57 if ( !function_exists( 'hootkit_thumbnail_size' ) ):
58 function hootkit_thumbnail_size( $size = '', $crop = NULL, $default = 'full' ) {
59 _deprecated_function( __FUNCTION__, '3.0.0', 'hoot_thumbnail_size()' );
60 return hootkit_fnspace_bridge( 'fw_thumbnail_size', $default, $size, $crop );
61 }
62 endif;
63 if ( !function_exists( 'hoot_thumbnail_size' ) ):
64 function hoot_thumbnail_size( ...$args ) {
65 return hootkit_fnspace_bridge( 'fw_thumbnail_size', 'full', ...$args );
66 }
67 endif;
68
69 if ( !function_exists( 'hootkit_post_thumbnail' ) ):
70 function hootkit_post_thumbnail( $classes = '', $size = '', $microdata = false, $link = '', $crop = NULL, $default = 'full' ) {
71 _deprecated_function( __FUNCTION__, '3.0.0', 'hoot_post_thumbnail()' );
72 return hootkit_fnspace_bridge( 'fw_post_thumbnail', $default, $classes, $size, $microdata, $link, $crop );
73 }
74 endif;
75 if ( !function_exists( 'hoot_post_thumbnail' ) ):
76 function hoot_post_thumbnail( ...$args ) {
77 return hootkit_fnspace_bridge( 'fw_post_thumbnail', 'full', ...$args );
78 }
79 endif;
80
81 if ( !function_exists( 'hoot_meta_info' ) ):
82 function hoot_meta_info( ...$args ) {
83 return hootkit_fnspace_bridge( 'fw_meta_info', array(), ...$args );
84 }
85 endif;
86 if ( !function_exists( 'hoot_display_meta_info' ) ):
87 function hoot_display_meta_info( ...$args ) {
88 return hootkit_fnspace_bridge( 'fw_display_meta_info', '', ...$args );
89 }
90 endif;
91
92 /* hoot-library-icons.php */
93
94 if ( !function_exists( 'hoot_sanitize_fa' ) ):
95 function hoot_sanitize_fa( ...$args ) {
96 return hootkit_fnspace_bridge( 'fw_sanitize_fa', '', ...$args );
97 }
98 endif;
99 if ( !function_exists( 'hoot_enum_icons' ) ):
100 function hoot_enum_icons( ...$args ) {
101 return hootkit_fnspace_bridge( 'fw_enum_icons', array(), ...$args );
102 }
103 endif;
104 if ( !function_exists( 'hoot_enum_social_profiles' ) ):
105 function hoot_enum_social_profiles( ...$args ) {
106 return hootkit_fnspace_bridge( 'fw_enum_social_profiles', array(), ...$args );
107 }
108 endif;
109 if ( !function_exists( 'hoot_fonticons_list' ) ):
110 function hoot_fonticons_list( ...$args ) {
111 return hootkit_fnspace_bridge( 'fw_fonticons_list', array(), ...$args );
112 }
113 endif;
114
115 /* hoot-library.php */
116
117 if ( !function_exists( 'hoot_sanitize_html_classes' ) ):
118 function hoot_sanitize_html_classes( ...$args ) {
119 return hootkit_fnspace_bridge( 'fw_sanitize_html_classes', '', ...$args );
120 }
121 endif;
122 if ( !function_exists( 'hoot_attr' ) ):
123 function hoot_attr( ...$args ) {
124 return hootkit_fnspace_bridge( 'fw_attr', '', ...$args );
125 }
126 endif;
127 if ( !function_exists( 'hoot_get_attr' ) ):
128 function hoot_get_attr( ...$args ) {
129 return hootkit_fnspace_bridge( 'fw_get_attr', '', ...$args );
130 }
131 endif;
132 if ( !function_exists( 'hoot_get_excerpt' ) ):
133 function hoot_get_excerpt( ...$args ) {
134 return hootkit_fnspace_bridge( 'fw_get_excerpt', '', ...$args );
135 }
136 endif;
137 if ( !function_exists( 'hoot_getexcerpt_customlength' ) ):
138 function hoot_getexcerpt_customlength( ...$args ) {
139 return hootkit_fnspace_bridge( 'fw_getexcerpt_customlength', '', ...$args );
140 }
141 endif;
142
143 global $hoot_data;
144 if ( !isset( $hoot_data ) || !is_object( $hoot_data ) )
145 $hoot_data = new stdClass();
146
147 if ( !function_exists( 'hoot_data' ) ):
148 function hoot_data( $key = '', $subkey = '' ) {
149 $prevtn = hootkit_fnspace_bridge( 'fw_data', 'prevtn', $key, $subkey );
150 if ( $prevtn !== 'prevtn' ) {
151 return $prevtn;
152 }
153
154 global $hoot_data;
155
156 // Return entire data object if no key provided
157 if ( ! $key ) {
158 return $hoot_data;
159 }
160
161 // Return data value
162 elseif ( $key && is_string( $key ) ) {
163 if ( isset( $hoot_data->$key ) ) {
164
165 if ( !$subkey || ( !is_string( $subkey ) && !is_integer( $subkey ) ) )
166 return $hoot_data->$key;
167
168 if ( is_object( $hoot_data->$key ) )
169 return ( isset( $hoot_data->$key->$subkey ) ) ? $hoot_data->$key->$subkey : null;
170
171 if ( is_array( $hoot_data->$key ) ) {
172 $arr = $hoot_data->$key;
173 return ( isset( $arr[ $subkey ] ) ) ? $arr[ $subkey ] : null;
174 }
175
176 } else {
177
178 // $key has not been set in $hoot_data
179 return null;
180
181 }
182 }
183
184 // $key provided but isn't a string - Nothing!
185
186 }
187 endif;
188 if ( !function_exists( 'hoot_get_data' ) ):
189 function hoot_get_data( $key = '', $subkey = '' ) {
190 $prevtn = hootkit_fnspace_bridge( 'fw_get_data', 'prevtn', $key, $subkey );
191 if ( $prevtn !== 'prevtn' ) {
192 return $prevtn;
193 }
194
195 return hoot_data( $key, $subkey );
196 }
197 endif;
198 if ( !function_exists( 'hoot_set_data' ) ):
199 function hoot_set_data( $key, $value, $override = true ) {
200 $prevtn = hootkit_fnspace_bridge( 'fw_set_data', 'prevtn', $key, $value, $override );
201 if ( $prevtn !== 'prevtn' ) {
202 return $prevtn;
203 }
204
205 global $hoot_data;
206 if ( !is_string( $key ) || empty( $key ) )
207 return false;
208 if ( !isset( $hoot_data->$key ) || $override ) {
209 $hoot_data->$key = $value;
210 return true;
211 }
212 return false;
213 }
214 endif;
215 if ( !function_exists( 'hoot_unset_data' ) ):
216 function hoot_unset_data( $key ) {
217 $prevtn = hootkit_fnspace_bridge( 'fw_unset_data', 'prevtn', $key );
218 if ( $prevtn !== 'prevtn' ) {
219 return $prevtn;
220 }
221
222 global $hoot_data;
223 if ( !is_string( $key ) || empty( $key ) )
224 return false;
225 if ( isset( $hoot_data->$key ) ) {
226 unset( $hoot_data->$key );
227 return true;
228 }
229 return false;
230 }
231 endif;
232 if ( !function_exists( 'hoot_get_widget' ) ):
233 function hoot_get_widget( ...$args ) {
234 return hootkit_fnspace_bridge( 'fw_get_widget', '', ...$args );
235 }
236 endif;
237 if ( !function_exists( 'hoot_get_mod' ) ):
238 function hoot_get_mod( $name, $default = NULL ) {
239 return hootkit_fnspace_bridge( 'fw_get_mod', $default, $name, $default );
240 }
241 endif;
242 if ( !function_exists( 'hoot_register_sidebar' ) ):
243 function hoot_register_sidebar( ...$args ) {
244 return hootkit_fnspace_bridge( 'fw_register_sidebar', '', ...$args );
245 }
246 endif;
247 if ( !function_exists( 'hoot_remove_readmore_link' ) ):
248 function hoot_remove_readmore_link( ...$args ) {
249 return hootkit_fnspace_bridge( 'fw_remove_readmore_link', '', ...$args );
250 }
251 endif;
252 if ( !function_exists( 'hoot_reinstate_readmore_link' ) ):
253 function hoot_reinstate_readmore_link( ...$args ) {
254 return hootkit_fnspace_bridge( 'fw_reinstate_readmore_link', '', ...$args );
255 }
256 endif;
257 if ( !function_exists( 'hoot_trim_content' ) ):
258 function hoot_trim_content( $raw, $words ) {
259 return hootkit_fnspace_bridge( 'fw_trim_content', $raw, $raw, $words );
260 }
261 endif;
262 if ( !function_exists( 'hoot_list_products_category' ) ):
263 function hoot_list_products_category( ...$args ) {
264 return hootkit_fnspace_bridge( 'fw_list_products_category', array(), ...$args );
265 }
266 endif;
267
268
269 if ( !class_exists( 'Hoot_List' ) ):
270 class Hoot_List {
271 protected static function call( $method, $args = array(), $default='' ) {
272 global $hootkit_theme_list;
273 if ( $hootkit_theme_list && is_callable( array( $hootkit_theme_list, $method ) ) ) {
274 return call_user_func_array( array( $hootkit_theme_list, $method ), $args );
275 }
276 _deprecated_function( $method, '3.0.0', 'hootlist_' . $method . '()' );
277 return $default;
278 }
279
280 static function listlength() {
281 return self::call( 'listlength', array(), 99 );
282 }
283 static function countval( $number ) {
284 return self::call( 'countval', array( $number ), 99 );
285 }
286 static function get_pages( $number = 0, $post_type = 'page' ){
287 return self::call( 'get_pages', array( $number, $post_type ), array() );
288 }
289 static function get_posts( $number = 0 ){
290 return self::call( 'get_posts', array( $number ), array() );
291 }
292 static function get_terms( $number = 0, $taxonomy = 'category' ){
293 return self::call( 'get_terms', array( $number, $taxonomy ), array() );
294 }
295 static function categories( $number = false ){
296 return self::call( 'categories', array( $number ), array() );
297 }
298 static function tags( $number = false ){
299 return self::call( 'tags', array( $number ), array() );
300 }
301 static function pages( $number = false ){
302 return self::call( 'pages', array( $number ), array() );
303 }
304 static function posts( $number = false ){
305 return self::call( 'posts', array( $number ), array() );
306 }
307 static function cpt( $post_type = 'page', $number = false ){
308 return self::call( 'cpt', array( $post_type, $number ), array() );
309 }
310 }
311 endif;
312