PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 1.6.2
Shortcodes and extra features for Phlox theme v1.6.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
601 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 auxels_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", "auxels_init_shortcode_manager");
38
39
40 /*-----------------------------------------------------------------------------------*/
41 /* Wizard admin notice
42 /*-----------------------------------------------------------------------------------*/
43
44 /**
45 * Skip the notice for running the setup wizard
46 *
47 * @return void
48 */
49 function auxels_hide_wizard_notice() {
50 if ( isset( $_GET['auxels-hide-wizard-notice'] ) && isset( $_GET['_notice_nonce'] ) ) {
51 if ( ! wp_verify_nonce( $_GET['_notice_nonce'], 'auxels_hide_notices_nonce' ) ) {
52 wp_die( __( 'Authorization failed. Please refresh the page and try again.', 'auxin-elements' ) );
53 }
54 auxin_update_option( 'auxels_hide_wizard_notice', 1 );
55 }
56 }
57 add_action( 'wp_loaded', 'auxels_hide_wizard_notice' );
58
59
60 /**
61 * Display a notice for running the setup wizard
62 *
63 * @return void
64 */
65 function auxels_wizard_notice(){
66 if( auxin_get_option( 'auxels_hide_wizard_notice' ) ){
67 return;
68 }
69 ?>
70 <div id="message" class="updated auxin-message">
71 <p><?php _e( '<strong>Welcome to Phlox</strong> &#8211; You can import demo content and install recommended plugins using setup wizard.', 'auxin-elements' ); ?></p>
72 <p class="submit"><a href="<?php echo esc_url( Auxin_Wizard::get_instance()->get_page_link() ); ?>" class="button-primary"><?php _e( 'Run Setup Wizard', 'auxin-elements' ); ?></a> <a class="button-secondary skip" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'auxels-hide-wizard-notice', 'install' ), 'auxels_hide_notices_nonce', '_notice_nonce' ) ); ?>"><?php _e( 'Skip Setup', 'auxin-elements' ); ?></a></p>
73 </div>
74 <?php
75 }
76
77 add_action( 'admin_notices', 'auxels_wizard_notice' );
78
79 /*-----------------------------------------------------------------------------------*/
80 /* Add Editor styles
81 /*-----------------------------------------------------------------------------------*/
82
83 function auxin_register_mce_buttons_style(){
84 wp_register_style('auxin_mce_buttons' , AUXELS_ADMIN_URL. '/assets/css/editor.css', NULL, '1.1');
85 wp_enqueue_style('auxin_mce_buttons');
86 }
87 add_action('admin_enqueue_scripts', 'auxin_register_mce_buttons_style');
88
89
90
91 /*-----------------------------------------------------------------------------------*/
92 /* Adds demos tab in theme about (welcome) page
93 /*-----------------------------------------------------------------------------------*/
94
95 function auxin_welcome_add_section_demos( $sections ){
96
97 $sections['demos'] = array(
98 'label' => __( 'Setup Wizard', 'auxin-elements' ),
99 'description' => '',
100 'url' => Auxin_Wizard::get_instance()->get_page_link()
101 );
102
103 return $sections;
104 }
105
106 add_filter( 'auxin_admin_welcome_sections', 'auxin_welcome_add_section_demos', 60 );
107
108 /*-----------------------------------------------------------------------------------*/
109 /* Adds system status tab in theme about (welcome) page
110 /*-----------------------------------------------------------------------------------*/
111
112 function auxin_about_system_status( $sections ){
113
114 $sections['status'] = array(
115 'label' => __( 'System Status', 'auxin-elements' ),
116 'description' => __( 'The informaition about your WordPress installation which can be helpful for debugging or monitoring your website.', 'auxin-elements'),
117 'callback' => 'auxin_get_about_system_status'
118 );
119
120 return $sections;
121 }
122
123 add_filter( 'auxin_admin_welcome_sections', 'auxin_about_system_status', 100 );
124
125
126 /*-----------------------------------------------------------------------------------*/
127 /* Adds feedback tab in theme about (welcome) page
128 /*-----------------------------------------------------------------------------------*/
129
130 function auxin_welcome_page_display_section_feedback(){
131 // the previous rate of the client
132 $previous_rate = auxin_get_option( 'user_rating' );
133 $support_tab_url = admin_url( 'themes.php?page=auxin-welcome&tab=support' );
134 ?>
135
136 <div class="changelog feature-section two-col feedback">
137
138 <form class="aux-feedback-form" action="<?php echo admin_url( 'admin.php?page=auxin-welcome&tab=feedback'); ?>" method="post" >
139
140 <div class="aux-rating-section">
141 <h2 class="aux-featur"><?php _e('How likely are you to recommend Phlox to a friend?', 'auxin-elements' ); ?></h2>
142 <div class="aux-theme-ratings">
143 <?php
144 for( $i = 1; $i <= 5; $i++ ){
145 printf(
146 '<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>',
147 $i, checked( $previous_rate, $i, false )
148 );
149 }
150 ?>
151
152 </div>
153 <div class="aux-ratings-measure">
154 <p>Don't like it</p>
155 <p>Like it so much</p>
156 </div>
157 </div>
158
159 <div class="aux-feedback-section aux-hide">
160 <h2 class="aux-featur"><?php _e('Please explain why you gave this score (optional)', 'auxin-elements'); ?></h2>
161 <h4 class="aux-featur feedback-subtitle">
162 <?php
163 printf( __( 'Please do not use this form to get support, in this case please check the %s help section %s', 'auxin-elements' ),
164 '<a href="' . $support_tab_url . '">', '</a>' ); ?>
165 </h4>
166 <textarea placeholder="Enter your feedback here" rows="10" name="feedback" class="large-text"></textarea>
167 <input type="text" placeholder="Email address (Optional)" name="email" class="text-input" />
168 <?php wp_nonce_field( 'phlox_feedback' ); ?>
169
170 <input type="submit" class="button button-primary aux-button" value="Submit feedback" />
171
172 <div class="aux-sending-status">
173 <img class="ajax-progress aux-hide" src="<?php echo AUXIN_URL; ?>/css/images/elements/saving.gif" />
174 <span class="ajax-response aux-hide" ><?php _e( 'Submitting your feedback ..', 'auxin-elements' ); ?></span>
175 </div>
176
177 </div>
178
179 <?php auxin_send_feedback_mail(); ?>
180 </form>
181 </div>
182
183 <?php
184 }
185
186 function auxin_welcome_add_section_feedback( $sections ){
187
188 $sections['feedback'] = array(
189 'label' => __( 'Feedback', 'auxin-elements' ),
190 'description' => sprintf(__( 'Please leave a feedback and help us to improve %s theme.', 'auxin-elements'), THEME_NAME_I18N ),
191 'callback' => 'auxin_welcome_page_display_section_feedback'
192 );
193
194 return $sections;
195 }
196
197 add_filter( 'auxin_admin_welcome_sections', 'auxin_welcome_add_section_feedback', 90 );
198
199 function auxin_send_feedback_mail(){
200 if ( ! ( ! isset( $_POST['phlox_feedback'] ) || ! wp_verify_nonce( $_POST['phlox_feedback'], 'feedback_send') ) ) {
201
202 $email = ! empty( $_POST["email"] ) ? sanitize_email( $_POST["email"] ) : 'Empty';
203 $feedback = ! empty( $_POST["feedback"] ) ? esc_textarea( $_POST["feedback"] ) : '';
204
205 if( $feedback ){
206 wp_mail( 'info@averta.net', 'feedback from phlox dashboard', $feedback . chr(0x0D).chr(0x0A) . 'Email: ' . $email );
207 $text = __( 'Thanks for your feedback', 'auxin-elements' );
208 } else{
209 $text = __('Please try again and fill up at least the feedback field.', 'auxin-elements');
210 }
211
212 printf('<p class="notification">%s</p>', $text);
213 }
214 }
215
216 /*-----------------------------------------------------------------------------------*/
217 /* Adds subtitle meta field to 'Title setting' tab
218 /*-----------------------------------------------------------------------------------*/
219
220 function auxin_add_metabox_field_to_title_setting_tab( $fields, $id, $type ){
221
222 if( 'general-title' == $id ){
223 array_unshift(
224 $fields,
225 array(
226 'title' => __('Subtitle', 'auxin-elements'),
227 'description' => __('Second Title (optional). Note: You have to enable "Display Title Bar Section" option in order to display the subtitle.', 'auxin-elements'),
228 'id' => 'page_subtitle',
229 'type' => 'editor',
230 'default' => ''
231 )
232 );
233 }
234
235 return $fields;
236 }
237 add_filter( 'auxin_metabox_fields', 'auxin_add_metabox_field_to_title_setting_tab', 10, 3 );
238
239
240 /**
241 * Display changelogs on welcome page
242 *
243 * @param string $theme_id The theme ID that we intent to display the it's changelog
244 * @return void
245 */
246 function auxels_add_changelog_to_welcome_page( $theme_id ){
247
248
249 if( function_exists('auxin_get_remote_changelog') ){
250
251 // sanitize the theme id
252 $theme_id = esc_sql( $theme_id );
253
254 // get remote changelog
255 if( false === $changelog_info = get_transient( "auxin_{$theme_id}_remote_changelog" ) ){
256
257 $changelog = auxin_get_remote_changelog( $theme_id );
258
259 if( is_wp_error( $changelog ) ){
260 echo $changelog->get_error_message();
261 } else {
262 $changelog_info = json_decode( $changelog, true );
263 set_transient( "auxin_{$theme_id}_remote_changelog", $changelog_info, 2 * HOUR_IN_SECONDS );
264 }
265
266 }
267
268 // print the changelog
269 if( $changelog_info && ! empty( $changelog_info['version'] ) && ! empty( $changelog_info['changelog'] ) ){
270 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>';
271 echo '<div class="welcome-changelog">';
272 echo str_replace("\n", "<br />", $changelog_info['changelog'] );
273 echo '</div>';
274 }
275
276 }
277
278 }
279
280 add_action( 'auxin_welcome_page_after_feature_section', 'auxels_add_changelog_to_welcome_page' );
281
282 /*-----------------------------------------------------------------------------------*/
283 /* Adds Custom JavaScript meta field to 'Advanced setting' tab
284 /*-----------------------------------------------------------------------------------*/
285
286 function auxin_add_metabox_field_to_advanced_setting_tab( $fields, $id, $type ){
287
288 if( 'general-advanced' == $id ){
289 $fields[] = array(
290 'title' => __('Custom JavaScript Code', 'auxin-elements'),
291 'description' => __('Attention: The following custom JavaScript code will be applied ONLY to this page.', 'auxin-elements').'<br />'.
292 __('For defining global JavaScript roles, please use custom javaScript field on option panel.', 'auxin-elements' ),
293 'id' => 'aux_page_custom_js',
294 'type' => 'code',
295 'mode' => 'javascript',
296 'default' => ''
297 );
298 }
299 return $fields;
300 }
301 add_filter( 'auxin_metabox_fields', 'auxin_add_metabox_field_to_advanced_setting_tab', 10, 3 );
302
303
304
305 /*-----------------------------------------------------------------------------------*/
306 /* Define demo info list / for auxin-element plugin
307 /*-----------------------------------------------------------------------------------*/
308
309 /**
310 * Retrieves the list of available demos for current theme
311 *
312 * @return array List of demos
313 */
314 function auxels_add_to_demo_info_list( $default_demos ){
315
316 $demos_list = array(
317 'the-journey' => array(
318 'id' => 'the-journey',
319 'title' => __('The Journey', 'auxin-elements'),
320 'desc' => __('Create your awesome Journey Website using this demo as a starter. Best choice for adventure looks.', 'auxin-elements'),
321 'preview_url' => 'http://averta.net/phlox/demo/journey/',
322 'thumb_url' => AUXELS_URL . '/embeds/demos/journey-blog/banner.jpg',
323 'file' => AUXELS_DIR . '/embeds/demos/journey-blog/data.xml'
324 ),
325 'classic-blog' => array(
326 'id' => 'classic-blog',
327 'title' => __('Classic Blog', 'auxin-elements'),
328 'desc' => __('Create your classic good looking Blog using this demo as a starter. Best choice for a classic blogger.', 'auxin-elements'),
329 'preview_url' => 'http://averta.net/phlox/demo/classic-blog/',
330 'thumb_url' => AUXELS_URL . '/embeds/demos/classic-blog/banner.jpg',
331 'file' => AUXELS_DIR . '/embeds/demos/classic-blog/data.xml'
332 ),
333 'food-blog' => array(
334 'id' => 'food-blog',
335 'title' => __('Food Blog', 'auxin-elements'),
336 'desc' => __('Create your awesome Food Website using this demo as a starter. Best choice for restaurant looks.', 'auxin-elements'),
337 'preview_url' => 'http://averta.net/phlox/demo/food/',
338 'thumb_url' => AUXELS_URL . '/embeds/demos/food-blog/banner.jpg',
339 'file' => AUXELS_DIR . '/embeds/demos/food-blog/data.xml'
340 ),
341 'portfolio' => array(
342 'id' => 'portfolio',
343 'title' => __('Protfolio', 'auxin-elements'),
344 'desc' => __('A stunning demo for Phlox portfolio that represents your projects in a modern and stylish way.', 'auxin-elements'),
345 'preview_url' => 'http://averta.net/phlox/demo/portfolio/',
346 'thumb_url' => AUXELS_URL . '/embeds/demos/portfolio/banner.jpg',
347 'file' => AUXELS_DIR . '/embeds/demos/food-blog/data.xml'
348 ),
349 'default' => array(
350 'id' => 'default',
351 'title' => __('Default', 'auxin-elements'),
352 'desc' => __('An excellent example to get familiar with all available layouts, elements, shortcodes and other features of Phlox.', 'auxin-elements'),
353 'preview_url' => 'http://averta.net/phlox/demo/default/',
354 'thumb_url' => AUXELS_URL . '/embeds/demos/default/banner.jpg',
355 'file' => AUXELS_DIR . '/embeds/demos/default/data.xml'
356 )
357 );
358
359 return array_merge( $default_demos, $demos_list );
360 }
361
362 add_filter( 'auxin_get_demo_info_list', 'auxels_add_to_demo_info_list' );
363
364 /*-----------------------------------------------------------------------------------*/
365 /* Adding fallback for deprecated theme option name
366 /*-----------------------------------------------------------------------------------*/
367
368 function auxels_sync_deprecated_options(){
369
370 $old_theme_options = get_option( THEME_ID . '_formatted_options' );
371 if( false === $old_theme_options ){
372 return;
373 }
374
375 $new_theme_options = get_option( THEME_ID . '_theme_options' );
376 if( false === $new_theme_options ){
377 update_option( THEME_ID . '_theme_options', $old_theme_options );
378 }
379 }
380 add_action( 'admin_init', 'auxels_sync_deprecated_options' );
381
382 /*-----------------------------------------------------------------------------------*/
383 /* Add allowed custom mieme types
384 /*-----------------------------------------------------------------------------------*/
385
386 function auxin_mime_types( $mimes ) {
387 $mimes['svg'] = 'image/svg+xml';
388 return $mimes;
389 }
390
391 add_filter('upload_mimes', 'auxin_mime_types');
392
393
394 /*-----------------------------------------------------------------------------------*/
395 /* Add post format related metafields to post
396 /*-----------------------------------------------------------------------------------*/
397
398 function auxels_add_post_metabox_models( $models ){
399
400 // Load general metabox models
401 include_once( 'metaboxes/metabox-fields-post-audio.php' );
402 include_once( 'metaboxes/metabox-fields-post-gallery.php' );
403 include_once( 'metaboxes/metabox-fields-post-quote.php' );
404 include_once( 'metaboxes/metabox-fields-post-video.php' );
405
406 $models[] = array(
407 'model' => auxin_metabox_fields_post_gallery(),
408 'priority' => 20
409 );
410
411 $models[] = array(
412 'model' => auxin_metabox_fields_post_video(),
413 'priority' => 22
414 );
415
416 $models[] = array(
417 'model' => auxin_metabox_fields_post_audio(),
418 'priority' => 24
419 );
420
421 $models[] = array(
422 'model' => auxin_metabox_fields_post_quote(),
423 'priority' => 26
424 );
425
426 $models[] = array(
427 'model' => auxin_metabox_fields_general_advanced(),
428 'priority' => 36
429 );
430
431 return $models;
432 }
433
434 add_filter( 'auxin_admin_metabox_models_post', 'auxels_add_post_metabox_models' );
435
436 /*-----------------------------------------------------------------------------------*/
437 /* Add advanced metafields to page
438 /*-----------------------------------------------------------------------------------*/
439
440 function auxels_add_page_metabox_models( $models ){
441
442
443 $models[] = array(
444 'model' => auxin_metabox_fields_general_advanced(),
445 'priority' => 36
446 );
447
448 return $models;
449 }
450
451 add_filter( 'auxin_admin_metabox_models_page', 'auxels_add_page_metabox_models' );
452
453 /*-----------------------------------------------------------------------------------*/
454 /* Add theme tab in siteorigin page builder
455 /*-----------------------------------------------------------------------------------*/
456
457 function auxin_add_widget_tabs($tabs) {
458 $tabs[] = array(
459 'title' => THEME_NAME,
460 'filter' => array(
461 'groups' => array('auxin')
462 )
463 );
464
465 if (isset($tabs['recommended'])){
466 unset($tabs['recommended']);
467 }
468
469
470 return $tabs;
471 }
472 add_filter( 'siteorigin_panels_widget_dialog_tabs', 'auxin_add_widget_tabs', 20 );
473
474 // =============================================================================
475
476 function auxin_admin_footer_text( $footer_text ) {
477
478 // the admin pages that we intent to display theme footer text on
479 $admin_pages = array(
480 'toplevel_page_auxin',
481 'appearance_page_auxin',
482 'toplevel_page_auxin-welcome',
483 'appearance_page_auxin-welcome',
484 'page',
485 'post',
486 'widgets',
487 'dashboard',
488 'edit-post',
489 'edit-page',
490 'edit-portfolio'
491 );
492
493 if( ! ( function_exists('auxin_is_theme_admin_page') && auxin_is_theme_admin_page( $admin_pages ) ) ){
494 return $footer_text;
495 }
496
497 $welcome_tab_url = admin_url( 'themes.php?page=auxin-welcome&tab=' );
498
499 $auxin_text = sprintf(
500 __( 'Quick access to %sdashboard%s, %soptions%s, %ssupport%s and %sfeedback%s page.', 'auxin-elements' ),
501 '<a href="'. $welcome_tab_url .'features" title="Version ' . THEME_NAME_I18N . '" >' . THEME_NAME_I18N . ' ',
502 '</a>',
503 '<a href="'. admin_url( 'customize.php' ). '?url=' . $welcome_tab_url .'features" title="'. __('Theme Customizer', 'auxin-elements' ) .'" >',
504 '</a>',
505 '<a href="'. $welcome_tab_url .'support">',
506 '</a>',
507 '<a href="'. $welcome_tab_url .'feedback">',
508 '</a>'
509 );
510
511 return '<span id="footer-thankyou">' . $auxin_text . '</span>';
512 }
513 add_filter( 'admin_footer_text', 'auxin_admin_footer_text' );
514
515
516
517 /*-----------------------------------------------------------------------------------*/
518 /* Assign menus on start or after demo import
519 /*-----------------------------------------------------------------------------------*/
520
521 /**
522 * Automatically assigns the appropriate menus to menu locations
523 * Known Locations:
524 * - header-primary : There should be a menu with the word "Primary" Or "Mega" in its name
525 * - header-secondary: There should be a menu with the word "Secondary" in its name
526 * - footer : There should be a menu with the word "Footer" in its name
527 *
528 * @return bool True if at least one menu was assigned, false otherwise
529 */
530 function auxin_assign_default_menus(){
531
532 $assinged = false;
533 $locations = get_theme_mod('nav_menu_locations');
534 $nav_menus = wp_get_nav_menus();
535
536 foreach ( $nav_menus as $nav_menu ) {
537 $menu_name = strtolower( $nav_menu->name );
538
539 if( empty( $locations['header-secondary'] ) && preg_match( '(secondary)', $menu_name ) ){
540 $locations['header-secondary'] = $nav_menu->term_id;
541 $assinged = true;
542 } elseif( empty( $locations['header-primary'] ) && preg_match( '(primary|mega|header)', $menu_name ) ){
543 $locations['header-primary'] = $nav_menu->term_id;
544 $assinged = true;
545 } elseif( empty( $locations['footer'] ) && preg_match( '(footer)', $menu_name ) ){
546 $locations['footer'] = $nav_menu->term_id;
547 $assinged = true;
548 }
549 }
550
551 set_theme_mod( 'nav_menu_locations', $locations );
552 return $assinged;
553 }
554
555 add_action( 'after_switch_theme', 'auxin_assign_default_menus' ); // triggers when theme will be actived, WP 3.3
556 add_action( 'import_end', 'auxin_assign_default_menus' ); // triggers when the theme data was imported
557
558 /*-----------------------------------------------------------------------------------*/
559 /* Remove any script tag fromt custom js (if user used them in the script content)
560 /*-----------------------------------------------------------------------------------*/
561
562 /**
563 * Strip <script> tags
564 *
565 * @param string $js_string The custom js string
566 * @return string The sanitized custom js code
567 */
568 function auxels_strip_script_tags_from_custom_js( $js_string ){
569 if ( false !== stripos( $js_string, '</script>' ) ) {
570 $js_string = str_replace( array( "<script>", "</script>" ), array('', ''), $js_string );
571 }
572 return $js_string;
573 }
574 add_filter( 'auxin_custom_js_string', 'auxels_strip_script_tags_from_custom_js' );
575
576 /*-----------------------------------------------------------------------------------*/
577 /* Remove any style tag fromt custom css (if user used them in the style content)
578 /*-----------------------------------------------------------------------------------*/
579
580 /**
581 * Strip <style> tags
582 *
583 * @param string $css_string The custom css string
584 * @return string The sanitized custom css code
585 */
586 function auxels_strip_style_tags_from_custom_css( $css_string ){
587 if ( false !== stripos( $css_string, '</style>' ) ) {
588 $css_string = str_replace( array( "<style>", "</style>" ), array('', ''), $css_string );
589 }
590 return $css_string;
591 }
592 add_filter( 'auxin_custom_css_string', 'auxels_strip_style_tags_from_custom_css' );
593
594 /*-----------------------------------------------------------------------------------*/
595
596 function auxin_update_custom_js_css_file_on_post_save( $post_ID ){
597 auxin_save_custom_js();
598 auxin_save_custom_css();
599 }
600 add_action( "save_post", "auxin_update_custom_js_css_file_on_post_save" );
601