1 <?php |
1 <?php |
2 /** |
2 /** |
3 * Plugin Name: OptionTree |
3 * Plugin Name: OptionTree |
4 * Plugin URI: https://github.com/valendesigns/option-tree/ |
4 * Plugin URI: https://github.com/valendesigns/option-tree/ |
5 * Description: Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes. |
5 * Description: Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes. |
6 * Version: 2.5.5 |
6 * Version: 2.6.0 |
7 * Author: Derek Herman |
7 * Author: Derek Herman |
8 * Author URI: http://valendesigns.com |
8 * Author URI: http://valendesigns.com |
9 * License: GPLv3 |
9 * License: GPLv3 |
|
10 * Text Domain: option-tree |
10 */ |
11 */ |
11 |
12 |
12 /** |
13 /** |
13 * Forces Plugin Mode when OptionTree is already loaded and displays an admin notice. |
14 * Forces Plugin Mode when OptionTree is already loaded and displays an admin notice. |
14 */ |
15 */ |
88 |
89 |
89 } else { |
90 } else { |
90 |
91 |
91 if ( apply_filters( 'ot_child_theme_mode', false ) == true ) { |
92 if ( apply_filters( 'ot_child_theme_mode', false ) == true ) { |
92 |
93 |
93 $path = ltrim( end( @explode( get_stylesheet(), str_replace( '\\', '/', dirname( __FILE__ ) ) ) ), '/' ); |
94 $path = @explode( get_stylesheet(), str_replace( '\\', '/', dirname( __FILE__ ) ) ); |
|
95 $path = ltrim( end( $path ), '/' ); |
94 define( 'OT_LANG_DIR', trailingslashit( trailingslashit( get_stylesheet_directory() ) . $path ) . trailingslashit( 'languages' ) . 'theme-mode' ); |
96 define( 'OT_LANG_DIR', trailingslashit( trailingslashit( get_stylesheet_directory() ) . $path ) . trailingslashit( 'languages' ) . 'theme-mode' ); |
95 |
97 |
96 } else { |
98 } else { |
97 |
99 |
98 $path = ltrim( end( @explode( get_template(), str_replace( '\\', '/', dirname( __FILE__ ) ) ) ), '/' ); |
100 $path = @explode( get_template(), str_replace( '\\', '/', dirname( __FILE__ ) ) ); |
|
101 $path = ltrim( end( $path ), '/' ); |
99 define( 'OT_LANG_DIR', trailingslashit( trailingslashit( get_template_directory() ) . $path ) . trailingslashit( 'languages' ) . 'theme-mode' ); |
102 define( 'OT_LANG_DIR', trailingslashit( trailingslashit( get_template_directory() ) . $path ) . trailingslashit( 'languages' ) . 'theme-mode' ); |
100 |
103 |
101 } |
104 } |
102 |
105 |
103 } |
106 } |
176 private function constants() { |
179 private function constants() { |
177 |
180 |
178 /** |
181 /** |
179 * Current Version number. |
182 * Current Version number. |
180 */ |
183 */ |
181 define( 'OT_VERSION', '2.5.5' ); |
184 define( 'OT_VERSION', '2.6.0' ); |
182 |
185 |
183 /** |
186 /** |
184 * For developers: Theme mode. |
187 * For developers: Theme mode. |
185 * |
188 * |
186 * Run a filter and set to true to enable OptionTree theme mode. |
189 * Run a filter and set to true to enable OptionTree theme mode. |
394 add_action( 'init', 'ot_register_theme_options_page' ); |
397 add_action( 'init', 'ot_register_theme_options_page' ); |
395 |
398 |
396 /* Registers the Settings page */ |
399 /* Registers the Settings page */ |
397 if ( OT_SHOW_PAGES == true ) { |
400 if ( OT_SHOW_PAGES == true ) { |
398 add_action( 'init', 'ot_register_settings_page' ); |
401 add_action( 'init', 'ot_register_settings_page' ); |
|
402 |
|
403 /* global CSS */ |
|
404 add_action( 'admin_head', array( $this, 'global_admin_css' ) ); |
399 } |
405 } |
400 |
406 |
401 } |
407 } |
402 |
408 |
403 /** |
409 /** |
484 /* save layouts */ |
490 /* save layouts */ |
485 add_action( 'admin_init', 'ot_modify_layouts', 7 ); |
491 add_action( 'admin_init', 'ot_modify_layouts', 7 ); |
486 |
492 |
487 /* create media post */ |
493 /* create media post */ |
488 add_action( 'admin_init', 'ot_create_media_post', 8 ); |
494 add_action( 'admin_init', 'ot_create_media_post', 8 ); |
489 |
|
490 /* global CSS */ |
|
491 add_action( 'admin_head', array( $this, 'global_admin_css' ) ); |
|
492 |
495 |
493 /* Google Fonts front-end CSS */ |
496 /* Google Fonts front-end CSS */ |
494 add_action( 'wp_enqueue_scripts', 'ot_load_google_fonts_css', 1 ); |
497 add_action( 'wp_enqueue_scripts', 'ot_load_google_fonts_css', 1 ); |
495 |
498 |
496 /* dynamic front-end CSS */ |
499 /* dynamic front-end CSS */ |
581 url("' . OT_URL . 'assets/fonts/option-tree-font.ttf") format("truetype"), |
584 url("' . OT_URL . 'assets/fonts/option-tree-font.ttf") format("truetype"), |
582 url("' . OT_URL . 'assets/fonts/option-tree-font.svg#option-tree-font") format("svg"); |
585 url("' . OT_URL . 'assets/fonts/option-tree-font.svg#option-tree-font") format("svg"); |
583 font-weight: normal; |
586 font-weight: normal; |
584 font-style: normal; |
587 font-style: normal; |
585 } |
588 } |
586 #adminmenu #toplevel_page_ot-settings .menu-icon-generic div.wp-menu-image:before, |
589 #adminmenu #toplevel_page_ot-settings .menu-icon-generic div.wp-menu-image:before { |
587 #option-tree-header #option-tree-logo a:before { |
|
588 font: normal ' . $fontsize . '/1 "option-tree-font" !important; |
590 font: normal ' . $fontsize . '/1 "option-tree-font" !important; |
589 speak: none; |
591 speak: none; |
590 padding: 6px 0; |
592 padding: 6px 0; |
591 height: 34px; |
593 height: 34px; |
592 width: 20px; |
594 width: 20px; |
595 -moz-osx-font-smoothing: grayscale; |
597 -moz-osx-font-smoothing: grayscale; |
596 -webkit-transition: all .1s ease-in-out; |
598 -webkit-transition: all .1s ease-in-out; |
597 -moz-transition: all .1s ease-in-out; |
599 -moz-transition: all .1s ease-in-out; |
598 transition: all .1s ease-in-out; |
600 transition: all .1s ease-in-out; |
599 } |
601 } |
600 #adminmenu #toplevel_page_ot-settings .menu-icon-generic div.wp-menu-image:before, |
602 #adminmenu #toplevel_page_ot-settings .menu-icon-generic div.wp-menu-image:before { |
601 #option-tree-header #option-tree-logo a:before { |
|
602 content: "\e785"; |
603 content: "\e785"; |
603 } |
|
604 #option-tree-header #option-tree-logo a:before { |
|
605 font-size: 20px !important; |
|
606 height: 24px; |
|
607 padding: 2px 0; |
|
608 }' . $wp_38minus . ' |
604 }' . $wp_38minus . ' |
609 </style> |
605 </style> |
610 '; |
606 '; |
611 } |
607 } |
612 |
608 |
660 |
656 |
661 /** |
657 /** |
662 * AJAX utility function for adding a new list item. |
658 * AJAX utility function for adding a new list item. |
663 */ |
659 */ |
664 public function add_list_item() { |
660 public function add_list_item() { |
|
661 check_ajax_referer( 'option_tree', 'nonce' ); |
665 ot_list_item_view( $_REQUEST['name'], $_REQUEST['count'], array(), $_REQUEST['post_id'], $_REQUEST['get_option'], unserialize( ot_decode( $_REQUEST['settings'] ) ), $_REQUEST['type'] ); |
662 ot_list_item_view( $_REQUEST['name'], $_REQUEST['count'], array(), $_REQUEST['post_id'], $_REQUEST['get_option'], unserialize( ot_decode( $_REQUEST['settings'] ) ), $_REQUEST['type'] ); |
666 die(); |
663 die(); |
667 } |
664 } |
668 |
665 |
669 /** |
666 /** |
670 * AJAX utility function for adding a new social link. |
667 * AJAX utility function for adding a new social link. |
671 */ |
668 */ |
672 public function add_social_links() { |
669 public function add_social_links() { |
|
670 check_ajax_referer( 'option_tree', 'nonce' ); |
673 ot_social_links_view( $_REQUEST['name'], $_REQUEST['count'], array(), $_REQUEST['post_id'], $_REQUEST['get_option'], unserialize( ot_decode( $_REQUEST['settings'] ) ), $_REQUEST['type'] ); |
671 ot_social_links_view( $_REQUEST['name'], $_REQUEST['count'], array(), $_REQUEST['post_id'], $_REQUEST['get_option'], unserialize( ot_decode( $_REQUEST['settings'] ) ), $_REQUEST['type'] ); |
674 die(); |
672 die(); |
675 } |
673 } |
676 |
674 |
677 /** |
675 /** |