Weaver Xtreme Theme Support - Version 2.0

Version Description

This is the initial release of this plugin.

Download this release

Release Info

Developer wpweaver
Plugin Icon 128x128 Weaver Xtreme Theme Support
Version 2.0
Comparing to
See all releases

Code changes from version 1.9.7 to 2.0

admin/add-weaverx-sapi-options.php CHANGED
@@ -14,11 +14,14 @@ function weaverx_admin_ts_head() { // action definition
14
  require_once(dirname(__FILE__ ) . '/admin-lib-ts.php');
15
  require_once(dirname(__FILE__ ) . '/admin-lib-ts-2.php');
16
 
 
 
17
  add_action('weaverx_admin_subthemes', 'weaverx_ts_weaverx_admin_subthemes');
18
  add_action('weaverx_admin_mainopts', 'weaverx_ts_weaverx_admin_mainopts');
19
  add_action('weaverx_admin_advancedopts', 'weaverx_ts_weaverx_admin_advancedopts');
20
 
21
 
 
22
  }
23
  // admin actions function definitons
24
 
@@ -42,6 +45,13 @@ function weaverx_ts_weaverx_admin_advancedopts() {
42
  weaverx_admin_advancedopts();
43
  }
44
 
 
 
 
 
 
 
 
45
  } // END IF CAN EDIT POSTS ---------------------------------------------------------------------
46
 
47
 
14
  require_once(dirname(__FILE__ ) . '/admin-lib-ts.php');
15
  require_once(dirname(__FILE__ ) . '/admin-lib-ts-2.php');
16
 
17
+ add_action('weaverx_admin_saverestore', 'weaverx_ts_weaverx_admin_saverestore');
18
+
19
  add_action('weaverx_admin_subthemes', 'weaverx_ts_weaverx_admin_subthemes');
20
  add_action('weaverx_admin_mainopts', 'weaverx_ts_weaverx_admin_mainopts');
21
  add_action('weaverx_admin_advancedopts', 'weaverx_ts_weaverx_admin_advancedopts');
22
 
23
 
24
+
25
  }
26
  // admin actions function definitons
27
 
45
  weaverx_admin_advancedopts();
46
  }
47
 
48
+ function weaverx_ts_weaverx_admin_saverestore() {
49
+
50
+ require_once( dirname(__FILE__ ) . '/admin-saverestore.php');
51
+
52
+ weaverx_ts_admin_saverestore();
53
+ }
54
+
55
  } // END IF CAN EDIT POSTS ---------------------------------------------------------------------
56
 
57
 
admin/admin-lib-ts-2.php CHANGED
@@ -570,6 +570,14 @@ function weaverx_form_menu_opts( $value, $submit = false ) {
570
  'id' => $id .'_menu_pad_dec', 'type' => 'val_em',
571
  'info' => '<em>' . $name . '</em>' . __(': Add vertical padding to Desktop menu bar and submenus (Default: 0.6em)', 'weaver-xtreme' /*adm*/) ),
572
 
 
 
 
 
 
 
 
 
573
  array( 'name' => '<span class="i-left" style="font-size:150%;">&harr;</span><small>' . __('Desktop Menu Spacing. (not on Smart Menus)', 'weaver-xtreme' /*adm*/) . '</small>',
574
  'id' => $id .'_right_padding_dec' , 'type' => 'val_em',
575
  'info' => '<em>' . $name . '</em>' . __(': Add space between desktop menu bar items (Use value &gt; 1.0)', 'weaver-xtreme' /*adm*/) ),
570
  'id' => $id .'_menu_pad_dec', 'type' => 'val_em',
571
  'info' => '<em>' . $name . '</em>' . __(': Add vertical padding to Desktop menu bar and submenus (Default: 0.6em)', 'weaver-xtreme' /*adm*/) ),
572
 
573
+ array( 'name' => '<span class="i-left dashicons dashicons-align-none"></span><small>' . __('Menu Top Margin', 'weaver-xtreme' /*adm*/) . '</small>',
574
+ 'id' => $id .'_top_margin_dec', 'type' => 'val_px',
575
+ 'info' => '<em>' . $name . '</em>' . __(': Top margin for menu bar.', 'weaver-xtreme' /*adm*/) ),
576
+ array( 'name' => '<span class="i-left dashicons dashicons-align-none"></span><small>' . __('Menu Bottom Margin', 'weaver-xtreme' /*adm*/) . '</small>',
577
+ 'id' => $id .'_bottom_margin_dec', 'type' => 'val_px',
578
+ 'info' => '<em>' . $name . '</em>' . __(': Bottom margin for menu bar.', 'weaver-xtreme' /*adm*/) ),
579
+
580
+
581
  array( 'name' => '<span class="i-left" style="font-size:150%;">&harr;</span><small>' . __('Desktop Menu Spacing. (not on Smart Menus)', 'weaver-xtreme' /*adm*/) . '</small>',
582
  'id' => $id .'_right_padding_dec' , 'type' => 'val_em',
583
  'info' => '<em>' . $name . '</em>' . __(': Add space between desktop menu bar items (Use value &gt; 1.0)', 'weaver-xtreme' /*adm*/) ),
admin/admin-lib-ts.php CHANGED
@@ -47,6 +47,33 @@ function weaverx_process_options_themes() {
47
  weaverx_setopt('_hide_theme_thumbs', !$hide);
48
  return true;
49
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  return false;
51
  }
52
 
@@ -573,4 +600,125 @@ function weaverx_form_header_area($value) {
573
  <?php
574
  }
575
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
576
  ?>
47
  weaverx_setopt('_hide_theme_thumbs', !$hide);
48
  return true;
49
  }
50
+
51
+ // save/restore options
52
+ if ( weaverx_submitted( 'weaverx_clear_messages' )) {
53
+ return true;
54
+ }
55
+ if (weaverx_submitted('reset_weaverx')) {
56
+ if (! current_user_can('manage_options'))
57
+ wp_die(__('You do not have the capability to do that.', 'weaver-xtreme' /*adm*/));
58
+ // delete everything!
59
+ weaverx_save_msg(__('All Weaver Xtreme settings have been reset to the defaults.','weaver-xtreme'));
60
+ delete_option( apply_filters('weaverx_options','weaverx_settings') );
61
+ global $weaverx_opts_cache;
62
+ $weaverx_opts_cache = false; // clear the cache
63
+ weaverx_init_opts('reset_weaverx');
64
+ delete_option( apply_filters('weaverx_options','weaverx_settings_backup') );
65
+
66
+ do_action('weaverxplus_admin','reset_weaverxplus');
67
+
68
+ update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice', 0 ); // reset the dismiss on the plugin loader
69
+ return true;
70
+ }
71
+
72
+ if (weaverx_submitted('uploadtheme') && function_exists('weaverx_loadtheme')) {
73
+ weaverx_loadtheme();
74
+ return true;
75
+ }
76
+
77
  return false;
78
  }
79
 
600
  <?php
601
  }
602
 
