Social Media Feather | social media sharing - Version 2.0.0

Version Description

  • Fixed missing index error.
  • Added review us dismissable popup.
  • Tested WP 5.4.1 compatability.
Download this release

Release Info

Developer socialmediafeather
Plugin Icon 128x128 Social Media Feather | social media sharing
Version 2.0.0
Comparing to
See all releases

Code changes from version 1.9.4 to 2.0.0

readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Social Media Feather | social media sharing ===
2
- Contributors: socialmediafeather
3
  Tags: social media, social sharing, social buttons, Facebook, Share, Like, twitter, google, Reddit, youtube, instagram, pinterest, social media buttons, button, shortcode, sidebar, sharing buttons, follow buttons
4
  Requires at least: 3.1
5
- Tested up to: 5.2.2
6
- Stable tag: 1.9.4
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -191,6 +191,11 @@ margin-left: 10px;
191
 
192
  == Changelog ==
193
 
 
 
 
 
 
194
  = 1.9.4 =
195
  * Removed deprecated function "create_function".
196
  * Utilizing WP Settings API.
1
  === Social Media Feather | social media sharing ===
2
+ Contributors: socialmediafeather, scottstorebloom
3
  Tags: social media, social sharing, social buttons, Facebook, Share, Like, twitter, google, Reddit, youtube, instagram, pinterest, social media buttons, button, shortcode, sidebar, sharing buttons, follow buttons
4
  Requires at least: 3.1
5
+ Tested up to: 5.4.1
6
+ Stable tag: 2.0.0
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
191
 
192
  == Changelog ==
193
 
194
+ = 2.0.0 =
195
+ * Fixed missing index error.
196
+ * Added review us dismissable popup.
197
+ * Tested WP 5.4.1 compatability.
198
+
199
  = 1.9.4 =
200
  * Removed deprecated function "create_function".
201
  * Utilizing WP Settings API.
social-media-feather.php CHANGED
@@ -4,11 +4,11 @@ Plugin Name: Social Media Feather
4
  Plugin URI: http://socialmediafeather.com/
5
  Description: Super lightweight social media plugin to add nice and effective social media sharing and following buttons and icons anywhere on your site quickly and easily
6
  Author: socialmediafeather
7
- Version: 1.9.4
8
  Author URI: http://socialmediafeather.com/
9
  */
10
 
11
- define( 'SYNVED_VERSION', '1.9.4' );
12
 
13
  if (!function_exists('synved_wp_social_load'))
