PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 1.5.2
Shortcodes and extra features for Phlox theme v1.5.2
2.17.22 2.17.21 2.17.20 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.6 1.0.9 1.1.0 1.3.0 1.3.1 1.3.10 1.3.14 1.3.2 1.3.3 1.3.6 1.4.0 1.4.1 1.4.2 1.5.0 1.5.2 1.6.0 1.6.2 1.6.4 1.7.0 1.7.2 2.10.0 2.10.1 2.10.3 2.10.5 2.10.7 2.10.8 2.10.9 2.11.0 2.11.1 2.11.2 2.12.0 2.14.0 2.15.0 2.15.2 2.15.4 2.15.5 2.15.6 2.15.7 2.15.8 2.15.9 2.16.0 2.16.1 2.16.2 2.16.3 2.16.4 2.17.0 2.17.1 2.17.12 2.17.13 2.17.14 2.17.15 2.17.16 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.8 2.17.9 2.4.12 2.4.13 2.4.14 2.4.16 2.4.18 2.4.19 2.4.9 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.15 2.5.16 2.5.17 2.5.19 2.5.2 2.5.20 2.5.3 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.10 2.6.12 2.6.13 2.6.14 2.6.15 2.6.16 2.6.17 2.6.19 2.6.2 2.6.20 2.6.4 2.6.5 2.6.7 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.9 2.9.0 2.9.12 2.9.14 2.9.15 2.9.16 2.9.17 2.9.18 2.9.19 2.9.2 2.9.20 2.9.21 2.9.22 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8
auxin-elements / admin / includes / admin-hooks.php
auxin-elements / admin / includes Last commit date
classes 8 years ago compatibility 8 years ago metaboxes 8 years ago modules 10 years ago admin-ajax.php 8 years ago admin-hooks.php 8 years ago admin-the-functions.php 8 years ago index.php 8 years ago
admin-hooks.php
594 lines
1 <?php
2
3
4
5
6 /*-----------------------------------------------------------------------------------*/
7 /* Add shortcode button to tinymce
8 /*-----------------------------------------------------------------------------------*/
9
10 function auxin_register_shortcode_button( $buttons ) {
11 array_push( $buttons, '|', 'phlox_shortcodes_button' );
12 return $buttons;
13 }
14
15 /**
16 * Add the shortcode button to TinyMCE
17 *
18 * @param array $plugin_array
19 * @return array
20 */
21 function auxin_add_elements_tinymce_plugin( $plugin_array ) {
22 $wp_version = get_bloginfo( 'version' );
23
24 $plugin_array['phlox_shortcodes_button'] = AUXELS_ADMIN_URL."/assets/js/tinymce/plugins/auxin-btns.js";
25
26 return $plugin_array;
27 }
28
29
30 function axion_init_shortcode_manager(){
31 if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )
32 return;
33
34 add_filter( 'mce_external_plugins', 'auxin_add_elements_tinymce_plugin' );
35 add_filter( 'mce_buttons', 'auxin_register_shortcode_button' );
36 }
37 add_action("init", "axion_init_shortcode_manager");
38
39 /*-----------------------------------------------------------------------------------*/
40 /* Add Editor styles
41 /*-----------------------------------------------------------------------------------*/
42
43 function auxin_register_mce_buttons_style(){
44 wp_register_style('auxin_mce_buttons' , AUXELS_ADMIN_URL. '/assets/css/editor.css', NULL, '1.1');
45 wp_enqueue_style('auxin_mce_buttons');
46 }
47 add_action('admin_enqueue_scripts', 'auxin_register_mce_buttons_style');
48
49
50
51 /*-----------------------------------------------------------------------------------*/
52 /* Adds demos tab in theme about (welcome) page
53 /*-----------------------------------------------------------------------------------*/
54
55 function auxin_welcome_page_display_section_demos(){
56 // all the demos information should add into this array
57 $demo_list = get_transient( 'auxin_'. THEME_ID .'_demo_list' );
58
59 if ( empty( $demo_list ) ){
60
61 $request = wp_remote_get( 'http://averta.net/phlox/wordpress-theme/demo/wp-content/list.json' );
62
63 if( is_wp_error( $request ) ) {
64 return false;
65 }
66
67 $body = wp_remote_retrieve_body( $request );
68 $demo_list = json_decode( $body );
69
70 set_transient( 'auxin_'. THEME_ID .'_demo_list', $demo_list, DAY_IN_SECONDS );
71 }
72
73 ?>
74 <h2 class="aux-featur"><?php esc_html_e( 'Choose the demo you want.', 'auxin-elements' ); ?></h2>
75 <h4 class="aux-featur demos-subtitle"><?php esc_html_e('Please note that, it is recommended to import a demo on a clean WordPress installation.', 'auxin-elements'); ?></h4>
76 <div class="changelog feature-section three-col">
77 <?php foreach ( $demo_list as $demo ) { ?>
78 <div class="col" id="<?php echo esc_attr( $demo->site_id ); ?>">
79 <img class="demos-img" src="<?php echo esc_url( $demo->thumbnail ) ; ?>" alt="<?php echo esc_attr( $demo->title ); ?>">
80 <h3><?php echo esc_html( $demo->title ); ?></h3>
81 <p><?php echo $demo->excerpt ; ?></p>
82
83 <a href="<?php echo esc_url( $demo->url ); ?>" class="button button-primary aux-button" target="_blank"><?php esc_html_e('Preview', 'auxin-elements'); ?></a>
84 <a href="" class="button button-primary aux-button import-demo">
85 <?php _e( 'Import Demo', 'auxin-elements' ); ?>
86 </a>
87 </div>
88 <?php } ?>
89
90 </div>
91 <?php
92 }
93
94 function auxin_welcome_add_section_demos( $sections ){
95
96 $sections['demos'] = array(
97 'label' => __( 'Demos', 'auxin-elements' ),
98 'description' => sprintf(__( 'you can see and import the %s demos in this section.', 'auxin-elements'), THEME_NAME_I18N ),
99 'callback' => 'auxin_welcome_page_display_section_demos'
100 );
101
102 return $sections;
103 }
104
105 add_filter( 'auxin_admin_welcome_sections', 'auxin_welcome_add_section_demos', 60 );
106
107 /*-----------------------------------------------------------------------------------*/
108 /* Adds system status tab in theme about (welcome) page
109 /*-----------------------------------------------------------------------------------*/
110
111 function auxin_about_system_status( $sections ){
112
113 $sections['status'] = array(
114 'label' => __( 'System Status', 'auxin-elements' ),
115 'description' => __( 'The informaition about your WordPress installation which can be helpful for debugging or monitoring your website.', 'auxin-elements'),
116 'callback' => 'auxin_get_about_system_status'
117 );
118
119 return $sections;
120 }
121
122 add_filter( 'auxin_admin_welcome_sections', 'auxin_about_system_status', 100 );
123
124
125 /*-----------------------------------------------------------------------------------*/
126 /* Adds feedback tab in theme about (welcome) page
127 /*-----------------------------------------------------------------------------------*/
128
129 function auxin_welcome_page_display_section_feedback(){
130 // the previous rate of the client
131 $previous_rate = auxin_get_option( 'user_rating' );
132 $support_tab_url = admin_url( 'themes.php?page=auxin-welcome&tab=support' );
133 ?>
134
135 <div class="changelog feature-section two-col feedback">
136
137 <form class="aux-feedback-form" action="<?php echo admin_url( 'admin.php?page=auxin-welcome&tab=feedback'); ?>" method="post" >
138
139 <div class="aux-rating-section">
140 <h2 class="aux-featur"><?php _e('How likely are you to recommend Phlox to a friend?', 'auxin-elements' ); ?></h2>
141 <div class="aux-theme-ratings">
142 <?php
143 for( $i = 1; $i <= 5; $i++ ){
144 printf(
145 '<div class="aux-rate-cell"><input type="radio" name="theme_rate" id="theme-rating%1$s" value="%1$s" %2$s/><label class="rating" for="theme-rating%1$s">%1$s</label></div>',
146 $i, checked( $previous_rate, $i, false )
147 );
148 }
149 ?>
150
151 </div>
152 <div class="aux-ratings-measure">
153 <p>Don't like it</p>
154 <p>Like it so much</p>
155 </div>
156 </div>
157
158 <div class="aux-feedback-section aux-hide">
159 <h2 class="aux-featur"><?php _e('Please explain why you gave this score (optional)', 'auxin-elements'); ?></h2>
160 <h4 class="aux-featur feedback-subtitle">
161 <?php
162 printf( __( 'Please do not use this form to get support, in this case please check the %s help section %s', 'auxin-elements' ),
163 '<a href="' . $support_tab_url . '">', '</a>' ); ?>
164 </h4>
165 <textarea placeholder="Enter your feedback here" rows="10" name="feedback" class="large-text"></textarea>
166 <input type="text" placeholder="Email address (Optional)" name="email" class="text-input" />
167 <?php wp_nonce_field( 'phlox_feedback' ); ?>
168
169 <input type="submit" class="button button-primary aux-button" value="Submit feedback" />
170
171 <div class="aux-sending-status">
172 <img class="ajax-progress aux-hide" src="<?php echo AUXIN_URL; ?>/css/images/elements/saving.gif" />
173 <span class="ajax-response aux-hide" ><?php _e( 'Submitting your feedback ..', 'auxin-elements' ); ?></span>
174 </div>
175
176 </div>
177
178 <?php auxin_send_feedback_mail(); ?>
179 </form>
180 </div>
181
182 <?php
183 }
184
185 function auxin_welcome_add_section_feedback( $sections ){
186
187 $sections['feedback'] = array(
188 'label' => __( 'Feedback', 'auxin-elements' ),
189 'description' => sprintf(__( 'Please leave a feedback and help us to improve %s theme.', 'auxin-elements'), THEME_NAME_I18N ),
190 'callback' => 'auxin_welcome_page_display_section_feedback'
191 );
192
193 return $sections;
194 }
195
196 add_filter( 'auxin_admin_welcome_sections', 'auxin_welcome_add_section_feedback', 90 );
197
198 function auxin_send_feedback_mail(){
199 if ( ! ( ! isset( $_POST['phlox_feedback'] ) || ! wp_verify_nonce( $_POST['phlox_feedback'], 'feedback_send') ) ) {
200
201 $email = ! empty( $_POST["email"] ) ? sanitize_email( $_POST["email"] ) : 'Empty';
202 $feedback = ! empty( $_POST["feedback"] ) ? esc_textarea( $_POST["feedback"] ) : '';
203
204 if( $feedback ){
205 wp_mail( 'info@averta.net', 'feedback from phlox dashboard', $feedback . chr(0x0D).chr(0x0A) . 'Email: ' . $email );
206 $text = __( 'Thanks for your feedback', 'auxin-elements' );
207 } else{
208 $text = __('Please try again and fill up at least the feedback field.', 'auxin-elements');
209 }
210
211 printf('<p class="notification">%s</p>', $text);
212 }
213 }
214
215 /*-----------------------------------------------------------------------------------*/
216 /* Adds subtitle meta field to 'Title setting' tab
217 /*-----------------------------------------------------------------------------------*/
218
219 function auxin_add_metabox_field_to_title_setting_tab( $fields, $id, $type ){
220
221 if( 'general-title' == $id ){
222 array_unshift(
223 $fields,
224 array(
225 'title' => __('Subtitle', 'auxin-elements'),
226 'description' => __('Second Title (optional). Note: You have to enable "Display Title Bar Section" option in order to display the subtitle.', 'auxin-elements'),
227 'id' => 'page_subtitle',
228 'type' => 'editor',
229 'default' => ''
230 )
231 );
232 }
233
234 return $fields;
235 }
236 add_filter( 'auxin_metabox_fields', 'auxin_add_metabox_field_to_title_setting_tab', 10, 3 );
237
238
239 /**
240 * Display changelogs on welcome page
241 *
242 * @param string $theme_id The theme ID that we intent to display the it's changelog
243 * @return void
244 */
245 function auxels_add_changelog_to_welcome_page( $theme_id ){
246
247
248 if( function_exists('auxin_get_remote_changelog') ){
249
250 // sanitize the theme id
251 $theme_id = esc_sql( $theme_id );
252
253 // get remote changelog
254 if( false === $changelog_info = get_transient( "auxin_{$theme_id}_remote_changelog" ) ){
255
256 $changelog = auxin_get_remote_changelog( $theme_id );
257
258 if( is_wp_error( $changelog ) ){
259 echo $changelog->get_error_message();
260 } else {
261 $changelog_info = json_decode( $changelog, true );
262 set_transient( "auxin_{$theme_id}_remote_changelog", $changelog_info, 2 * HOUR_IN_SECONDS );
263 }
264
265 }
266
267 // print the changelog
268 if( $changelog_info && ! empty( $changelog_info['version'] ) && ! empty( $changelog_info['changelog'] ) ){
269 echo '<a href="http://support.averta.net/en/changelog/'.$theme_id.'/" target="_blank"><h2 class="aux-featur">' . __( "What's New in version", 'auxin-elements') . ' '. $changelog_info['version'] . '</h2></a>';
270 echo '<div class="welcome-changelog">';
271 echo str_replace("\n", "<br />", $changelog_info['changelog'] );
272 echo '</div>';
273 }
274
275 }
276
277 }
278
279 add_action( 'auxin_welcome_page_after_feature_section', 'auxels_add_changelog_to_welcome_page' );
280
281 /*-----------------------------------------------------------------------------------*/
282 /* Adds Custom JavaScript meta field to 'Advanced setting' tab
283 /*-----------------------------------------------------------------------------------*/
284
285 function auxin_add_metabox_field_to_advanced_setting_tab( $fields, $id, $type ){
286
287 if( 'general-advanced' == $id ){
288 $fields[] = array(
289 'title' => __('Custom JavaScript Code', 'auxin-elements'),
290 'description' => __('Attention: The following custom JavaScript code will be applied ONLY to this page.', 'auxin-elements').'<br />'.
291 __('For defining global JavaScript roles, please use custom javaScript field on option panel.', 'auxin-elements' ),
292 'id' => 'aux_page_custom_js',
293 'type' => 'code',
294 'mode' => 'javascript',
295 'default' => ''
296 );
297 }
298 return $fields;
299 }
300 add_filter( 'auxin_metabox_fields', 'auxin_add_metabox_field_to_advanced_setting_tab', 10, 3 );
301
302
303
304 /*-----------------------------------------------------------------------------------*/
305 /* Define demo info list / for auxin-element plugin
306 /*-----------------------------------------------------------------------------------*/
307
308 /**
309 * Retrieves the list of available demos for current theme
310 *
311 * @return array List of demos
312 */
313 function auxels_add_to_demo_info_list( $default_demos ){
314
315 $demos_list = array(
316 'the-journey' => array(
317 'id' => 'the-journey',
318 'title' => __('The Journey', 'auxin-elements'),
319 'desc' => __('Create your awesome Journey Website using this demo as a starter. Best choice for adventure looks.', 'auxin-elements'),
320 'preview_url' => 'http://averta.net/phlox/demo/journey/',
321 'thumb_url' => AUXELS_URL . '/embeds/demos/journey-blog/banner.jpg',
322 'file' => AUXELS_DIR . '/embeds/demos/journey-blog/data.xml'
323 ),
324 'classic-blog' => array(
325 'id' => 'classic-blog',
326 'title' => __('Classic Blog', 'auxin-elements'),
327 'desc' => __('Create your classic good looking Blog using this demo as a starter. Best choice for a classic blogger.', 'auxin-elements'),
328 'preview_url' => 'http://averta.net/phlox/demo/classic-blog/',
329 'thumb_url' => AUXELS_URL . '/embeds/demos/classic-blog/banner.jpg',
330 'file' => AUXELS_DIR . '/embeds/demos/classic-blog/data.xml'
331 ),
332 'food-blog' => array(
333 'id' => 'food-blog',
334 'title' => __('Food Blog', 'auxin-elements'),
335 'desc' => __('Create your awesome Food Website using this demo as a starter. Best choice for restaurant looks.', 'auxin-elements'),
336 'preview_url' => 'http://averta.net/phlox/demo/food/',
337 'thumb_url' => AUXELS_URL . '/embeds/demos/food-blog/banner.jpg',
338 'file' => AUXELS_DIR . '/embeds/demos/food-blog/data.xml'
339 ),
340 'portfolio' => array(
341 'id' => 'portfolio',
342 'title' => __('Protfolio', 'auxin-elements'),
343 'desc' => __('A stunning demo for Phlox portfolio that represents your projects in a modern and stylish way.', 'auxin-elements'),
344 'preview_url' => 'http://averta.net/phlox/demo/portfolio/',
345 'thumb_url' => AUXELS_URL . '/embeds/demos/portfolio/banner.jpg',
346 'file' => AUXELS_DIR . '/embeds/demos/food-blog/data.xml'
347 ),
348 'default' => array(
349 'id' => 'default',
350 'title' => __('Default', 'auxin-elements'),
351 'desc' => __('An excellent example to get familiar with all available layouts, elements, shortcodes and other features of Phlox.', 'auxin-elements'),
352 'preview_url' => 'http://averta.net/phlox/demo/default/',
353 'thumb_url' => AUXELS_URL . '/embeds/demos/default/banner.jpg',
354 'file' => AUXELS_DIR . '/embeds/demos/default/data.xml'
355 )
356 );
357
358 return array_merge( $default_demos, $demos_list );
359 }
360
361 add_filter( 'auxin_get_demo_info_list', 'auxels_add_to_demo_info_list' );
362
363 /*-----------------------------------------------------------------------------------*/
364 /* Adding fallback for deprecated theme option name
365 /*-----------------------------------------------------------------------------------*/
366
367 function auxels_sync_deprecated_options(){
368
369 $old_theme_options = get_option( THEME_ID . '_formatted_options' );
370 if( false === $old_theme_options ){
371 return;
372 }
373
374 $new_theme_options = get_option( THEME_ID . '_theme_options' );
375 if( false === $new_theme_options ){
376 update_option( THEME_ID . '_theme_options', $old_theme_options );
377 }
378 }
379 add_action( 'admin_init', 'auxels_sync_deprecated_options' );
380
381 /*-----------------------------------------------------------------------------------*/
382 /* Add allowed custom mieme types
383 /*-----------------------------------------------------------------------------------*/
384
385 function auxin_mime_types( $mimes ) {
386 $mimes['svg'] = 'image/svg+xml';
387 return $mimes;
388 }
389
390 add_filter('upload_mimes', 'auxin_mime_types');
391
392
393 /*-----------------------------------------------------------------------------------*/
394 /* Add post format related metafields to post
395 /*-----------------------------------------------------------------------------------*/
396
397 function auxels_add_post_metabox_models( $models ){
398
399 // Load general metabox models
400 include_once( 'metaboxes/metabox-fields-post-audio.php' );
401 include_once( 'metaboxes/metabox-fields-post-gallery.php' );
402 include_once( 'metaboxes/metabox-fields-post-quote.php' );
403 include_once( 'metaboxes/metabox-fields-post-video.php' );
404
405 $models[] = array(
406 'model' => auxin_metabox_fields_post_gallery(),
407 'priority' => 20
408 );
409
410 $models[] = array(
411 'model' => auxin_metabox_fields_post_video(),
412 'priority' => 22
413 );
414
415 $models[] = array(
416 'model' => auxin_metabox_fields_post_audio(),
417 'priority' => 24
418 );
419
420 $models[] = array(
421 'model' => auxin_metabox_fields_post_quote(),
422 'priority' => 26
423 );
424
425 $models[] = array(
426 'model' => auxin_metabox_fields_general_advanced(),
427 'priority' => 36
428 );
429
430 return $models;
431 }
432
433 add_filter( 'auxin_admin_metabox_models_post', 'auxels_add_post_metabox_models' );
434
435 /*-----------------------------------------------------------------------------------*/
436 /* Add advanced metafields to page
437 /*-----------------------------------------------------------------------------------*/
438
439 function auxels_add_page_metabox_models( $models ){
440
441
442 $models[] = array(
443 'model' => auxin_metabox_fields_general_advanced(),
444 'priority' => 36
445 );
446
447 return $models;
448 }
449
450 add_filter( 'auxin_admin_metabox_models_page', 'auxels_add_page_metabox_models' );
451
452 /*-----------------------------------------------------------------------------------*/
453 /* Add theme tab in siteorigin page builder
454 /*-----------------------------------------------------------------------------------*/
455
456 function auxin_add_widget_tabs($tabs) {
457 $tabs[] = array(
458 'title' => THEME_NAME,
459 'filter' => array(
460 'groups' => array('auxin')
461 )
462 );
463
464 if (isset($tabs['recommended'])){
465 unset($tabs['recommended']);
466 }
467
468
469 return $tabs;
470 }
471 add_filter( 'siteorigin_panels_widget_dialog_tabs', 'auxin_add_widget_tabs', 20 );
472
473 // =============================================================================
474
475 function auxin_admin_footer_text( $footer_text ) {
476
477 // the admin pages that we intent to display theme footer text on
478 $admin_pages = array(
479 'toplevel_page_auxin',
480 'appearance_page_auxin',
481 'toplevel_page_auxin-welcome',
482 'appearance_page_auxin-welcome',
483 'page',
484 'post',
485 'widgets',
486 'dashboard',
487 'edit-post',
488 'edit-page',
489 'edit-portfolio'
490 );
491
492 if( ! ( function_exists('auxin_is_theme_admin_page') && auxin_is_theme_admin_page( $admin_pages ) ) ){
493 return $footer_text;
494 }
495
496 $welcome_tab_url = admin_url( 'themes.php?page=auxin-welcome&tab=' );
497
498 $auxin_text = sprintf(
499 __( 'Quick access to %sdashboard%s, %soptions%s, %ssupport%s and %sfeedback%s page.', 'auxin-elements' ),
500 '<a href="'. $welcome_tab_url .'features" title="Version ' . THEME_NAME_I18N . '" >' . THEME_NAME_I18N . ' ',
501 '</a>',
502 '<a href="'. admin_url( 'customize.php' ). '?url=' . $welcome_tab_url .'features" title="'. __('Theme Customizer', 'auxin-elements' ) .'" >',
503 '</a>',
504 '<a href="'. $welcome_tab_url .'support">',
505 '</a>',
506 '<a href="'. $welcome_tab_url .'feedback">',
507 '</a>'
508 );
509
510 return '<span id="footer-thankyou">' . $auxin_text . '</span>';
511 }
512 add_filter( 'admin_footer_text', 'auxin_admin_footer_text' );
513
514
515
516 /*-----------------------------------------------------------------------------------*/
517 /* Assign menus on start or after demo import
518 /*-----------------------------------------------------------------------------------*/
519
520 /**
521 * Automatically assigns the appropriate menus to menu locations
522 * Known Locations:
523 * - header-primary : There should be a menu with the word "Primary" Or "Mega" in its name
524 * - header-secondary: There should be a menu with the word "Secondary" in its name
525 * - footer : There should be a menu with the word "Footer" in its name
526 *
527 * @return bool True if at least one menu was assigned, false otherwise
528 */
529 function auxin_assign_default_menus(){
530
531 $assinged = false;
532 $locations = get_theme_mod('nav_menu_locations');
533 $nav_menus = wp_get_nav_menus();
534
535 foreach ( $nav_menus as $nav_menu ) {
536 $menu_name = strtolower( $nav_menu->name );
537
538 if( empty( $locations['header-secondary'] ) && preg_match( '(secondary)', $menu_name ) ){
539 $locations['header-secondary'] = $nav_menu->term_id;
540 $assinged = true;
541 } elseif( empty( $locations['header-primary'] ) && preg_match( '(primary|mega|header)', $menu_name ) ){
542 $locations['header-primary'] = $nav_menu->term_id;
543 $assinged = true;
544 } elseif( empty( $locations['footer'] ) && preg_match( '(footer)', $menu_name ) ){
545 $locations['footer'] = $nav_menu->term_id;
546 $assinged = true;
547 }
548 }
549
550 set_theme_mod( 'nav_menu_locations', $locations );
551 return $assinged;
552 }
553
554 add_action( 'after_switch_theme', 'auxin_assign_default_menus' ); // triggers when theme will be actived, WP 3.3
555 add_action( 'import_end', 'auxin_assign_default_menus' ); // triggers when the theme data was imported
556
557 /*-----------------------------------------------------------------------------------*/
558 /* Remove any script tag fromt custom js (if user used them in the script content)
559 /*-----------------------------------------------------------------------------------*/
560
561 /**
562 * Strip <script> tags
563 *
564 * @param string $js_string The custom js string
565 * @return string The sanitized custom js code
566 */
567 function auxels_strip_script_tags_from_custom_js( $js_string ){
568 if ( false !== stripos( $js_string, '</script>' ) ) {
569 $js_string = str_replace( array( "<script>", "</script>" ), array('', ''), $js_string );
570 }
571 return $js_string;
572 }
573 add_filter( 'auxin_custom_js_string', 'auxels_strip_script_tags_from_custom_js' );
574
575 /*-----------------------------------------------------------------------------------*/
576 /* Remove any style tag fromt custom css (if user used them in the style content)
577 /*-----------------------------------------------------------------------------------*/
578
579 /**
580 * Strip <style> tags
581 *
582 * @param string $css_string The custom css string
583 * @return string The sanitized custom css code
584 */
585 function auxels_strip_style_tags_from_custom_css( $css_string ){
586 if ( false !== stripos( $css_string, '</style>' ) ) {
587 $css_string = str_replace( array( "<style>", "</style>" ), array('', ''), $css_string );
588 }
589 return $css_string;
590 }
591 add_filter( 'auxin_custom_css_string', 'auxels_strip_style_tags_from_custom_css' );
592
593 /*-----------------------------------------------------------------------------------*/
594