603
+ //-- load theme settings needed here
604
+
605
+ function weaverx_loadtheme() {
606
+ if (!(isset($_POST['uploadit']) && $_POST['uploadit'] == 'yes')) return;
607
+
608
+ // upload theme from users computer
609
+ // they've supplied and uploaded a file
610
+
611
+ $ok = true; // no errors so far
612
+
613
+ if (isset($_FILES['uploaded']['name']))
614
+ $filename = $_FILES['uploaded']['name'];
615
+ else
616
+ $filename = "";
617
+
618
+ if (isset($_FILES['uploaded']['tmp_name'])) {
619
+ $openname = $_FILES['uploaded']['tmp_name'];
620
+ } else {
621
+ $openname = "";
622
+ }
623
+
624
+ //Check the file extension
625
+ $check_file = strtolower($filename);
626
+ $pat = '.'; // PHP version strict checking bug...
627
+ $end = explode($pat, $check_file);
628
+ $ext_check = end($end);
629
+
630
+
631
+ if ($filename == "") {
632
+ $errors[] = __('You didn\'t select a file to upload.', 'weaver-xtreme' /*adm*/) . "<br />";
633
+ $ok = false;
634
+ }
635
+
636
+ if ($ok && $ext_check != 'wxt' && $ext_check != 'wxb'){
637
+ $errors[] = __('Theme files must have <em>.wxt</em> or <em>.wxb</em> extension.', 'weaver-xtreme' /*adm*/) . '<br />';
638
+ $ok = false;
639
+ }
640
+
641
+ if ($ok) {
642
+ if (!weaverx_f_exists($openname)) {
643
+ $errors[] = '<strong><em style="color:red;">' .
644
+ __('Sorry, there was a problem uploading your file.
645
+ You may need to check your folder permissions or other server settings.', 'weaver-xtreme' /*adm*/) .
646
+ '</em></strong><br />(' . __('Trying to use file', 'weaver-xtreme' /*adm*/) . ' <em>' . $openname . '</em>)';
647
+ $ok = false;
648
+ }
649
+ }
650
+ if (!$ok) {
651
+ echo '<div id="message" class="updated fade"><p><strong><em style="color:red;">' .
652
+ __('ERROR', 'weaver-xtreme' /*adm*/) . '</em></strong></p><p>';
653
+ foreach($errors as $error){
654
+ echo $error.'<br />';
655
+ }
656
+ echo '</p></div>';
657
+ } else { // OK - read file and save to My Saved Theme
658
+ // $handle has file handle to temp file.
659
+ $contents = weaverx_f_get_contents($openname);
660
+
661
+ if ( ! weaverx_ex_set_current_to_serialized_values($contents,'weaverx_uploadit:'.$openname ) ) {
662
+ echo '<div id="message" class="updated fade"><p><strong><em style="color:red;">' .
663
+ __('Sorry, there was a problem uploading your file.
664
+ The file you picked was not a valid Weaver Xtreme theme file.', 'weaver-xtreme' /*adm*/) .
665
+ '</em></strong></p></div>';
666
+ } else {
667
+ weaverx_save_msg( __('Weaver Xtreme theme options reset to uploaded theme.', 'weaver-xtreme' /*adm*/) );
668
+ }
669
+ }
670
+ }
671
+
672
+ function weaverx_ex_set_current_to_serialized_values($contents) {
673
+ global $weaverx_opts_cache; // need to mess with the cache
674
+
675
+ if (substr($contents,0,10) == 'WXT-V01.00')
676
+ $type = 'theme';
677
+ else if (substr($contents,0,10) == 'WXB-V01.00')
678
+ $type = 'backup';
679
+ else {
680
+ $val = substr($contents,0,10);
681
+ return weaverx_f_fail(__("Wrong theme file format version", 'weaver-xtreme' /*adm*/) . ':' . $val); /* simple check for one of ours */
682
+ }
683
+ $restore = array();
684
+ $restore = unserialize(substr($contents,10));
685
+
686
+ if (!$restore) return weaverx_f_fail(__("Unserialize failed", 'weaver-xtreme' /*adm*/));
687
+
688
+ $version = weaverx_getopt('weaverx_version_id'); // get something to force load
689
+
690
+ if ($type == 'theme') {
691
+ // need to clear some settings
692
+ // first, pickup the per-site settings that aren't theme related...
693
+ $new_cache = array();
694
+ foreach ($weaverx_opts_cache as $key => $val) {
695
+ if (isset($key[0]) && $key[0] == '_') // these are non-theme specific settings
696
+ $new_cache[$key] = $val; // keep
697
+ }
698
+ $opts = $restore['weaverx_base']; // fetch base opts
699
+ weaverx_delete_all_options();
700
+
701
+ foreach ($opts as $key => $val) {
702
+ if (isset($key[0]) && $key[0] != '_')
703
+ weaverx_setopt($key, $val, false); // overwrite with saved theme values
704
+ }
705
+
706
+ foreach ($new_cache as $key => $val) { // set the values we need to keep
707
+ weaverx_setopt($key,$val,false);
708
+ }
709
+ } else if ($type == 'backup') {
710
+ weaverx_delete_all_options();
711
+
712
+ $opts = $restore['weaverx_base']; // fetch base opts
713
+ foreach ($opts as $key => $val) {
714
+ weaverx_setopt($key, $val, false); // overwrite with saved values
715
+ }
716
+ }
717
+ weaverx_setopt('weaverx_version_id',$version); // keep version, force save of db
718
+ weaverx_setopt('wvrx_css_saved','');
719
+ weaverx_setopt('last_option','Weaver Xtreme');
720
+ weaverx_save_opts('loading theme'); // OK, now we've saved the options, update them in the DB
721
+ return true;
722
+ }
723
+
724
  ?>
admin/admin-mainopts.php CHANGED
@@ -482,12 +482,12 @@ function weaverx_mainopts_menus() {
482
  array('name' => __('Mini-Menu', 'weaver-xtreme' /*adm*/), 'id' => 'm_header_mini', 'type' => 'titles_text',
483
  'info' => __('Color of Mini-Menu Link Items', 'weaver-xtreme' /*adm*/)),
484
 
485
- array('name' => '<small>' . __('Mini-Menu Hover', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => 'm_header_mini_hover_color', 'type' => 'ctext',
486
  'info' => __('Hover Color for Mini-Menu Links', 'weaver-xtreme' /*adm*/)),
487
 
488
  array('name' => '<span class="i-left dashicons dashicons-align-none"></span><small>' . __('Mini Menu Top Margin', 'weaver-xtreme' /*adm*/) . '</small>',
489
  'id' => 'm_header_mini_top_margin_dec', 'type' => 'val_em',
490
- 'info' => __('Top margin for Mini-Menu. Negative value moves it up. (Default: -1.0em)', 'weaver-xtreme' /*adm*/)),
491
 
492
  array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Mini Menu', 'weaver-xtreme' /*adm*/) . '</small>',
493
  'id' => 'm_header_mini_hide', 'type' => 'select_hide',
@@ -788,7 +788,7 @@ function weaverx_mainopts_posts() {
788
 
789
  array('name' => '<span class="i-left dashicons dashicons-admin-comments"></span><small>' . __('Show Comment Bubble', 'weaver-xtreme' /*adm*/) . '</small>',
790
  'id' => 'show_post_bubble', 'type' => 'checkbox',
791
- 'info' => __("Show comment bubble with link to comments on the post info line", 'weaver-xtreme' /*adm*/)),
792
 
793
  array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide <em>Post Format</em> Icons', 'weaver-xtreme' /*adm*/) . '</small>',
794
  'id' => 'hide_post_format_icon', 'type' => '+checkbox',
@@ -797,9 +797,18 @@ function weaverx_mainopts_posts() {
797
 
798
 
799
 
800
- array('name' => __('Post Layout', 'weaver-xtreme' /*adm*/), 'id' => '-schedule', 'type' => 'subheader_alt',
801
  'info' => __('Layout of Posts', 'weaver-xtreme' /*adm*/)),
802
 
 
 
 
 
 
 
 
 
 
803
  array('name' => '<span class="i-left" style=font-size:120%;">&nbsp;&#9783;</span>' . __('Columns of Posts', 'weaver-xtreme' /*adm*/), 'id' => 'blog_cols', 'type' => 'select_id', //code
804
  'info' => __('Display posts on blog page with this many columns. (You should adjust "Display posts on blog page with this many columns" on Settings:Reading to be a multiple of this value.)', 'weaver-xtreme' /*adm*/),
805
  'value' => array(
482
  array('name' => __('Mini-Menu', 'weaver-xtreme' /*adm*/), 'id' => 'm_header_mini', 'type' => 'titles_text',
483
  'info' => __('Color of Mini-Menu Link Items', 'weaver-xtreme' /*adm*/)),
484
 
485
+ array('name' => '<small>' . __('Mini Menu Hover', 'weaver-xtreme' /*adm*/) . '</small>', 'id' => 'm_header_mini_hover_color', 'type' => 'ctext',
486
  'info' => __('Hover Color for Mini-Menu Links', 'weaver-xtreme' /*adm*/)),
487
 
488
  array('name' => '<span class="i-left dashicons dashicons-align-none"></span><small>' . __('Mini Menu Top Margin', 'weaver-xtreme' /*adm*/) . '</small>',
489
  'id' => 'm_header_mini_top_margin_dec', 'type' => 'val_em',
490
+ 'info' => __('Top margin for Mini-Menu. Negative value moves it up. (Default: 0em)', 'weaver-xtreme' /*adm*/)),
491
 
492
  array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide Mini Menu', 'weaver-xtreme' /*adm*/) . '</small>',
493
  'id' => 'm_header_mini_hide', 'type' => 'select_hide',
788
 
789
  array('name' => '<span class="i-left dashicons dashicons-admin-comments"></span><small>' . __('Show Comment Bubble', 'weaver-xtreme' /*adm*/) . '</small>',
790
  'id' => 'show_post_bubble', 'type' => 'checkbox',
791
+ 'info' => __("Show comment bubble with link to comments on the post info line.", 'weaver-xtreme' /*adm*/)),
792
 
793
  array('name' => '<span class="i-left dashicons dashicons-visibility"></span><small>' . __('Hide <em>Post Format</em> Icons', 'weaver-xtreme' /*adm*/) . '</small>',
794
  'id' => 'hide_post_format_icon', 'type' => '+checkbox',
797
 
798
 
799
 
800
+ array('name' => __('Post Layout', 'weaver-xtreme' /*adm*/), 'id' => '-schedule', 'type' => 'subheader_alt',
801
  'info' => __('Layout of Posts', 'weaver-xtreme' /*adm*/)),
802
 
803
+ array('name' => '<span class="i-left" style=font-size:120%;">&nbsp;&#9783;</span>' . __('Post Content Columns', 'weaver-xtreme' /*adm*/), 'id' => 'post_cols', 'type' => 'select_id', //code
804
+ 'info' => __('Automatically split all post content into columns for both blog and single page views. <em>This is post content only.</em> This is not the same as "Columns of Posts". (Always 1 column on IE&lt;=9.)', 'weaver-xtreme' /*adm*/),
805
+ 'value' => array(
806
+ array('val' => '1', 'desc' => __('1 Column', 'weaver-xtreme' /*adm*/)),
807
+ array('val' => '2', 'desc' => __('2 Columns', 'weaver-xtreme' /*adm*/)),
808
+ array('val' => '3', 'desc' => __('3 Columns', 'weaver-xtreme' /*adm*/)),
809
+ array('val' => '4', 'desc' => __('4 Columns', 'weaver-xtreme' /*adm*/)))
810
+ ),
811
+
812
  array('name' => '<span class="i-left" style=font-size:120%;">&nbsp;&#9783;</span>' . __('Columns of Posts', 'weaver-xtreme' /*adm*/), 'id' => 'blog_cols', 'type' => 'select_id', //code
813
  'info' => __('Display posts on blog page with this many columns. (You should adjust "Display posts on blog page with this many columns" on Settings:Reading to be a multiple of this value.)', 'weaver-xtreme' /*adm*/),
814
  'value' => array(
admin/admin-saverestore.php ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( !defined('ABSPATH')) exit; // Exit if accessed directly
3
+ /* Weaver Xtreme - admin Save/Restore
4
+ * __ added - 12/10/14
5
+ * This will come after the Options form has been closed, and is used for non-SAPI options
6
+ *
7
+ */
8
+
9
+
10
+ function weaverx_ts_admin_saverestore() {
11
+ $saved = get_option( apply_filters('weaverx_options','weaverx_settings_backup') ,array());
12
+ $style_date = '';
13
+ if (!empty($saved))
14
+ $style_date = $saved['style_date'];
15
+
16
+ if (! $style_date ) $style_date = __('No saved settings', 'weaver-xtreme' /*adm*/);
17
+ ?>
18
+
19
+ <div class="atw-option-header" style="clear:both;"><?php _e('Save/Restore Theme Settings', 'weaver-xtreme' /*adm*/);weaverx_help_link('help.html#SaveRestore',_e('Help on Save/Restore Themes', 'weaver-xtreme' /*adm*/));?></div>
20
+ <p>
21
+ <?php _e('Note: if you have Weaver Xtreme Plus installed, then options marked with &starf;Plus will be included in saves and restores.', 'weaver-xtreme' /*adm*/); ?>
22
+ </p>
23
+ <div class="atw-option-subheader"><?php _e('Save/Restore Current Theme Settings using WordPress Database', 'weaver-xtreme' /*adm*/);?></div>
24
+ <?php _e('<p>This option allows you to save and restore all current theme settings using your host\'s WordPress database. Your options will be preserved across Weaver Xtreme theme upgrades, as well when you change to different themes. There is only one saved backup available. You can also download your setting to your computer with the options below.</p>
25
+ <p>Note: This save option saves <strong>all</strong> settings, including those marked with &diams;.</p>', 'weaver-xtreme' /*adm*/);?>
26
+ <form name="save_mysave_form" method="post">
27
+ <span class="submit"><input type="submit" name="save_mytheme" value="<?php _e('Save Current Theme Settings', 'weaver-xtreme' /*adm*/);?>"/></span>
28
+ <strong><?php _e('Backup all current theme settings using the WordPress database.', 'weaver-xtreme' /*adm*/);?></strong>
29
+ <?php weaverx_nonce_field('save_mytheme'); ?>
30
+ <br /><br />
31
+ <span class="submit"><input type="submit" name="restore_mytheme" value="<?php _e('Restore Settings', 'weaver-xtreme' /*adm*/);?>"/></span>
32
+ <strong><?php _e('Restore from saved settings.', 'weaver-xtreme' /*adm*/);?></strong> <em><?php _e('Last save date:', 'weaver-xtreme' /*adm*/);?> <?php echo $style_date; ?></em>
33
+ <?php
34
+ weaverx_nonce_field('restore_mytheme');
35
+ do_action('weaverxplus_admin','save_restore');
36
+ ?>
37
+ </form>
38
+
39
+ <?php
40
+
41
+ weaverx_saverestore(); // download/upload to computer
42
+
43
+ do_action('weaverx_child_saverestore'); // allow additional save/restore in child
44
+
45
+ do_action('weaverx_child_update');
46
+ ?>
47
+ <div class="atw-option-subheader"><?php _e('Reset Current Settings to Default', 'weaver-xtreme' /*adm*/); ?></div><br />
48
+ <form name="resetweaverx_form" method="post" onSubmit="return confirm('<?php _e('Are you sure you want to reset all Weaver Xtreme settings? This will include the [Saved Current Settings using WordPress Database].', 'weaver-xtreme' /*adm*/); ?>');">
49
+ <strong><?php _e('Click the Clear button to reset all Weaver Xtreme settings, including &diams;, &starf;Plus, and Weaver Xtreme Plus shortcode settings, to the default values.', 'weaver-xtreme' /*adm*/); ?></strong><br >
50
+ <em style="color:red;"><?php _e('Warning: You will lose all current settings, including settings from "Save Settings using the WordPress Database".', 'weaver-xtreme' /*adm*/); ?></em><br />
51
+ <?php _e('You should use the "Download Current Settings To Your Computer" option above to save a copy of your current settings before clearing!
52
+ If you have Weaver Xtreme Plus installed, you should also save shortcode settings from the Xtreme Plus Save/Restore tab.', 'weaver-xtreme' /*adm*/); ?>
53
+ <br />
54
+ <span class="submit"><input type="submit" name="reset_weaverx" value="<?php _e('Clear All Weaver Xtreme Settings', 'weaver-xtreme' /*adm*/); ?>"/></span>
55
+ <?php weaverx_nonce_field('reset_weaverx'); ?>
56
+ </form> <!-- resetweaverx_form -->
57
+ <br /><hr />
58
+
59
+ <?php
60
+
61
+ }
62
+
63
+ function weaverx_process_options_admin_standard( $processed ) {
64
+ if ( weaverx_submitted( 'weaverx_clear_messages' )) {
65
+ return true;
66
+ }
67
+ if (weaverx_submitted('reset_weaverx')) {
68
+ if (! current_user_can('manage_options'))
69
+ wp_die(__('You do not have the capability to do that.', 'weaver-xtreme' /*adm*/));
70
+ // delete everything!
71
+ weaverx_save_msg(__('All Weaver Xtreme settings have been reset to the defaults.','weaver-xtreme'));
72
+ delete_option( apply_filters('weaverx_options','weaverx_settings') );
73
+ global $weaverx_opts_cache;
74
+ $weaverx_opts_cache = false; // clear the cache
75
+ weaverx_init_opts('reset_weaverx');
76
+ delete_option( apply_filters('weaverx_options','weaverx_settings_backup') );
77
+
78
+ do_action('weaverxplus_admin','reset_weaverxplus');
79
+
80
+ update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice', 0 ); // reset the dismiss on the plugin loader
81
+ return true;
82
+ }
83
+
84
+ if (weaverx_submitted('uploadtheme') && function_exists('weaverx_loadtheme')) {
85
+ weaverx_loadtheme();
86
+ return true;
87
+ }
88
+
89
+ return $processed;
90
+ }
91
+
92
+ function weaverx_saverestore(){
93
+ /* admin tab for saving and restoring theme */
94
+ $weaverx_theme_dir = esc_url(weaverx_f_uploads_base_dir() .'weaverx-theme/');
95
+ $download_path = esc_url(weaverx_relative_url('includes/download.php'));
96
+ $download_img_path = esc_url(weaverx_relative_url('assets/images/download.png'));
97
+ $nonce = wp_create_nonce('weaverx_download');
98
+ $a_pro = (function_exists('weaverxplus_plugin_installed')) ? '-plus' : '';
99
+
100
+ ?>
101
+ <h3 class="atw-option-subheader" style="color:blue;">
102
+ <?php _e('Save/Restore Current Theme Settings using Your Computer', 'weaver-xtreme' /*adm*/); ?>
103
+ </h3>
104
+ <p>
105
+ <?php _e('This option allows you to save and restore all current theme settings by uploading and downloading to your own computer.', 'weaver-xtreme' /*adm*/); ?>
106
+ </p>
107
+
108
+ <h3><?php _e('Download Current Settings To Your Computer', 'weaver-xtreme' /*adm*/); ?></h3>
109
+
110
+ <a href="<?php echo $download_path . '?_wpnonce=' . $nonce; ?>"><img src="<?php echo esc_url($download_img_path); ?>" />
111
+ &nbsp; <strong><?php _e('Download', 'weaver-xtreme' /*adm*/); ?></strong>&nbsp;</a> -
112
+ <?php _e('<strong>Save all</strong> current settings to file on your computer.
113
+ (Full settings backup, including those marked with &diams;.) <em>File:</em>', 'weaver-xtreme' /*adm*/); ?>
114
+ <strong>weaverx-backup-settings<?php echo $a_pro;?>.wxb</strong>
115
+ <br />
116
+ <br />
117
+ <a href="<?php echo $download_path . '?_wpnoncet=' . $nonce;?>"><img src="<?php echo esc_url($download_img_path); ?>" />
118
+ &nbsp;<strong><?php _e('Download', 'weaver-xtreme' /*adm*/); ?></strong></a>&nbsp; -
119
+ <?php _e('<strong><em>Save only theme related</em></strong> current settings to file on your computer. <em>File:</em>
120
+ <strong>weaverx-theme-settings<?php echo $a_pro;?>.wxt</strong>', 'weaver-xtreme' /*adm*/); ?>
121
+ <?php
122
+ if (function_exists('weaverxplus_plugin_installed'))
123
+ echo '<p>' .
124
+ __('Note: Downloaded settings include <em>Weaver Xtreme Plus</em> settings.
125
+ Setting files from Weaver Xtreme Plus can be uploaded to the Free Weaver Xtreme version, but will not be used or saved by the free version.', 'weaver-xtreme' /*adm*/)
126
+ . '</p>';
127
+ ?>
128
+
129
+ <form enctype="multipart/form-data" action="<?php echo $_SERVER["REQUEST_URI"]; ?>" method="POST">
130
+ <table>
131
+ <tr><td><h3><?php _e('Upload settings from file saved on your computer', 'weaver-xtreme' /*adm*/); ?></h3></td></tr>
132
+
133
+ <tr valign="top">
134
+ <td><?php _e('Select theme/backup file to upload:', 'weaver-xtreme' /*adm*/); ?>
135
+ <span style="border:1px solid black;padding:2px;"><input name="uploaded" type="file" /></span>
136
+ <input type="hidden" name="uploadit" value="yes" />&nbsp;<?php _e('(Restores settings in file to current settings.)', 'weaver-xtreme' /*adm*/); ?>
137
+ </td>
138
+ </tr>
139
+
140
+ <tr><td><span class='submit'>
141
+ <input name="uploadtheme" type="submit" value="<?php _e('Upload theme/backup', 'weaver-xtreme' /*adm*/); ?>" /></span>
142
+ &nbsp;<small><?php _e('<strong>Upload and Restore</strong> a theme/backup from file on your computer. Will become current settings.', 'weaver-xtreme' /*adm*/); ?>
143
+ </small></td></tr>
144
+
145
+ <tr><td>
146
+ <?php if (!function_exists('weaverxplus_plugin_installed'))
147
+ echo '<small>' .
148
+ __('Note: Any Weaver Xtreme Plus settings will <em>not</em> be restored for Weaver Xtreme Free version.', 'weaver-xtreme' /*adm*/) . '</small>';
149
+ ?>&nbsp;</td></tr>
150
+
151
+ </table>
152
+ <?php weaverx_nonce_field('uploadtheme'); ?>
153
+ </form>
154
+ <?php
155
+ }
156
+ ?>
admin/admin-subthemes.php CHANGED
@@ -63,7 +63,7 @@ function weaverx_st_pick_theme($list_in) {
63
  <?php
64
  $cur_addon = weaverx_getopt('addon_name');
65
  if ($cur_addon == '') {
66
- echo ucwords(str_replace('-',' ',$cur_theme));
67
  } else {
68
  echo __('Add-on Subtheme: ','weaver-xtreme') . ucwords(str_replace('-',' ',$cur_addon));
69
  $cur_theme = '';
63
  <?php
64
  $cur_addon = weaverx_getopt('addon_name');
65
  if ($cur_addon == '') {
66
+ echo ucwords(str_replace('-',' ',$cur_theme));
67
  } else {
68
  echo __('Add-on Subtheme: ','weaver-xtreme') . ucwords(str_replace('-',' ',$cur_addon));
69
  $cur_theme = '';
includes/wvrx-ts-runtime-lib.php CHANGED
@@ -33,7 +33,8 @@ add_action('weaverx_theme_support_addon','wvrx_ts_theme_support_addon');
33
  function wvrx_ts_theme_support_addon() {
34
  ?>
35
  <div class="a-plus">
36
- <p><strong style="font-size:110%;"><?php _e('You have Weaver Xtreme Theme Support installed.','weaverx-theme-support' /*adm*/); ?></strong><br />
 
37
  <?php _e('This section shows the shortcodes and widgets available with Weaver X Theme Support.
38
  Click the<span style="color:red; vertical-align: middle; margin-left:.25em;" class="dashicons dashicons-editor-help"></span> button to open help entry.','weaverx-theme-support' /*adm*/); ?></p>
39
 
33
  function wvrx_ts_theme_support_addon() {
34
  ?>
35
  <div class="a-plus">
36
+ <p><strong style="font-size:110%;"><?php _e('You have Weaver Xtreme Theme Support installed.','weaverx-theme-support' /*adm*/);
37
+ echo ' (V ' . WVRX_TS_VERSION . ')'; ?></strong><br />
38
  <?php _e('This section shows the shortcodes and widgets available with Weaver X Theme Support.
39
  Click the<span style="color:red; vertical-align: middle; margin-left:.25em;" class="dashicons dashicons-editor-help"></span> button to open help entry.','weaverx-theme-support' /*adm*/); ?></p>
40
 
readme.txt CHANGED
@@ -9,8 +9,8 @@ License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  Text Domain: weaverx-theme-support
11
  Requires at least: 4.0
12
- Tested up to: 4.3
13
- Stable tag: 1.9.7
14
 
15
  A useful shortcode and widget collection for Weaver Xtreme
16
 
@@ -75,6 +75,15 @@ Support for this plugin can best be found at our forum - http://forum.weaverthem
75
  This is the initial release of this plugin.
76
 
77
  == ChangeLog ==
 
 
 
 
 
 
 
 
 
78
  = 1.9.7 =
79
  * More refinement
80
  * New: "Retain menu bar hover color" when sub menu open
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  Text Domain: weaverx-theme-support
11
  Requires at least: 4.0
12
+ Tested up to: 4.4
13
+ Stable tag: 2.0
14
 
15
  A useful shortcode and widget collection for Weaver Xtreme
16
 
75
  This is the initial release of this plugin.
76
 
77
  == ChangeLog ==
78
+ = 2.00 =
79
+ * Final tweaks for Weaver Xtreme 2.0
80
+ * New: Google Fonts for Font Family selections
81
+
82
+ = 1.10 =
83
+ * New: Menu Bar Margin options
84
+ * Tweak: Remove download .zip theme files
85
+ * Tweak: Mini Menu top margin default
86
+
87
  = 1.9.7 =
88
  * More refinement
89
  * New: "Retain menu bar hover color" when sub menu open
weaverx-ts.php CHANGED
@@ -5,12 +5,12 @@ Plugin URI: http://weavertheme.com/plugins
5
  Description: Weaver X Theme Support - a package of useful shortcodes and widgets that integrates closely with the Weaver X theme. This plugin Will also allow you to switch from Weaver X to any other theme and still be able to use the shortcodes and widgets from Weaver X with minimal effort.
6
  Author: wpweaver
7
  Author URI: http://weavertheme.com/about/
8
- Version: 1.9.7
9
  License: GPL V3
10
 
11
  Weaver Xtreme Theme Support
12
 
13
- Copyright (C) 2014, Bruce E. Wampler - weaver@weavertheme.com
14
 
15
  This program is free software: you can redistribute it and/or modify
16
  it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ $theme = get_template_directory();
33
 
34
  if ( strpos( $theme, '/weaver-xtreme') !== false ) { // only load if Weaver Xtreme is the theme
35
 
36
- define ('WVRX_TS_VERSION','1.9.7');
37
  define ('WVRX_TS_MINIFY','.min'); // '' for dev, '.min' for production
38
  define ('WVRX_TS_APPEARANCE_PAGE', false );
39
 
@@ -82,8 +82,8 @@ if ( ! ( function_exists( 'weaverxplus_plugin_installed' ) && version_compare(WE
82
  add_action('admin_menu', 'wvrx_ts_add_page_fields',11); // allow X-Plus to override us
83
 
84
  function wvrx_ts_add_page_fields() {
85
- add_meta_box('page-box', __('Weaver Xtreme Options For This Page (Theme Support Per Page Options)','weaverx-theme-support' /*adm*/), 'wvrx_ts_page_extras_load', 'page', 'normal', 'high');
86
- add_meta_box('post-box', __('Weaver Xtreme Options For This Post (Theme Support Per Post Options)','weaverx-theme-support' /*adm*/), 'wvrx_ts_post_extras_load', 'post', 'normal', 'high');
87
  global $post;
88
  $opts = get_option( apply_filters('weaverx_options','weaverx_settings') , array()); // need to fetch Weaver Xtreme options
89
  if ((isset($opts['_show_per_post_all']) && $opts['_show_per_post_all']) || function_exists('atw_slider_plugins_loaded') ) {
@@ -91,7 +91,7 @@ function wvrx_ts_add_page_fields() {
91
  $args=array( 'public' => true, '_builtin' => false );
92
  $post_types = get_post_types($args,'names','and');
93
  foreach ($post_types as $post_type ) {
94
- add_meta_box('post-box' . $i, __('Weaver Xtreme Options For This Post (Theme Support Per Post Options)','weaverx-theme-support' /*adm*/), 'wvrx_ts_post_extras', $post_type, 'normal', 'high');
95
  $i++;
96
  }
97
  }
@@ -112,7 +112,9 @@ function wvrx_ts_post_extras_load() {
112
  add_action('weaverx_child_show_extrathemes','wvrx_ts_child_show_extrathemes_action');
113
 
114
  function wvrx_ts_child_show_extrathemes_action() {
115
- echo '<h3 class="atw-option-subheader">' . __('Select an Add-on Subtheme You Have Uploaded','weaverx-theme-support' /*adm*/) . '</h3>';
 
 
116
  $addon_dir = weaverx_f_uploads_base_dir() . 'weaverx-subthemes/addon-subthemes/';
117
  $addon_url = weaverx_f_uploads_base_url() . 'weaverx-subthemes/addon-subthemes/';
118
 
@@ -133,11 +135,11 @@ function wvrx_ts_child_show_extrathemes_action() {
133
 
134
  $cur_addon = weaverx_getopt('wvrx_addon_name');
135
  if ($cur_addon)
136
- echo '<h3>' . __('Currently selected Add-on Subtheme: ','weaverx-theme-support' /*adm*/) . ucwords(str_replace('-',' ',$cur_addon)) . '</h3>';
137
  ?>
138
  <form enctype="multipart/form-data" name='pick_added_theme' action="<?php echo $_SERVER["REQUEST_URI"]; ?>" method='post'>
139
 
140
- <h4><?php _e('Select an add-on subtheme:','weaverx-theme-support' /*adm*/); ?></h4>
141
 
142
  <?php
143
  foreach ($addon_list as $addon) {
@@ -151,31 +153,31 @@ function wvrx_ts_child_show_extrathemes_action() {
151
  }
152
  ?>
153
  <div style="clear:both;"></div>
154
- <br /><span class='submit'><input name="set_added_subtheme" type="submit" value="<?php _e('Set to Selected Add-on Subtheme','weaverx-theme-support' /*adm*/); ?>" /></span>
155
  <small style="color:#b00;"><br /><?php _e('<strong>Note:</strong> Selecting a new subtheme will change only theme related settings.
156
  Options labelled with (&diams;) will be retained.
157
- You can use the Save/Restore tab to save a copy of all your current settings first.','weaverx-theme-support' /*adm*/); ?></small>
158
 
159
  <?php weaverx_nonce_field('set_added_subtheme'); ?>
160
 
161
- <br /><br /><span class='atw-small-submit' style="margin-left:100px;"><input name="delete_added_subtheme" type="submit" value="<?php _e('Delete Selected Add-on Subtheme','weaverx-theme-support' /*adm*/); ?>" /></span> &nbsp;
162
- <small><?php _e('This will delete the selected Add-on Subtheme from the Add-on directory','weaverx-theme-support' /*adm*/); ?></small>
163
  <?php weaverx_nonce_field('delete_added_subtheme'); ?>
164
  </form>
165
  <?php
166
  } else {
167
  ?>
168
- <p><?php _e('No Add-on Subthemes available.','weaverx-theme-support' /*adm*/); ?></p>
169
  <?php
170
  }
171
  echo '<h3 class="atw-option-subheader">Upload an Add-on Subtheme From Your Computer</h3>';
172
  ?>
173
- <p><?php _e('You can find additional free and premium Add-on Subthemes for <em>Weaver Xtreme</em>','weaverx-theme-support' /*adm*/); ?>
174
- <a href="//xtreme.weavertheme.com/add-on-subthemes/" title="<?php _e('Weaver Xtreme Add-on Subthemes','weaverx-theme-support' /*adm*/); ?>"><strong><?php _e('HERE','weaverx-theme-support' /*adm*/); ?></strong></a>.</p>
175
  <form name='form_added_theme' enctype="multipart/form-data" action="<?php echo $_SERVER["REQUEST_URI"]; ?>" method="POST">
176
  <table>
177
  <tr valign="top">
178
- <td><strong><?php _e('Select Add-on Subtheme .zip file to upload:','weaverx-theme-support' /*adm*/); ?></strong>
179
  <input name="uploaded_addon" type="file" />
180
  <input type="hidden" name="uploadaddon" value="yes" />
181
  </td>
@@ -183,19 +185,21 @@ function wvrx_ts_child_show_extrathemes_action() {
183
  <tr><td>
184
  <span style="margin-left:50px;" class='submit'>
185
  <input name="upload_addon" type="submit" value="Upload Add-on Subtheme" /><br />
186
- </span>&nbsp;<small><?php _e('<strong>Upload and Save</strong> an Add-on Subtheme or Subtheme collection from .zip file on your computer. Will be saved on your site\'s filesystem.','weaverx-theme-support' /*adm*/); ?></small>
187
  </td></tr>
188
  </table>
189
  <?php weaverx_nonce_field('upload_addon'); ?>
190
  </form>
191
 
192
  <?php
 
193
  }
194
 
195
  add_action('weaverx_child_process_options','wvrx_ts_child_process_options');
196
  function wvrx_ts_child_process_options() {
197
 
198
- if (weaverx_submitted('set_added_subtheme') ) { // Set to selected addon - theme
 
199
  if (isset($_POST['wvrx_addon_name']))
200
  {
201
  $name = $_POST['wvrx_addon_name'];
@@ -206,9 +210,9 @@ function wvrx_ts_child_process_options() {
206
  if (!weaverx_ex_set_current_to_serialized_values($contents,'weaverx_uploadit:'.$openname)) {
207
  echo '<div id="message" class="updated fade"><p><strong><em style="color:red;">' .
208
  __('Sorry, there was a problem uploading your add on theme. The name you picked did not have a valid
209
- Weaver Xtreme theme file in the /weaverx-subthemes/addon-subthemes directory.','weaverx-theme-support' /*adm*/) . '</em></strong></p></div>';
210
  } else {
211
- weaverx_save_msg(__('Weaver Xtreme theme reset to ','weaverx-theme-support' /*adm*/) .
212
  ucwords(str_replace('-',' ',$name )) . ' add-on subtheme.');
213
  weaverx_setopt('wvrx_addon_name',$name);
214
  }
@@ -221,8 +225,8 @@ Weaver Xtreme theme file in the /weaverx-subthemes/addon-subthemes directory.','
221
  $name = $_POST['wvrx_addon_name'];
222
  @unlink(weaverx_f_uploads_base_dir() . 'weaverx-subthemes/addon-subthemes/' . $name . '.wxt');
223
  @unlink(weaverx_f_uploads_base_dir() . 'weaverx-subthemes/addon-subthemes/' . $name . '.jpg');
224
- weaverx_save_msg(__('Deleted ','weaverx-theme-support' /*adm*/) .
225
- ucwords(str_replace('-',' ',$name )) . __(' add-on subtheme.','weaverx-theme-support' /*adm*/));
226
  }
227
  }
228
 
@@ -234,7 +238,9 @@ Weaver Xtreme theme file in the /weaverx-subthemes/addon-subthemes directory.','
234
  $ok = wvrx_ts_wunpackzip('uploaded_addon', weaverx_f_uploads_base_dir() . 'weaverx-subthemes/addon-subthemes/');
235
  }
236
 
237
- else if ( weaverx_submitted('toggle_shortcode_prefix') ) {
 
 
238
  $val = get_option('wvrx_toggle_shortcode_prefix');
239
  if ( $val ) {
240
  delete_option('wvrx_toggle_shortcode_prefix');
@@ -249,6 +255,7 @@ Weaver Xtreme theme file in the /weaverx-subthemes/addon-subthemes directory.','
249
 
250
  }
251
 
 
252
  function wvrx_ts_wunpackzip($uploaded, $to_dir) {
253
  // upload theme from users computer
254
  // they've supplied and uploaded a file
@@ -274,17 +281,17 @@ function wvrx_ts_wunpackzip($uploaded, $to_dir) {
274
  $ext_check = end($end);
275
 
276
  if (false && !weaverx_f_file_access_available()) {
277
- $errors[] = __('Sorry - Theme unable to access files.','weaverx-theme-support' /*adm*/) . '<br />';
278
  $ok = false;
279
  }
280
 
281
  if ($filename == "") {
282
- $errors[] = __('You didn\'t select a file to upload.','weaverx-theme-support' /*adm*/) . '<br />';
283
  $ok = false;
284
  }
285
 
286
  if ($ok && $ext_check != 'zip'){
287
- $errors[] = __("Uploaded files must have <em>.zip</em> extension.",'weaverx-theme-support' /*adm*/) . "<br />";
288
  $ok = false;
289
  }
290
 
@@ -292,7 +299,7 @@ function wvrx_ts_wunpackzip($uploaded, $to_dir) {
292
  if (!weaverx_f_exists($openname)) {
293
  $errors[] = '<strong><em style="color:red;">' .
294
  __('Sorry, there was a problem uploading your file. You may need to check your folder permissions
295
- or other server settings.','weaverx-theme-support' /*adm*/) . '</em></strong><br />' . __('Trying to use file','weaverx-theme-support' /*adm*/) . "'$openname'";
296
  $ok = false;
297
  }
298
  }
@@ -306,7 +313,7 @@ or other server settings.','weaverx-theme-support' /*adm*/) . '</em></strong><br
306
  remove_filter('filesystem_method', 'wvrx_ts_wvx_return_direct');
307
  if (!$try2) {
308
  $errors[] = __('Sorry, there\'s a problem trying to use the WordPress unzip function. Please
309
- see the FAQ at weavertheme.com support for more information.','weaverx-theme-support' /*adm*/);
310
  $ok = false;
311
  }
312
  }
@@ -316,16 +323,16 @@ or other server settings.','weaverx-theme-support' /*adm*/) . '</em></strong><br
316
  // $filename has name of file uploaded
317
  $is_error = unzip_file( $openname, $to_dir );
318
  if ( !is_wp_error( $is_error ) ) {
319
- weaverx_save_msg(__('File ','weaverx-theme-support' /*adm*/) . $filename . __(' successfully uploaded and unpacked to: <br />','weaverx-theme-support' /*adm*/) . $to_dir);
320
  @unlink($openname); // delete temp file...
321
  } else {
322
- $errors[] = __("Sorry, unpacking the .zip you selected file failed. You may have a corrupt .zip file, or there many a file permissions problem on your WordPress installation.",'weaverx-theme-support' /*adm*/);
323
  $errors[] = $is_error->get_error_message();
324
  $ok = false;
325
  }
326
  }
327
  if (!$ok) {
328
- echo '<div id="message" class="updated fade"><p><strong><em style="color:red;">' . __('ERROR','weaverx-theme-support' /*adm*/) . '</em></strong></p><p>';
329
  foreach($errors as $error){
330
  echo $error.'<br />';
331
  }
@@ -333,14 +340,18 @@ or other server settings.','weaverx-theme-support' /*adm*/) . '</em></strong><br
333
  }
334
  return $ok;
335
  }
 
336
 
337
  add_action('weaverx_child_saverestore','wvrx_ts_child_saverestore_action');
338
  function wvrx_ts_child_saverestore_action() {
 
 
339
  echo '<h3 class="atw-option-subheader" style="font-style:italic">' . __('Use the <em>Weaver Xtreme Subthemes</em>
340
  tab to upload Add-on Subthemes.</h3><p>You can upload extra add-on subthemes you\'ve downloaded using the
341
  Subthemes tab. Note: the Save and Restore options on this page are for the custom settings you
342
  have created. These save/restore options are not related to Add-on Subthemes, although you can
343
- modify an Add-on Subtheme, and save your changes here.</p>','weaverx-theme-support' /*adm*/);
 
344
  }
345
 
346
  add_action('weaverx_check_updates', 'weaverx_check_updates_action');
5
  Description: Weaver X Theme Support - a package of useful shortcodes and widgets that integrates closely with the Weaver X theme. This plugin Will also allow you to switch from Weaver X to any other theme and still be able to use the shortcodes and widgets from Weaver X with minimal effort.
6
  Author: wpweaver
7
  Author URI: http://weavertheme.com/about/
8
+ Version: 1.10
9
  License: GPL V3
10
 
11
  Weaver Xtreme Theme Support
12
 
13
+ Copyright (C) 2014-2015 Bruce E. Wampler - weaver@weavertheme.com
14
 
15
  This program is free software: you can redistribute it and/or modify
16
  it under the terms of the GNU General Public License as published by
33
 
34
  if ( strpos( $theme, '/weaver-xtreme') !== false ) { // only load if Weaver Xtreme is the theme
35
 
36
+ define ('WVRX_TS_VERSION','2.0');
37
  define ('WVRX_TS_MINIFY','.min'); // '' for dev, '.min' for production
38
  define ('WVRX_TS_APPEARANCE_PAGE', false );
39
 
82
  add_action('admin_menu', 'wvrx_ts_add_page_fields',11); // allow X-Plus to override us
83
 
84
  function wvrx_ts_add_page_fields() {
85
+ add_meta_box('page-box', __('Weaver Xtreme Options For This Page (Theme Support Per Page Options)','weaverx-theme-support'), 'wvrx_ts_page_extras_load', 'page', 'normal', 'high');
86
+ add_meta_box('post-box', __('Weaver Xtreme Options For This Post (Theme Support Per Post Options)','weaverx-theme-support'), 'wvrx_ts_post_extras_load', 'post', 'normal', 'high');
87
  global $post;
88
  $opts = get_option( apply_filters('weaverx_options','weaverx_settings') , array()); // need to fetch Weaver Xtreme options
89
  if ((isset($opts['_show_per_post_all']) && $opts['_show_per_post_all']) || function_exists('atw_slider_plugins_loaded') ) {
91
  $args=array( 'public' => true, '_builtin' => false );
92
  $post_types = get_post_types($args,'names','and');
93
  foreach ($post_types as $post_type ) {
94
+ add_meta_box('post-box' . $i, __('Weaver Xtreme Options For This Post (Theme Support Per Post Options)','weaverx-theme-support'), 'wvrx_ts_post_extras', $post_type, 'normal', 'high');
95
  $i++;
96
  }
97
  }
112
  add_action('weaverx_child_show_extrathemes','wvrx_ts_child_show_extrathemes_action');
113
 
114
  function wvrx_ts_child_show_extrathemes_action() {
115
+ return;
116
+ /* -------------------
117
+ echo '<h3 class="atw-option-subheader">' . __('Select an Add-on Subtheme You Have Uploaded','weaverx-theme-support') . '</h3>';
118
  $addon_dir = weaverx_f_uploads_base_dir() . 'weaverx-subthemes/addon-subthemes/';
119
  $addon_url = weaverx_f_uploads_base_url() . 'weaverx-subthemes/addon-subthemes/';
120
 
135
 
136
  $cur_addon = weaverx_getopt('wvrx_addon_name');
137
  if ($cur_addon)
138
+ echo '<h3>' . __('Currently selected Add-on Subtheme: ','weaverx-theme-support') . ucwords(str_replace('-',' ',$cur_addon)) . '</h3>';
139
  ?>
140
  <form enctype="multipart/form-data" name='pick_added_theme' action="<?php echo $_SERVER["REQUEST_URI"]; ?>" method='post'>
141
 
142
+ <h4><?php _e('Select an add-on subtheme:','weaverx-theme-support'); ?></h4>
143
 
144
  <?php
145
  foreach ($addon_list as $addon) {
153
  }
154
  ?>
155
  <div style="clear:both;"></div>
156
+ <br /><span class='submit'><input name="set_added_subtheme" type="submit" value="<?php _e('Set to Selected Add-on Subtheme','weaverx-theme-support' ); ?>" /></span>
157
  <small style="color:#b00;"><br /><?php _e('<strong>Note:</strong> Selecting a new subtheme will change only theme related settings.
158
  Options labelled with (&diams;) will be retained.
159
+ You can use the Save/Restore tab to save a copy of all your current settings first.','weaverx-theme-support' ); ?></small>
160
 
161
  <?php weaverx_nonce_field('set_added_subtheme'); ?>
162
 
163
+ <br /><br /><span class='atw-small-submit' style="margin-left:100px;"><input name="delete_added_subtheme" type="submit" value="<?php _e('Delete Selected Add-on Subtheme','weaverx-theme-support'); ?>" /></span> &nbsp;
164
+ <small><?php _e('This will delete the selected Add-on Subtheme from the Add-on directory','weaverx-theme-support'); ?></small>
165
  <?php weaverx_nonce_field('delete_added_subtheme'); ?>
166
  </form>
167
  <?php
168
  } else {
169
  ?>
170
+ <p><?php _e('No Add-on Subthemes available.','weaverx-theme-support'); ?></p>
171
  <?php
172
  }
173
  echo '<h3 class="atw-option-subheader">Upload an Add-on Subtheme From Your Computer</h3>';
174
  ?>
175
+ <p><?php _e('You can find additional free and premium Add-on Subthemes for <em>Weaver Xtreme</em>','weaverx-theme-support'); ?>
176
+ <a href="//xtreme.weavertheme.com/add-on-subthemes/" title="<?php _e('Weaver Xtreme Add-on Subthemes','weaverx-theme-support'); ?>"><strong><?php _e('HERE','weaverx-theme-support'); ?></strong></a>.</p>
177
  <form name='form_added_theme' enctype="multipart/form-data" action="<?php echo $_SERVER["REQUEST_URI"]; ?>" method="POST">
178
  <table>
179
  <tr valign="top">
180
+ <td><strong><?php _e('Select Add-on Subtheme .zip file to upload:','weaverx-theme-support'); ?></strong>
181
  <input name="uploaded_addon" type="file" />
182
  <input type="hidden" name="uploadaddon" value="yes" />
183
  </td>
185
  <tr><td>
186
  <span style="margin-left:50px;" class='submit'>
187
  <input name="upload_addon" type="submit" value="Upload Add-on Subtheme" /><br />
188
+ </span>&nbsp;<small><?php _e('<strong>Upload and Save</strong> an Add-on Subtheme or Subtheme collection from .zip file on your computer. Will be saved on your site\'s filesystem.','weaverx-theme-support'); ?></small>
189
  </td></tr>
190
  </table>
191
  <?php weaverx_nonce_field('upload_addon'); ?>
192
  </form>
193
 
194
  <?php
195
+ ------------- */
196
  }
197
 
198
  add_action('weaverx_child_process_options','wvrx_ts_child_process_options');
199
  function wvrx_ts_child_process_options() {
200
 
201
+ /* ---------------
202
+ if (weaverx_submitted('set_added_subtheme') ) { // Set to selected addon - theme
203
  if (isset($_POST['wvrx_addon_name']))
204
  {
205
  $name = $_POST['wvrx_addon_name'];
210
  if (!weaverx_ex_set_current_to_serialized_values($contents,'weaverx_uploadit:'.$openname)) {
211
  echo '<div id="message" class="updated fade"><p><strong><em style="color:red;">' .
212
  __('Sorry, there was a problem uploading your add on theme. The name you picked did not have a valid
213
+ Weaver Xtreme theme file in the /weaverx-subthemes/addon-subthemes directory.','weaverx-theme-support') . '</em></strong></p></div>';
214
  } else {
215
+ weaverx_save_msg(__('Weaver Xtreme theme reset to ','weaverx-theme-support') .
216
  ucwords(str_replace('-',' ',$name )) . ' add-on subtheme.');
217
  weaverx_setopt('wvrx_addon_name',$name);
218
  }
225
  $name = $_POST['wvrx_addon_name'];
226
  @unlink(weaverx_f_uploads_base_dir() . 'weaverx-subthemes/addon-subthemes/' . $name . '.wxt');
227
  @unlink(weaverx_f_uploads_base_dir() . 'weaverx-subthemes/addon-subthemes/' . $name . '.jpg');
228
+ weaverx_save_msg(__('Deleted ','weaverx-theme-support') .
229
+ ucwords(str_replace('-',' ',$name )) . __(' add-on subtheme.','weaverx-theme-support'));
230
  }
231
  }
232
 
238
  $ok = wvrx_ts_wunpackzip('uploaded_addon', weaverx_f_uploads_base_dir() . 'weaverx-subthemes/addon-subthemes/');
239
  }
240
 
241
+ else
242
+ -------------------- */
243
+ if ( weaverx_submitted('toggle_shortcode_prefix') ) {
244
  $val = get_option('wvrx_toggle_shortcode_prefix');
245
  if ( $val ) {
246
  delete_option('wvrx_toggle_shortcode_prefix');
255
 
256
  }
257
 
258
+ /*-----------------
259
  function wvrx_ts_wunpackzip($uploaded, $to_dir) {
260
  // upload theme from users computer
261
  // they've supplied and uploaded a file
281
  $ext_check = end($end);
282
 
283
  if (false && !weaverx_f_file_access_available()) {
284
+ $errors[] = __('Sorry - Theme unable to access files.','weaverx-theme-support') . '<br />';
285
  $ok = false;
286
  }
287
 
288
  if ($filename == "") {
289
+ $errors[] = __('You didn\'t select a file to upload.','weaverx-theme-support') . '<br />';
290
  $ok = false;
291
  }
292
 
293
  if ($ok && $ext_check != 'zip'){
294
+ $errors[] = __("Uploaded files must have <em>.zip</em> extension.",'weaverx-theme-support') . "<br />";
295
  $ok = false;
296
  }
297
 
299
  if (!weaverx_f_exists($openname)) {
300
  $errors[] = '<strong><em style="color:red;">' .
301
  __('Sorry, there was a problem uploading your file. You may need to check your folder permissions
302
+ or other server settings.','weaverx-theme-support') . '</em></strong><br />' . __('Trying to use file','weaverx-theme-support') . "'$openname'";
303
  $ok = false;
304
  }
305
  }
313
  remove_filter('filesystem_method', 'wvrx_ts_wvx_return_direct');
314
  if (!$try2) {
315
  $errors[] = __('Sorry, there\'s a problem trying to use the WordPress unzip function. Please
316
+ see the FAQ at weavertheme.com support for more information.','weaverx-theme-support');
317
  $ok = false;
318
  }
319
  }
323
  // $filename has name of file uploaded
324
  $is_error = unzip_file( $openname, $to_dir );
325
  if ( !is_wp_error( $is_error ) ) {
326
+ weaverx_save_msg(__('File ','weaverx-theme-support') . $filename . __(' successfully uploaded and unpacked to: <br />','weaverx-theme-support') . $to_dir);
327
  @unlink($openname); // delete temp file...
328
  } else {
329
+ $errors[] = __("Sorry, unpacking the .zip you selected file failed. You may have a corrupt .zip file, or there many a file permissions problem on your WordPress installation.",'weaverx-theme-support');
330
  $errors[] = $is_error->get_error_message();
331
  $ok = false;
332
  }
333
  }
334
  if (!$ok) {
335
+ echo '<div id="message" class="updated fade"><p><strong><em style="color:red;">' . __('ERROR','weaverx-theme-support') . '</em></strong></p><p>';
336
  foreach($errors as $error){
337
  echo $error.'<br />';
338
  }
340
  }
341
  return $ok;
342
  }
343
+ ---------------- */
344
 
345
  add_action('weaverx_child_saverestore','wvrx_ts_child_saverestore_action');
346
  function wvrx_ts_child_saverestore_action() {
347
+ return;
348
+ /* ------------------
349
  echo '<h3 class="atw-option-subheader" style="font-style:italic">' . __('Use the <em>Weaver Xtreme Subthemes</em>
350
  tab to upload Add-on Subthemes.</h3><p>You can upload extra add-on subthemes you\'ve downloaded using the
351
  Subthemes tab. Note: the Save and Restore options on this page are for the custom settings you
352
  have created. These save/restore options are not related to Add-on Subthemes, although you can
353
+ modify an Add-on Subtheme, and save your changes here.</p>','weaverx-theme-support');
354
+ --------------- */
355
  }
356
 
357
  add_action('weaverx_check_updates', 'weaverx_check_updates_action');