14
  {
4
  Plugin URI: http://socialmediafeather.com/
5
  Description: Super lightweight social media plugin to add nice and effective social media sharing and following buttons and icons anywhere on your site quickly and easily
6
  Author: socialmediafeather
7
+ Version: 2.0.0
8
  Author URI: http://socialmediafeather.com/
9
  */
10
 
11
+ define( 'SYNVED_VERSION', '2.0.0' );
12
 
13
  if (!function_exists('synved_wp_social_load'))
14
  {
synved-connect/synved-connect-support.php CHANGED
@@ -2,56 +2,43 @@
2
 
3
  function synved_connect_support_social_follow_render()
4
  {
5
- $uri = synved_connect_path_uri();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
- $out = null;
8
-
9
- $out .= '<div class="synved-connect-notice" style="position:fixed; right:30px; bottom:35px; width:220px; background:#ececec; font-size:110%; color:#444;">';
10
-
11
- // $out .= '<a href="#" style="font-size:8px; position:absolute; top:0px; right:0px; margin-right: 5px;" onclick="' . esc_attr('jQuery(this).parents(\'.synved-connect-notice\').find(\'.notice-extra\').slideToggle(\'slow\'); return false;') . '">' . __('toggle', 'synved-connect') . '</a>';
12
-
13
- $out .= '<div class="notice-extra notice-secondary" style="border:dotted 1px #bbb;">';
14
- $out .= '<div class="sponsor-holder sponsor-type-extern">Your great site deserves a great look, make it shine with <a class="synved-connect-link" href="http://www.elegantthemes.com/affiliates/idevaffiliate.php?id=37330" target="_blank" title="many themes for the price of one">a new sexy theme</a>!</div>';
15
  $out .= '</div>';
16
 
17
- // $out .= '<div style="padding:8px 10px; border:dotted 1px #bbb;">';
18
- // $out .= '<a style="display:block; line-height:32px; height:32px;" target="_blank" href="https://twitter.com/synved" title="' . __('Follow Us on Twitter!', 'synved-connect') . '"><img style="vertical-align:middle;" alt="twitter" src="' . esc_url($uri . '/image/twitter.png') . '" /><span style="line-height:normal; margin-left:8px;">' . __('Follow Us on Twitter!', 'synved-connect') . '</span></a><div style="font-size:75%; color:#888; line-height:normal; text-align:center; margin-top:5px;">' . __('We only tweet relevant updates!', 'synved-connect') . '</div>';
19
- // $out .= '</div>';
20
- //
21
- // $out .= '<div class="notice-extra" style="margin:8px 0 0 0; padding:8px 10px; border:dotted 1px #bbb;">';
22
- // $out .= '<a style="display:block; line-height:32px; height:32px;" target="_blank" href="http://synved.com/about/contact/?subject=Quote%20Request" title="' . __('Hire Us!', 'synved-connect') . '"><img style="vertical-align:middle;" alt="hire_us" src="' . esc_url($uri . '/image/hire.png') . '" /><span style="line-height:normal; margin-left:8px;">' . __('Hire Us!', 'synved-connect') . '</span></a><div style="font-size:75%; color:#888; line-height:normal; text-align:center; margin-top:5px;">' . __('For any WordPress development', 'synved-connect') . '</div>';
23
- // $out .= '</div>';
24
- //
25
- // $out .= '<div class="notice-extra notice-secondary">';
26
- // $out .= '<h4 style="margin:10px 0 -10px 0; padding:0;">News</h4>';
27
- // ob_start();
28
- // wp_widget_rss_output('http://feeds.feedburner.com/SynvedNews?format=xml', array('items' => 4, 'show_author' => 0, 'show_date' => 0, 'show_summary' => 0));
29
- // $out .= ob_get_clean();
30
- // $out .= '</div>';
31
- //
32
- // $sponsor_item = synved_connect_sponsor_item_pick(array('type' => 'intern|extern'));
33
- //
34
- // if ($sponsor_item != null)
35
- // {
36
- // $out .= '<div class="notice-extra notice-secondary" style="margin:10px 0 0 0; border:dotted 1px #bbb;">';
37
- // $out .= synved_connect_sponsor_content($sponsor_item);
38
- // $out .= '</div>';
39
- // }
40
-
41
- $out .= '</div>';
42
-
43
- return $out;
44
  }
45
 
46
  function synved_connect_support_social_follow_render_small()
47
  {
48
- $uri = synved_connect_path_uri();
49
 
50
- $out = null;
51
 
52
- $out .= '<span>';
53
- $out .= '<a target="_blank" href="https://twitter.com/synved" title="' . __('Follow Us on Twitter!', 'synved-connect') . '"><img alt="twitter" style="vertical-align:middle;" src="' . esc_url($uri . '/image/small/twitter.png') . '"></a></div>';
54
- $out .= '</span>';
55
 
56
- return $out;
57
  }
2
 
3
  function synved_connect_support_social_follow_render()
4
  {
5
+ $uri = synved_connect_path_uri();
6
+
7
+ $out = null;
8
+
9
+ $out .= '<div class="synved-connect-notice" style="position:fixed; right:30px; bottom:35px; width:220px; background:#ececec; font-size:110%; color:#444;">';
10
+
11
+ if (empty(get_option('smf-hide-review'))) {
12
+ $out .= '<div class="smf-review-us">';
13
+ $out .= '<h3>';
14
+ $out .= esc_html__('Love this plugin?', 'synved-connect');
15
+ $out .= '<p>';
16
+ $out .= '<a href="https://wordpress.org/support/plugin/social-media-feather/reviews/#new-post" target="_blank">';
17
+ $out .= esc_html__(
18
+ 'Please spread the word by leaving us a 5 star review!',
19
+ 'synved-connect'
20
+ );
21
+ $out .= '</a>';
22
+ $out .= '</p>';
23
+ $out .= '<div id="close-review-us">close</div>';
24
+ $out .= '</h3>';
25
+ $out .= '</div>';
26
+ }
27
 
 
 
 
 
 
 
 
 
28
  $out .= '</div>';
29
 
30
+ return $out;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  }
32
 
33
  function synved_connect_support_social_follow_render_small()
34
  {
35
+ $uri = synved_connect_path_uri();
36
 
37
+ $out = null;
38
 
39
+ $out .= '<span>';
40
+ $out .= '<a target="_blank" href="https://twitter.com/synved" title="' . __('Follow Us on Twitter!', 'synved-connect') . '"><img alt="twitter" style="vertical-align:middle;" src="' . esc_url($uri . '/image/small/twitter.png') . '"></a></div>';
41
+ $out .= '</span>';
42
 
43
+ return $out;
44
  }
synved-connect/synved-connect.php CHANGED
@@ -45,60 +45,60 @@ function synved_connect_version_string()
45
  function synved_connect_object()
46
  {
47
  global $synved_connect;
48
-
49
  return $synved_connect;
50
  }
51
 
52
  function synved_connect_server_get()
53
  {
54
  global $synved_connect;
55
-
56
  if (isset($synved_connect['server']))
57
  {
58
  return $synved_connect['server'];
59
  }
60
-
61
  return null;
62
  }
63
 
64
  function synved_connect_server_set($server)
65
  {
66
  global $synved_connect;
67
-
68
  $synved_connect['server'] = $server;
69
  }
70
 
71
  function synved_connect_path_uri($path = null)
72
  {
73
  $uri = plugins_url('/synved-wp-connect') . '/synved-connect';
74
-
75
  if (function_exists('synved_plugout_module_uri_get'))
76
  {
77
  $mod_uri = synved_plugout_module_uri_get('synved-connect');
78
-
79
  if ($mod_uri != null)
80
  {
81
  $uri = $mod_uri;
82
  }
83
  }
84
-
85
  if ($path != null)
86
  {
87
  if (substr($uri, -1) != '/' && $path[0] != '/')
88
  {
89
  $uri .= '/';
90
  }
91
-
92
  $uri .= $path;
93
  }
94
-
95
  return $uri;
96
  }
97
 
98
  function synved_connect_id_get($component = null, $part = null)
99
  {
100
  $option_key = null;
101
-
102
  if ($component != null)
103
  {
104
  $option_key = 'component_' . $component;
@@ -107,7 +107,7 @@ function synved_connect_id_get($component = null, $part = null)
107
  {
108
  $option_key = 'default';
109
  }
110
-
111
  $id = get_option('synved_connect_id_' . $option_key);
112
 
113
  return $id;
@@ -116,7 +116,7 @@ function synved_connect_id_get($component = null, $part = null)
116
  function synved_connect_id_set($component = null, $sponsor_id)
117
  {
118
  $option_key = null;
119
-
120
  if ($component != null)
121
  {
122
  $option_key = 'component_' . $component;
@@ -125,7 +125,7 @@ function synved_connect_id_set($component = null, $sponsor_id)
125
  {
126
  $option_key = 'default';
127
  }
128
-
129
  return update_option('synved_connect_id_' . $option_key, $sponsor_id);
130
  }
131
 
@@ -133,9 +133,9 @@ function synved_connect_id_set($component = null, $sponsor_id)
133
  function synved_connect_enqueue_scripts()
134
  {
135
  $uri = synved_connect_path_uri();
136
-
137
  wp_register_style('synved-connect-admin', $uri . '/style/admin.css', false, '1.0');
138
-
139
  wp_enqueue_style('synved-connect-admin');
140
 
141
  if ( version_compare( get_bloginfo( 'version' ), SYNVED_WP_MODERN_VERSION, 'lt' ) ) {
@@ -178,3 +178,11 @@ function synved_connect_upgrade( $version ) {
178
 
179
  add_action( 'init', 'synved_connect_init', 9 );
180
  add_action( 'admin_enqueue_scripts', 'synved_connect_enqueue_scripts' );
 
 
 
 
 
 
 
 
45
  function synved_connect_object()
46
  {
47
  global $synved_connect;
48
+
49
  return $synved_connect;
50
  }
51
 
52
  function synved_connect_server_get()
53
  {
54
  global $synved_connect;
55
+
56
  if (isset($synved_connect['server']))
57
  {
58
  return $synved_connect['server'];
59
  }
60
+
61
  return null;
62
  }
63
 
64
  function synved_connect_server_set($server)
65
  {
66
  global $synved_connect;
67
+
68
  $synved_connect['server'] = $server;
69
  }
70
 
71
  function synved_connect_path_uri($path = null)
72
  {
73
  $uri = plugins_url('/synved-wp-connect') . '/synved-connect';
74
+
75
  if (function_exists('synved_plugout_module_uri_get'))
76
  {
77
  $mod_uri = synved_plugout_module_uri_get('synved-connect');
78
+
79
  if ($mod_uri != null)
80
  {
81
  $uri = $mod_uri;
82
  }
83
  }
84
+
85
  if ($path != null)
86
  {
87
  if (substr($uri, -1) != '/' && $path[0] != '/')
88
  {
89
  $uri .= '/';
90
  }
91
+
92
  $uri .= $path;
93
  }
94
+
95
  return $uri;
96
  }
97
 
98
  function synved_connect_id_get($component = null, $part = null)
99
  {
100
  $option_key = null;
101
+
102
  if ($component != null)
103
  {
104
  $option_key = 'component_' . $component;
107
  {
108
  $option_key = 'default';
109
  }
110
+
111
  $id = get_option('synved_connect_id_' . $option_key);
112
 
113
  return $id;
116
  function synved_connect_id_set($component = null, $sponsor_id)
117
  {
118
  $option_key = null;
119
+
120
  if ($component != null)
121
  {
122
  $option_key = 'component_' . $component;
125
  {
126
  $option_key = 'default';
127
  }
128
+
129
  return update_option('synved_connect_id_' . $option_key, $sponsor_id);
130
  }
131
 
133
  function synved_connect_enqueue_scripts()
134
  {
135
  $uri = synved_connect_path_uri();
136
+
137
  wp_register_style('synved-connect-admin', $uri . '/style/admin.css', false, '1.0');
138
+
139
  wp_enqueue_style('synved-connect-admin');
140
 
141
  if ( version_compare( get_bloginfo( 'version' ), SYNVED_WP_MODERN_VERSION, 'lt' ) ) {
178
 
179
  add_action( 'init', 'synved_connect_init', 9 );
180
  add_action( 'admin_enqueue_scripts', 'synved_connect_enqueue_scripts' );
181
+ add_action('wp_ajax_smf_ajax_hide_review', 'smfHideReview');
182
+
183
+ function smfHideReview()
184
+ {
185
+ update_option('smf-hide-review', true);
186
+
187
+ wp_send_json_success('hidden');
188
+ }
synved-option/script/custom.js CHANGED
@@ -8,14 +8,14 @@
8
  var synvedOptionmediaUploadInput = null;
9
 
10
  var SynvedOption = {
11
-
12
- performRequest: function (action, params)
13
  {
14
- if (params == undefined || params == null)
15
  {
16
  params = {}
17
  }
18
-
19
  jQuery.ajax(
20
  SynvedOptionVars.ajaxurl,
21
  {
@@ -35,25 +35,24 @@ var SynvedOption = {
35
  }
36
  );
37
  },
38
-
39
- actionStarted: function (action, params, response, request)
40
  {
41
-
42
  },
43
-
44
- actionFailed: function (action, params, error, request)
45
  {
46
-
47
  },
48
-
49
  handleOverlay: function (markup)
50
  {
51
-
52
  }
53
  };
54
 
55
  jQuery(document).ready(function() {
56
-
57
  jQuery('.synved-option-upload-button').click(function() {
58
  var formfield = jQuery(this).prevAll('input[type="text"]');
59
  var type = jQuery(this).prevAll('input[type="hidden"]').attr('value');
@@ -61,32 +60,32 @@ jQuery(document).ready(function() {
61
  tb_show('', 'media-upload.php?type=' + type + '&amp;TB_iframe=true');
62
  return false;
63
  });
64
-
65
  var oldSendToEditor = null;
66
-
67
  if (window.send_to_editor)
68
  {
69
  oldSendToEditor = window.send_to_editor;
70
  }
71
-
72
  window.send_to_editor = function(html) {
73
  if (oldSendToEditor != null)
74
  {
75
  oldSendToEditor(html);
76
  }
77
-
78
  imgurl = jQuery('img',html).attr('src');
79
  jQuery(synvedOptionmediaUploadInput).val(imgurl);
80
  tb_remove();
81
  }
82
-
83
  jQuery('.synved-option-color-input-picker').each(function () {
84
  var it = jQuery(this);
85
  var input = it.prev('input.color-input');
86
  it.farbtastic(input);
87
-
88
  it.stop().css({opacity: 0, display: 'none'});
89
-
90
  input.focus(function (){
91
  jQuery(it).stop().css({display: 'block'}).animate({opacity: 1});
92
  })
@@ -94,31 +93,43 @@ jQuery(document).ready(function() {
94
  jQuery(it).stop().animate({opacity: 0}).css({display: 'none'});
95
  });
96
  });
97
-
98
  jQuery('.synved-option-tag-selector').suggest(ajaxurl + '?action=ajax-tag-search&tax=post_tag', {multiple: true, multipleSep: ','});
99
-
100
  jQuery('.synved-option-reset-button').click(function (e) {
101
  var jthis = jQuery(this);
102
  var input = jthis.parentsUntil('tr').find('input, textarea');
103
-
104
  if (input.size() > 0)
105
  {
106
  var placeholder = input.attr('placeholder');
107
-
108
  if (placeholder != null)
109
  {
110
  input.val(placeholder);
111
  }
112
  }
113
-
114
  e.preventDefault();
115
-
116
  return false;
117
  });
118
  });
119
 
120
 
121
- (function ($) {
 
 
 
 
 
 
 
 
 
 
 
 
122
  /**
123
  * Handles "disable all features" switch button
124
  * @type {{init: synved_switcher.init}}
@@ -153,4 +164,4 @@ jQuery(document).ready(function() {
153
  });
154
  }
155
  };
156
- })(jQuery);
8
  var synvedOptionmediaUploadInput = null;
9
 
10
  var SynvedOption = {
11
+
12
+ performRequest: function (action, params)
13
  {
14
+ if (params == undefined || params == null)
15
  {
16
  params = {}
17
  }
18
+
19
  jQuery.ajax(
20
  SynvedOptionVars.ajaxurl,
21
  {
35
  }
36
  );
37
  },
38
+
39
+ actionStarted: function (action, params, response, request)
40
  {
41
+
42
  },
43
+
44
+ actionFailed: function (action, params, error, request)
45
  {
46
+
47
  },
48
+
49
  handleOverlay: function (markup)
50
  {
51
+
52
  }
53
  };
54
 
55
  jQuery(document).ready(function() {
 
56
  jQuery('.synved-option-upload-button').click(function() {
57
  var formfield = jQuery(this).prevAll('input[type="text"]');
58
  var type = jQuery(this).prevAll('input[type="hidden"]').attr('value');
60
  tb_show('', 'media-upload.php?type=' + type + '&amp;TB_iframe=true');
61
  return false;
62
  });
63
+
64
  var oldSendToEditor = null;
65
+
66
  if (window.send_to_editor)
67
  {
68
  oldSendToEditor = window.send_to_editor;
69
  }
70
+
71
  window.send_to_editor = function(html) {
72
  if (oldSendToEditor != null)
73
  {
74
  oldSendToEditor(html);
75
  }
76
+
77
  imgurl = jQuery('img',html).attr('src');
78
  jQuery(synvedOptionmediaUploadInput).val(imgurl);
79
  tb_remove();
80
  }
81
+
82
  jQuery('.synved-option-color-input-picker').each(function () {
83
  var it = jQuery(this);
84
  var input = it.prev('input.color-input');
85
  it.farbtastic(input);
86
+
87
  it.stop().css({opacity: 0, display: 'none'});
88
+
89
  input.focus(function (){
90
  jQuery(it).stop().css({display: 'block'}).animate({opacity: 1});
91
  })
93
  jQuery(it).stop().animate({opacity: 0}).css({display: 'none'});
94
  });
95
  });
96
+
97
  jQuery('.synved-option-tag-selector').suggest(ajaxurl + '?action=ajax-tag-search&tax=post_tag', {multiple: true, multipleSep: ','});
98
+
99
  jQuery('.synved-option-reset-button').click(function (e) {
100
  var jthis = jQuery(this);
101
  var input = jthis.parentsUntil('tr').find('input, textarea');
102
+
103
  if (input.size() > 0)
104
  {
105
  var placeholder = input.attr('placeholder');
106
+
107
  if (placeholder != null)
108
  {
109
  input.val(placeholder);
110
  }
111
  }
112
+
113
  e.preventDefault();
114
+
115
  return false;
116
  });
117
  });
118
 
119
 
120
+ (function ($, wp) {
121
+
122
+ $(document).ready(function() {
123
+ // Close review us.
124
+ $( 'body' ).on( 'click', '#close-review-us', function () {
125
+ wp.ajax.post( 'smf_ajax_hide_review', {
126
+ nonce: ''
127
+ } ).always( function ( results ) {
128
+ $( '.smf-review-us' ).fadeOut();
129
+ } );
130
+ } );
131
+ });
132
+
133
  /**
134
  * Handles "disable all features" switch button
135
  * @type {{init: synved_switcher.init}}
164
  });
165
  }
166
  };
167
+ })( window.jQuery, window.wp );
synved-option/style/admin.css CHANGED
@@ -56,3 +56,27 @@ background-image:none;
56
  .synved-option-creds-form .wrap {
57
  margin-left:15px;
58
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  .synved-option-creds-form .wrap {
57
  margin-left:15px;
58
  }
59
+
60
+ .smf-review-us {
61
+ position: fixed;
62
+ right: 10px;
63
+ bottom: 40px;
64
+ background: #fff;
65
+ border: solid 1px #00b300;
66
+ border-radius: 10px;
67
+ padding: 15px;
68
+ width: 295px;
69
+ text-align: center;
70
+ }
71
+
72
+ .smf-review-us #close-review-us {
73
+ cursor: pointer;
74
+ }
75
+
76
+ .smf-review-us h3 {
77
+ color: #353535;
78
+ }
79
+
80
+ .smf-review-us h3 a {
81
+ color: #00b300;
82
+ }
synved-option/synved-option.php CHANGED
@@ -39,7 +39,7 @@ class SynvedOptionCallback
39
  private $_Callback;
40
  private $_Default;
41
  private $_Params;
42
-
43
  public function __construct($callback, $object = null, $default = null, array $callback_parameters = null)
44
  {
45
  $this->_Object = $object;
@@ -47,50 +47,50 @@ class SynvedOptionCallback
47
  $this->_Default = $default;
48
  $this->_Params = $callback_parameters;
49
  }
50
-
51
  public function __invoke($arguments = null)
52
  {
53
  if (!is_array($arguments) || func_num_args() > 1)
54
  {
55
  $arguments = func_get_args();
56
  }
57
-
58
  return $this->InvokeInternal($arguments);
59
  }
60
-
61
  public function Invoke($arguments = null)
62
  {
63
  if (!is_array($arguments) || func_num_args() > 1)
64
  {
65
  $arguments = func_get_args();
66
  }
67
-
68
  return $this->InvokeInternal($arguments);
69
  }
70
-
71
  protected function InvokeInternal(array $arguments = null)
72
  {
73
  $func = $this->_Callback;
74
-
75
  if ($this->_Object != null)
76
  {
77
  $func = array($this->_Object, $func);
78
  }
79
-
80
  $parameters = $this->_Params;
81
-
82
  if ($parameters != null)
83
  {
84
  $parameter_keys = array_keys($parameters);
85
  $count = count($parameter_keys);
86
  $argument_list = array();
87
-
88
  for ($i = 0; $i < $count; $i++)
89
  {
90
  $key = $parameter_keys[$i];
91
  $parameter = $parameters[$key];
92
  $value = isset($parameter['default']) ? $parameter['default'] : null;
93
-
94
  if (isset($arguments[$key]))
95
  {
96
  $value = $arguments[$key];
@@ -99,23 +99,23 @@ class SynvedOptionCallback
99
  {
100
  $value = $arguments[$i];
101
  }
102
-
103
  $argument_list[$i] = $value;
104
  }
105
-
106
  $arguments = $argument_list;
107
  }
108
-
109
  if (!isset($arguments[0]) || $arguments[0] === null)
110
  {
111
  $arguments[0] = $this->_Default;
112
  }
113
-
114
  if (is_callable($func))
115
  {
116
  return call_user_func_array($func, $arguments);
117
  }
118
-
119
  return $arguments[0];
120
  }
121
  }
@@ -134,13 +134,13 @@ function synved_option_callback($callback, $default = null, $callback_parameters
134
  {
135
  $object = null;
136
  $func = $callback;
137
-
138
  if (is_array($callback))
139
  {
140
  $object = $callback[0];
141
  $func = $callback[1];
142
  }
143
-
144
  return new SynvedOptionCallback($func, $object, $default, $callback_parameters);
145
  }
146
 
@@ -150,8 +150,8 @@ function synved_option_callback_create($callback_code, $callback_parameters = nu
150
  {
151
  $callback_parameters = array(
152
  'value' => array(),
153
- 'item' => array('default' => null),
154
- 'name' => array('default' => null),
155
  'id' => array('default' => null)
156
  );
157
  }
@@ -159,29 +159,29 @@ function synved_option_callback_create($callback_code, $callback_parameters = nu
159
  {
160
  $parameters = explode(',', $callback_parameters);
161
  $callback_parameters = array();
162
-
163
  foreach ($parameters as $param)
164
  {
165
  $param = trim($param);
166
  $param_info = preg_split('/\\s+/', $param, -1, PREG_SPLIT_NO_EMPTY);
167
-
168
  if (count($param_info) > 1)
169
  {
170
  if ($param_info[1] == '=')
171
  {
172
  array_unshift($param_info, null);
173
  }
174
-
175
  $param_type = $param_info[0];
176
  $param_name = ltrim($param_info[1], '$');
177
  $param_manifest = array('type' => $param_type);
178
-
179
  if (count($param_info) > 2)
180
  {
181
  if ($param_info[2] == '=' && isset($param_info[3]))
182
  {
183
  $param_default = trim($param_info[3]);
184
-
185
  if ($param_default == 'null')
186
  {
187
  $param_default = null;
@@ -211,25 +211,25 @@ function synved_option_callback_create($callback_code, $callback_parameters = nu
211
  $param_default = (double) $param_default;
212
  }
213
  }
214
-
215
  $param_manifest['default'] = $param_default;
216
  }
217
  }
218
-
219
  $callback_parameters[$param_name] = $param_manifest;
220
  }
221
  else
222
  {
223
  $param_name = ltrim($param_info[0], '$');
224
-
225
  $callback_parameters[$param_name] = array();
226
  }
227
  }
228
  }
229
-
230
  $callback_code = trim($callback_code);
231
  $callback = null;
232
-
233
  if ($callback_code != null)
234
  {
235
  if (substr($callback_code, -1) != ';')
@@ -244,11 +244,11 @@ function synved_option_callback_create($callback_code, $callback_parameters = nu
244
  $partial = null;
245
  $string = null;
246
  $lines = array();
247
-
248
  for ($i = 0; $i < $count; $i++)
249
  {
250
  $split = $result[$i];
251
-
252
  if ($string != null)
253
  {
254
  $partial .= $string . $split;
@@ -267,83 +267,83 @@ function synved_option_callback_create($callback_code, $callback_parameters = nu
267
  {
268
  $partial .= $split;
269
  }
270
-
271
  if ($split != null && $partial == null)
272
  {
273
  $lines[] = $split;
274
  }
275
  }
276
-
277
  $count = count($lines);
278
  $lines[$count - 1] = 'return ' . $lines[$count - 1];
279
-
280
  $callback_code = implode(';', $lines) . ';';
281
  }
282
-
283
  $function_params = null;
284
-
285
  foreach ($callback_parameters as $param_name => $callback_param)
286
  {
287
  $param_type = isset($callback_param['type']) ? $callback_param['type'] : null;
288
  $param_default = isset($callback_param['default']) ? $callback_param['default'] : null;
289
-
290
  if ($function_params != null)
291
  {
292
  $function_params .= ', ';
293
  }
294
-
295
  if ($param_type != null)
296
  {
297
  $function_params .= $param_type;
298
  }
299
-
300
  $function_params .= '$' . $param_name;
301
-
302
  if ($param_default != null)
303
  {
304
  $function_params .= ' = ' . $param_default;
305
  }
306
  }
307
-
308
  $callback = function($function_params) { $callback_code; };
309
-
310
  return synved_option_callback($callback, null, $callback_parameters);
311
  }
312
-
313
  return null;
314
  }
315
 
316
  function synved_option_register($id, array $options)
317
  {
318
  global $synved_option_list;
319
-
320
  $synved_option_list[$id] = array('options' => $options, 'items' => array(), 'names' => array(), 'groups' => array(), 'pages' => array(), 'sections' => array(), 'outputs' => array());
321
  }
322
 
323
  function synved_option_item_list($id)
324
  {
325
  global $synved_option_list;
326
-
327
  if (isset($synved_option_list[$id]))
328
  {
329
  $list = !empty($synved_option_list[$id]['items'])?$synved_option_list[$id]['items']:null;
330
-
331
  if ($list == null)
332
  {
333
  $list = synved_option_prepare_list($id);
334
  $synved_option_list[$id]['items'] = $list;
335
  }
336
-
337
  return $list;
338
  }
339
-
340
  return null;
341
  }
342
 
343
  function synved_option_prepare_list($id)
344
  {
345
  global $synved_option_list;
346
-
347
  if (isset($synved_option_list[$id]))
348
  {
349
  $options = !empty($synved_option_list[$id]['options'])?$synved_option_list[$id]['options']:array();
@@ -406,49 +406,49 @@ function synved_option_prepare_list($id)
406
  $item = $default_page;
407
  $name = $item['name'];
408
  $item = synved_option_prepare_list_item($id, null, null, $name, $item);
409
-
410
  if ($item != null)
411
  {
412
  $final_list[$name] = $item;
413
  }
414
  }
415
-
416
  return $final_list;
417
  }
418
-
419
  return null;
420
  }
421
 
422
  function synved_option_prepare_list_item($id, $page, $section, $name, array $item)
423
  {
424
  global $synved_option_list;
425
-
426
  $type = synved_option_item_type($item);
427
  $sections = isset($item['sections']) ? $item['sections'] : null;
428
  $settings = isset($item['settings']) ? $item['settings'] : null;
429
-
430
  $item['_synved_option_id'] = $id;
431
  $item['_synved_option_name'] = $name;
432
-
433
  if ($type == 'options-page')
434
  {
435
  if ($sections != null)
436
  {
437
  $list = $sections;
438
-
439
  foreach ($list as $child_name => $child_item)
440
  {
441
  $child_item = synved_option_prepare_list_item($id, $name, null, $child_name, $child_item);
442
-
443
  if ($child_item != null)
444
  {
445
  $list[$child_name] = $child_item;
446
  }
447
  }
448
-
449
  $item['sections'] = $list;
450
  }
451
-
452
  $synved_option_list[$id]['pages'][$name] = $item;
453
  }
454
  else if ($type == 'options-section')
@@ -456,38 +456,38 @@ function synved_option_prepare_list_item($id, $page, $section, $name, array $ite
456
  if ($settings != null)
457
  {
458
  $list = $settings;
459
-
460
  foreach ($list as $child_name => $child_item)
461
  {
462
  $child_item = synved_option_prepare_list_item($id, $page, $name, $child_name, $child_item);
463
-
464
  if ($child_item != null)
465
  {
466
  $list[$child_name] = $child_item;
467
  }
468
  }
469
-
470
  $item['settings'] = $list;
471
  }
472
-
473
  $synved_option_list[$id]['sections'][$name] = $item;
474
  }
475
  else if (in_array($type, array('style', 'script')))
476
  {
477
  $synved_option_list[$id]['outputs'][$name] = $item;
478
  }
479
-
480
  return $item;
481
  }
482
 
483
  function synved_option_value_list($id)
484
  {
485
  global $synved_option_list;
486
-
487
  if (!isset($synved_option_list[$id]['values']) || $synved_option_list[$id]['values'] == null)
488
  {
489
  $options = get_option(synved_option_name_default($id));
490
-
491
  if ($options != null && is_array($options))
492
  {
493
  $synved_option_list[$id]['values'] = $options;
@@ -497,7 +497,7 @@ function synved_option_value_list($id)
497
  return array();
498
  }
499
  }
500
-
501
  return $synved_option_list[$id]['values'];
502
  }
503
 
@@ -506,12 +506,12 @@ function synved_option_get($id, $name, $default = null)
506
  $options = synved_option_value_list($id);
507
  $value = isset($options[$name]) ? $options[$name] : null;
508
  $item = synved_option_item($id, $name);
509
-
510
  if (!isset($options[$name]) && $default !== null)
511
  {
512
  $value = $default;
513
  }
514
-
515
  if ($item != null)
516
  {
517
  $value = synved_option_item_sanitize_value($id, $name, $value, $item);
@@ -520,20 +520,20 @@ function synved_option_get($id, $name, $default = null)
520
  {
521
  $value = $default;
522
  }
523
-
524
  return $value;
525
  }
526
 
527
  function synved_option_set($id, $name, $value)
528
  {
529
  global $synved_option_list;
530
-
531
  $options_name = synved_option_name_default($id);
532
  $options = get_option($options_name);
533
 
534
  $options[$name] = synved_option_item_sanitize_value($id, $name, $value);
535
  update_option($options_name, $options);
536
-
537
  unset($synved_option_list[$id]['values']);
538
  }
539
 
@@ -545,28 +545,28 @@ function synved_option_label_from_id($id)
545
  function synved_option_name_default($id)
546
  {
547
  global $synved_option_list;
548
-
549
  $name = $id . '_settings';
550
-
551
  if (!isset($synved_option_list[$id]['names'][$name]))
552
  {
553
  $synved_option_list[$id]['names'][$name] = array('type' => 'name', 'label' => synved_option_label_from_id($id));
554
  }
555
-
556
  return $name;
557
  }
558
 
559
  function synved_option_group_default($id)
560
  {
561
  global $synved_option_list;
562
-
563
  $group = $id . '_settings_group';
564
-
565
  if (!isset($synved_option_list[$id]['groups'][$group]))
566
  {
567
  $synved_option_list[$id]['groups'][$group] = array('type' => 'group', 'label' => synved_option_label_from_id($id));
568
  }
569
-
570
  return $group;
571
  }
572
 
@@ -585,7 +585,7 @@ function synved_option_wp_handle_setting($id, $page, $section, $name, $item)
585
  if ($sections != null)
586
  {
587
  $page_slug = synved_option_page_slug($id, $name, $item);
588
-
589
  foreach ($sections as $child_name => $child_item)
590
  {
591
  synved_option_wp_handle_setting($id, $page_slug, null, $child_name, $child_item);
@@ -608,7 +608,7 @@ function synved_option_wp_handle_setting($id, $page, $section, $name, $item)
608
  {
609
  add_settings_field($name, $label,
610
  'synved_option_call_array',
611
- $page, $section,
612
  array('synved_option_setting_cb', array($id, $name, $item)));
613
  }
614
  }
@@ -616,12 +616,12 @@ function synved_option_wp_handle_setting($id, $page, $section, $name, $item)
616
  function synved_option_addon_installed($id, $name, $item = null)
617
  {
618
  $item = synved_option_item($id, $name);
619
-
620
  if ($item != null)
621
  {
622
  return synved_option_item_addon_is_installed($item);
623
  }
624
-
625
  return false;
626
  }
627
 
@@ -644,14 +644,14 @@ function synved_option_include_addon_list($path, $filter = null)
644
  function synved_option_include_module_addon_list($module_id, $filter = null)
645
  {
646
  global $synved_option;
647
-
648
  $synved_option['module-addon-list'][] = array('module-id' => $module_id, 'filter' => $filter);
649
  }
650
 
651
  function synved_option_init()
652
  {
653
  global $synved_option_list;
654
-
655
  if ($synved_option_list != null)
656
  {
657
  foreach ($synved_option_list as $id => $list)
@@ -659,7 +659,7 @@ function synved_option_init()
659
  $items = synved_option_item_list($id);
660
  }
661
  }
662
-
663
  if ((isset($_POST['action']) && $_POST['action'] == 'synved_option'))
664
  {
665
  ob_start();
@@ -674,53 +674,53 @@ function synved_option_call_array($args)
674
  function synved_option_path_uri($path = null)
675
  {
676
  $uri = plugins_url('/synved-options') . '/synved-option';
677
-
678
  if (function_exists('synved_plugout_module_uri_get'))
679
  {
680
  $mod_uri = synved_plugout_module_uri_get('synved-option');
681
-
682
  if ($mod_uri != null)
683
  {
684
  $uri = $mod_uri;
685
  }
686
  }
687
-
688
  if ($path != null)
689
  {
690
  if (substr($uri, -1) != '/' && $path[0] != '/')
691
  {
692
  $uri .= '/';
693
  }
694
-
695
  $uri .= $path;
696
  }
697
-
698
  return $uri;
699
  }
700
 
701
  function synved_option_print_head_outputs()
702
  {
703
  global $synved_option_list;
704
-
705
  foreach ($synved_option_list as $id => $list)
706
  {
707
  $items = synved_option_item_list($id);
708
  $outputs = $list['outputs'];
709
-
710
  foreach ($outputs as $name => $item)
711
  {
712
  $type = synved_option_item_type($item);
713
  $mode = synved_option_item_mode($item);
714
-
715
  if (in_array('manual', $mode))
716
  {
717
  continue;
718
  }
719
-
720
  $content = synved_option_get($id, $name);
721
  $tag = null;
722
  $attrs = null;
723
-
724
  if ($type == 'style')
725
  {
726
  $tag = $type;
@@ -730,19 +730,19 @@ function synved_option_print_head_outputs()
730
  {
731
  $tag = $type;
732
  $attrs['type'] = 'text/javascript';
733
-
734
  $content = '/* <![CDATA[ */' . "\r\n" . $content . "\r\n" . '/* ]]> */';
735
  }
736
-
737
  if ($tag != null)
738
  {
739
  echo "\r\n" . '<' . $tag;
740
-
741
  foreach ($attrs as $attr_name => $attr_value)
742
  {
743
  echo ' ' . $attr_name . '="' . esc_attr($attr_value) . '"';
744
  }
745
-
746
  echo '>';
747
  echo $content;
748
  echo '</' . $tag . '>' . "\r\n";
@@ -777,14 +777,14 @@ function synved_option_print_head_outputs()
777
  function synved_option_wp_after_setup_theme()
778
  {
779
  global $synved_option;
780
-
781
  foreach ($synved_option['module-addon-list'] as $module_addon_load)
782
  {
783
  $module_id = $module_addon_load['module-id'];
784
  $filter = $module_addon_load['filter'];
785
-
786
  $addon_list = synved_plugout_module_addon_list($module_id, $filter);
787
-
788
  if ($addon_list != null)
789
  {
790
  foreach ($addon_list as $addon_name => $addon_file)
@@ -816,7 +816,7 @@ function synved_option_wp_admin_menu()
816
  function synved_option_wp_admin_init()
817
  {
818
  global $synved_option_list;
819
-
820
  if ($synved_option_list != null)
821
  {
822
  foreach ($synved_option_list as $id => $list)
@@ -827,9 +827,9 @@ function synved_option_wp_admin_init()
827
  define( 'SYNVEDOPTIONID', $id );
828
 
829
  register_setting($group, $dbname, synved_option_setting_sanitize_cb($id, $list));
830
-
831
  $items = synved_option_item_list($id);
832
-
833
  foreach ($items as $name => $item)
834
  {
835
  synved_option_wp_handle_setting($id, null, null, $name, $item);
@@ -848,12 +848,12 @@ function synved_option_wp_upgrader_source_selection($source, $remote_source, $ob
848
  if ($object != null && $object instanceof Plugin_Upgrader && method_exists($object, 'check_package'))
849
  {
850
  $result = $object->check_package($source);
851
-
852
  if (is_wp_error($result))
853
  {
854
  $folder_name = basename($source);
855
  $addon_item = synved_option_item_query(null, array(array('type' => 'addon'), array('folder' => $folder_name)));
856
-
857
  if ($addon_item != null)
858
  {
859
  // XXX fix this $id/$name retrieval...ugly
@@ -863,7 +863,7 @@ function synved_option_wp_upgrader_source_selection($source, $remote_source, $ob
863
  $page_item = synved_option_item($id, $addon_page);
864
  $page_label = synved_option_item_label($page_item);
865
  $page_url = synved_option_item_page_link_url($id, $name);
866
-
867
  $source = new WP_Error('synved_option_invalid_plugin_is_addon', sprintf(__('<b>This addon must be installed through the <a href="%s">%s settings page</a>.</b>'), $page_url, $page_label), '');
868
  }
869
  }
@@ -878,49 +878,49 @@ function synved_option_wp_upgrader_pre_install($perform, $extra)
878
  {
879
  return $perform;
880
  }
881
-
882
  $upgrade_transfer = get_option('synved_option_wp_upgrade_addon_transfer');
883
-
884
  if ($upgrade_transfer != null)
885
  {
886
  $upgrade_transfer_time = get_option('synved_option_wp_upgrade_addon_transfer_time');
887
-
888
  if ($upgrade_transfer_time == null || (time() - $upgrade_transfer_time > (60 * 60 * 1)))
889
  {
890
  $upgrade_transfer = null;
891
-
892
  update_option('synved_option_wp_upgrade_addon_transfer', '');
893
  }
894
  }
895
 
896
  $module_list = array();
897
-
898
  if (function_exists('synved_plugout_get_module_list'))
899
  {
900
  $module_list = synved_plugout_get_module_list();
901
  }
902
- else
903
  {
904
  global $synved_plugout;
905
-
906
  $module_list = array_keys($synved_plugout['module-list']);
907
  }
908
-
909
  $plugins_dir = WP_PLUGIN_DIR;
910
  $plugins_dir = rtrim(str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, realpath($plugins_dir)), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
911
-
912
  $plugin = $extra['plugin'];
913
  $plugin_dir = rtrim(str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, realpath(dirname($plugins_dir . $plugin))), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
914
-
915
  $dir = get_temp_dir();
916
  $name = time();
917
  $dir = rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . wp_unique_filename($dir, $name) . DIRECTORY_SEPARATOR;
918
  $list = array();
919
-
920
  foreach ($module_list as $module_id)
921
  {
922
  $addon_list = synved_plugout_module_addon_list($module_id);
923
-
924
  if ($addon_list != null)
925
  {
926
  foreach ($addon_list as $addon_name => $addon_file)
@@ -929,93 +929,93 @@ function synved_option_wp_upgrader_pre_install($perform, $extra)
929
  {
930
  $addon_dir = dirname($addon_file);
931
  $parent_dir = dirname($addon_dir);
932
-
933
  // clean names for comparison
934
  $addon_dir = rtrim(str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, realpath($addon_dir)), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
935
  $parent_dir = rtrim(str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, realpath($parent_dir)), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
936
-
937
  if (strtolower($parent_dir) != strtolower($plugins_dir) && strpos(strtolower($addon_dir), strtolower($plugin_dir)) !== false)
938
  {
939
  $path = $dir;
940
  $diff = substr($addon_dir, strlen($plugins_dir));
941
  $path .= $diff;
942
-
943
  wp_mkdir_p($path);
944
-
945
  copy_dir($addon_dir, $path);
946
-
947
  $list[] = array('original' => $addon_dir, 'temporary' => $path);
948
  }
949
  }
950
  }
951
  }
952
  }
953
-
954
  if ($list != null)
955
  {
956
  update_option('synved_option_wp_upgrade_addon_transfer', array('directory' => $dir, 'list' => $list));
957
  update_option('synved_option_wp_upgrade_addon_transfer_time', time());
958
  }
959
-
960
  return $perform;
961
  }
962
 
963
  function synved_option_wp_upgrader_post_install($perform, $extra, $result = null)
964
  {
965
  $upgrade_transfer = get_option('synved_option_wp_upgrade_addon_transfer');
966
-
967
  if ($upgrade_transfer != null)
968
  {
969
  $list = $upgrade_transfer['list'];
970
-
971
  foreach ($list as $upgrade_item)
972
  {
973
  $original = $upgrade_item['original'];
974
  $temporary = $upgrade_item['temporary'];
975
-
976
  wp_mkdir_p($original);
977
-
978
  copy_dir($temporary, $original);
979
  }
980
-
981
  global $wp_filesystem;
982
-
983
  if ($wp_filesystem != null)
984
  {
985
  $directory = $upgrade_transfer['directory'];
986
-
987
  $wp_filesystem->delete($directory, true);
988
  }
989
-
990
  update_option('synved_option_wp_upgrade_addon_transfer', '');
991
  }
992
-
993
  return $perform;
994
  }
995
 
996
  function synved_option_wp_plugin_action_links($links, $file)
997
  {
998
  global $synved_option_list;
999
-
1000
  if ($synved_option_list != null)
1001
  {
1002
  foreach ($synved_option_list as $id => $list)
1003
  {
1004
  $items = synved_option_item_list($id);
1005
  $pages = $synved_option_list[$id]['pages'];
1006
-
1007
  foreach ($pages as $name => $page)
1008
  {
1009
  $link_label = synved_option_item_property($page, 'link-label');
1010
  $link_target = synved_option_item_property($page, 'link-target');
1011
  $link_url = synved_option_page_link_url($id, $name, $page);
1012
-
1013
  if ($link_label == null)
1014
  {
1015
  $link_label = __('Settings');
1016
  }
1017
-
1018
- if ($file == $link_target)
1019
  {
1020
  $links[] = '<a href="' . $link_url . '">' . $link_label . '</a>';
1021
  }
@@ -1029,18 +1029,18 @@ function synved_option_wp_plugin_action_links($links, $file)
1029
  function synved_option_admin_enqueue_scripts()
1030
  {
1031
  $uri = synved_option_path_uri();
1032
-
1033
  wp_register_style('synved-option-jquery-ui', $uri . '/jqueryUI/css/snvdopt/jquery-ui-1.9.2.custom.min.css', false, '1.9.2');
1034
  wp_register_style('synved-option-admin', $uri . '/style/admin.css', array('wp-jquery-ui-dialog', 'synved-option-jquery-ui'), '1.0');
1035
-
1036
- wp_register_script('synved-option-script-custom', $uri . '/script/custom.js', array('jquery', 'suggest', 'media-upload', 'thickbox', 'jquery-ui-core', 'jquery-ui-progressbar', 'jquery-ui-dialog'), '1.0.0');
1037
  wp_localize_script('synved-option-script-custom', 'SynvedOptionVars', array('flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'ajaxurl' => admin_url('admin-ajax.php'), 'synvedSecurity' => wp_create_nonce('synved-option-submit-nonce')));
1038
-
1039
  $page = isset($_GET['page']) ? $_GET['page'] : null;
1040
  $enqueue = false;
1041
-
1042
  global $synved_option_list;
1043
-
1044
  if ($synved_option_list != null)
1045
  {
1046
  foreach ($synved_option_list as $id => $list)
@@ -1048,20 +1048,20 @@ function synved_option_admin_enqueue_scripts()
1048
  if (isset($list['pages']) && $list['pages'] != null)
1049
  {
1050
  $page_list = $list['pages'];
1051
-
1052
  foreach ($page_list as $name => $page_object)
1053
  {
1054
  if ($page == synved_option_page_slug($id, $name))
1055
  {
1056
  $enqueue = true;
1057
-
1058
  break;
1059
  }
1060
  }
1061
  }
1062
  }
1063
  }
1064
-
1065
  if ($enqueue)
1066
  {
1067
  wp_enqueue_style('thickbox');
@@ -1069,7 +1069,7 @@ function synved_option_admin_enqueue_scripts()
1069
  wp_enqueue_style('wp-pointer');
1070
  wp_enqueue_style('synved-option-jquery-ui');
1071
  wp_enqueue_style('synved-option-admin');
1072
-
1073
  wp_enqueue_script('plupload-all');
1074
  wp_enqueue_script('media-upload');
1075
  wp_enqueue_script('suggest');
@@ -1083,7 +1083,7 @@ function synved_option_ajax()
1083
  {
1084
  check_ajax_referer('synved-option-submit-nonce', 'synvedSecurity');
1085
 
1086
- if (!isset($_POST['synvedAction']) || $_POST['synvedAction'] == null)
1087
  {
1088
  return;
1089
  }
@@ -1091,19 +1091,19 @@ function synved_option_ajax()
1091
  $action = $_POST['synvedAction'];
1092
  $params = isset($_POST['synvedParams']) ? $_POST['synvedParams'] : null;
1093
  $response = null;
1094
-
1095
  if (is_string($params))
1096
  {
1097
  $parms = json_decode($params, true);
1098
-
1099
  if ($parms == null)
1100
  {
1101
  $parms = json_decode(stripslashes($params), true);
1102
  }
1103
-
1104
  $params = $parms;
1105
  }
1106
-
1107
  switch ($action)
1108
  {
1109
  case 'install-addon':
@@ -1115,17 +1115,17 @@ function synved_option_ajax()
1115
  $response = synved_option_ajax_type_addon($action, $params);
1116
  }
1117
  }
1118
-
1119
  break;
1120
  }
1121
  }
1122
 
1123
- while (ob_get_level() > 0)
1124
  {
1125
  ob_end_clean();
1126
  }
1127
 
1128
- if ($response != null)
1129
  {
1130
  $response = json_encode($response);
1131
 
@@ -1133,7 +1133,7 @@ function synved_option_ajax()
1133
 
1134
  echo $response;
1135
  }
1136
- else
1137
  {
1138
  header('HTTP/1.1 403 Forbidden');
1139
  }
39
  private $_Callback;
40
  private $_Default;
41
  private $_Params;
42
+
43
  public function __construct($callback, $object = null, $default = null, array $callback_parameters = null)
44
  {
45
  $this->_Object = $object;
47
  $this->_Default = $default;
48
  $this->_Params = $callback_parameters;
49
  }
50
+
51
  public function __invoke($arguments = null)
52
  {
53
  if (!is_array($arguments) || func_num_args() > 1)
54
  {
55
  $arguments = func_get_args();
56
  }
57
+
58
  return $this->InvokeInternal($arguments);
59
  }
60
+
61
  public function Invoke($arguments = null)
62
  {
63
  if (!is_array($arguments) || func_num_args() > 1)
64
  {
65
  $arguments = func_get_args();
66
  }
67
+
68
  return $this->InvokeInternal($arguments);
69
  }
70
+
71
  protected function InvokeInternal(array $arguments = null)
72
  {
73
  $func = $this->_Callback;
74
+
75
  if ($this->_Object != null)
76
  {
77
  $func = array($this->_Object, $func);
78
  }
79
+
80
  $parameters = $this->_Params;
81
+
82
  if ($parameters != null)
83
  {
84
  $parameter_keys = array_keys($parameters);
85
  $count = count($parameter_keys);
86
  $argument_list = array();
87
+
88
  for ($i = 0; $i < $count; $i++)
89
  {
90
  $key = $parameter_keys[$i];
91
  $parameter = $parameters[$key];
92
  $value = isset($parameter['default']) ? $parameter['default'] : null;
93
+
94
  if (isset($arguments[$key]))
95
  {
96
  $value = $arguments[$key];
99
  {
100
  $value = $arguments[$i];
101
  }
102
+
103
  $argument_list[$i] = $value;
104
  }
105
+
106
  $arguments = $argument_list;
107
  }
108
+
109
  if (!isset($arguments[0]) || $arguments[0] === null)
110
  {
111
  $arguments[0] = $this->_Default;
112
  }
113
+
114
  if (is_callable($func))
115
  {
116
  return call_user_func_array($func, $arguments);
117
  }
118
+
119
  return $arguments[0];
120
  }
121
  }
134
  {
135
  $object = null;
136
  $func = $callback;
137
+
138
  if (is_array($callback))
139
  {
140
  $object = $callback[0];
141
  $func = $callback[1];
142
  }
143
+
144
  return new SynvedOptionCallback($func, $object, $default, $callback_parameters);
145
  }
146
 
150
  {
151
  $callback_parameters = array(
152
  'value' => array(),
153
+ 'item' => array('default' => null),
154
+ 'name' => array('default' => null),
155
  'id' => array('default' => null)
156
  );
157
  }
159
  {
160
  $parameters = explode(',', $callback_parameters);
161
  $callback_parameters = array();
162
+
163
  foreach ($parameters as $param)
164
  {
165
  $param = trim($param);
166
  $param_info = preg_split('/\\s+/', $param, -1, PREG_SPLIT_NO_EMPTY);
167
+
168
  if (count($param_info) > 1)
169
  {
170
  if ($param_info[1] == '=')
171
  {
172
  array_unshift($param_info, null);
173
  }
174
+
175
  $param_type = $param_info[0];
176
  $param_name = ltrim($param_info[1], '$');
177
  $param_manifest = array('type' => $param_type);
178
+
179
  if (count($param_info) > 2)
180
  {
181
  if ($param_info[2] == '=' && isset($param_info[3]))
182
  {
183
  $param_default = trim($param_info[3]);
184
+
185
  if ($param_default == 'null')
186
  {
187
  $param_default = null;
211
  $param_default = (double) $param_default;
212
  }
213
  }
214
+
215
  $param_manifest['default'] = $param_default;
216
  }
217
  }
218
+
219
  $callback_parameters[$param_name] = $param_manifest;
220
  }
221
  else
222
  {
223
  $param_name = ltrim($param_info[0], '$');
224
+
225
  $callback_parameters[$param_name] = array();
226
  }
227
  }
228
  }
229
+
230
  $callback_code = trim($callback_code);
231
  $callback = null;
232
+
233
  if ($callback_code != null)
234
  {
235
  if (substr($callback_code, -1) != ';')
244
  $partial = null;
245
  $string = null;
246
  $lines = array();
247
+
248
  for ($i = 0; $i < $count; $i++)
249
  {
250
  $split = $result[$i];
251
+
252
  if ($string != null)
253
  {
254
  $partial .= $string . $split;
267
  {
268
  $partial .= $split;
269
  }
270
+
271
  if ($split != null && $partial == null)
272
  {
273
  $lines[] = $split;
274
  }
275
  }
276
+
277
  $count = count($lines);
278
  $lines[$count - 1] = 'return ' . $lines[$count - 1];
279
+
280
  $callback_code = implode(';', $lines) . ';';
281
  }
282
+
283
  $function_params = null;
284
+
285
  foreach ($callback_parameters as $param_name => $callback_param)
286
  {
287
  $param_type = isset($callback_param['type']) ? $callback_param['type'] : null;
288
  $param_default = isset($callback_param['default']) ? $callback_param['default'] : null;
289
+
290
  if ($function_params != null)
291
  {
292
  $function_params .= ', ';
293
  }
294
+
295
  if ($param_type != null)
296
  {
297
  $function_params .= $param_type;
298
  }
299
+
300
  $function_params .= '$' . $param_name;
301
+
302
  if ($param_default != null)
303
  {
304
  $function_params .= ' = ' . $param_default;
305
  }
306
  }
307
+
308
  $callback = function($function_params) { $callback_code; };
309
+
310
  return synved_option_callback($callback, null, $callback_parameters);
311
  }
312
+
313
  return null;
314
  }
315
 
316
  function synved_option_register($id, array $options)
317
  {
318
  global $synved_option_list;
319
+
320
  $synved_option_list[$id] = array('options' => $options, 'items' => array(), 'names' => array(), 'groups' => array(), 'pages' => array(), 'sections' => array(), 'outputs' => array());
321
  }
322
 
323
  function synved_option_item_list($id)
324
  {
325
  global $synved_option_list;
326
+
327
  if (isset($synved_option_list[$id]))
328
  {
329
  $list = !empty($synved_option_list[$id]['items'])?$synved_option_list[$id]['items']:null;
330
+
331
  if ($list == null)
332
  {
333
  $list = synved_option_prepare_list($id);
334
  $synved_option_list[$id]['items'] = $list;
335
  }
336
+
337
  return $list;
338
  }
339
+
340
  return null;
341
  }
342
 
343
  function synved_option_prepare_list($id)
344
  {
345
  global $synved_option_list;
346
+
347
  if (isset($synved_option_list[$id]))
348
  {
349
  $options = !empty($synved_option_list[$id]['options'])?$synved_option_list[$id]['options']:array();
406
  $item = $default_page;
407
  $name = $item['name'];
408
  $item = synved_option_prepare_list_item($id, null, null, $name, $item);
409
+
410
  if ($item != null)
411
  {
412
  $final_list[$name] = $item;
413
  }
414
  }
415
+
416
  return $final_list;
417
  }
418
+
419
  return null;
420
  }
421
 
422
  function synved_option_prepare_list_item($id, $page, $section, $name, array $item)
423
  {
424
  global $synved_option_list;
425
+
426
  $type = synved_option_item_type($item);
427
  $sections = isset($item['sections']) ? $item['sections'] : null;
428
  $settings = isset($item['settings']) ? $item['settings'] : null;
429
+
430
  $item['_synved_option_id'] = $id;
431
  $item['_synved_option_name'] = $name;
432
+
433
  if ($type == 'options-page')
434
  {
435
  if ($sections != null)
436
  {
437
  $list = $sections;
438
+
439
  foreach ($list as $child_name => $child_item)
440
  {
441
  $child_item = synved_option_prepare_list_item($id, $name, null, $child_name, $child_item);
442
+
443
  if ($child_item != null)
444
  {
445
  $list[$child_name] = $child_item;
446
  }
447
  }
448
+
449
  $item['sections'] = $list;
450
  }
451
+
452
  $synved_option_list[$id]['pages'][$name] = $item;
453
  }
454
  else if ($type == 'options-section')
456
  if ($settings != null)
457
  {
458
  $list = $settings;
459
+
460
  foreach ($list as $child_name => $child_item)
461
  {
462
  $child_item = synved_option_prepare_list_item($id, $page, $name, $child_name, $child_item);
463
+
464
  if ($child_item != null)
465
  {
466
  $list[$child_name] = $child_item;
467
  }
468
  }
469
+
470
  $item['settings'] = $list;
471
  }
472
+
473
  $synved_option_list[$id]['sections'][$name] = $item;
474
  }
475
  else if (in_array($type, array('style', 'script')))
476
  {
477
  $synved_option_list[$id]['outputs'][$name] = $item;
478
  }
479
+
480
  return $item;
481
  }
482
 
483
  function synved_option_value_list($id)
484
  {
485
  global $synved_option_list;
486
+
487
  if (!isset($synved_option_list[$id]['values']) || $synved_option_list[$id]['values'] == null)
488
  {
489
  $options = get_option(synved_option_name_default($id));
490
+
491
  if ($options != null && is_array($options))
492
  {
493
  $synved_option_list[$id]['values'] = $options;
497
  return array();
498
  }
499
  }
500
+
501
  return $synved_option_list[$id]['values'];
502
  }
503
 
506
  $options = synved_option_value_list($id);
507
  $value = isset($options[$name]) ? $options[$name] : null;
508
  $item = synved_option_item($id, $name);
509
+
510
  if (!isset($options[$name]) && $default !== null)
511
  {
512
  $value = $default;
513
  }
514
+
515
  if ($item != null)
516
  {
517
  $value = synved_option_item_sanitize_value($id, $name, $value, $item);
520
  {
521
  $value = $default;
522
  }
523
+
524
  return $value;
525
  }
526
 
527
  function synved_option_set($id, $name, $value)
528
  {
529
  global $synved_option_list;
530
+
531
  $options_name = synved_option_name_default($id);
532
  $options = get_option($options_name);
533
 
534
  $options[$name] = synved_option_item_sanitize_value($id, $name, $value);
535
  update_option($options_name, $options);
536
+
537
  unset($synved_option_list[$id]['values']);
538
  }
539
 
545
  function synved_option_name_default($id)
546
  {
547
  global $synved_option_list;
548
+
549
  $name = $id . '_settings';
550
+
551
  if (!isset($synved_option_list[$id]['names'][$name]))
552
  {
553
  $synved_option_list[$id]['names'][$name] = array('type' => 'name', 'label' => synved_option_label_from_id($id));
554
  }
555
+
556
  return $name;
557
  }
558
 
559
  function synved_option_group_default($id)
560
  {
561
  global $synved_option_list;
562
+
563
  $group = $id . '_settings_group';
564
+
565
  if (!isset($synved_option_list[$id]['groups'][$group]))
566
  {
567
  $synved_option_list[$id]['groups'][$group] = array('type' => 'group', 'label' => synved_option_label_from_id($id));
568
  }
569
+
570
  return $group;
571
  }
572
 
585
  if ($sections != null)
586
  {
587
  $page_slug = synved_option_page_slug($id, $name, $item);
588
+
589
  foreach ($sections as $child_name => $child_item)
590
  {
591
  synved_option_wp_handle_setting($id, $page_slug, null, $child_name, $child_item);
608
  {
609
  add_settings_field($name, $label,
610
  'synved_option_call_array',
611
+ $page, $section,
612
  array('synved_option_setting_cb', array($id, $name, $item)));
613
  }
614
  }
616
  function synved_option_addon_installed($id, $name, $item = null)
617
  {
618
  $item = synved_option_item($id, $name);
619
+
620
  if ($item != null)
621
  {
622
  return synved_option_item_addon_is_installed($item);
623
  }
624
+
625
  return false;
626
  }
627
 
644
  function synved_option_include_module_addon_list($module_id, $filter = null)
645
  {
646
  global $synved_option;
647
+
648
  $synved_option['module-addon-list'][] = array('module-id' => $module_id, 'filter' => $filter);
649
  }
650
 
651
  function synved_option_init()
652
  {
653
  global $synved_option_list;
654
+
655
  if ($synved_option_list != null)
656
  {
657
  foreach ($synved_option_list as $id => $list)
659
  $items = synved_option_item_list($id);
660
  }
661
  }
662
+
663
  if ((isset($_POST['action']) && $_POST['action'] == 'synved_option'))
664
  {
665
  ob_start();
674
  function synved_option_path_uri($path = null)
675
  {
676
  $uri = plugins_url('/synved-options') . '/synved-option';
677
+
678
  if (function_exists('synved_plugout_module_uri_get'))
679
  {
680
  $mod_uri = synved_plugout_module_uri_get('synved-option');
681
+
682
  if ($mod_uri != null)
683
  {
684
  $uri = $mod_uri;
685
  }
686
  }
687
+
688
  if ($path != null)
689
  {
690
  if (substr($uri, -1) != '/' && $path[0] != '/')
691
  {
692
  $uri .= '/';
693
  }
694
+
695
  $uri .= $path;
696
  }
697
+
698
  return $uri;
699
  }
700
 
701
  function synved_option_print_head_outputs()
702
  {
703
  global $synved_option_list;
704
+
705
  foreach ($synved_option_list as $id => $list)
706
  {
707
  $items = synved_option_item_list($id);
708
  $outputs = $list['outputs'];
709
+
710
  foreach ($outputs as $name => $item)
711
  {
712
  $type = synved_option_item_type($item);
713
  $mode = synved_option_item_mode($item);
714
+
715
  if (in_array('manual', $mode))
716
  {
717
  continue;
718
  }
719
+
720
  $content = synved_option_get($id, $name);
721
  $tag = null;
722
  $attrs = null;
723
+
724
  if ($type == 'style')
725
  {
726
  $tag = $type;
730
  {
731
  $tag = $type;
732
  $attrs['type'] = 'text/javascript';
733
+
734
  $content = '/* <![CDATA[ */' . "\r\n" . $content . "\r\n" . '/* ]]> */';
735
  }
736
+
737
  if ($tag != null)
738
  {
739
  echo "\r\n" . '<' . $tag;
740
+
741
  foreach ($attrs as $attr_name => $attr_value)
742
  {
743
  echo ' ' . $attr_name . '="' . esc_attr($attr_value) . '"';
744
  }
745
+
746
  echo '>';
747
  echo $content;
748
  echo '</' . $tag . '>' . "\r\n";
777
  function synved_option_wp_after_setup_theme()
778
  {
779
  global $synved_option;
780
+
781
  foreach ($synved_option['module-addon-list'] as $module_addon_load)
782
  {
783
  $module_id = $module_addon_load['module-id'];
784
  $filter = $module_addon_load['filter'];
785
+
786
  $addon_list = synved_plugout_module_addon_list($module_id, $filter);
787
+
788
  if ($addon_list != null)
789
  {
790
  foreach ($addon_list as $addon_name => $addon_file)
816
  function synved_option_wp_admin_init()
817
  {
818
  global $synved_option_list;
819
+
820
  if ($synved_option_list != null)
821
  {
822
  foreach ($synved_option_list as $id => $list)
827
  define( 'SYNVEDOPTIONID', $id );
828
 
829
  register_setting($group, $dbname, synved_option_setting_sanitize_cb($id, $list));
830
+
831
  $items = synved_option_item_list($id);
832
+
833
  foreach ($items as $name => $item)
834
  {
835
  synved_option_wp_handle_setting($id, null, null, $name, $item);
848
  if ($object != null && $object instanceof Plugin_Upgrader && method_exists($object, 'check_package'))
849
  {
850
  $result = $object->check_package($source);
851
+
852
  if (is_wp_error($result))
853
  {
854
  $folder_name = basename($source);
855
  $addon_item = synved_option_item_query(null, array(array('type' => 'addon'), array('folder' => $folder_name)));
856
+
857
  if ($addon_item != null)
858
  {
859
  // XXX fix this $id/$name retrieval...ugly
863
  $page_item = synved_option_item($id, $addon_page);
864
  $page_label = synved_option_item_label($page_item);
865
  $page_url = synved_option_item_page_link_url($id, $name);
866
+
867
  $source = new WP_Error('synved_option_invalid_plugin_is_addon', sprintf(__('<b>This addon must be installed through the <a href="%s">%s settings page</a>.</b>'), $page_url, $page_label), '');
868
  }
869
  }
878
  {
879
  return $perform;
880
  }
881
+
882
  $upgrade_transfer = get_option('synved_option_wp_upgrade_addon_transfer');
883
+
884
  if ($upgrade_transfer != null)
885
  {
886
  $upgrade_transfer_time = get_option('synved_option_wp_upgrade_addon_transfer_time');
887
+
888
  if ($upgrade_transfer_time == null || (time() - $upgrade_transfer_time > (60 * 60 * 1)))
889
  {
890
  $upgrade_transfer = null;
891
+
892
  update_option('synved_option_wp_upgrade_addon_transfer', '');
893
  }
894
  }
895
 
896
  $module_list = array();
897
+
898
  if (function_exists('synved_plugout_get_module_list'))
899
  {
900
  $module_list = synved_plugout_get_module_list();
901
  }
902
+ else
903
  {
904
  global $synved_plugout;
905
+
906
  $module_list = array_keys($synved_plugout['module-list']);
907
  }
908
+
909
  $plugins_dir = WP_PLUGIN_DIR;
910
  $plugins_dir = rtrim(str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, realpath($plugins_dir)), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
911
+
912
  $plugin = $extra['plugin'];
913
  $plugin_dir = rtrim(str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, realpath(dirname($plugins_dir . $plugin))), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
914
+
915
  $dir = get_temp_dir();
916
  $name = time();
917
  $dir = rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . wp_unique_filename($dir, $name) . DIRECTORY_SEPARATOR;
918
  $list = array();
919
+
920
  foreach ($module_list as $module_id)
921
  {
922
  $addon_list = synved_plugout_module_addon_list($module_id);
923
+
924
  if ($addon_list != null)
925
  {
926
  foreach ($addon_list as $addon_name => $addon_file)
929
  {
930
  $addon_dir = dirname($addon_file);
931
  $parent_dir = dirname($addon_dir);
932
+
933
  // clean names for comparison
934
  $addon_dir = rtrim(str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, realpath($addon_dir)), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
935
  $parent_dir = rtrim(str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, realpath($parent_dir)), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
936
+
937
  if (strtolower($parent_dir) != strtolower($plugins_dir) && strpos(strtolower($addon_dir), strtolower($plugin_dir)) !== false)
938
  {
939
  $path = $dir;
940
  $diff = substr($addon_dir, strlen($plugins_dir));
941
  $path .= $diff;
942
+
943
  wp_mkdir_p($path);
944
+
945
  copy_dir($addon_dir, $path);
946
+
947
  $list[] = array('original' => $addon_dir, 'temporary' => $path);
948
  }
949
  }
950
  }
951
  }
952
  }
953
+
954
  if ($list != null)
955
  {
956
  update_option('synved_option_wp_upgrade_addon_transfer', array('directory' => $dir, 'list' => $list));
957
  update_option('synved_option_wp_upgrade_addon_transfer_time', time());
958
  }
959
+
960
  return $perform;
961
  }
962
 
963
  function synved_option_wp_upgrader_post_install($perform, $extra, $result = null)
964
  {
965
  $upgrade_transfer = get_option('synved_option_wp_upgrade_addon_transfer');
966
+
967
  if ($upgrade_transfer != null)
968
  {
969
  $list = $upgrade_transfer['list'];
970
+
971
  foreach ($list as $upgrade_item)
972
  {
973
  $original = $upgrade_item['original'];
974
  $temporary = $upgrade_item['temporary'];
975
+
976
  wp_mkdir_p($original);
977
+
978
  copy_dir($temporary, $original);
979
  }
980
+
981
  global $wp_filesystem;
982
+
983
  if ($wp_filesystem != null)
984
  {
985
  $directory = $upgrade_transfer['directory'];
986
+
987
  $wp_filesystem->delete($directory, true);
988
  }
989
+
990
  update_option('synved_option_wp_upgrade_addon_transfer', '');
991
  }
992
+
993
  return $perform;
994
  }
995
 
996
  function synved_option_wp_plugin_action_links($links, $file)
997
  {
998
  global $synved_option_list;
999
+
1000
  if ($synved_option_list != null)
1001
  {
1002
  foreach ($synved_option_list as $id => $list)
1003
  {
1004
  $items = synved_option_item_list($id);
1005
  $pages = $synved_option_list[$id]['pages'];
1006
+
1007
  foreach ($pages as $name => $page)
1008
  {
1009
  $link_label = synved_option_item_property($page, 'link-label');
1010
  $link_target = synved_option_item_property($page, 'link-target');
1011
  $link_url = synved_option_page_link_url($id, $name, $page);
1012
+
1013
  if ($link_label == null)
1014
  {
1015
  $link_label = __('Settings');
1016
  }
1017
+
1018
+ if ($file == $link_target)
1019
  {
1020
  $links[] = '<a href="' . $link_url . '">' . $link_label . '</a>';
1021
  }
1029
  function synved_option_admin_enqueue_scripts()
1030
  {
1031
  $uri = synved_option_path_uri();
1032
+
1033
  wp_register_style('synved-option-jquery-ui', $uri . '/jqueryUI/css/snvdopt/jquery-ui-1.9.2.custom.min.css', false, '1.9.2');
1034
  wp_register_style('synved-option-admin', $uri . '/style/admin.css', array('wp-jquery-ui-dialog', 'synved-option-jquery-ui'), '1.0');
1035
+
1036
+ wp_register_script('synved-option-script-custom', $uri . '/script/custom.js', array('jquery', 'suggest', 'media-upload', 'thickbox', 'jquery-ui-core', 'jquery-ui-progressbar', 'jquery-ui-dialog', 'wp-util'), '1.0.1');
1037
  wp_localize_script('synved-option-script-custom', 'SynvedOptionVars', array('flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'ajaxurl' => admin_url('admin-ajax.php'), 'synvedSecurity' => wp_create_nonce('synved-option-submit-nonce')));
1038
+
1039
  $page = isset($_GET['page']) ? $_GET['page'] : null;
1040
  $enqueue = false;
1041
+
1042
  global $synved_option_list;
1043
+
1044
  if ($synved_option_list != null)
1045
  {
1046
  foreach ($synved_option_list as $id => $list)
1048
  if (isset($list['pages']) && $list['pages'] != null)
1049
  {
1050
  $page_list = $list['pages'];
1051
+
1052
  foreach ($page_list as $name => $page_object)
1053
  {
1054
  if ($page == synved_option_page_slug($id, $name))
1055
  {
1056
  $enqueue = true;
1057
+
1058
  break;
1059
  }
1060
  }
1061
  }
1062
  }
1063
  }
1064
+
1065
  if ($enqueue)
1066
  {
1067
  wp_enqueue_style('thickbox');
1069
  wp_enqueue_style('wp-pointer');
1070
  wp_enqueue_style('synved-option-jquery-ui');
1071
  wp_enqueue_style('synved-option-admin');
1072
+
1073
  wp_enqueue_script('plupload-all');
1074
  wp_enqueue_script('media-upload');
1075
  wp_enqueue_script('suggest');
1083
  {
1084
  check_ajax_referer('synved-option-submit-nonce', 'synvedSecurity');
1085
 
1086
+ if (!isset($_POST['synvedAction']) || $_POST['synvedAction'] == null)
1087
  {
1088
  return;
1089
  }
1091
  $action = $_POST['synvedAction'];
1092
  $params = isset($_POST['synvedParams']) ? $_POST['synvedParams'] : null;
1093
  $response = null;
1094
+
1095
  if (is_string($params))
1096
  {
1097
  $parms = json_decode($params, true);
1098
+
1099
  if ($parms == null)
1100
  {
1101
  $parms = json_decode(stripslashes($params), true);
1102
  }
1103
+
1104
  $params = $parms;
1105
  }
1106
+
1107
  switch ($action)
1108
  {
1109
  case 'install-addon':
1115
  $response = synved_option_ajax_type_addon($action, $params);
1116
  }
1117
  }
1118
+
1119
  break;
1120
  }
1121
  }
1122
 
1123
+ while (ob_get_level() > 0)
1124
  {
1125
  ob_end_clean();
1126
  }
1127
 
1128
+ if ($response != null)
1129
  {
1130
  $response = json_encode($response);
1131
 
1133
 
1134
  echo $response;
1135
  }
1136
+ else
1137
  {
1138
  header('HTTP/1.1 403 Forbidden');
1139
  }