Social Media Feather | social media sharing - Version 1.0

Version Description

  • First public release.
Download this release

Release Info

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

Version 1.0

Files changed (116) hide show
  1. readme.txt +102 -0
  2. screenshot-1.png +0 -0
  3. screenshot-2.png +0 -0
  4. screenshot-3.png +0 -0
  5. screenshot-4.png +0 -0
  6. screenshot-5.png +0 -0
  7. screenshot-6.png +0 -0
  8. screenshot-7.png +0 -0
  9. social-media-feather.php +70 -0
  10. synved-connect/image/hire.png +0 -0
  11. synved-connect/image/rss.png +0 -0
  12. synved-connect/image/small/rss.png +0 -0
  13. synved-connect/image/small/twitter.png +0 -0
  14. synved-connect/image/twitter.png +0 -0
  15. synved-connect/style/admin.css +20 -0
  16. synved-connect/synved-connect-addon.php +3 -0
  17. synved-connect/synved-connect-component.php +23 -0
  18. synved-connect/synved-connect-credit.php +60 -0
  19. synved-connect/synved-connect-key.php +108 -0
  20. synved-connect/synved-connect-sponsor.php +264 -0
  21. synved-connect/synved-connect-support.php +54 -0
  22. synved-connect/synved-connect.php +221 -0
  23. synved-option/addons/option-type-addon/addon-handle.php +5 -0
  24. synved-option/addons/option-type-addon/addon-render.php +5 -0
  25. synved-option/addons/option-type-addon/option-type-addon.php +190 -0
  26. synved-option/addons/option-type-addon/script/custom.js +282 -0
  27. synved-option/farbtastic/LICENSE.txt +341 -0
  28. synved-option/farbtastic/farbtastic.css +33 -0
  29. synved-option/farbtastic/farbtastic.js +276 -0
  30. synved-option/farbtastic/farbtastic.min.js +14 -0
  31. synved-option/farbtastic/marker.png +0 -0
  32. synved-option/farbtastic/mask.png +0 -0
  33. synved-option/farbtastic/wheel.png +0 -0
  34. synved-option/jqueryUI/css/snvdopt/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  35. synved-option/jqueryUI/css/snvdopt/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  36. synved-option/jqueryUI/css/snvdopt/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  37. synved-option/jqueryUI/css/snvdopt/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  38. synved-option/jqueryUI/css/snvdopt/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  39. synved-option/jqueryUI/css/snvdopt/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  40. synved-option/jqueryUI/css/snvdopt/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  41. synved-option/jqueryUI/css/snvdopt/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  42. synved-option/jqueryUI/css/snvdopt/images/ui-icons_222222_256x240.png +0 -0
  43. synved-option/jqueryUI/css/snvdopt/images/ui-icons_2e83ff_256x240.png +0 -0
  44. synved-option/jqueryUI/css/snvdopt/images/ui-icons_454545_256x240.png +0 -0
  45. synved-option/jqueryUI/css/snvdopt/images/ui-icons_888888_256x240.png +0 -0
  46. synved-option/jqueryUI/css/snvdopt/images/ui-icons_cd0a0a_256x240.png +0 -0
  47. synved-option/jqueryUI/css/snvdopt/jquery-ui-1.9.2.custom.css +462 -0
  48. synved-option/jqueryUI/css/snvdopt/jquery-ui-1.9.2.custom.min.css +5 -0
  49. synved-option/script/custom.js +100 -0
  50. synved-option/style/admin.css +58 -0
  51. synved-option/synved-option-context.php +8 -0
  52. synved-option/synved-option-error.php +5 -0
  53. synved-option/synved-option-item.php +818 -0
  54. synved-option/synved-option-page.php +147 -0
  55. synved-option/synved-option-render.php +471 -0
  56. synved-option/synved-option-section.php +25 -0
  57. synved-option/synved-option-setting.php +23 -0
  58. synved-option/synved-option.php +955 -0
  59. synved-plugout/synved-plugout-core.php +380 -0
  60. synved-plugout/synved-plugout.php +28 -0
  61. synved-social/image/icon.png +0 -0
  62. synved-social/image/social-feather-extra-icons.png +0 -0
  63. synved-social/image/social-feather-grey-fade-demo.png +0 -0
  64. synved-social/image/social/regular/16x16/facebook.png +0 -0
  65. synved-social/image/social/regular/16x16/google_plus.png +0 -0
  66. synved-social/image/social/regular/16x16/linkedin.png +0 -0
  67. synved-social/image/social/regular/16x16/mail.png +0 -0
  68. synved-social/image/social/regular/16x16/reddit.png +0 -0
  69. synved-social/image/social/regular/16x16/rss.png +0 -0
  70. synved-social/image/social/regular/16x16/twitter.png +0 -0
  71. synved-social/image/social/regular/16x16/youtube.png +0 -0
  72. synved-social/image/social/regular/24x24/facebook.png +0 -0
  73. synved-social/image/social/regular/24x24/google_plus.png +0 -0
  74. synved-social/image/social/regular/24x24/linkedin.png +0 -0
  75. synved-social/image/social/regular/24x24/mail.png +0 -0
  76. synved-social/image/social/regular/24x24/reddit.png +0 -0
  77. synved-social/image/social/regular/24x24/rss.png +0 -0
  78. synved-social/image/social/regular/24x24/twitter.png +0 -0
  79. synved-social/image/social/regular/24x24/youtube.png +0 -0
  80. synved-social/image/social/regular/32x32/facebook.png +0 -0
  81. synved-social/image/social/regular/32x32/google_plus.png +0 -0
  82. synved-social/image/social/regular/32x32/linkedin.png +0 -0
  83. synved-social/image/social/regular/32x32/mail.png +0 -0
  84. synved-social/image/social/regular/32x32/reddit.png +0 -0
  85. synved-social/image/social/regular/32x32/rss.png +0 -0
  86. synved-social/image/social/regular/32x32/twitter.png +0 -0
  87. synved-social/image/social/regular/32x32/youtube.png +0 -0
  88. synved-social/image/social/regular/48x48/facebook.png +0 -0
  89. synved-social/image/social/regular/48x48/google_plus.png +0 -0
  90. synved-social/image/social/regular/48x48/linkedin.png +0 -0
  91. synved-social/image/social/regular/48x48/mail.png +0 -0
  92. synved-social/image/social/regular/48x48/reddit.png +0 -0
  93. synved-social/image/social/regular/48x48/rss.png +0 -0
  94. synved-social/image/social/regular/48x48/twitter.png +0 -0
  95. synved-social/image/social/regular/48x48/youtube.png +0 -0
  96. synved-social/image/social/regular/64x64/facebook.png +0 -0
  97. synved-social/image/social/regular/64x64/google_plus.png +0 -0
  98. synved-social/image/social/regular/64x64/linkedin.png +0 -0
  99. synved-social/image/social/regular/64x64/mail.png +0 -0
  100. synved-social/image/social/regular/64x64/reddit.png +0 -0
  101. synved-social/image/social/regular/64x64/rss.png +0 -0
  102. synved-social/image/social/regular/64x64/twitter.png +0 -0
  103. synved-social/image/social/regular/64x64/youtube.png +0 -0
  104. synved-social/image/social/regular/96x96/facebook.png +0 -0
  105. synved-social/image/social/regular/96x96/google_plus.png +0 -0
  106. synved-social/image/social/regular/96x96/linkedin.png +0 -0
  107. synved-social/image/social/regular/96x96/mail.png +0 -0
  108. synved-social/image/social/regular/96x96/reddit.png +0 -0
  109. synved-social/image/social/regular/96x96/rss.png +0 -0
  110. synved-social/image/social/regular/96x96/twitter.png +0 -0
  111. synved-social/image/social/regular/96x96/youtube.png +0 -0
  112. synved-social/image/social/regular/preview.png +0 -0
  113. synved-social/script/custom.js +0 -0
  114. synved-social/style/style.css +0 -0
  115. synved-social/synved-social-setup.php +630 -0
  116. synved-social/synved-social.php +649 -0
readme.txt ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Social Media Feather ===
2
+ Contributors: Synved
3
+ Donate link: http://synved.com/wordpress-social-media-feather/
4
+ Tags: shortcode, shortcodes, link, links, url, permalink, permalinks, time, icons, button, buttons, free, content, plugin, Share, sharing, page, pages, widget, CSS, list, media, profile, shortlinks, social, social media, twitter, google, Facebook, Reddit, youtube, bookmark, bookmarks, bookmarking, linkedin, image, edit, manage, mail, Post, posts, Style, seo, title
5
+ Requires at least: 3.1
6
+ Tested up to: 3.4.2
7
+ Stable tag: trunk
8
+ License: GPLv2
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Super lightweight, simple, nice, modern looking and effective social sharing and following buttons and icons on your site without the extra burden
12
+
13
+ == Description ==
14
+
15
+ [WordPress Social Media Feather](http://synved.com/wordpress-social-media-feather/ "WordPress Social Media Feather – lightweight social sharing and following") is a super lightweight free social media WordPress plugin that allows you to quickly and painlessly add **social sharing and following** features to all your posts, pages and custom post types.
16
+
17
+ The primary goal behind the plugin is to provide very lightweight WordPress social sharing and following that doesn’t add any unnecessary burden to your site and especially on your users.
18
+
19
+ What sets WordPress Social Media Feather aside from the plethora of other social sharing and following WordPress plugins is its focus on simplicity, performance and unobtrusive impact.
20
+
21
+ In order to achieve this the plugin makes no use of JavaScript and as a consequence it’s **really fast** while still providing all the social media functionality you might need.
22
+
23
+ By keeping load times at a minimum, you ensure that all the social sharing aspects of your site don’t interfere with those visitors who just want to access the content but are not interested in sharing on social platforms.
24
+
25
+ On the other hand, given the widespread focus on WordPress social media integration, your site will still provide social bookmarks to improve visibility of your posts and content and improve your overall global reach.
26
+
27
+ The WordPress social media sharing offered by the plugin includes all major social sharing providers like Facebook, Twitter, Google+, reddit, Linkedin and even e-mail.
28
+
29
+ The plugin also offers widgets for sharing and following buttons that you can place in any widgetized area in your site. Widgets also expose some settings to tweak appearance.
30
+
31
+ = Features =
32
+ * Integrated WordPress social sharing
33
+ * WordPress social sharing and following widgets
34
+ * Supports all major providers of social features
35
+ * Sharing with Facebook, Twitter, Google+, reddit, Linkedin and e-mail
36
+ * Following on Facebook, Twitter, Google+, Linkedin, YouTube or RSS Feed
37
+ * Each social provider can be enabled or disabled
38
+ * Ability to select what services each provider will be exposed for
39
+ * Full customization for titles and URLs for each provider
40
+ * Super lightweight social sharing and following
41
+ * Comes with a default modern icon set
42
+ * For further customization more [social icons skins](http://synved.com/product/feather-extra-social-icons/ "Add 8 extra social icon skins to the Social Media Feather plugin!") are available
43
+ * Potential skins can be quadrupled by [fading and greying out](http://synved.com/product/feather-grey-fade/ "Quadruple the amount of available social icon skins!") social icons
44
+
45
+ = Example Shortcodes =
46
+
47
+ This shortcode will create a list of social sharing buttons to share content on your site:
48
+ `[feather_share]`
49
+
50
+ This shortcode will create a list of social sharing buttons to share content on your site using the "Wheel" icons skin:
51
+ `[feather_share skin="wheel"]`
52
+
53
+ This shortcode will create a list of social sharing buttons to share content on your site using the "Wheel" icons skin with a size of 64 pixels:
54
+ `[feather_share skin="wheel" size="64"]`
55
+
56
+ The next shortcode will create a list of social following buttons that allow visitors to follow you:
57
+ `[feather_follow]`
58
+
59
+ The next shortcode will create a list of social following buttons that allow visitors to follow you, using the "Balloon" icons skin:
60
+ `[feather_follow skin="balloon"]`
61
+
62
+ The next shortcode will create a list of social following buttons that allow visitors to follow you, using the "Balloon" icons skin with a size of 64 pixels:
63
+ `[feather_follow skin="balloon" size="64"]`
64
+
65
+ = Related Links: =
66
+
67
+ * [WordPress Social Media Feather Official Page](http://synved.com/wordpress-social-media-feather/ "WordPress Social Media Feather – lightweight social sharing and following")
68
+ * [Extra Social Icons Skins](http://synved.com/product/feather-extra-social-icons/ "Add 8 extra social icon skins to the Social Media Feather plugin!")
69
+ * [Grey Fade addon that can grey out and fade out any social icons set](http://synved.com/product/feather-grey-fade/ "Quadruple the amount of available social icon skins!")
70
+ * [Our own site](http://synved.com/) where you can see social sharing and following in action
71
+ * [Stripefolio theme demo](http://wpdemo.synved.com/stripefolio/) where you can see some of the social sharing and following features in action
72
+ * [The free Stripefolio WordPress portfolio theme](http://synved.com/stripefolio-free-wordpress-portfolio-theme/ "A free WordPress theme that serves as a readable blog and a full-screen portfolio showcase") the Official page for the theme in the above demo link
73
+
74
+ == Installation ==
75
+
76
+ 1. Download the plugin
77
+ 2. Simply go under the Plugins page, then click on Add new and select the plugin's .zip file
78
+ 3. Alternatively you can extract the contents of the zip file directly to your *wp-content/plugins/* folder
79
+ 4. Finally, just go under Plugins and activate the plugin
80
+
81
+ == Frequently Asked Questions ==
82
+
83
+ = How can I see the social icons in action? =
84
+
85
+ Have a look at [our site](http://synved.com/) or the [Stripefolio portfolio theme demo](http://wpdemo.synved.com/stripefolio/) where you can see the social sharing and following features in action
86
+
87
+ == Screenshots ==
88
+
89
+ 1. An example of how the sharing or following buttons appear in the front-end at 64 pixel resolution
90
+ 2. An example of how the sharing or following buttons appear in the front-end at 24 pixel resolution
91
+ 3. An example of how the sharing or following buttons appear in the front-end using the [Extra Social Icons addon](http://synved.com/product/feather-extra-social-icons/ "Add 8 extra social icon skins to the Social Media Feather plugin!")
92
+ 4. Showing how using the [Grey Fade addon](http://synved.com/product/feather-grey-fade/ "Quadruple the amount of available social icon skins!") transforms the sharing or following buttons in the front-end
93
+ 5. A demo of how providers can be customized in the back-end
94
+ 6. An view of some of the settings that can be customized in the back-end
95
+ 7. This shows the available social sharing and following widgets and their settings
96
+
97
+ == Changelog ==
98
+
99
+ = 1.0 =
100
+ * First public release.
101
+
102
+
screenshot-1.png ADDED
Binary file
screenshot-2.png ADDED
Binary file
screenshot-3.png ADDED
Binary file
screenshot-4.png ADDED
Binary file
screenshot-5.png ADDED
Binary file
screenshot-6.png ADDED
Binary file
screenshot-7.png ADDED
Binary file
social-media-feather.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Social Media Feather
4
+ Plugin URI: http://synved.com/wordpress-social-media-feather/
5
+ Description: Super lightweight social media plugin to add nice and effective social sharing and following buttons and icons anywhere on your site without the extra burden
6
+ Author: Synved
7
+ Version: 1.0
8
+ Author URI: http://synved.com/
9
+
10
+ LEGAL STATEMENTS
11
+
12
+ NO WARRANTY
13
+ All products, support, services, information and software are provided "as is" without warranty of any kind, express or implied, including, but not limited to, the implied warranties of fitness for a particular purpose, and non-infringement.
14
+
15
+ NO LIABILITY
16
+ In no event shall Synved Ltd. be liable to you or any third party for any direct or indirect, special, incidental, or consequential damages in connection with or arising from errors, omissions, delays or other cause of action that may be attributed to your use of any product, support, services, information or software provided, including, but not limited to, lost profits or lost data, even if Synved Ltd. had been advised of the possibility of such damages.
17
+ */
18
+
19
+ if (!function_exists('synved_wp_social_load'))
20
+ {
21
+ function synved_wp_social_load()
22
+ {
23
+ global $plugin;
24
+
25
+ $path = __FILE__;
26
+
27
+ if (defined('SYNVED_SOCIAL_INCLUDE_PATH'))
28
+ {
29
+ $path = SYNVED_SOCIAL_INCLUDE_PATH;
30
+ }
31
+ else if (isset($plugin))
32
+ {
33
+ /* This is mostly for symlink support */
34
+ $real_plugin = realpath($plugin);
35
+
36
+ if (strtolower($real_plugin) == strtolower(__FILE__))
37
+ {
38
+ $path = $plugin;
39
+ }
40
+ }
41
+
42
+ $dir = dirname($path) . DIRECTORY_SEPARATOR;
43
+
44
+ if (!function_exists('synved_plugout_module_import'))
45
+ {
46
+ include($dir . 'synved-plugout' . DIRECTORY_SEPARATOR . 'synved-plugout.php');
47
+ }
48
+
49
+ /* Register used modules */
50
+ synved_plugout_module_register('synved-connect');
51
+ synved_plugout_module_path_add('synved-connect', 'core', $dir . 'synved-connect');
52
+ synved_plugout_module_register('synved-option');
53
+ synved_plugout_module_path_add('synved-option', 'core', $dir . 'synved-option');
54
+ synved_plugout_module_register('synved-social');
55
+ synved_plugout_module_path_add('synved-social', 'core', $dir . 'synved-social');
56
+
57
+ /* Import modules */
58
+ synved_plugout_module_import('synved-connect');
59
+ synved_plugout_module_import('synved-option');
60
+ synved_plugout_module_import('synved-social');
61
+ }
62
+
63
+ synved_wp_social_load();
64
+ }
65
+
66
+ synved_plugout_module_path_add('synved-connect', 'addon', dirname((defined('SYNVED_SOCIAL_INCLUDE_PATH') ? SYNVED_SOCIAL_INCLUDE_PATH : __FILE__)) . '/synved-connect/addons');
67
+ synved_plugout_module_path_add('synved-option', 'addon', dirname((defined('SYNVED_SOCIAL_INCLUDE_PATH') ? SYNVED_SOCIAL_INCLUDE_PATH : __FILE__)) . '/synved-option/addons');
68
+ synved_plugout_module_path_add('synved-social', 'addon', dirname((defined('SYNVED_SOCIAL_INCLUDE_PATH') ? SYNVED_SOCIAL_INCLUDE_PATH : __FILE__)) . '/synved-social/addons');
69
+
70
+ ?>
synved-connect/image/hire.png ADDED
Binary file
synved-connect/image/rss.png ADDED
Binary file
synved-connect/image/small/rss.png ADDED
Binary file
synved-connect/image/small/twitter.png ADDED
Binary file
synved-connect/image/twitter.png ADDED
Binary file
synved-connect/style/admin.css ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .metabox-holder .hndle .author {
2
+ font-size:75%;
3
+ font-weight:bold;
4
+ margin-left:5px;
5
+ }
6
+ .sponsor-holder {
7
+ padding:7px 12px;
8
+ }
9
+ .sponsor-type-intern {
10
+ background-color:#e0f2e2;
11
+ }
12
+ .sponsor-type-extern {
13
+ background-color:#d2e8d4;
14
+ }
15
+
16
+ .synved-connect-notice .notice-secondary,
17
+ .synved-connect-notice .notice-secondary a,
18
+ .synved-connect-notice .notice-secondary a.rsswidget {
19
+ font-size: 11px;
20
+ }
synved-connect/synved-connect-addon.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ ?>
synved-connect/synved-connect-component.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function synved_connect_component_key($component)
4
+ {
5
+ return get_option('synved_connect_key_' . strtolower($component));
6
+ }
7
+
8
+ function synved_connect_component_validate($component, $online_check = false)
9
+ {
10
+ return synved_connect_key_component_validate(synved_connect_component_key($component), $component, $online_check);
11
+ }
12
+
13
+ function synved_connect_component_support($component)
14
+ {
15
+
16
+ }
17
+
18
+ function synved_connect_component_sponsor($component)
19
+ {
20
+ $sponsor = get_option('synved_connect_sponsor');
21
+ }
22
+
23
+ ?>
synved-connect/synved-connect-credit.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function synved_connect_credit_filter_apply($filter)
4
+ {
5
+ if (!is_array($filter))
6
+ {
7
+ $filter = array();
8
+ }
9
+
10
+ $filter['type'] = 'credit';
11
+
12
+ return $filter;
13
+ }
14
+
15
+ function synved_connect_credit_list($filter = null)
16
+ {
17
+ $filter = synved_connect_credit_filter_apply($filter);
18
+
19
+ return synved_connect_sponsor_list($filter);
20
+ }
21
+
22
+ function synved_connect_credit_id_pick($filter = null)
23
+ {
24
+ $filter = synved_connect_credit_filter_apply($filter);
25
+
26
+ return synved_connect_sponsor_id_pick($filter);
27
+ }
28
+
29
+ function synved_connect_credit_item_by_id($credit_id, $filter = null)
30
+ {
31
+ $filter = synved_connect_credit_filter_apply($filter);
32
+
33
+ return synved_connect_sponsor_item_by_id($credit_id, $filter);
34
+ }
35
+
36
+ function synved_connect_credit_item_pick($filter = null)
37
+ {
38
+ $filter = synved_connect_credit_filter_apply($filter);
39
+
40
+ return synved_connect_sponsor_item_pick($filter);
41
+ }
42
+
43
+ function synved_connect_credit_item($component = null, $filter = null)
44
+ {
45
+ $filter = synved_connect_credit_filter_apply($filter);
46
+
47
+ return synved_connect_sponsor_item($component, $filter);
48
+ }
49
+
50
+ function synved_connect_credit_link(array $credit_item = null)
51
+ {
52
+ return synved_connect_sponsor_link($credit_item);
53
+ }
54
+
55
+ function synved_connect_credit_content(array $credit_item = null)
56
+ {
57
+ return synved_connect_sponsor_content($credit_item);
58
+ }
59
+
60
+ ?>
synved-connect/synved-connect-key.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SynvedConnectKey
4
+ {
5
+ const STATE_OK = 0x01;
6
+ const STATE_FAIL = 0x02;
7
+ const STATE_MISMATCH = 0x03;
8
+ const STATE_ONLINE_FAIL = 0x04;
9
+ }
10
+
11
+ function synved_connect_key_item_list($key)
12
+ {
13
+ // Note, this is just used to retrieve info from a textual key and is not used yet
14
+ $key_clear = pack('H*', $key);
15
+ $key_items = json_decode($key_clear, true);
16
+
17
+ return $key_items;
18
+ }
19
+
20
+ function synved_connect_key_item($key, $item_id)
21
+ {
22
+ $key_items = synved_connect_key_item_list($key);
23
+
24
+ if (isset($key_items[$item_id]))
25
+ {
26
+ return $key_items[$item_id];
27
+ }
28
+
29
+ return null;
30
+ }
31
+
32
+ function synved_connect_key_component($key)
33
+ {
34
+ return synved_connect_key_item($key, 'component');
35
+ }
36
+
37
+ function synved_connect_key_domain($key)
38
+ {
39
+ return synved_connect_key_item($key, 'domain');
40
+ }
41
+
42
+ function synved_connect_key_owner($key)
43
+ {
44
+ return synved_connect_key_item($key, 'owner');
45
+ }
46
+
47
+ function synved_connect_key_item_match($item, $item_list)
48
+ {
49
+ if (is_string($item_list))
50
+ {
51
+ $item_key = $item_list;
52
+
53
+ if ($item == $item_key)
54
+ {
55
+ return true;
56
+ }
57
+
58
+ $item_key = '/' . $item_key . '/';
59
+
60
+ if (preg_match($item_key, $item))
61
+ {
62
+ return true;
63
+ }
64
+ }
65
+ else if (is_array($item_list))
66
+ {
67
+ // XXX TODO
68
+ }
69
+
70
+ return false;
71
+ }
72
+
73
+ function synved_connect_key_component_state($key, $component, $online_check = false)
74
+ {
75
+ $key_component = synved_connect_key_component($key);
76
+ $key_domain = synved_connect_key_domain($key);
77
+
78
+ if (synved_connect_key_item_match($component, $key_component))
79
+ {
80
+ if ($online_check)
81
+ {
82
+ // XXX perform online check
83
+ }
84
+
85
+ if (synved_connect_key_item_match($_SERVER['SERVER_NAME'], $key_domain))
86
+ {
87
+ return SynvedConnectKey::STATE_OK;
88
+ }
89
+
90
+ return SynvedConnectKey::STATE_MISMATCH;
91
+ }
92
+
93
+ return SynvedConnectKey::STATE_FAIL;
94
+ }
95
+
96
+ function synved_connect_key_component_validate($key, $component, $online_check = false)
97
+ {
98
+ $component_state = synved_connect_key_component_state($key, $component, $online_check);
99
+
100
+ if ($component_state == SynvedConnectKey::STATE_OK)
101
+ {
102
+ return true;
103
+ }
104
+
105
+ return false;
106
+ }
107
+
108
+ ?>
synved-connect/synved-connect-sponsor.php ADDED
@@ -0,0 +1,264 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function synved_connect_sponsor_list($filter = null)
4
+ {
5
+ $sponsor_list = array(
6
+ 'wordpress-themes-1' => array(
7
+ 'type' => 'credit',
8
+ 'label' => 'WordPress Themes',
9
+ 'tip' => 'WordPress plugins and themes',
10
+ 'link' => 'http://synved.com',
11
+ 'text' => '%%link%% by Synved'
12
+ ),
13
+ 'wordpress-design-1' => array(
14
+ 'type' => 'credit',
15
+ 'label' => 'WordPress Design',
16
+ 'tip' => 'WordPress development, themes and custom plugins',
17
+ 'link' => 'http://synved.com',
18
+ 'text' => '%%link%% by Synved'
19
+ ),
20
+ 'synved-options' => array(
21
+ 'type' => 'intern',
22
+ 'label' => 'WordPress Options',
23
+ 'tip' => 'Add options to your products, the easy way!',
24
+ 'link' => 'http://synved.com/wordpress-options/',
25
+ 'text' => 'If you are a designer or developer you might want to chek out our free plugin %%link%% to easily add options to your WordPress products and sell your own addons for them too'
26
+ ),
27
+ 'hosting-1' => array(
28
+ 'type' => 'extern',
29
+ 'label' => 'professional hosting',
30
+ 'tip' => 'recommended hosting',
31
+ 'link' => 'http://synved.com/suggests/hosting/',
32
+ 'text' => 'If searching for a reliable hosting service you might wanna check out our recommended %%link%%'
33
+ ),
34
+ 'photocrati' => array(
35
+ 'type' => 'extern',
36
+ 'label' => 'Photocrati',
37
+ 'tip' => 'WordPress theme for gallery management',
38
+ 'link' => 'http://synved.com/suggests/photocrati/',
39
+ 'text' => 'For more advanced image and gallery management features we recommend %%link%% and their fantastic support ;)'
40
+ )
41
+ );
42
+
43
+ $feed = fetch_feed('http://feeds.feedburner.com/_SynvedConnectList?format=xml');
44
+
45
+ if (!is_wp_error($feed))
46
+ {
47
+ $maxitems = $feed->get_item_quantity();
48
+ $feed_items = $feed->get_items(0, $maxitems);
49
+ $feed_list = array();
50
+
51
+ if ($maxitems > 0)
52
+ {
53
+ foreach ($feed_items as $feed_item)
54
+ {
55
+ $id = $feed_item->get_id();
56
+ $label = $feed_item->get_title();
57
+ $tip = $feed_item->get_description();
58
+ $link = $feed_item->get_permalink();
59
+ $text = $feed_item->get_content();
60
+
61
+ $id_parts = array();
62
+ parse_str(parse_url($id, PHP_URL_QUERY), $id_parts);
63
+ $id = $id_parts['guid'];
64
+
65
+ $feed_categories = $feed_item->get_categories();
66
+ $type = null;
67
+
68
+ if ($feed_categories != null)
69
+ {
70
+ $category_tag = 'synved-connect-type-';
71
+
72
+ foreach ($feed_categories as $feed_category)
73
+ {
74
+ $feed_category = $feed_category->get_label();
75
+
76
+ if (substr($feed_category, 0, strlen($category_tag)) == $category_tag)
77
+ {
78
+ $type = substr($feed_category, strlen($category_tag));
79
+
80
+ break;
81
+ }
82
+ }
83
+ }
84
+
85
+ if ($type != null && $id != null)
86
+ {
87
+ $feed_list[$id] = array(
88
+ 'type' => $type,
89
+ 'label' => $label,
90
+ 'tip' => $tip,
91
+ 'link' => $link,
92
+ 'text' => $text
93
+ );
94
+ }
95
+ }
96
+ }
97
+
98
+ if ($feed_list != null)
99
+ {
100
+ $sponsor_list = $feed_list;
101
+ }
102
+ }
103
+
104
+ if ($filter != null)
105
+ {
106
+ $final_list = array();
107
+
108
+ foreach ($sponsor_list as $sponsor_key => $sponsor_item)
109
+ {
110
+ foreach ($filter as $filter_key => $filter_value)
111
+ {
112
+ if (isset($sponsor_item[$filter_key]))
113
+ {
114
+ $sponsor_value = $sponsor_item[$filter_key];
115
+
116
+ if (synved_connect_key_item_match($sponsor_value, $filter_value))
117
+ {
118
+ $final_list[$sponsor_key] = $sponsor_item;
119
+ }
120
+ }
121
+ }
122
+ }
123
+
124
+ $sponsor_list = $final_list;
125
+ }
126
+
127
+ $sponsor_keys = array_keys($sponsor_list);
128
+
129
+ foreach ($sponsor_keys as $sponsor_key)
130
+ {
131
+ $sponsor_list[$sponsor_key]['id'] = $sponsor_key;
132
+ }
133
+
134
+ return $sponsor_list;
135
+ }
136
+
137
+ function synved_connect_sponsor_id_pick($filter = null)
138
+ {
139
+ $sponsor_list = synved_connect_sponsor_list($filter);
140
+ $sponsor_keys = array_keys($sponsor_list);
141
+ $count = count($sponsor_keys);
142
+
143
+ $index = rand(0, $count - 1);
144
+ $sponsor_id = $sponsor_keys[$index];
145
+
146
+ return $sponsor_id;
147
+ }
148
+
149
+ function synved_connect_sponsor_item_by_id($sponsor_id, $filter = null)
150
+ {
151
+ $sponsor_list = synved_connect_sponsor_list($filter);
152
+
153
+ if ($sponsor_id != null && isset($sponsor_list[$sponsor_id]))
154
+ {
155
+ $sponsor = $sponsor_list[$sponsor_id];
156
+
157
+ return $sponsor;
158
+ }
159
+
160
+ return null;
161
+ }
162
+
163
+ function synved_connect_sponsor_item_pick($filter = null)
164
+ {
165
+ $sponsor_id = synved_connect_sponsor_id_pick($filter);
166
+
167
+ return synved_connect_sponsor_item_by_id($sponsor_id);
168
+ }
169
+
170
+ function synved_connect_sponsor_item($component = null, $filter = null)
171
+ {
172
+ $sponsor = null;
173
+
174
+ // for now it is valid to have null $component
175
+ //if ($component != null)
176
+ {
177
+ $sponsor_id = synved_connect_id_get($component);
178
+ $sponsor = synved_connect_sponsor_item_by_id($sponsor_id, $filter);
179
+ }
180
+
181
+ return $sponsor;
182
+ }
183
+
184
+ function synved_connect_sponsor_link(array $sponsor_item = null)
185
+ {
186
+ if ($sponsor_item == null)
187
+ {
188
+ $sponsor_item = synved_connect_sponsor_item();
189
+ }
190
+
191
+ if ($sponsor_item == null)
192
+ {
193
+ return null;
194
+ }
195
+
196
+ $sponsor_label = isset($sponsor_item['label']) ? $sponsor_item['label'] : null;
197
+ $sponsor_tip = isset($sponsor_item['tip']) ? $sponsor_item['tip'] : null;
198
+ $sponsor_link = isset($sponsor_item['link']) ? $sponsor_item['link'] : null;
199
+
200
+ return '<a class="synved-connect-link" href="' . $sponsor_link . '" target="_blank" title="' . $sponsor_tip . '">' . $sponsor_label . '</a>';
201
+ }
202
+
203
+ function synved_connect_sponsor_content(array $sponsor_item = null)
204
+ {
205
+ if ($sponsor_item == null)
206
+ {
207
+ $sponsor_item = synved_connect_sponsor_item();
208
+
209
+ if ($sponsor_item == null)
210
+ {
211
+ $sponsor_item = synved_connect_sponsor_item_pick();
212
+ }
213
+ }
214
+
215
+ if ($sponsor_item == null)
216
+ {
217
+ return null;
218
+ }
219
+
220
+ $sponsor_type = isset($sponsor_item['type']) ? $sponsor_item['type'] : null;
221
+ $sponsor_text = isset($sponsor_item['text']) ? $sponsor_item['text'] : null;
222
+ $sponsor_markup = isset($sponsor_item['markup']) ? $sponsor_item['markup'] : null;
223
+ $sponsor_link = synved_connect_sponsor_link($sponsor_item);
224
+
225
+ if ($sponsor_text == null)
226
+ {
227
+ if ($sponsor_type == 'credit')
228
+ {
229
+ $sponsor_text = '%%link%% by Synved';
230
+ }
231
+ else
232
+ {
233
+ return null;
234
+ }
235
+ }
236
+
237
+ if ($sponsor_markup == null)
238
+ {
239
+ if ($sponsor_type == 'credit')
240
+ {
241
+ $sponsor_markup = '<span class="%%class%%">%%content%%</span>';
242
+ }
243
+ else
244
+ {
245
+ $sponsor_markup = '<div class="%%class%%">%%content%%</div>';
246
+ }
247
+ }
248
+
249
+ $sponsor_class = 'sponsor-holder';
250
+
251
+ if ($sponsor_type != null)
252
+ {
253
+ $sponsor_class .= ' sponsor-type-' . $sponsor_type;
254
+ }
255
+
256
+ $sponsor_markup = str_replace('%%class%%', $sponsor_class, $sponsor_markup);
257
+
258
+ $sponsor_content = str_replace('%%link%%', $sponsor_link, $sponsor_text);
259
+ $sponsor_content = str_replace('%%content%%', $sponsor_content, $sponsor_markup);
260
+
261
+ return $sponsor_content;
262
+ }
263
+
264
+ ?>
synved-connect/synved-connect-support.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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; top:60px; width:220px; background:#f2f2f2; font-size:110%; color:#444; padding:16px 18px 16px 18px;">';
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 style="padding:8px 10px; border:dotted 1px #bbb;">';
14
+ $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; vertical-align:middle; 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>';
15
+ $out .= '</div>';
16
+
17
+ $out .= '<div class="notice-extra" style="margin:8px 0 0 0; padding:8px 10px; border:dotted 1px #bbb;">';
18
+ $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; vertical-align:middle; margin-left:8px;">' . __('Request a FREE quote!', '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>';
19
+ $out .= '</div>';
20
+
21
+ $out .= '<div class="notice-extra notice-secondary">';
22
+ $out .= '<h4 style="margin:10px 0 -10px 0; padding:0;">News</h4>';
23
+ ob_start();
24
+ wp_widget_rss_output('http://feeds.feedburner.com/SynvedNews?format=xml', array('items' => 4, 'show_author' => 0, 'show_date' => 0, 'show_summary' => 0));
25
+ $out .= ob_get_clean();
26
+ $out .= '</div>';
27
+
28
+ $sponsor_item = synved_connect_sponsor_item_pick(array('type' => 'intern|extern'));
29
+
30
+ if ($sponsor_item != null)
31
+ {
32
+ $out .= '<div class="notice-extra notice-secondary" style="margin:10px 0 0 0; border:dotted 1px #bbb;">';
33
+ $out .= synved_connect_sponsor_content($sponsor_item);
34
+ $out .= '</div>';
35
+ }
36
+
37
+ $out .= '</div>';
38
+
39
+ return $out;
40
+ }
41
+
42
+ function synved_connect_support_social_follow_render_small()
43
+ {
44
+ $uri = synved_connect_path_uri();
45
+
46
+ $out = null;
47
+
48
+ $out .= '<span>';
49
+ $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>';
50
+ $out .= '</span>';
51
+
52
+ return $out;
53
+ }
54
+
synved-connect/synved-connect.php ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Module Name: Synved Connect
4
+ Description: Connect and sync components in a WordPress installation with a remote server
5
+ Author: Synved
6
+ Version: 1.0
7
+ Author URI: http://synved.com/
8
+ License: GPLv2
9
+
10
+ LEGAL STATEMENTS
11
+
12
+ NO WARRANTY
13
+ All products, support, services, information and software are provided "as is" without warranty of any kind, express or implied, including, but not limited to, the implied warranties of fitness for a particular purpose, and non-infringement.
14
+
15
+ NO LIABILITY
16
+ In no event shall Synved Ltd. be liable to you or any third party for any direct or indirect, special, incidental, or consequential damages in connection with or arising from errors, omissions, delays or other cause of action that may be attributed to your use of any product, support, services, information or software provided, including, but not limited to, lost profits or lost data, even if Synved Ltd. had been advised of the possibility of such damages.
17
+ */
18
+
19
+ include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'synved-connect-key.php');
20
+ include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'synved-connect-component.php');
21
+ include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'synved-connect-credit.php');
22
+ include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'synved-connect-support.php');
23
+ include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'synved-connect-sponsor.php');
24
+
25
+
26
+ define('SYNVED_CONNECT_LOADED', true);
27
+ define('SYNVED_CONNECT_VERSION', 100000000);
28
+ define('SYNVED_CONNECT_VERSION_STRING', '1.0');
29
+
30
+
31
+ $synved_connect = array();
32
+
33
+
34
+ function synved_connect_version()
35
+ {
36
+ return SYNVED_CONNECT_VERSION;
37
+ }
38
+
39
+ function synved_connect_version_string()
40
+ {
41
+ return SYNVED_CONNECT_VERSION_STRING;
42
+ }
43
+
44
+ function synved_connect_object()
45
+ {
46
+ global $synved_connect;
47
+
48
+ return $synved_connect;
49
+ }
50
+
51
+ function synved_connect_server_get()
52
+ {
53
+ global $synved_connect;
54
+
55
+ if (isset($synved_connect['server']))
56
+ {
57
+ return $synved_connect['server'];
58
+ }
59
+
60
+ return null;
61
+ }
62
+
63
+ function synved_connect_server_set($server)
64
+ {
65
+ global $synved_connect;
66
+
67
+ $synved_connect['server'] = $server;
68
+ }
69
+
70
+ function synved_connect_dashboard_setup()
71
+ {
72
+ wp_add_dashboard_widget('synved_connect_dashboard_widget', __('News and Updates <span class="author">by Synved</span>'), 'synved_connect_dashboard_widget');
73
+
74
+ global $wp_meta_boxes;
75
+
76
+ if (isset($wp_meta_boxes['dashboard']['normal']['core']))
77
+ {
78
+ $normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core'];
79
+ $widget_backup = array('dashboard_right_now' => $normal_dashboard['dashboard_right_now'], 'synved_connect_dashboard_widget' => $normal_dashboard['synved_connect_dashboard_widget']);
80
+ unset($normal_dashboard['dashboard_right_now']);
81
+ unset($normal_dashboard['synved_connect_dashboard_widget']);
82
+
83
+ $sorted_dashboard = array_merge($widget_backup, $normal_dashboard);
84
+ $wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard;
85
+ }
86
+ }
87
+
88
+ //add_filter( 'wp_feed_cache_transient_lifetime', create_function('$a', 'return 1;') );
89
+ function synved_connect_dashboard_widget()
90
+ {
91
+ $out = null;
92
+
93
+ $install_date = get_option('synved_connect_install_date', null);
94
+
95
+ if ($install_date == null)
96
+ {
97
+ update_option('synved_connect_install_date', time());
98
+ }
99
+
100
+ if ($install_date != null && (time() - $install_date) >= (60 * 60 * 6))
101
+ {
102
+ $sponsor_item = synved_connect_sponsor_item_pick(array('type' => 'intern|extern'));
103
+
104
+ if ($sponsor_item != null)
105
+ {
106
+ $out .= synved_connect_sponsor_content($sponsor_item);
107
+
108
+ $out .= '<div>&nbsp;</div>';
109
+ }
110
+ }
111
+
112
+ $out .= '<div class="rss-widget">';
113
+ ob_start();
114
+ wp_widget_rss_output('http://feeds.feedburner.com/SynvedNews?format=xml', array('items' => 3, 'show_author' => 0, 'show_date' => 0, 'show_summary' => 1));
115
+ $out .= ob_get_clean();
116
+ $out .= '</div>';
117
+
118
+ echo $out;
119
+ }
120
+
121
+ function synved_connect_path_uri($path = null)
122
+ {
123
+ $uri = plugins_url('/synved-wp-connect') . '/synved-connect';
124
+
125
+ if (function_exists('synved_plugout_module_uri_get'))
126
+ {
127
+ $mod_uri = synved_plugout_module_uri_get('synved-connect');
128
+
129
+ if ($mod_uri != null)
130
+ {
131
+ $uri = $mod_uri;
132
+ }
133
+ }
134
+
135
+ if ($path != null)
136
+ {
137
+ if (substr($uri, -1) != '/' && $path[0] != '/')
138
+ {
139
+ $uri .= '/';
140
+ }
141
+
142
+ $uri .= $path;
143
+ }
144
+
145
+ return $uri;
146
+ }
147
+
148
+ function synved_connect_id_get($component = null, $part = null)
149
+ {
150
+ $option_key = null;
151
+
152
+ if ($component != null)
153
+ {
154
+ $option_key = 'component_' . $component;
155
+ }
156
+ else
157
+ {
158
+ $option_key = 'default';
159
+ }
160
+
161
+ $id = get_option('synved_connect_id_' . $option_key);
162
+
163
+ # if (is_array($id))
164
+ # {
165
+ # if ($part != null)
166
+ # {
167
+ # if (isset($id[$part]))
168
+ # {
169
+ # return $id[$part];
170
+ # }
171
+ #
172
+ # return null;
173
+ # }
174
+ #
175
+ # return array_shift($id);
176
+ # }
177
+
178
+ return $id;
179
+ }
180
+
181
+ function synved_connect_id_set($component = null, $sponsor_id)
182
+ {
183
+ $option_key = null;
184
+
185
+ if ($component != null)
186
+ {
187
+ $option_key = 'component_' . $component;
188
+ }
189
+ else
190
+ {
191
+ $option_key = 'default';
192
+ }
193
+
194
+ return update_option('synved_connect_id_' . $option_key, $sponsor_id);
195
+ }
196
+
197
+
198
+ function synved_connect_enqueue_scripts()
199
+ {
200
+ $uri = synved_connect_path_uri();
201
+
202
+ wp_register_style('synved-connect-admin', $uri . '/style/admin.css', false, '1.0');
203
+
204
+ wp_enqueue_style('synved-connect-admin');
205
+ }
206
+
207
+ function synved_connect_init()
208
+ {
209
+
210
+ }
211
+
212
+ if (is_admin())
213
+ {
214
+ add_action('admin_init', 'synved_connect_init');
215
+ //add_action('admin_menu', 'synved_connect_page_add_cb');
216
+ add_action('wp_dashboard_setup', 'synved_connect_dashboard_setup');
217
+ add_action('admin_enqueue_scripts', 'synved_connect_enqueue_scripts');
218
+ //add_action('wp_ajax_synved_connect', 'synved_connect_ajax');
219
+ }
220
+
221
+ ?>
synved-option/addons/option-type-addon/addon-handle.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+
5
+ ?>
synved-option/addons/option-type-addon/addon-render.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+
5
+ ?>
synved-option/addons/option-type-addon/option-type-addon.php ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!function_exists('synved_option_render_type_addon'))
4
+ {
5
+
6
+ function synved_option_render_type_addon($id, $name, $item, $out_name, $extra = null)
7
+ {
8
+ $type = synved_option_item_type($item);
9
+ $folder = synved_option_item_property($item, 'folder');
10
+ $out_id = isset($extra['out_id']) ? $extra['out_id'] : null;
11
+ $label = isset($extra['label']) ? $extra['label'] : null;
12
+ $out = null;
13
+
14
+ $out .= '<div class="synved-option-overlay-markup snvdopt" style="display:none;"><div class="overlay-ui"><div id="' . $out_id . '_overlay_container' . '" class="overlay-container">&nbsp;</div><div class="overlay-message">' . __('Click "Upload" and select the addon file, "' . $folder . '.zip". Only 1 file can be selected.', 'synved-option') . '</div>' . __('Progress', 'synved-option') . ': <div class="overlay-progress"></div></div><input id="' . $out_id . '_overlay_button' . '" type="button" class="overlay-button button-primary" value="' . __('Upload', 'synved-option') . '"/></div>';
15
+ $out .= '<div class="synved-option-item-info" style="display:none;">' . "\n" . json_encode(array('id' => $id, 'name' => $name)) . "\n" . '</div>';
16
+ $out .= '<input type="hidden" name="' . synved_option_render_field_name($id, $name . '_info_') . '" value="' . $type . '" />';
17
+ $out .= '<input name="' . $out_name . '" id="' . $out_id . '" type="button" value="' . $label .'" class="button-secondary synved-option-overlay-button" />';
18
+ $out .= '<input type="hidden" name="synved_option_addon_uploaded" value="0" />';
19
+
20
+ return $out;
21
+ }
22
+
23
+ function synved_option_item_addon_install($id, $name, $item)
24
+ {
25
+ $return = null;
26
+ $type = synved_option_item_type($item);
27
+ $target = synved_option_item_property($item, 'target');
28
+ $folder = synved_option_item_property($item, 'folder');
29
+ $field_name = synved_option_name_default($id);
30
+ $path = null;
31
+
32
+ if (file_exists($target))
33
+ {
34
+ $path = $target;
35
+ }
36
+
37
+ if ($type != 'addon' || $path == null)
38
+ {
39
+ return false;
40
+ }
41
+
42
+ $path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path);
43
+
44
+ if (substr($path, -1) != DIRECTORY_SEPARATOR)
45
+ {
46
+ $path .= DIRECTORY_SEPARATOR;
47
+ }
48
+
49
+ if (isset($_FILES[$field_name]))
50
+ {
51
+ foreach ($_FILES[$field_name]["error"] as $key => $error)
52
+ {
53
+ if ($key == $name && $error == UPLOAD_ERR_OK)
54
+ {
55
+ $tmp_name = $_FILES[$field_name]["tmp_name"][$key];
56
+ $name = $_FILES[$field_name]["name"][$key];
57
+ $tmpfname = wp_tempnam($name . '.zip');
58
+
59
+ if (move_uploaded_file($tmp_name, $tmpfname))
60
+ {
61
+ global $wp_filesystem;
62
+
63
+ $dirs = glob($path . '*', GLOB_ONLYDIR);
64
+
65
+ $return = unzip_file($tmpfname, $path);
66
+
67
+ if ($wp_filesystem != null)
68
+ {
69
+ $wp_filesystem->delete($tmpfname);
70
+ }
71
+
72
+ $dirs_new = glob($path . '*', GLOB_ONLYDIR);
73
+ $dirs_diff = array_values(array_diff($dirs_new, $dirs));
74
+ $addon_path = $path;
75
+
76
+ if ($dirs_diff != null)
77
+ {
78
+ $folder_path = null;
79
+
80
+ foreach ($dirs_diff as $dir)
81
+ {
82
+ if (basename($dir) == $folder)
83
+ {
84
+ $folder_path = $dir;
85
+ }
86
+ }
87
+
88
+ // XXX no correct path, was unzip successful?
89
+ if ($folder_path == null)
90
+ {
91
+ $folder_path = $dirs_diff[0];
92
+ }
93
+
94
+ $addon_path = $folder_path;
95
+ }
96
+
97
+ synved_option_set($id, $name, $addon_path);
98
+ }
99
+ }
100
+ }
101
+ }
102
+
103
+ return $return;
104
+ }
105
+
106
+ function synved_option_ajax_type_addon($action, $params)
107
+ {
108
+ $response = null;
109
+
110
+ if (current_user_can('upload_files') && current_user_can('install_plugins'))
111
+ {
112
+ $id = isset($params['id']) ? $params['id'] : null;
113
+ $name = isset($params['name']) ? $params['name'] : null;
114
+
115
+ if ($id != null && $name != null)
116
+ {
117
+ $item = synved_option_item_find($id, $name);
118
+
119
+ if ($item != null)
120
+ {
121
+ $return = null;
122
+ $error_list = array();
123
+
124
+ try
125
+ {
126
+ $page_name = synved_option_item_page($id, $name);
127
+ $page = synved_option_item($id, $page_name);
128
+ $parent = synved_option_item_parent($page);
129
+ $url = wp_nonce_url($parent . '?page=' . $page_name, 'synved-option');
130
+
131
+ ob_start();
132
+ $old_err = error_reporting(0);
133
+ $credentials = request_filesystem_credentials($url);
134
+ $form = ob_get_clean();
135
+ error_reporting($old_err);
136
+
137
+ ob_start();
138
+ var_dump($_POST);
139
+ $posted = ob_get_clean();
140
+
141
+ if ($credentials === false)
142
+ {
143
+ $response['result'] = 'ERROR';
144
+ $response['error'] = 'NO_CREDS';
145
+ $response['creds_form'] = $form;
146
+ $response['posted'] = $posted;
147
+ }
148
+ else if (WP_Filesystem($credentials))
149
+ {
150
+ $return = synved_option_item_addon_install($id, $name, $item);
151
+ }
152
+ }
153
+ catch (Exception $ex)
154
+ {
155
+ $return = null;
156
+ }
157
+
158
+ if ($return != null)
159
+ {
160
+ $response['result'] = 'OK';
161
+ }
162
+ }
163
+ }
164
+ }
165
+
166
+ return $response;
167
+ }
168
+
169
+ function synved_option_enqueue_scripts_type_addon()
170
+ {
171
+ $uri = synved_option_path_uri('addons/' . basename(dirname(__FILE__)));
172
+
173
+ wp_register_style('synved-option-type-addon-admin', $uri . '/style/admin.css', array('jquery-ui', 'wp-jquery-ui-dialog'), '1.0');
174
+
175
+ wp_register_script('synved-option-type-addon-script-custom', $uri . '/script/custom.js', array('jquery', 'thickbox', 'jquery-ui-core', 'jquery-ui-progressbar', 'jquery-ui-dialog'), '1.0.0');
176
+
177
+ //wp_enqueue_style('synved-option-type-addon-admin');
178
+
179
+ wp_enqueue_script('plupload-all');
180
+ wp_enqueue_script('synved-option-type-addon-script-custom');
181
+ }
182
+
183
+ if (is_admin())
184
+ {
185
+ add_action('admin_enqueue_scripts', 'synved_option_enqueue_scripts_type_addon');
186
+ }
187
+
188
+ }
189
+
190
+ ?>
synved-option/addons/option-type-addon/script/custom.js ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Synved WP Options - Addon Type
2
+ // Custom jquery code
3
+ // Version: 1.0
4
+ //
5
+ // Copyright (c) 2011 Synved Ltd.
6
+ // All rights reserved
7
+
8
+ jQuery(document).ready(function() {
9
+
10
+ jQuery('.synved-option-overlay-button').click(function() {
11
+ tb_show(this.value, SynvedOptionVars.ajaxurl);
12
+ var tb = jQuery("#TB_window");
13
+
14
+ if (tb)
15
+ {
16
+ var tbCont = tb.find('#TB_ajaxContent');
17
+ tbCont.css({ width : tbCont.parent().width(), height : '100%' });
18
+
19
+ if (!tbCont /*|| !tbCont.is(":visible")*/)
20
+ {
21
+ //tbCont = tb.find('#TB_iframeContent');
22
+ }
23
+
24
+ var jthis = jQuery(this);
25
+ var info = jthis.prevAll('.synved-option-item-info:first').html();
26
+
27
+ var infoObj = null;
28
+
29
+ try
30
+ {
31
+ infoObj = jQuery.parseJSON(info);
32
+ }
33
+ catch (ex)
34
+ {
35
+ infoObj = jQuery.parseJSON(jQuery('<div/>').html(info).text());
36
+ }
37
+
38
+ var markup = jthis.prevAll('.synved-option-overlay-markup');
39
+
40
+ if (markup)
41
+ {
42
+ markup = markup.clone();
43
+ var progressBar = markup.find('.overlay-progress');
44
+ var containerId = markup.find('.overlay-container').attr('id');
45
+ var buttonId = markup.find('.overlay-button').attr('id');
46
+ var fileField = jthis.attr('name');
47
+
48
+ var counter = 0;
49
+ containerId += '_tb';
50
+ buttonId += '_tb';
51
+
52
+ while (jQuery('#' + containerId + counter.toString()).size() > 0)
53
+ {
54
+ counter += 1;
55
+ }
56
+
57
+ containerId += counter.toString();
58
+ buttonId += counter.toString();
59
+
60
+ markup.find('.overlay-container').attr('id', containerId);
61
+ markup.find('.overlay-button').attr('id', buttonId);
62
+
63
+ markup.append(jQuery('<div class="overlay-message overlay-status" />'));
64
+ markup.append(jQuery('<button class="button-primary overlay-close">Close and continue</button>').hide().click(function () {
65
+ tb_remove();
66
+ window.location = window.location;
67
+ }));
68
+
69
+ tbCont.html(markup);
70
+ markup.show();
71
+
72
+ // markup.append(containerId);
73
+ // markup.append('<br/>');
74
+ // markup.append(buttonId);
75
+ // markup.append('<br/>');
76
+ // markup.append(fileField);
77
+
78
+ progressBar.progressbar();
79
+
80
+ var finishInstall = function (message, error)
81
+ {
82
+ var status = markup.find('.overlay-status');
83
+
84
+ if (status != null)
85
+ {
86
+ if (error != undefined && error == true)
87
+ {
88
+ status.css('color', '#b06066');
89
+ }
90
+ else
91
+ {
92
+ status.css('color', '#66b060');
93
+ }
94
+
95
+ status.html(message);
96
+ }
97
+
98
+ markup.find('#' + buttonId).hide();
99
+ markup.find('.overlay-close').css('display', 'inline');
100
+ };
101
+
102
+ var params = infoObj;
103
+ params = JSON.stringify(params);
104
+
105
+ var uploader = new plupload.Uploader({
106
+ runtimes: 'html5,flash,silverlight,html4',
107
+ autostart : true,
108
+ browse_button: buttonId,
109
+ container: containerId,
110
+ //drop_element: '',
111
+ file_data_name: fileField,
112
+ max_file_size: '1mb',
113
+ max_file_count: 1,
114
+ flash_swf_url: SynvedOptionVars.flash_swf_url,
115
+ silverlight_xap_url: SynvedOptionVars.silverlight_xap_url,
116
+ url: SynvedOptionVars.ajaxurl,
117
+ multipart: true,
118
+ urlstream_upload: true,
119
+ multipart_params :
120
+ {
121
+ action : 'synved_option',
122
+ synvedSecurity : SynvedOptionVars.synvedSecurity,
123
+ synvedAction : 'install-addon',
124
+ synvedParams : params
125
+ },
126
+ filters : [
127
+ {title : "Zip files", extensions : "zip"}
128
+ ],
129
+ multiple_queues: true,
130
+ debug: true
131
+ });
132
+
133
+ uploader.bind('Init', function(up) {
134
+ up.bind('FilesAdded', function(up, files) {
135
+
136
+ progressBar.progressbar('option', 'value', 0);
137
+
138
+ if (files.length > 1)
139
+ {
140
+ up.splice(1);
141
+ }
142
+
143
+ plupload.each(files, function(file){
144
+ });
145
+
146
+ up.refresh();
147
+ up.start();
148
+ });
149
+ });
150
+
151
+ uploader.bind('UploadProgress', function(up, file) {
152
+ progressBar.progressbar('option', 'value', file.percent);
153
+ });
154
+
155
+ uploader.bind('FileUploaded', function(up, file, info) {
156
+ var response = info.response;
157
+ var responseObj = null;
158
+
159
+ try
160
+ {
161
+ responseObj = jQuery.parseJSON(response);
162
+ }
163
+ catch (ex)
164
+ {
165
+ responseObj = jQuery.parseJSON(jQuery('<div/>').html(response).text());
166
+ }
167
+
168
+ if (responseObj != null)
169
+ {
170
+ //tbCont.append('FileUploaded ' + JSON.stringify(file) + ' INFO: ' + jQuery('<div/>').text(JSON.stringify(info)).html());
171
+
172
+ var result = responseObj['result'];
173
+
174
+ if (result == 'ERROR')
175
+ {
176
+ progressBar.progressbar('option', 'value', 0);
177
+
178
+ var error = null;
179
+
180
+ if ('error' in responseObj)
181
+ {
182
+ error = responseObj['error'];
183
+ }
184
+
185
+ if (error == 'NO_CREDS')
186
+ {
187
+ var form = jQuery('<div>' + responseObj['creds_form'] + '</div>').find('form');
188
+ var submitData = up.settings.multipart_params;
189
+
190
+ if (submitData)
191
+ {
192
+ for (var i in submitData)
193
+ {
194
+ form.find('[name=' + i + ']').val(submitData[i]);
195
+ }
196
+ }
197
+
198
+ form.data('submit-ok', false);
199
+ form.submit(function () {
200
+ form.data('submit-ok', true);
201
+ form.dialog('close');
202
+
203
+ return false;
204
+ });
205
+
206
+ form.find('.wrap .icon32').attr('id', 'icon-index');
207
+
208
+ form.dialog({
209
+ dialogClass : 'wp-dialog synved-option-creds-form',
210
+ title: 'Connection Details',
211
+ width: 550,
212
+ modal: true,
213
+ resizable: false,
214
+ close: function() {
215
+ if (form.data('submit-ok') == true)
216
+ {
217
+ var formData = form.serializeArray();
218
+ var submitData = {};
219
+
220
+ for (var i in formData)
221
+ {
222
+ submitData[formData[i].name] = formData[i].value;
223
+ }
224
+
225
+ for (var i in up.settings.multipart_params)
226
+ {
227
+ submitData[i] = up.settings.multipart_params[i];
228
+ }
229
+
230
+ up.settings.multipart_params = submitData;
231
+
232
+ for (var f in up.files)
233
+ {
234
+ up.files[f].loaded = 0;
235
+ up.files[f].percent = 0;
236
+ up.files[f].status = plupload.STOPPED;
237
+ }
238
+
239
+ up.refresh();
240
+ up.start();
241
+ }
242
+ else
243
+ {
244
+ finishInstall('Installation was canceled.', true);
245
+ }
246
+ }
247
+ });
248
+ }
249
+ else
250
+ {
251
+ finishInstall('An error occurred.', true);
252
+ }
253
+ }
254
+ else
255
+ {
256
+ if (result == 'OK')
257
+ {
258
+ finishInstall('Installation was successful.', false);
259
+ }
260
+
261
+ progressBar.progressbar('option', 'value', file.percent);
262
+ }
263
+ }
264
+ });
265
+
266
+ uploader.bind('Error', function(up, err) {
267
+ console.log(err);
268
+ finishInstall(err.message, true);
269
+ });
270
+
271
+ uploader.init();
272
+ }
273
+ else
274
+ {
275
+ tbCont.html('Error');
276
+ }
277
+ }
278
+
279
+ return false;
280
+ });
281
+ });
282
+
synved-option/farbtastic/LICENSE.txt ADDED
@@ -0,0 +1,341 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ GNU GENERAL PUBLIC LICENSE
3
+ Version 2, June 1991
4
+
5
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
6
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7
+ Everyone is permitted to copy and distribute verbatim copies
8
+ of this license document, but changing it is not allowed.
9
+
10
+ Preamble
11
+
12
+ The licenses for most software are designed to take away your
13
+ freedom to share and change it. By contrast, the GNU General Public
14
+ License is intended to guarantee your freedom to share and change free
15
+ software--to make sure the software is free for all its users. This
16
+ General Public License applies to most of the Free Software
17
+ Foundation's software and to any other program whose authors commit to
18
+ using it. (Some other Free Software Foundation software is covered by
19
+ the GNU Lesser General Public License instead.) You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ this service if you wish), that you receive source code or can get it
26
+ if you want it, that you can change the software or use pieces of it
27
+ in new free programs; and that you know you can do these things.
28
+
29
+ To protect your rights, we need to make restrictions that forbid
30
+ anyone to deny you these rights or to ask you to surrender the rights.
31
+ These restrictions translate to certain responsibilities for you if you
32
+ distribute copies of the software, or if you modify it.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must give the recipients all the rights that
36
+ you have. You must make sure that they, too, receive or can get the
37
+ source code. And you must show them these terms so they know their
38
+ rights.
39
+
40
+ We protect your rights with two steps: (1) copyright the software, and
41
+ (2) offer you this license which gives you legal permission to copy,
42
+ distribute and/or modify the software.
43
+
44
+ Also, for each author's protection and ours, we want to make certain
45
+ that everyone understands that there is no warranty for this free
46
+ software. If the software is modified by someone else and passed on, we
47
+ want its recipients to know that what they have is not the original, so
48
+ that any problems introduced by others will not reflect on the original
49
+ authors' reputations.
50
+
51
+ Finally, any free program is threatened constantly by software
52
+ patents. We wish to avoid the danger that redistributors of a free
53
+ program will individually obtain patent licenses, in effect making the
54
+ program proprietary. To prevent this, we have made it clear that any
55
+ patent must be licensed for everyone's free use or not licensed at all.
56
+
57
+ The precise terms and conditions for copying, distribution and
58
+ modification follow.
59
+
60
+ GNU GENERAL PUBLIC LICENSE
61
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
62
+
63
+ 0. This License applies to any program or other work which contains
64
+ a notice placed by the copyright holder saying it may be distributed
65
+ under the terms of this General Public License. The "Program", below,
66
+ refers to any such program or work, and a "work based on the Program"
67
+ means either the Program or any derivative work under copyright law:
68
+ that is to say, a work containing the Program or a portion of it,
69
+ either verbatim or with modifications and/or translated into another
70
+ language. (Hereinafter, translation is included without limitation in
71
+ the term "modification".) Each licensee is addressed as "you".
72
+
73
+ Activities other than copying, distribution and modification are not
74
+ covered by this License; they are outside its scope. The act of
75
+ running the Program is not restricted, and the output from the Program
76
+ is covered only if its contents constitute a work based on the
77
+ Program (independent of having been made by running the Program).
78
+ Whether that is true depends on what the Program does.
79
+
80
+ 1. You may copy and distribute verbatim copies of the Program's
81
+ source code as you receive it, in any medium, provided that you
82
+ conspicuously and appropriately publish on each copy an appropriate
83
+ copyright notice and disclaimer of warranty; keep intact all the
84
+ notices that refer to this License and to the absence of any warranty;
85
+ and give any other recipients of the Program a copy of this License
86
+ along with the Program.
87
+
88
+ You may charge a fee for the physical act of transferring a copy, and
89
+ you may at your option offer warranty protection in exchange for a fee.
90
+
91
+ 2. You may modify your copy or copies of the Program or any portion
92
+ of it, thus forming a work based on the Program, and copy and
93
+ distribute such modifications or work under the terms of Section 1
94
+ above, provided that you also meet all of these conditions:
95
+
96
+ a) You must cause the modified files to carry prominent notices
97
+ stating that you changed the files and the date of any change.
98
+
99
+ b) You must cause any work that you distribute or publish, that in
100
+ whole or in part contains or is derived from the Program or any
101
+ part thereof, to be licensed as a whole at no charge to all third
102
+ parties under the terms of this License.
103
+
104
+ c) If the modified program normally reads commands interactively
105
+ when run, you must cause it, when started running for such
106
+ interactive use in the most ordinary way, to print or display an
107
+ announcement including an appropriate copyright notice and a
108
+ notice that there is no warranty (or else, saying that you provide
109
+ a warranty) and that users may redistribute the program under
110
+ these conditions, and telling the user how to view a copy of this
111
+ License. (Exception: if the Program itself is interactive but
112
+ does not normally print such an announcement, your work based on
113
+ the Program is not required to print an announcement.)
114
+
115
+ These requirements apply to the modified work as a whole. If
116
+ identifiable sections of that work are not derived from the Program,
117
+ and can be reasonably considered independent and separate works in
118
+ themselves, then this License, and its terms, do not apply to those
119
+ sections when you distribute them as separate works. But when you
120
+ distribute the same sections as part of a whole which is a work based
121
+ on the Program, the distribution of the whole must be on the terms of
122
+ this License, whose permissions for other licensees extend to the
123
+ entire whole, and thus to each and every part regardless of who wrote it.
124
+
125
+ Thus, it is not the intent of this section to claim rights or contest
126
+ your rights to work written entirely by you; rather, the intent is to
127
+ exercise the right to control the distribution of derivative or
128
+ collective works based on the Program.
129
+
130
+ In addition, mere aggregation of another work not based on the Program
131
+ with the Program (or with a work based on the Program) on a volume of
132
+ a storage or distribution medium does not bring the other work under
133
+ the scope of this License.
134
+
135
+ 3. You may copy and distribute the Program (or a work based on it,
136
+ under Section 2) in object code or executable form under the terms of
137
+ Sections 1 and 2 above provided that you also do one of the following:
138
+
139
+ a) Accompany it with the complete corresponding machine-readable
140
+ source code, which must be distributed under the terms of Sections
141
+ 1 and 2 above on a medium customarily used for software interchange; or,
142
+
143
+ b) Accompany it with a written offer, valid for at least three
144
+ years, to give any third party, for a charge no more than your
145
+ cost of physically performing source distribution, a complete
146
+ machine-readable copy of the corresponding source code, to be
147
+ distributed under the terms of Sections 1 and 2 above on a medium
148
+ customarily used for software interchange; or,
149
+
150
+ c) Accompany it with the information you received as to the offer
151
+ to distribute corresponding source code. (This alternative is
152
+ allowed only for noncommercial distribution and only if you
153
+ received the program in object code or executable form with such
154
+ an offer, in accord with Subsection b above.)
155
+
156
+ The source code for a work means the preferred form of the work for
157
+ making modifications to it. For an executable work, complete source
158
+ code means all the source code for all modules it contains, plus any
159
+ associated interface definition files, plus the scripts used to
160
+ control compilation and installation of the executable. However, as a
161
+ special exception, the source code distributed need not include
162
+ anything that is normally distributed (in either source or binary
163
+ form) with the major components (compiler, kernel, and so on) of the
164
+ operating system on which the executable runs, unless that component
165
+ itself accompanies the executable.
166
+
167
+ If distribution of executable or object code is made by offering
168
+ access to copy from a designated place, then offering equivalent
169
+ access to copy the source code from the same place counts as
170
+ distribution of the source code, even though third parties are not
171
+ compelled to copy the source along with the object code.
172
+
173
+ 4. You may not copy, modify, sublicense, or distribute the Program
174
+ except as expressly provided under this License. Any attempt
175
+ otherwise to copy, modify, sublicense or distribute the Program is
176
+ void, and will automatically terminate your rights under this License.
177
+ However, parties who have received copies, or rights, from you under
178
+ this License will not have their licenses terminated so long as such
179
+ parties remain in full compliance.
180
+
181
+ 5. You are not required to accept this License, since you have not
182
+ signed it. However, nothing else grants you permission to modify or
183
+ distribute the Program or its derivative works. These actions are
184
+ prohibited by law if you do not accept this License. Therefore, by
185
+ modifying or distributing the Program (or any work based on the
186
+ Program), you indicate your acceptance of this License to do so, and
187
+ all its terms and conditions for copying, distributing or modifying
188
+ the Program or works based on it.
189
+
190
+ 6. Each time you redistribute the Program (or any work based on the
191
+ Program), the recipient automatically receives a license from the
192
+ original licensor to copy, distribute or modify the Program subject to
193
+ these terms and conditions. You may not impose any further
194
+ restrictions on the recipients' exercise of the rights granted herein.
195
+ You are not responsible for enforcing compliance by third parties to
196
+ this License.
197
+
198
+ 7. If, as a consequence of a court judgment or allegation of patent
199
+ infringement or for any other reason (not limited to patent issues),
200
+ conditions are imposed on you (whether by court order, agreement or
201
+ otherwise) that contradict the conditions of this License, they do not
202
+ excuse you from the conditions of this License. If you cannot
203
+ distribute so as to satisfy simultaneously your obligations under this
204
+ License and any other pertinent obligations, then as a consequence you
205
+ may not distribute the Program at all. For example, if a patent
206
+ license would not permit royalty-free redistribution of the Program by
207
+ all those who receive copies directly or indirectly through you, then
208
+ the only way you could satisfy both it and this License would be to
209
+ refrain entirely from distribution of the Program.
210
+
211
+ If any portion of this section is held invalid or unenforceable under
212
+ any particular circumstance, the balance of the section is intended to
213
+ apply and the section as a whole is intended to apply in other
214
+ circumstances.
215
+
216
+ It is not the purpose of this section to induce you to infringe any
217
+ patents or other property right claims or to contest validity of any
218
+ such claims; this section has the sole purpose of protecting the
219
+ integrity of the free software distribution system, which is
220
+ implemented by public license practices. Many people have made
221
+ generous contributions to the wide range of software distributed
222
+ through that system in reliance on consistent application of that
223
+ system; it is up to the author/donor to decide if he or she is willing
224
+ to distribute software through any other system and a licensee cannot
225
+ impose that choice.
226
+
227
+ This section is intended to make thoroughly clear what is believed to
228
+ be a consequence of the rest of this License.
229
+
230
+ 8. If the distribution and/or use of the Program is restricted in
231
+ certain countries either by patents or by copyrighted interfaces, the
232
+ original copyright holder who places the Program under this License
233
+ may add an explicit geographical distribution limitation excluding
234
+ those countries, so that distribution is permitted only in or among
235
+ countries not thus excluded. In such case, this License incorporates
236
+ the limitation as if written in the body of this License.
237
+
238
+ 9. The Free Software Foundation may publish revised and/or new versions
239
+ of the General Public License from time to time. Such new versions will
240
+ be similar in spirit to the present version, but may differ in detail to
241
+ address new problems or concerns.
242
+
243
+ Each version is given a distinguishing version number. If the Program
244
+ specifies a version number of this License which applies to it and "any
245
+ later version", you have the option of following the terms and conditions
246
+ either of that version or of any later version published by the Free
247
+ Software Foundation. If the Program does not specify a version number of
248
+ this License, you may choose any version ever published by the Free Software
249
+ Foundation.
250
+
251
+ 10. If you wish to incorporate parts of the Program into other free
252
+ programs whose distribution conditions are different, write to the author
253
+ to ask for permission. For software which is copyrighted by the Free
254
+ Software Foundation, write to the Free Software Foundation; we sometimes
255
+ make exceptions for this. Our decision will be guided by the two goals
256
+ of preserving the free status of all derivatives of our free software and
257
+ of promoting the sharing and reuse of software generally.
258
+
259
+ NO WARRANTY
260
+
261
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
262
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
263
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
264
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
265
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
266
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
267
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
268
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
269
+ REPAIR OR CORRECTION.
270
+
271
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
272
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
273
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
274
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
275
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
276
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
277
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
278
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
279
+ POSSIBILITY OF SUCH DAMAGES.
280
+
281
+ END OF TERMS AND CONDITIONS
282
+
283
+ How to Apply These Terms to Your New Programs
284
+
285
+ If you develop a new program, and you want it to be of the greatest
286
+ possible use to the public, the best way to achieve this is to make it
287
+ free software which everyone can redistribute and change under these terms.
288
+
289
+ To do so, attach the following notices to the program. It is safest
290
+ to attach them to the start of each source file to most effectively
291
+ convey the exclusion of warranty; and each file should have at least
292
+ the "copyright" line and a pointer to where the full notice is found.
293
+
294
+ <one line to give the program's name and a brief idea of what it does.>
295
+ Copyright (C) <year> <name of author>
296
+
297
+ This program is free software; you can redistribute it and/or modify
298
+ it under the terms of the GNU General Public License as published by
299
+ the Free Software Foundation; either version 2 of the License, or
300
+ (at your option) any later version.
301
+
302
+ This program is distributed in the hope that it will be useful,
303
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
304
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
305
+ GNU General Public License for more details.
306
+
307
+ You should have received a copy of the GNU General Public License
308
+ along with this program; if not, write to the Free Software
309
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
310
+
311
+
312
+ Also add information on how to contact you by electronic and paper mail.
313
+
314
+ If the program is interactive, make it output a short notice like this
315
+ when it starts in an interactive mode:
316
+
317
+ Gnomovision version 69, Copyright (C) year name of author
318
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
319
+ This is free software, and you are welcome to redistribute it
320
+ under certain conditions; type `show c' for details.
321
+
322
+ The hypothetical commands `show w' and `show c' should show the appropriate
323
+ parts of the General Public License. Of course, the commands you use may
324
+ be called something other than `show w' and `show c'; they could even be
325
+ mouse-clicks or menu items--whatever suits your program.
326
+
327
+ You should also get your employer (if you work as a programmer) or your
328
+ school, if any, to sign a "copyright disclaimer" for the program, if
329
+ necessary. Here is a sample; alter the names:
330
+
331
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
332
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
333
+
334
+ <signature of Ty Coon>, 1 April 1989
335
+ Ty Coon, President of Vice
336
+
337
+ This General Public License does not permit incorporating your program into
338
+ proprietary programs. If your program is a subroutine library, you may
339
+ consider it more useful to permit linking proprietary applications with the
340
+ library. If this is what you want to do, use the GNU Lesser General
341
+ Public License instead of this License.
synved-option/farbtastic/farbtastic.css ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .farbtastic {
2
+ position: relative;
3
+ }
4
+ .farbtastic * {
5
+ position: absolute;
6
+ cursor: crosshair;
7
+ }
8
+ .farbtastic, .farbtastic .wheel {
9
+ width: 195px;
10
+ height: 195px;
11
+ }
12
+ .farbtastic .color, .farbtastic .overlay {
13
+ top: 47px;
14
+ left: 47px;
15
+ width: 101px;
16
+ height: 101px;
17
+ }
18
+ .farbtastic .wheel {
19
+ background: url(wheel.png) no-repeat;
20
+ width: 195px;
21
+ height: 195px;
22
+ }
23
+ .farbtastic .overlay {
24
+ background: url(mask.png) no-repeat;
25
+ }
26
+ .farbtastic .marker {
27
+ width: 17px;
28
+ height: 17px;
29
+ margin: -8px 0 0 -8px;
30
+ overflow: hidden;
31
+ background: url(marker.png) no-repeat;
32
+ }
33
+
synved-option/farbtastic/farbtastic.js ADDED
@@ -0,0 +1,276 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * Farbtastic: jQuery color picker plug-in v1.3u
3
+ *
4
+ * Licensed under the GPL license:
5
+ * http://www.gnu.org/licenses/gpl.html
6
+ */
7
+ (function($) {
8
+
9
+ $.fn.farbtastic = function (options) {
10
+ $.farbtastic(this, options);
11
+ return this;
12
+ };
13
+
14
+ $.farbtastic = function (container, callback) {
15
+ var container = $(container).get(0);
16
+ return container.farbtastic || (container.farbtastic = new $._farbtastic(container, callback));
17
+ };
18
+
19
+ $._farbtastic = function (container, callback) {
20
+ // Store farbtastic object
21
+ var fb = this;
22
+
23
+ // Insert markup
24
+ $(container).html('<div class="farbtastic"><div class="color"></div><div class="wheel"></div><div class="overlay"></div><div class="h-marker marker"></div><div class="sl-marker marker"></div></div>');
25
+ var e = $('.farbtastic', container);
26
+ fb.wheel = $('.wheel', container).get(0);
27
+ // Dimensions
28
+ fb.radius = 84;
29
+ fb.square = 100;
30
+ fb.width = 194;
31
+
32
+ // Fix background PNGs in IE6
33
+ if (navigator.appVersion.match(/MSIE [0-6]\./)) {
34
+ $('*', e).each(function () {
35
+ if (this.currentStyle.backgroundImage != 'none') {
36
+ var image = this.currentStyle.backgroundImage;
37
+ image = this.currentStyle.backgroundImage.substring(5, image.length - 2);
38
+ $(this).css({
39
+ 'backgroundImage': 'none',
40
+ 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"
41
+ });
42
+ }
43
+ });
44
+ }
45
+
46
+ /**
47
+ * Link to the given element(s) or callback.
48
+ */
49
+ fb.linkTo = function (callback) {
50
+ // Unbind previous nodes
51
+ if (typeof fb.callback == 'object') {
52
+ $(fb.callback).unbind('keyup', fb.updateValue);
53
+ }
54
+
55
+ // Reset color
56
+ fb.color = null;
57
+
58
+ // Bind callback or elements
59
+ if (typeof callback == 'function') {
60
+ fb.callback = callback;
61
+ }
62
+ else if (typeof callback == 'object' || typeof callback == 'string') {
63
+ fb.callback = $(callback);
64
+ fb.callback.bind('keyup', fb.updateValue);
65
+ if (fb.callback.get(0).value) {
66
+ fb.setColor(fb.callback.get(0).value);
67
+ }
68
+ }
69
+ return this;
70
+ };
71
+ fb.updateValue = function (event) {
72
+ if (this.value && this.value != fb.color) {
73
+ fb.setColor(this.value);
74
+ }
75
+ };
76
+
77
+ /**
78
+ * Change color with HTML syntax #123456
79
+ */
80
+ fb.setColor = function (color) {
81
+ var unpack = fb.unpack(color);
82
+ if (fb.color != color && unpack) {
83
+ fb.color = color;
84
+ fb.rgb = unpack;
85
+ fb.hsl = fb.RGBToHSL(fb.rgb);
86
+ fb.updateDisplay();
87
+ }
88
+ return this;
89
+ };
90
+
91
+ /**
92
+ * Change color with HSL triplet [0..1, 0..1, 0..1]
93
+ */
94
+ fb.setHSL = function (hsl) {
95
+ fb.hsl = hsl;
96
+ fb.rgb = fb.HSLToRGB(hsl);
97
+ fb.color = fb.pack(fb.rgb);
98
+ fb.updateDisplay();
99
+ return this;
100
+ };
101
+
102
+ /////////////////////////////////////////////////////
103
+
104
+ /**
105
+ * Retrieve the coordinates of the given event relative to the center
106
+ * of the widget.
107
+ */
108
+ fb.widgetCoords = function (event) {
109
+ var offset = $(fb.wheel).offset();
110
+ return { x: (event.pageX - offset.left) - fb.width / 2, y: (event.pageY - offset.top) - fb.width / 2 };
111
+ };
112
+
113
+ /**
114
+ * Mousedown handler
115
+ */
116
+ fb.mousedown = function (event) {
117
+ // Capture mouse
118
+ if (!document.dragging) {
119
+ $(document).bind('mousemove', fb.mousemove).bind('mouseup', fb.mouseup);
120
+ document.dragging = true;
121
+ }
122
+
123
+ // Check which area is being dragged
124
+ var pos = fb.widgetCoords(event);
125
+ fb.circleDrag = Math.max(Math.abs(pos.x), Math.abs(pos.y)) * 2 > fb.square;
126
+
127
+ // Process
128
+ fb.mousemove(event);
129
+ return false;
130
+ };
131
+
132
+ /**
133
+ * Mousemove handler
134
+ */
135
+ fb.mousemove = function (event) {
136
+ // Get coordinates relative to color picker center
137
+ var pos = fb.widgetCoords(event);
138
+
139
+ // Set new HSL parameters
140
+ if (fb.circleDrag) {
141
+ var hue = Math.atan2(pos.x, -pos.y) / 6.28;
142
+ if (hue < 0) hue += 1;
143
+ fb.setHSL([hue, fb.hsl[1], fb.hsl[2]]);
144
+ }
145
+ else {
146
+ var sat = Math.max(0, Math.min(1, -(pos.x / fb.square) + .5));
147
+ var lum = Math.max(0, Math.min(1, -(pos.y / fb.square) + .5));
148
+ fb.setHSL([fb.hsl[0], sat, lum]);
149
+ }
150
+ return false;
151
+ };
152
+
153
+ /**
154
+ * Mouseup handler
155
+ */
156
+ fb.mouseup = function () {
157
+ // Uncapture mouse
158
+ $(document).unbind('mousemove', fb.mousemove);
159
+ $(document).unbind('mouseup', fb.mouseup);
160
+ document.dragging = false;
161
+ };
162
+
163
+ /**
164
+ * Update the markers and styles
165
+ */
166
+ fb.updateDisplay = function () {
167
+ // Markers
168
+ var angle = fb.hsl[0] * 6.28;
169
+ $('.h-marker', e).css({
170
+ left: Math.round(Math.sin(angle) * fb.radius + fb.width / 2) + 'px',
171
+ top: Math.round(-Math.cos(angle) * fb.radius + fb.width / 2) + 'px'
172
+ });
173
+
174
+ $('.sl-marker', e).css({
175
+ left: Math.round(fb.square * (.5 - fb.hsl[1]) + fb.width / 2) + 'px',
176
+ top: Math.round(fb.square * (.5 - fb.hsl[2]) + fb.width / 2) + 'px'
177
+ });
178
+
179
+ // Saturation/Luminance gradient
180
+ $('.color', e).css('backgroundColor', fb.pack(fb.HSLToRGB([fb.hsl[0], 1, 0.5])));
181
+
182
+ // Linked elements or callback
183
+ if (typeof fb.callback == 'object') {
184
+ // Set background/foreground color
185
+ $(fb.callback).css({
186
+ backgroundColor: fb.color,
187
+ color: fb.hsl[2] > 0.5 ? '#000' : '#fff'
188
+ });
189
+
190
+ // Change linked value
191
+ $(fb.callback).each(function() {
192
+ if (this.value && this.value != fb.color) {
193
+ this.value = fb.color;
194
+ }
195
+ });
196
+ }
197
+ else if (typeof fb.callback == 'function') {
198
+ fb.callback.call(fb, fb.color);
199
+ }
200
+ };
201
+
202
+ /* Various color utility functions */
203
+ fb.pack = function (rgb) {
204
+ var r = Math.round(rgb[0] * 255);
205
+ var g = Math.round(rgb[1] * 255);
206
+ var b = Math.round(rgb[2] * 255);
207
+ return '#' + (r < 16 ? '0' : '') + r.toString(16) +
208
+ (g < 16 ? '0' : '') + g.toString(16) +
209
+ (b < 16 ? '0' : '') + b.toString(16);
210
+ };
211
+
212
+ fb.unpack = function (color) {
213
+ if (color.length == 7) {
214
+ return [parseInt('0x' + color.substring(1, 3)) / 255,
215
+ parseInt('0x' + color.substring(3, 5)) / 255,
216
+ parseInt('0x' + color.substring(5, 7)) / 255];
217
+ }
218
+ else if (color.length == 4) {
219
+ return [parseInt('0x' + color.substring(1, 2)) / 15,
220
+ parseInt('0x' + color.substring(2, 3)) / 15,
221
+ parseInt('0x' + color.substring(3, 4)) / 15];
222
+ }
223
+ };
224
+
225
+ fb.HSLToRGB = function (hsl) {
226
+ var m1, m2, r, g, b;
227
+ var h = hsl[0], s = hsl[1], l = hsl[2];
228
+ m2 = (l <= 0.5) ? l * (s + 1) : l + s - l*s;
229
+ m1 = l * 2 - m2;
230
+ return [this.hueToRGB(m1, m2, h+0.33333),
231
+ this.hueToRGB(m1, m2, h),
232
+ this.hueToRGB(m1, m2, h-0.33333)];
233
+ };
234
+
235
+ fb.hueToRGB = function (m1, m2, h) {
236
+ h = (h < 0) ? h + 1 : ((h > 1) ? h - 1 : h);
237
+ if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;
238
+ if (h * 2 < 1) return m2;
239
+ if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6;
240
+ return m1;
241
+ };
242
+
243
+ fb.RGBToHSL = function (rgb) {
244
+ var min, max, delta, h, s, l;
245
+ var r = rgb[0], g = rgb[1], b = rgb[2];
246
+ min = Math.min(r, Math.min(g, b));
247
+ max = Math.max(r, Math.max(g, b));
248
+ delta = max - min;
249
+ l = (min + max) / 2;
250
+ s = 0;
251
+ if (l > 0 && l < 1) {
252
+ s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l));
253
+ }
254
+ h = 0;
255
+ if (delta > 0) {
256
+ if (max == r && max != g) h += (g - b) / delta;
257
+ if (max == g && max != b) h += (2 + (b - r) / delta);
258
+ if (max == b && max != r) h += (4 + (r - g) / delta);
259
+ h /= 6;
260
+ }
261
+ return [h, s, l];
262
+ };
263
+
264
+ // Install mousedown handler (the others are set on the document on-demand)
265
+ $('*', e).mousedown(fb.mousedown);
266
+
267
+ // Init color
268
+ fb.setColor('#000000');
269
+
270
+ // Set linked elements/callback
271
+ if (callback) {
272
+ fb.linkTo(callback);
273
+ }
274
+ };
275
+
276
+ })(jQuery);
synved-option/farbtastic/farbtastic.min.js ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * Farbtastic: jQuery color picker plug-in v1.3u
3
+ *
4
+ * Licensed under the GPL license:
5
+ * http://www.gnu.org/licenses/gpl.html
6
+ */
7
+ (function(e){e.fn.farbtastic=function(f){e.farbtastic(this,f);return this};e.farbtastic=function(f,l){f=e(f).get(0);return f.farbtastic||(f.farbtastic=new e._farbtastic(f,l))};e._farbtastic=function(f,l){var a=this;e(f).html('<div class="farbtastic"><div class="color"></div><div class="wheel"></div><div class="overlay"></div><div class="h-marker marker"></div><div class="sl-marker marker"></div></div>');var k=e(".farbtastic",f);a.wheel=e(".wheel",f).get(0);a.radius=84;a.square=100;a.width=194;navigator.appVersion.match(/MSIE [0-6]\./)&&
8
+ e("*",k).each(function(){if(this.currentStyle.backgroundImage!="none"){var b=this.currentStyle.backgroundImage;b=this.currentStyle.backgroundImage.substring(5,b.length-2);e(this).css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+b+"')"})}});a.linkTo=function(b){typeof a.callback=="object"&&e(a.callback).unbind("keyup",a.updateValue);a.color=null;if(typeof b=="function")a.callback=b;else if(typeof b=="object"||typeof b=="string"){a.callback=
9
+ e(b);a.callback.bind("keyup",a.updateValue);a.callback.get(0).value&&a.setColor(a.callback.get(0).value)}return this};a.updateValue=function(){this.value&&this.value!=a.color&&a.setColor(this.value)};a.setColor=function(b){var c=a.unpack(b);if(a.color!=b&&c){a.color=b;a.rgb=c;a.hsl=a.RGBToHSL(a.rgb);a.updateDisplay()}return this};a.setHSL=function(b){a.hsl=b;a.rgb=a.HSLToRGB(b);a.color=a.pack(a.rgb);a.updateDisplay();return this};a.widgetCoords=function(b){var c=e(a.wheel).offset();return{x:b.pageX-
10
+ c.left-a.width/2,y:b.pageY-c.top-a.width/2}};a.mousedown=function(b){if(!document.dragging){e(document).bind("mousemove",a.mousemove).bind("mouseup",a.mouseup);document.dragging=true}var c=a.widgetCoords(b);a.circleDrag=Math.max(Math.abs(c.x),Math.abs(c.y))*2>a.square;a.mousemove(b);return false};a.mousemove=function(b){var c=a.widgetCoords(b);if(a.circleDrag){b=Math.atan2(c.x,-c.y)/6.28;if(b<0)b+=1;a.setHSL([b,a.hsl[1],a.hsl[2]])}else{b=Math.max(0,Math.min(1,-(c.x/a.square)+0.5));c=Math.max(0,Math.min(1,
11
+ -(c.y/a.square)+0.5));a.setHSL([a.hsl[0],b,c])}return false};a.mouseup=function(){e(document).unbind("mousemove",a.mousemove);e(document).unbind("mouseup",a.mouseup);document.dragging=false};a.updateDisplay=function(){var b=a.hsl[0]*6.28;e(".h-marker",k).css({left:Math.round(Math.sin(b)*a.radius+a.width/2)+"px",top:Math.round(-Math.cos(b)*a.radius+a.width/2)+"px"});e(".sl-marker",k).css({left:Math.round(a.square*(0.5-a.hsl[1])+a.width/2)+"px",top:Math.round(a.square*(0.5-a.hsl[2])+a.width/2)+"px"});
12
+ e(".color",k).css("backgroundColor",a.pack(a.HSLToRGB([a.hsl[0],1,0.5])));if(typeof a.callback=="object"){e(a.callback).css({backgroundColor:a.color,color:a.hsl[2]>0.5?"#000":"#fff"});e(a.callback).each(function(){if(this.value&&this.value!=a.color)this.value=a.color})}else typeof a.callback=="function"&&a.callback.call(a,a.color)};a.pack=function(b){var c=Math.round(b[0]*255),d=Math.round(b[1]*255);b=Math.round(b[2]*255);return"#"+(c<16?"0":"")+c.toString(16)+(d<16?"0":"")+d.toString(16)+(b<16?"0":
13
+ "")+b.toString(16)};a.unpack=function(b){if(b.length==7)return[parseInt("0x"+b.substring(1,3))/255,parseInt("0x"+b.substring(3,5))/255,parseInt("0x"+b.substring(5,7))/255];else if(b.length==4)return[parseInt("0x"+b.substring(1,2))/15,parseInt("0x"+b.substring(2,3))/15,parseInt("0x"+b.substring(3,4))/15]};a.HSLToRGB=function(b){var c,d=b[0];c=b[1];b=b[2];c=b<=0.5?b*(c+1):b+c-b*c;b=b*2-c;return[this.hueToRGB(b,c,d+0.33333),this.hueToRGB(b,c,d),this.hueToRGB(b,c,d-0.33333)]};a.hueToRGB=function(b,c,
14
+ d){d=d<0?d+1:d>1?d-1:d;if(d*6<1)return b+(c-b)*d*6;if(d*2<1)return c;if(d*3<2)return b+(c-b)*(0.66666-d)*6;return b};a.RGBToHSL=function(b){var c,d,m,g,h=b[0],i=b[1],j=b[2];c=Math.min(h,Math.min(i,j));b=Math.max(h,Math.max(i,j));d=b-c;g=(c+b)/2;m=0;if(g>0&&g<1)m=d/(g<0.5?2*g:2-2*g);c=0;if(d>0){if(b==h&&b!=i)c+=(i-j)/d;if(b==i&&b!=j)c+=2+(j-h)/d;if(b==j&&b!=h)c+=4+(h-i)/d;c/=6}return[c,m,g]};e("*",k).mousedown(a.mousedown);a.setColor("#000000");l&&a.linkTo(l)}})(jQuery);
synved-option/farbtastic/marker.png ADDED
Binary file
synved-option/farbtastic/mask.png ADDED
Binary file
synved-option/farbtastic/wheel.png ADDED
Binary file
synved-option/jqueryUI/css/snvdopt/images/ui-bg_flat_0_aaaaaa_40x100.png ADDED
Binary file
synved-option/jqueryUI/css/snvdopt/images/ui-bg_flat_75_ffffff_40x100.png ADDED
Binary file
synved-option/jqueryUI/css/snvdopt/images/ui-bg_glass_55_fbf9ee_1x400.png ADDED
Binary file
synved-option/jqueryUI/css/snvdopt/images/ui-bg_glass_65_ffffff_1x400.png ADDED
Binary file
synved-option/jqueryUI/css/snvdopt/images/ui-bg_glass_75_dadada_1x400.png ADDED
Binary file
synved-option/jqueryUI/css/snvdopt/images/ui-bg_glass_75_e6e6e6_1x400.png ADDED
Binary file
synved-option/jqueryUI/css/snvdopt/images/ui-bg_glass_95_fef1ec_1x400.png ADDED
Binary file
synved-option/jqueryUI/css/snvdopt/images/ui-bg_highlight-soft_75_cccccc_1x100.png ADDED
Binary file
synved-option/jqueryUI/css/snvdopt/images/ui-icons_222222_256x240.png ADDED
Binary file
synved-option/jqueryUI/css/snvdopt/images/ui-icons_2e83ff_256x240.png ADDED
Binary file
synved-option/jqueryUI/css/snvdopt/images/ui-icons_454545_256x240.png ADDED
Binary file
synved-option/jqueryUI/css/snvdopt/images/ui-icons_888888_256x240.png ADDED
Binary file
synved-option/jqueryUI/css/snvdopt/images/ui-icons_cd0a0a_256x240.png ADDED
Binary file
synved-option/jqueryUI/css/snvdopt/jquery-ui-1.9.2.custom.css ADDED
@@ -0,0 +1,462 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! jQuery UI - v1.9.2 - 2012-12-15
2
+ * http://jqueryui.com
3
+ * Includes: jquery.ui.core.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css
4
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
5
+ * Copyright (c) 2012 jQuery Foundation and other contributors Licensed MIT */
6
+
7
+ /* Layout helpers
8
+ ----------------------------------*/
9
+ .ui-helper-hidden { display: none; }
10
+ .ui-helper-hidden-accessible { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
11
+ .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
12
+ .ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; }
13
+ .ui-helper-clearfix:after { clear: both; }
14
+ .ui-helper-clearfix { zoom: 1; }
15
+ .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
16
+
17
+
18
+ /* Interaction Cues
19
+ ----------------------------------*/
20
+ .ui-state-disabled { cursor: default !important; }
21
+
22
+
23
+ /* Icons
24
+ ----------------------------------*/
25
+
26
+ /* states and images */
27
+ .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
28
+
29
+
30
+ /* Misc visuals
31
+ ----------------------------------*/
32
+
33
+ /* Overlays */
34
+ .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
35
+ .ui-resizable { position: relative;}
36
+ .ui-resizable-handle { position: absolute;font-size: 0.1px; display: block; }
37
+ .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
38
+ .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
39
+ .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
40
+ .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
41
+ .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
42
+ .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
43
+ .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
44
+ .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
45
+ .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
46
+ .ui-accordion .ui-accordion-header { display: block; cursor: pointer; position: relative; margin-top: 2px; padding: .5em .5em .5em .7em; zoom: 1; }
47
+ .ui-accordion .ui-accordion-icons { padding-left: 2.2em; }
48
+ .ui-accordion .ui-accordion-noicons { padding-left: .7em; }
49
+ .ui-accordion .ui-accordion-icons .ui-accordion-icons { padding-left: 2.2em; }
50
+ .ui-accordion .ui-accordion-header .ui-accordion-header-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
51
+ .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; overflow: auto; zoom: 1; }
52
+ .ui-autocomplete {
53
+ position: absolute;
54
+ top: 0;
55
+ left: 0;
56
+ cursor: default;
57
+ }
58
+
59
+ /* workarounds */
60
+ * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
61
+ .ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
62
+ .ui-button, .ui-button:link, .ui-button:visited, .ui-button:hover, .ui-button:active { text-decoration: none; }
63
+ .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
64
+ button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
65
+ .ui-button-icons-only { width: 3.4em; }
66
+ button.ui-button-icons-only { width: 3.7em; }
67
+
68
+ /*button text element */
69
+ .ui-button .ui-button-text { display: block; line-height: 1.4; }
70
+ .ui-button-text-only .ui-button-text { padding: .4em 1em; }
71
+ .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
72
+ .ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
73
+ .ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
74
+ .ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
75
+ /* no icon support for input elements, provide padding by default */
76
+ input.ui-button { padding: .4em 1em; }
77
+
78
+ /*button icon element(s) */
79
+ .ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
80
+ .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
81
+ .ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
82
+ .ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
83
+ .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
84
+
85
+ /*button sets*/
86
+ .ui-buttonset { margin-right: 7px; }
87
+ .ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
88
+
89
+ /* workarounds */
90
+ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
91
+ .ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
92
+ .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
93
+ .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
94
+ .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
95
+ .ui-datepicker .ui-datepicker-prev { left:2px; }
96
+ .ui-datepicker .ui-datepicker-next { right:2px; }
97
+ .ui-datepicker .ui-datepicker-prev-hover { left:1px; }
98
+ .ui-datepicker .ui-datepicker-next-hover { right:1px; }
99
+ .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
100
+ .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
101
+ .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
102
+ .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
103
+ .ui-datepicker select.ui-datepicker-month,
104
+ .ui-datepicker select.ui-datepicker-year { width: 49%;}
105
+ .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
106
+ .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
107
+ .ui-datepicker td { border: 0; padding: 1px; }
108
+ .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
109
+ .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
110
+ .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
111
+ .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
112
+
113
+ /* with multiple calendars */
114
+ .ui-datepicker.ui-datepicker-multi { width:auto; }
115
+ .ui-datepicker-multi .ui-datepicker-group { float:left; }
116
+ .ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
117
+ .ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
118
+ .ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
119
+ .ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
120
+ .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
121
+ .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
122
+ .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
123
+ .ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
124
+
125
+ /* RTL support */
126
+ .ui-datepicker-rtl { direction: rtl; }
127
+ .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
128
+ .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
129
+ .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
130
+ .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
131
+ .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
132
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
133
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
134
+ .ui-datepicker-rtl .ui-datepicker-group { float:right; }
135
+ .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
136
+ .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
137
+
138
+ /* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
139
+ .ui-datepicker-cover {
140
+ position: absolute; /*must have*/
141
+ z-index: -1; /*must have*/
142
+ filter: mask(); /*must have*/
143
+ top: -4px; /*must have*/
144
+ left: -4px; /*must have*/
145
+ width: 200px; /*must have*/
146
+ height: 200px; /*must have*/
147
+ }.ui-dialog { position: absolute; top: 0; left: 0; padding: .2em; width: 300px; overflow: hidden; }
148
+ .ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
149
+ .ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
150
+ .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
151
+ .ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
152
+ .ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
153
+ .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
154
+ .ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
155
+ .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
156
+ .ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
157
+ .ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
158
+ .ui-draggable .ui-dialog-titlebar { cursor: move; }
159
+ .ui-menu { list-style:none; padding: 2px; margin: 0; display:block; outline: none; }
160
+ .ui-menu .ui-menu { margin-top: -3px; position: absolute; }
161
+ .ui-menu .ui-menu-item { margin: 0; padding: 0; zoom: 1; width: 100%; }
162
+ .ui-menu .ui-menu-divider { margin: 5px -2px 5px -2px; height: 0; font-size: 0; line-height: 0; border-width: 1px 0 0 0; }
163
+ .ui-menu .ui-menu-item a { text-decoration: none; display: block; padding: 2px .4em; line-height: 1.5; zoom: 1; font-weight: normal; }
164
+ .ui-menu .ui-menu-item a.ui-state-focus,
165
+ .ui-menu .ui-menu-item a.ui-state-active { font-weight: normal; margin: -1px; }
166
+
167
+ .ui-menu .ui-state-disabled { font-weight: normal; margin: .4em 0 .2em; line-height: 1.5; }
168
+ .ui-menu .ui-state-disabled a { cursor: default; }
169
+
170
+ /* icon support */
171
+ .ui-menu-icons { position: relative; }
172
+ .ui-menu-icons .ui-menu-item a { position: relative; padding-left: 2em; }
173
+
174
+ /* left-aligned */
175
+ .ui-menu .ui-icon { position: absolute; top: .2em; left: .2em; }
176
+
177
+ /* right-aligned */
178
+ .ui-menu .ui-menu-icon { position: static; float: right; }
179
+ .ui-progressbar { height:2em; text-align: left; overflow: hidden; }
180
+ .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }.ui-slider { position: relative; text-align: left; }
181
+ .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
182
+ .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
183
+
184
+ .ui-slider-horizontal { height: .8em; }
185
+ .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
186
+ .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
187
+ .ui-slider-horizontal .ui-slider-range-min { left: 0; }
188
+ .ui-slider-horizontal .ui-slider-range-max { right: 0; }
189
+
190
+ .ui-slider-vertical { width: .8em; height: 100px; }
191
+ .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
192
+ .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
193
+ .ui-slider-vertical .ui-slider-range-min { bottom: 0; }
194
+ .ui-slider-vertical .ui-slider-range-max { top: 0; }.ui-spinner { position:relative; display: inline-block; overflow: hidden; padding: 0; vertical-align: middle; }
195
+ .ui-spinner-input { border: none; background: none; padding: 0; margin: .2em 0; vertical-align: middle; margin-left: .4em; margin-right: 22px; }
196
+ .ui-spinner-button { width: 16px; height: 50%; font-size: .5em; padding: 0; margin: 0; text-align: center; position: absolute; cursor: default; display: block; overflow: hidden; right: 0; }
197
+ .ui-spinner a.ui-spinner-button { border-top: none; border-bottom: none; border-right: none; } /* more specificity required here to overide default borders */
198
+ .ui-spinner .ui-icon { position: absolute; margin-top: -8px; top: 50%; left: 0; } /* vertical centre icon */
199
+ .ui-spinner-up { top: 0; }
200
+ .ui-spinner-down { bottom: 0; }
201
+
202
+ /* TR overrides */
203
+ .ui-spinner .ui-icon-triangle-1-s {
204
+ /* need to fix icons sprite */
205
+ background-position:-65px -16px;
206
+ }
207
+ .ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
208
+ .ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
209
+ .ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 0; margin: 1px .2em 0 0; border-bottom: 0; padding: 0; white-space: nowrap; }
210
+ .ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
211
+ .ui-tabs .ui-tabs-nav li.ui-tabs-active { margin-bottom: -1px; padding-bottom: 1px; }
212
+ .ui-tabs .ui-tabs-nav li.ui-tabs-active a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-tabs-loading a { cursor: text; }
213
+ .ui-tabs .ui-tabs-nav li a, .ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
214
+ .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
215
+ .ui-tooltip {
216
+ padding: 8px;
217
+ position: absolute;
218
+ z-index: 9999;
219
+ max-width: 300px;
220
+ -webkit-box-shadow: 0 0 5px #aaa;
221
+ box-shadow: 0 0 5px #aaa;
222
+ }
223
+ /* Fades and background-images don't work well together in IE6, drop the image */
224
+ * html .ui-tooltip {
225
+ background-image: none;
226
+ }
227
+ body .ui-tooltip { border-width: 2px; }
228
+
229
+ /* Component containers
230
+ ----------------------------------*/
231
+ .snvdopt .ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
232
+ .snvdopt .ui-widget .ui-widget { font-size: 1em; }
233
+ .snvdopt .ui-widget input, .snvdopt .ui-widget select, .snvdopt .ui-widget textarea, .snvdopt .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
234
+ .snvdopt .ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
235
+ .snvdopt .ui-widget-content a { color: #222222; }
236
+ .snvdopt .ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
237
+ .snvdopt .ui-widget-header a { color: #222222; }
238
+
239
+ /* Interaction states
240
+ ----------------------------------*/
241
+ .snvdopt .ui-state-default, .snvdopt .ui-widget-content .ui-state-default, .snvdopt .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
242
+ .snvdopt .ui-state-default a, .snvdopt .ui-state-default a:link, .snvdopt .ui-state-default a:visited { color: #555555; text-decoration: none; }
243
+ .snvdopt .ui-state-hover, .snvdopt .ui-widget-content .ui-state-hover, .snvdopt .ui-widget-header .ui-state-hover, .snvdopt .ui-state-focus, .snvdopt .ui-widget-content .ui-state-focus, .snvdopt .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
244
+ .snvdopt .ui-state-hover a, .snvdopt .ui-state-hover a:hover, .snvdopt .ui-state-hover a:link, .snvdopt .ui-state-hover a:visited { color: #212121; text-decoration: none; }
245
+ .snvdopt .ui-state-active, .snvdopt .ui-widget-content .ui-state-active, .snvdopt .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
246
+ .snvdopt .ui-state-active a, .snvdopt .ui-state-active a:link, .snvdopt .ui-state-active a:visited { color: #212121; text-decoration: none; }
247
+
248
+ /* Interaction Cues
249
+ ----------------------------------*/
250
+ .snvdopt .ui-state-highlight, .snvdopt .ui-widget-content .ui-state-highlight, .snvdopt .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
251
+ .snvdopt .ui-state-highlight a, .snvdopt .ui-widget-content .ui-state-highlight a,.snvdopt .ui-widget-header .ui-state-highlight a { color: #363636; }
252
+ .snvdopt .ui-state-error, .snvdopt .ui-widget-content .ui-state-error, .snvdopt .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
253
+ .snvdopt .ui-state-error a, .snvdopt .ui-widget-content .ui-state-error a, .snvdopt .ui-widget-header .ui-state-error a { color: #cd0a0a; }
254
+ .snvdopt .ui-state-error-text, .snvdopt .ui-widget-content .ui-state-error-text, .snvdopt .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
255
+ .snvdopt .ui-priority-primary, .snvdopt .ui-widget-content .ui-priority-primary, .snvdopt .ui-widget-header .ui-priority-primary { font-weight: bold; }
256
+ .snvdopt .ui-priority-secondary, .snvdopt .ui-widget-content .ui-priority-secondary, .snvdopt .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
257
+ .snvdopt .ui-state-disabled, .snvdopt .ui-widget-content .ui-state-disabled, .snvdopt .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
258
+ .snvdopt .ui-state-disabled .ui-icon { filter:Alpha(Opacity=35); } /* For IE8 - See #6059 */
259
+
260
+ /* Icons
261
+ ----------------------------------*/
262
+
263
+ /* states and images */
264
+ .snvdopt .ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
265
+ .snvdopt .ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
266
+ .snvdopt .ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
267
+ .snvdopt .ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
268
+ .snvdopt .ui-state-hover .ui-icon, .snvdopt .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
269
+ .snvdopt .ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
270
+ .snvdopt .ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
271
+ .snvdopt .ui-state-error .ui-icon, .snvdopt .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
272
+
273
+ /* positioning */
274
+ .snvdopt .ui-icon-carat-1-n { background-position: 0 0; }
275
+ .snvdopt .ui-icon-carat-1-ne { background-position: -16px 0; }
276
+ .snvdopt .ui-icon-carat-1-e { background-position: -32px 0; }
277
+ .snvdopt .ui-icon-carat-1-se { background-position: -48px 0; }
278
+ .snvdopt .ui-icon-carat-1-s { background-position: -64px 0; }
279
+ .snvdopt .ui-icon-carat-1-sw { background-position: -80px 0; }
280
+ .snvdopt .ui-icon-carat-1-w { background-position: -96px 0; }
281
+ .snvdopt .ui-icon-carat-1-nw { background-position: -112px 0; }
282
+ .snvdopt .ui-icon-carat-2-n-s { background-position: -128px 0; }
283
+ .snvdopt .ui-icon-carat-2-e-w { background-position: -144px 0; }
284
+ .snvdopt .ui-icon-triangle-1-n { background-position: 0 -16px; }
285
+ .snvdopt .ui-icon-triangle-1-ne { background-position: -16px -16px; }
286
+ .snvdopt .ui-icon-triangle-1-e { background-position: -32px -16px; }
287
+ .snvdopt .ui-icon-triangle-1-se { background-position: -48px -16px; }
288
+ .snvdopt .ui-icon-triangle-1-s { background-position: -64px -16px; }
289
+ .snvdopt .ui-icon-triangle-1-sw { background-position: -80px -16px; }
290
+ .snvdopt .ui-icon-triangle-1-w { background-position: -96px -16px; }
291
+ .snvdopt .ui-icon-triangle-1-nw { background-position: -112px -16px; }
292
+ .snvdopt .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
293
+ .snvdopt .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
294
+ .snvdopt .ui-icon-arrow-1-n { background-position: 0 -32px; }
295
+ .snvdopt .ui-icon-arrow-1-ne { background-position: -16px -32px; }
296
+ .snvdopt .ui-icon-arrow-1-e { background-position: -32px -32px; }
297
+ .snvdopt .ui-icon-arrow-1-se { background-position: -48px -32px; }
298
+ .snvdopt .ui-icon-arrow-1-s { background-position: -64px -32px; }
299
+ .snvdopt .ui-icon-arrow-1-sw { background-position: -80px -32px; }
300
+ .snvdopt .ui-icon-arrow-1-w { background-position: -96px -32px; }
301
+ .snvdopt .ui-icon-arrow-1-nw { background-position: -112px -32px; }
302
+ .snvdopt .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
303
+ .snvdopt .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
304
+ .snvdopt .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
305
+ .snvdopt .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
306
+ .snvdopt .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
307
+ .snvdopt .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
308
+ .snvdopt .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
309
+ .snvdopt .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
310
+ .snvdopt .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
311
+ .snvdopt .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
312
+ .snvdopt .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
313
+ .snvdopt .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
314
+ .snvdopt .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
315
+ .snvdopt .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
316
+ .snvdopt .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
317
+ .snvdopt .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
318
+ .snvdopt .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
319
+ .snvdopt .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
320
+ .snvdopt .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
321
+ .snvdopt .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
322
+ .snvdopt .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
323
+ .snvdopt .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
324
+ .snvdopt .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
325
+ .snvdopt .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
326
+ .snvdopt .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
327
+ .snvdopt .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
328
+ .snvdopt .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
329
+ .snvdopt .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
330
+ .snvdopt .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
331
+ .snvdopt .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
332
+ .snvdopt .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
333
+ .snvdopt .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
334
+ .snvdopt .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
335
+ .snvdopt .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
336
+ .snvdopt .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
337
+ .snvdopt .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
338
+ .snvdopt .ui-icon-arrow-4 { background-position: 0 -80px; }
339
+ .snvdopt .ui-icon-arrow-4-diag { background-position: -16px -80px; }
340
+ .snvdopt .ui-icon-extlink { background-position: -32px -80px; }
341
+ .snvdopt .ui-icon-newwin { background-position: -48px -80px; }
342
+ .snvdopt .ui-icon-refresh { background-position: -64px -80px; }
343
+ .snvdopt .ui-icon-shuffle { background-position: -80px -80px; }
344
+ .snvdopt .ui-icon-transfer-e-w { background-position: -96px -80px; }
345
+ .snvdopt .ui-icon-transferthick-e-w { background-position: -112px -80px; }
346
+ .snvdopt .ui-icon-folder-collapsed { background-position: 0 -96px; }
347
+ .snvdopt .ui-icon-folder-open { background-position: -16px -96px; }
348
+ .snvdopt .ui-icon-document { background-position: -32px -96px; }
349
+ .snvdopt .ui-icon-document-b { background-position: -48px -96px; }
350
+ .snvdopt .ui-icon-note { background-position: -64px -96px; }
351
+ .snvdopt .ui-icon-mail-closed { background-position: -80px -96px; }
352
+ .snvdopt .ui-icon-mail-open { background-position: -96px -96px; }
353
+ .snvdopt .ui-icon-suitcase { background-position: -112px -96px; }
354
+ .snvdopt .ui-icon-comment { background-position: -128px -96px; }
355
+ .snvdopt .ui-icon-person { background-position: -144px -96px; }
356
+ .snvdopt .ui-icon-print { background-position: -160px -96px; }
357
+ .snvdopt .ui-icon-trash { background-position: -176px -96px; }
358
+ .snvdopt .ui-icon-locked { background-position: -192px -96px; }
359
+ .snvdopt .ui-icon-unlocked { background-position: -208px -96px; }
360
+ .snvdopt .ui-icon-bookmark { background-position: -224px -96px; }
361
+ .snvdopt .ui-icon-tag { background-position: -240px -96px; }
362
+ .snvdopt .ui-icon-home { background-position: 0 -112px; }
363
+ .snvdopt .ui-icon-flag { background-position: -16px -112px; }
364
+ .snvdopt .ui-icon-calendar { background-position: -32px -112px; }
365
+ .snvdopt .ui-icon-cart { background-position: -48px -112px; }
366
+ .snvdopt .ui-icon-pencil { background-position: -64px -112px; }
367
+ .snvdopt .ui-icon-clock { background-position: -80px -112px; }
368
+ .snvdopt .ui-icon-disk { background-position: -96px -112px; }
369
+ .snvdopt .ui-icon-calculator { background-position: -112px -112px; }
370
+ .snvdopt .ui-icon-zoomin { background-position: -128px -112px; }
371
+ .snvdopt .ui-icon-zoomout { background-position: -144px -112px; }
372
+ .snvdopt .ui-icon-search { background-position: -160px -112px; }
373
+ .snvdopt .ui-icon-wrench { background-position: -176px -112px; }
374
+ .snvdopt .ui-icon-gear { background-position: -192px -112px; }
375
+ .snvdopt .ui-icon-heart { background-position: -208px -112px; }
376
+ .snvdopt .ui-icon-star { background-position: -224px -112px; }
377
+ .snvdopt .ui-icon-link { background-position: -240px -112px; }
378
+ .snvdopt .ui-icon-cancel { background-position: 0 -128px; }
379
+ .snvdopt .ui-icon-plus { background-position: -16px -128px; }
380
+ .snvdopt .ui-icon-plusthick { background-position: -32px -128px; }
381
+ .snvdopt .ui-icon-minus { background-position: -48px -128px; }
382
+ .snvdopt .ui-icon-minusthick { background-position: -64px -128px; }
383
+ .snvdopt .ui-icon-close { background-position: -80px -128px; }
384
+ .snvdopt .ui-icon-closethick { background-position: -96px -128px; }
385
+ .snvdopt .ui-icon-key { background-position: -112px -128px; }
386
+ .snvdopt .ui-icon-lightbulb { background-position: -128px -128px; }
387
+ .snvdopt .ui-icon-scissors { background-position: -144px -128px; }
388
+ .snvdopt .ui-icon-clipboard { background-position: -160px -128px; }
389
+ .snvdopt .ui-icon-copy { background-position: -176px -128px; }
390
+ .snvdopt .ui-icon-contact { background-position: -192px -128px; }
391
+ .snvdopt .ui-icon-image { background-position: -208px -128px; }
392
+ .snvdopt .ui-icon-video { background-position: -224px -128px; }
393
+ .snvdopt .ui-icon-script { background-position: -240px -128px; }
394
+ .snvdopt .ui-icon-alert { background-position: 0 -144px; }
395
+ .snvdopt .ui-icon-info { background-position: -16px -144px; }
396
+ .snvdopt .ui-icon-notice { background-position: -32px -144px; }
397
+ .snvdopt .ui-icon-help { background-position: -48px -144px; }
398
+ .snvdopt .ui-icon-check { background-position: -64px -144px; }
399
+ .snvdopt .ui-icon-bullet { background-position: -80px -144px; }
400
+ .snvdopt .ui-icon-radio-on { background-position: -96px -144px; }
401
+ .snvdopt .ui-icon-radio-off { background-position: -112px -144px; }
402
+ .snvdopt .ui-icon-pin-w { background-position: -128px -144px; }
403
+ .snvdopt .ui-icon-pin-s { background-position: -144px -144px; }
404
+ .snvdopt .ui-icon-play { background-position: 0 -160px; }
405
+ .snvdopt .ui-icon-pause { background-position: -16px -160px; }
406
+ .snvdopt .ui-icon-seek-next { background-position: -32px -160px; }
407
+ .snvdopt .ui-icon-seek-prev { background-position: -48px -160px; }
408
+ .snvdopt .ui-icon-seek-end { background-position: -64px -160px; }
409
+ .snvdopt .ui-icon-seek-start { background-position: -80px -160px; }
410
+ /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
411
+ .snvdopt .ui-icon-seek-first { background-position: -80px -160px; }
412
+ .snvdopt .ui-icon-stop { background-position: -96px -160px; }
413
+ .snvdopt .ui-icon-eject { background-position: -112px -160px; }
414
+ .snvdopt .ui-icon-volume-off { background-position: -128px -160px; }
415
+ .snvdopt .ui-icon-volume-on { background-position: -144px -160px; }
416
+ .snvdopt .ui-icon-power { background-position: 0 -176px; }
417
+ .snvdopt .ui-icon-signal-diag { background-position: -16px -176px; }
418
+ .snvdopt .ui-icon-signal { background-position: -32px -176px; }
419
+ .snvdopt .ui-icon-battery-0 { background-position: -48px -176px; }
420
+ .snvdopt .ui-icon-battery-1 { background-position: -64px -176px; }
421
+ .snvdopt .ui-icon-battery-2 { background-position: -80px -176px; }
422
+ .snvdopt .ui-icon-battery-3 { background-position: -96px -176px; }
423
+ .snvdopt .ui-icon-circle-plus { background-position: 0 -192px; }
424
+ .snvdopt .ui-icon-circle-minus { background-position: -16px -192px; }
425
+ .snvdopt .ui-icon-circle-close { background-position: -32px -192px; }
426
+ .snvdopt .ui-icon-circle-triangle-e { background-position: -48px -192px; }
427
+ .snvdopt .ui-icon-circle-triangle-s { background-position: -64px -192px; }
428
+ .snvdopt .ui-icon-circle-triangle-w { background-position: -80px -192px; }
429
+ .snvdopt .ui-icon-circle-triangle-n { background-position: -96px -192px; }
430
+ .snvdopt .ui-icon-circle-arrow-e { background-position: -112px -192px; }
431
+ .snvdopt .ui-icon-circle-arrow-s { background-position: -128px -192px; }
432
+ .snvdopt .ui-icon-circle-arrow-w { background-position: -144px -192px; }
433
+ .snvdopt .ui-icon-circle-arrow-n { background-position: -160px -192px; }
434
+ .snvdopt .ui-icon-circle-zoomin { background-position: -176px -192px; }
435
+ .snvdopt .ui-icon-circle-zoomout { background-position: -192px -192px; }
436
+ .snvdopt .ui-icon-circle-check { background-position: -208px -192px; }
437
+ .snvdopt .ui-icon-circlesmall-plus { background-position: 0 -208px; }
438
+ .snvdopt .ui-icon-circlesmall-minus { background-position: -16px -208px; }
439
+ .snvdopt .ui-icon-circlesmall-close { background-position: -32px -208px; }
440
+ .snvdopt .ui-icon-squaresmall-plus { background-position: -48px -208px; }
441
+ .snvdopt .ui-icon-squaresmall-minus { background-position: -64px -208px; }
442
+ .snvdopt .ui-icon-squaresmall-close { background-position: -80px -208px; }
443
+ .snvdopt .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
444
+ .snvdopt .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
445
+ .snvdopt .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
446
+ .snvdopt .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
447
+ .snvdopt .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
448
+ .snvdopt .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
449
+
450
+
451
+ /* Misc visuals
452
+ ----------------------------------*/
453
+
454
+ /* Corner radius */
455
+ .snvdopt .ui-corner-all, .snvdopt .ui-corner-top, .snvdopt .ui-corner-left, .snvdopt .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
456
+ .snvdopt .ui-corner-all, .snvdopt .ui-corner-top, .snvdopt .ui-corner-right, .snvdopt .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
457
+ .snvdopt .ui-corner-all, .snvdopt .ui-corner-bottom, .snvdopt .ui-corner-left, .snvdopt .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
458
+ .snvdopt .ui-corner-all, .snvdopt .ui-corner-bottom, .snvdopt .ui-corner-right, .snvdopt .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
459
+
460
+ /* Overlays */
461
+ .snvdopt .ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .3;filter:Alpha(Opacity=30); }
462
+ .snvdopt .ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .3;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }
synved-option/jqueryUI/css/snvdopt/jquery-ui-1.9.2.custom.min.css ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ /*! jQuery UI - v1.9.2 - 2012-12-15
2
+ * http://jqueryui.com
3
+ * Includes: jquery.ui.core.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css
4
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
5
+ * Copyright (c) 2012 jQuery Foundation and other contributors Licensed MIT */.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{zoom:1}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:absolute;top:0;left:0;width:100%;height:100%}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:0.1px;display:block}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin-top:2px;padding:.5em .5em .5em .7em;zoom:1}.ui-accordion .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-noicons{padding-left:.7em}.ui-accordion .ui-accordion-icons .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-header .ui-accordion-header-icon{position:absolute;left:.5em;top:50%;margin-top:-8px}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto;zoom:1}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}* html .ui-autocomplete{width:1px}.ui-button{display:inline-block;position:relative;padding:0;margin-right:.1em;cursor:pointer;text-align:center;zoom:1;overflow:visible}.ui-button,.ui-button:link,.ui-button:visited,.ui-button:hover,.ui-button:active{text-decoration:none}.ui-button-icon-only{width:2.2em}button.ui-button-icon-only{width:2.4em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button .ui-button-text{display:block;line-height:1.4}.ui-button-text-only .ui-button-text{padding:.4em 1em}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999999px}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon,.ui-button-icons-only .ui-icon{position:absolute;top:50%;margin-top:-8px}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px}.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary,.ui-button-icons-only .ui-button-icon-primary{left:.5em}.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-button{margin-left:0;margin-right:-.3em}button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month-year{width:100%}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:49%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0em}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current{float:right}.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-datepicker-cover{position:absolute;z-index:-1;filter:mask();top:-4px;left:-4px;width:200px;height:200px}.ui-dialog{position:absolute;top:0;left:0;padding:.2em;width:300px;overflow:hidden}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 16px .1em 0}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:19px;margin:-10px 0 0 0;padding:1px;height:18px}.ui-dialog .ui-dialog-titlebar-close span{display:block;margin:1px}.ui-dialog .ui-dialog-titlebar-close:hover,.ui-dialog .ui-dialog-titlebar-close:focus{padding:0}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:none;overflow:auto;zoom:1}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin:.5em 0 0 0;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-se{width:14px;height:14px;right:3px;bottom:3px}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-menu{list-style:none;padding:2px;margin:0;display:block;outline:none}.ui-menu .ui-menu{margin-top:-3px;position:absolute}.ui-menu .ui-menu-item{margin:0;padding:0;zoom:1;width:100%}.ui-menu .ui-menu-divider{margin:5px -2px 5px -2px;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-menu-item a{text-decoration:none;display:block;padding:2px .4em;line-height:1.5;zoom:1;font-weight:normal}.ui-menu .ui-menu-item a.ui-state-focus,.ui-menu .ui-menu-item a.ui-state-active{font-weight:normal;margin:-1px}.ui-menu .ui-state-disabled{font-weight:normal;margin:.4em 0 .2em;line-height:1.5}.ui-menu .ui-state-disabled a{cursor:default}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item a{position:relative;padding-left:2em}.ui-menu .ui-icon{position:absolute;top:.2em;left:.2em}.ui-menu .ui-menu-icon{position:static;float:right}.ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-spinner{position:relative;display:inline-block;overflow:hidden;padding:0;vertical-align:middle}.ui-spinner-input{border:none;background:none;padding:0;margin:.2em 0;vertical-align:middle;margin-left:.4em;margin-right:22px}.ui-spinner-button{width:16px;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top:none;border-bottom:none;border-right:none}.ui-spinner .ui-icon{position:absolute;margin-top:-8px;top:50%;left:0}.ui-spinner-up{top:0}.ui-spinner-down{bottom:0}.ui-spinner .ui-icon-triangle-1-s{background-position:-65px -16px}.ui-tabs{position:relative;padding:.2em;zoom:1}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:0;margin:1px .2em 0 0;border-bottom:0;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav li a{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active{margin-bottom:-1px;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-active a,.ui-tabs .ui-tabs-nav li.ui-state-disabled a,.ui-tabs .ui-tabs-nav li.ui-tabs-loading a{cursor:text}.ui-tabs .ui-tabs-nav li a,.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active a{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:none}.ui-tooltip{padding:8px;position:absolute;z-index:9999;max-width:300px;-webkit-box-shadow:0 0 5px #aaa;box-shadow:0 0 5px #aaa}* html .ui-tooltip{background-image:none}body .ui-tooltip{border-width:2px}.snvdopt .ui-widget{font-family:Verdana,Arial,sans-serif;font-size:1.1em}.snvdopt .ui-widget .ui-widget{font-size:1em}.snvdopt .ui-widget input,.snvdopt .ui-widget select,.snvdopt .ui-widget textarea,.snvdopt .ui-widget button{font-family:Verdana,Arial,sans-serif;font-size:1em}.snvdopt .ui-widget-content{border:1px solid #aaa;background:#fff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x;color:#222}.snvdopt .ui-widget-content a{color:#222}.snvdopt .ui-widget-header{border:1px solid #aaa;background:#ccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x;color:#222;font-weight:bold}.snvdopt .ui-widget-header a{color:#222}.snvdopt .ui-state-default,.snvdopt .ui-widget-content .ui-state-default,.snvdopt .ui-widget-header .ui-state-default{border:1px solid #d3d3d3;background:#e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x;font-weight:normal;color:#555}.snvdopt .ui-state-default a,.snvdopt .ui-state-default a:link,.snvdopt .ui-state-default a:visited{color:#555;text-decoration:none}.snvdopt .ui-state-hover,.snvdopt .ui-widget-content .ui-state-hover,.snvdopt .ui-widget-header .ui-state-hover,.snvdopt .ui-state-focus,.snvdopt .ui-widget-content .ui-state-focus,.snvdopt .ui-widget-header .ui-state-focus{border:1px solid #999;background:#dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x;font-weight:normal;color:#212121}.snvdopt .ui-state-hover a,.snvdopt .ui-state-hover a:hover,.snvdopt .ui-state-hover a:link,.snvdopt .ui-state-hover a:visited{color:#212121;text-decoration:none}.snvdopt .ui-state-active,.snvdopt .ui-widget-content .ui-state-active,.snvdopt .ui-widget-header .ui-state-active{border:1px solid #aaa;background:#fff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x;font-weight:normal;color:#212121}.snvdopt .ui-state-active a,.snvdopt .ui-state-active a:link,.snvdopt .ui-state-active a:visited{color:#212121;text-decoration:none}.snvdopt .ui-state-highlight,.snvdopt .ui-widget-content .ui-state-highlight,.snvdopt .ui-widget-header .ui-state-highlight{border:1px solid #fcefa1;background:#fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x;color:#363636}.snvdopt .ui-state-highlight a,.snvdopt .ui-widget-content .ui-state-highlight a,.snvdopt .ui-widget-header .ui-state-highlight a{color:#363636}.snvdopt .ui-state-error,.snvdopt .ui-widget-content .ui-state-error,.snvdopt .ui-widget-header .ui-state-error{border:1px solid #cd0a0a;background:#fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x;color:#cd0a0a}.snvdopt .ui-state-error a,.snvdopt .ui-widget-content .ui-state-error a,.snvdopt .ui-widget-header .ui-state-error a{color:#cd0a0a}.snvdopt .ui-state-error-text,.snvdopt .ui-widget-content .ui-state-error-text,.snvdopt .ui-widget-header .ui-state-error-text{color:#cd0a0a}.snvdopt .ui-priority-primary,.snvdopt .ui-widget-content .ui-priority-primary,.snvdopt .ui-widget-header .ui-priority-primary{font-weight:bold}.snvdopt .ui-priority-secondary,.snvdopt .ui-widget-content .ui-priority-secondary,.snvdopt .ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.snvdopt .ui-state-disabled,.snvdopt .ui-widget-content .ui-state-disabled,.snvdopt .ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.snvdopt .ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.snvdopt .ui-icon{width:16px;height:16px;background-image:url(images/ui-icons_222222_256x240.png)}.snvdopt .ui-widget-content .ui-icon{background-image:url(images/ui-icons_222222_256x240.png)}.snvdopt .ui-widget-header .ui-icon{background-image:url(images/ui-icons_222222_256x240.png)}.snvdopt .ui-state-default .ui-icon{background-image:url(images/ui-icons_888888_256x240.png)}.snvdopt .ui-state-hover .ui-icon,.snvdopt .ui-state-focus .ui-icon{background-image:url(images/ui-icons_454545_256x240.png)}.snvdopt .ui-state-active .ui-icon{background-image:url(images/ui-icons_454545_256x240.png)}.snvdopt .ui-state-highlight .ui-icon{background-image:url(images/ui-icons_2e83ff_256x240.png)}.snvdopt .ui-state-error .ui-icon,.snvdopt .ui-state-error-text .ui-icon{background-image:url(images/ui-icons_cd0a0a_256x240.png)}.snvdopt .ui-icon-carat-1-n{background-position:0 0}.snvdopt .ui-icon-carat-1-ne{background-position:-16px 0}.snvdopt .ui-icon-carat-1-e{background-position:-32px 0}.snvdopt .ui-icon-carat-1-se{background-position:-48px 0}.snvdopt .ui-icon-carat-1-s{background-position:-64px 0}.snvdopt .ui-icon-carat-1-sw{background-position:-80px 0}.snvdopt .ui-icon-carat-1-w{background-position:-96px 0}.snvdopt .ui-icon-carat-1-nw{background-position:-112px 0}.snvdopt .ui-icon-carat-2-n-s{background-position:-128px 0}.snvdopt .ui-icon-carat-2-e-w{background-position:-144px 0}.snvdopt .ui-icon-triangle-1-n{background-position:0 -16px}.snvdopt .ui-icon-triangle-1-ne{background-position:-16px -16px}.snvdopt .ui-icon-triangle-1-e{background-position:-32px -16px}.snvdopt .ui-icon-triangle-1-se{background-position:-48px -16px}.snvdopt .ui-icon-triangle-1-s{background-position:-64px -16px}.snvdopt .ui-icon-triangle-1-sw{background-position:-80px -16px}.snvdopt .ui-icon-triangle-1-w{background-position:-96px -16px}.snvdopt .ui-icon-triangle-1-nw{background-position:-112px -16px}.snvdopt .ui-icon-triangle-2-n-s{background-position:-128px -16px}.snvdopt .ui-icon-triangle-2-e-w{background-position:-144px -16px}.snvdopt .ui-icon-arrow-1-n{background-position:0 -32px}.snvdopt .ui-icon-arrow-1-ne{background-position:-16px -32px}.snvdopt .ui-icon-arrow-1-e{background-position:-32px -32px}.snvdopt .ui-icon-arrow-1-se{background-position:-48px -32px}.snvdopt .ui-icon-arrow-1-s{background-position:-64px -32px}.snvdopt .ui-icon-arrow-1-sw{background-position:-80px -32px}.snvdopt .ui-icon-arrow-1-w{background-position:-96px -32px}.snvdopt .ui-icon-arrow-1-nw{background-position:-112px -32px}.snvdopt .ui-icon-arrow-2-n-s{background-position:-128px -32px}.snvdopt .ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.snvdopt .ui-icon-arrow-2-e-w{background-position:-160px -32px}.snvdopt .ui-icon-arrow-2-se-nw{background-position:-176px -32px}.snvdopt .ui-icon-arrowstop-1-n{background-position:-192px -32px}.snvdopt .ui-icon-arrowstop-1-e{background-position:-208px -32px}.snvdopt .ui-icon-arrowstop-1-s{background-position:-224px -32px}.snvdopt .ui-icon-arrowstop-1-w{background-position:-240px -32px}.snvdopt .ui-icon-arrowthick-1-n{background-position:0 -48px}.snvdopt .ui-icon-arrowthick-1-ne{background-position:-16px -48px}.snvdopt .ui-icon-arrowthick-1-e{background-position:-32px -48px}.snvdopt .ui-icon-arrowthick-1-se{background-position:-48px -48px}.snvdopt .ui-icon-arrowthick-1-s{background-position:-64px -48px}.snvdopt .ui-icon-arrowthick-1-sw{background-position:-80px -48px}.snvdopt .ui-icon-arrowthick-1-w{background-position:-96px -48px}.snvdopt .ui-icon-arrowthick-1-nw{background-position:-112px -48px}.snvdopt .ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.snvdopt .ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.snvdopt .ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.snvdopt .ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.snvdopt .ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.snvdopt .ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.snvdopt .ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.snvdopt .ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.snvdopt .ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.snvdopt .ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.snvdopt .ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.snvdopt .ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.snvdopt .ui-icon-arrowreturn-1-w{background-position:-64px -64px}.snvdopt .ui-icon-arrowreturn-1-n{background-position:-80px -64px}.snvdopt .ui-icon-arrowreturn-1-e{background-position:-96px -64px}.snvdopt .ui-icon-arrowreturn-1-s{background-position:-112px -64px}.snvdopt .ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.snvdopt .ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.snvdopt .ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.snvdopt .ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.snvdopt .ui-icon-arrow-4{background-position:0 -80px}.snvdopt .ui-icon-arrow-4-diag{background-position:-16px -80px}.snvdopt .ui-icon-extlink{background-position:-32px -80px}.snvdopt .ui-icon-newwin{background-position:-48px -80px}.snvdopt .ui-icon-refresh{background-position:-64px -80px}.snvdopt .ui-icon-shuffle{background-position:-80px -80px}.snvdopt .ui-icon-transfer-e-w{background-position:-96px -80px}.snvdopt .ui-icon-transferthick-e-w{background-position:-112px -80px}.snvdopt .ui-icon-folder-collapsed{background-position:0 -96px}.snvdopt .ui-icon-folder-open{background-position:-16px -96px}.snvdopt .ui-icon-document{background-position:-32px -96px}.snvdopt .ui-icon-document-b{background-position:-48px -96px}.snvdopt .ui-icon-note{background-position:-64px -96px}.snvdopt .ui-icon-mail-closed{background-position:-80px -96px}.snvdopt .ui-icon-mail-open{background-position:-96px -96px}.snvdopt .ui-icon-suitcase{background-position:-112px -96px}.snvdopt .ui-icon-comment{background-position:-128px -96px}.snvdopt .ui-icon-person{background-position:-144px -96px}.snvdopt .ui-icon-print{background-position:-160px -96px}.snvdopt .ui-icon-trash{background-position:-176px -96px}.snvdopt .ui-icon-locked{background-position:-192px -96px}.snvdopt .ui-icon-unlocked{background-position:-208px -96px}.snvdopt .ui-icon-bookmark{background-position:-224px -96px}.snvdopt .ui-icon-tag{background-position:-240px -96px}.snvdopt .ui-icon-home{background-position:0 -112px}.snvdopt .ui-icon-flag{background-position:-16px -112px}.snvdopt .ui-icon-calendar{background-position:-32px -112px}.snvdopt .ui-icon-cart{background-position:-48px -112px}.snvdopt .ui-icon-pencil{background-position:-64px -112px}.snvdopt .ui-icon-clock{background-position:-80px -112px}.snvdopt .ui-icon-disk{background-position:-96px -112px}.snvdopt .ui-icon-calculator{background-position:-112px -112px}.snvdopt .ui-icon-zoomin{background-position:-128px -112px}.snvdopt .ui-icon-zoomout{background-position:-144px -112px}.snvdopt .ui-icon-search{background-position:-160px -112px}.snvdopt .ui-icon-wrench{background-position:-176px -112px}.snvdopt .ui-icon-gear{background-position:-192px -112px}.snvdopt .ui-icon-heart{background-position:-208px -112px}.snvdopt .ui-icon-star{background-position:-224px -112px}.snvdopt .ui-icon-link{background-position:-240px -112px}.snvdopt .ui-icon-cancel{background-position:0 -128px}.snvdopt .ui-icon-plus{background-position:-16px -128px}.snvdopt .ui-icon-plusthick{background-position:-32px -128px}.snvdopt .ui-icon-minus{background-position:-48px -128px}.snvdopt .ui-icon-minusthick{background-position:-64px -128px}.snvdopt .ui-icon-close{background-position:-80px -128px}.snvdopt .ui-icon-closethick{background-position:-96px -128px}.snvdopt .ui-icon-key{background-position:-112px -128px}.snvdopt .ui-icon-lightbulb{background-position:-128px -128px}.snvdopt .ui-icon-scissors{background-position:-144px -128px}.snvdopt .ui-icon-clipboard{background-position:-160px -128px}.snvdopt .ui-icon-copy{background-position:-176px -128px}.snvdopt .ui-icon-contact{background-position:-192px -128px}.snvdopt .ui-icon-image{background-position:-208px -128px}.snvdopt .ui-icon-video{background-position:-224px -128px}.snvdopt .ui-icon-script{background-position:-240px -128px}.snvdopt .ui-icon-alert{background-position:0 -144px}.snvdopt .ui-icon-info{background-position:-16px -144px}.snvdopt .ui-icon-notice{background-position:-32px -144px}.snvdopt .ui-icon-help{background-position:-48px -144px}.snvdopt .ui-icon-check{background-position:-64px -144px}.snvdopt .ui-icon-bullet{background-position:-80px -144px}.snvdopt .ui-icon-radio-on{background-position:-96px -144px}.snvdopt .ui-icon-radio-off{background-position:-112px -144px}.snvdopt .ui-icon-pin-w{background-position:-128px -144px}.snvdopt .ui-icon-pin-s{background-position:-144px -144px}.snvdopt .ui-icon-play{background-position:0 -160px}.snvdopt .ui-icon-pause{background-position:-16px -160px}.snvdopt .ui-icon-seek-next{background-position:-32px -160px}.snvdopt .ui-icon-seek-prev{background-position:-48px -160px}.snvdopt .ui-icon-seek-end{background-position:-64px -160px}.snvdopt .ui-icon-seek-start{background-position:-80px -160px}.snvdopt .ui-icon-seek-first{background-position:-80px -160px}.snvdopt .ui-icon-stop{background-position:-96px -160px}.snvdopt .ui-icon-eject{background-position:-112px -160px}.snvdopt .ui-icon-volume-off{background-position:-128px -160px}.snvdopt .ui-icon-volume-on{background-position:-144px -160px}.snvdopt .ui-icon-power{background-position:0 -176px}.snvdopt .ui-icon-signal-diag{background-position:-16px -176px}.snvdopt .ui-icon-signal{background-position:-32px -176px}.snvdopt .ui-icon-battery-0{background-position:-48px -176px}.snvdopt .ui-icon-battery-1{background-position:-64px -176px}.snvdopt .ui-icon-battery-2{background-position:-80px -176px}.snvdopt .ui-icon-battery-3{background-position:-96px -176px}.snvdopt .ui-icon-circle-plus{background-position:0 -192px}.snvdopt .ui-icon-circle-minus{background-position:-16px -192px}.snvdopt .ui-icon-circle-close{background-position:-32px -192px}.snvdopt .ui-icon-circle-triangle-e{background-position:-48px -192px}.snvdopt .ui-icon-circle-triangle-s{background-position:-64px -192px}.snvdopt .ui-icon-circle-triangle-w{background-position:-80px -192px}.snvdopt .ui-icon-circle-triangle-n{background-position:-96px -192px}.snvdopt .ui-icon-circle-arrow-e{background-position:-112px -192px}.snvdopt .ui-icon-circle-arrow-s{background-position:-128px -192px}.snvdopt .ui-icon-circle-arrow-w{background-position:-144px -192px}.snvdopt .ui-icon-circle-arrow-n{background-position:-160px -192px}.snvdopt .ui-icon-circle-zoomin{background-position:-176px -192px}.snvdopt .ui-icon-circle-zoomout{background-position:-192px -192px}.snvdopt .ui-icon-circle-check{background-position:-208px -192px}.snvdopt .ui-icon-circlesmall-plus{background-position:0 -208px}.snvdopt .ui-icon-circlesmall-minus{background-position:-16px -208px}.snvdopt .ui-icon-circlesmall-close{background-position:-32px -208px}.snvdopt .ui-icon-squaresmall-plus{background-position:-48px -208px}.snvdopt .ui-icon-squaresmall-minus{background-position:-64px -208px}.snvdopt .ui-icon-squaresmall-close{background-position:-80px -208px}.snvdopt .ui-icon-grip-dotted-vertical{background-position:0 -224px}.snvdopt .ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.snvdopt .ui-icon-grip-solid-vertical{background-position:-32px -224px}.snvdopt .ui-icon-grip-solid-horizontal{background-position:-48px -224px}.snvdopt .ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.snvdopt .ui-icon-grip-diagonal-se{background-position:-80px -224px}.snvdopt .ui-corner-all,.snvdopt .ui-corner-top,.snvdopt .ui-corner-left,.snvdopt .ui-corner-tl{-moz-border-radius-topleft:4px;-webkit-border-top-left-radius:4px;-khtml-border-top-left-radius:4px;border-top-left-radius:4px}.snvdopt .ui-corner-all,.snvdopt .ui-corner-top,.snvdopt .ui-corner-right,.snvdopt .ui-corner-tr{-moz-border-radius-topright:4px;-webkit-border-top-right-radius:4px;-khtml-border-top-right-radius:4px;border-top-right-radius:4px}.snvdopt .ui-corner-all,.snvdopt .ui-corner-bottom,.snvdopt .ui-corner-left,.snvdopt .ui-corner-bl{-moz-border-radius-bottomleft:4px;-webkit-border-bottom-left-radius:4px;-khtml-border-bottom-left-radius:4px;border-bottom-left-radius:4px}.snvdopt .ui-corner-all,.snvdopt .ui-corner-bottom,.snvdopt .ui-corner-right,.snvdopt .ui-corner-br{-moz-border-radius-bottomright:4px;-webkit-border-bottom-right-radius:4px;-khtml-border-bottom-right-radius:4px;border-bottom-right-radius:4px}.snvdopt .ui-widget-overlay{background:#aaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;opacity:.3;filter:Alpha(Opacity=30)}.snvdopt .ui-widget-shadow{margin:-8px 0 0 -8px;padding:8px;background:#aaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;opacity:.3;filter:Alpha(Opacity=30);-moz-border-radius:8px;-khtml-border-radius:8px;-webkit-border-radius:8px;border-radius:8px}
synved-option/script/custom.js ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Synved WP Options
2
+ // Custom jquery code
3
+ // Version: 1.0
4
+ //
5
+ // Copyright (c) 2011 Synved Ltd.
6
+ // All rights reserved
7
+
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
+ {
22
+ type : 'POST',
23
+ data : {
24
+ action : 'synved_option',
25
+ synvedSecurity : SynvedOptionVars.synvedSecurity,
26
+ synvedAction : action,
27
+ synvedParams : params
28
+ },
29
+ success : function( response ) {
30
+ SynvedOption.actionStarted(action, params, response, this);
31
+ },
32
+ error : function( jqXHR, textStatus, errorThrown ) {
33
+ SynvedOption.actionFailed(action, params, errorThrown, this);
34
+ }
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');
60
+ synvedOptionmediaUploadInput = formfield;
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
+ })
93
+ .blur(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
+
synved-option/style/admin.css ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .synved-option-type-addon .description {
2
+ line-height:26px;
3
+ }
4
+
5
+ .synved-option-style-important,
6
+ .synved-option-style-addon-important {
7
+ background-color:#ffe4e0;
8
+ }
9
+ .synved-option-style-addon-important-installed {
10
+ background-color:#e0ffe4;
11
+ }
12
+ .synved-option-style-group-active th,
13
+ .synved-option-style-group-active td {
14
+ padding-top:2em;
15
+ }
16
+ .synved-option-important th {
17
+ }
18
+
19
+ textarea.regular-text {
20
+ width:25em;
21
+ }
22
+ .wide-text {
23
+ width:40em;
24
+ }
25
+
26
+ #TB_ajaxContent {
27
+ max-width:100%;
28
+ }
29
+ .synved-option-overlay-markup {
30
+ width:100%;
31
+ }
32
+ .synved-option-overlay-markup .overlay-ui {
33
+ margin-bottom:10px;
34
+ }
35
+ .synved-option-overlay-markup .overlay-container {
36
+ height:10px;
37
+ }
38
+ .synved-option-overlay-markup .overlay-message {
39
+ font-size:10pt;
40
+ font-weight:bold;
41
+ margin:8px 0;
42
+ }
43
+ .ui-widget-overlay {
44
+ background-image:none;
45
+ }
46
+ .wp-dialog .ui-dialog-titlebar {
47
+ background-image:none;
48
+ }
49
+ .wp-dialog .ui-dialog-titlebar-close {
50
+ right: 0.3em;
51
+ top: 50%;
52
+ }
53
+ .wp-dialog .ui-dialog-titlebar-close span {
54
+ background-image:none;
55
+ }
56
+ .synved-option-creds-form .wrap {
57
+ margin-left:15px;
58
+ }
synved-option/synved-option-context.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function synved_option_context_post($post_id)
4
+ {
5
+ // XXX not implemented yet
6
+ }
7
+
8
+ ?>
synved-option/synved-option-error.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+
5
+ ?>
synved-option/synved-option-item.php ADDED
@@ -0,0 +1,818 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function synved_option_item_query_into($filter, $list)
4
+ {
5
+ if ($list == null)
6
+ {
7
+ return null;
8
+ }
9
+
10
+ foreach ($list as $item_name => $item)
11
+ {
12
+ if ($filter != null)
13
+ {
14
+ $filter = $filter;
15
+ $filter_keys = array_keys($filter);
16
+ $filter_name = $filter_keys[0];
17
+ $filter_value = $filter[$filter_keys[0]];
18
+
19
+ if (is_string($filter_name) || !is_array($filter_value))
20
+ {
21
+ $filter = array($filter);
22
+ }
23
+
24
+ $found_item = true;
25
+
26
+ foreach ($filter as $filter_index => $filter_list)
27
+ {
28
+ $pass = false;
29
+
30
+ foreach ($filter_list as $filter_name => $filter_value)
31
+ {
32
+ if ($filter_name == 'name')
33
+ {
34
+ if ($item_name == $filter_value)
35
+ {
36
+ $pass = true;
37
+ }
38
+ }
39
+ else
40
+ {
41
+ $property = synved_option_item_property($item, $filter_name);
42
+
43
+ if ($property == $filter_value)
44
+ {
45
+ $pass = true;
46
+ }
47
+ }
48
+ }
49
+
50
+ $found_item = ($found_item && $pass);
51
+
52
+ if (!$found_item)
53
+ {
54
+ break;
55
+ }
56
+ }
57
+
58
+ if ($found_item)
59
+ {
60
+ return $item;
61
+ }
62
+ }
63
+
64
+ $type = synved_option_item_type($item);
65
+
66
+ if ($type == 'options-page' && isset($item['sections']) && $item['sections'] != null)
67
+ {
68
+ $ret = synved_option_item_query_into($filter, $item['sections']);
69
+
70
+ if ($ret != null)
71
+ {
72
+ return $ret;
73
+ }
74
+ }
75
+ else if ($type == 'options-section' && isset($item['settings']) && $item['settings'] != null)
76
+ {
77
+ $ret = synved_option_item_query_into($filter, $item['settings']);
78
+
79
+ if ($ret != null)
80
+ {
81
+ return $ret;
82
+ }
83
+ }
84
+ }
85
+
86
+ return null;
87
+ }
88
+
89
+ function synved_option_item_query($id, $filter)
90
+ {
91
+ global $synved_option_list;
92
+
93
+ foreach ($synved_option_list as $list_id => $list)
94
+ {
95
+ if ($id == null || $list_id == $id)
96
+ {
97
+ $items = synved_option_item_list($list_id);
98
+
99
+ $ret = synved_option_item_query_into($filter, $items);
100
+
101
+ if ($ret != null || $id != null)
102
+ {
103
+ return $ret;
104
+ }
105
+ }
106
+ }
107
+
108
+ return null;
109
+ }
110
+
111
+ function synved_option_item_find_into($name, $list)
112
+ {
113
+ return synved_option_item_query_into(array('name' => $name), $list);
114
+ }
115
+
116
+ function synved_option_item_find($id, $name)
117
+ {
118
+ return synved_option_item_query($id, array('name' => $name));
119
+ }
120
+
121
+ function synved_option_item($id, $name)
122
+ {
123
+ return synved_option_item_find($id, $name);
124
+ }
125
+
126
+ function synved_option_item_property($item, $property, $default = null)
127
+ {
128
+ $prop = isset($item[$property]) ? $item[$property] : $default;
129
+
130
+ if ($prop instanceof SynvedOptionCallback)
131
+ {
132
+ $prop = $prop->Invoke(array($default, $item));
133
+ }
134
+
135
+ return $prop;
136
+ }
137
+
138
+ function synved_option_item_type(array $item)
139
+ {
140
+ $type = isset($item['type']) ? $item['type'] : null;
141
+ $default = synved_option_item_default($item);
142
+ $callback = null;
143
+
144
+ if ($type instanceof SynvedOptionCallback)
145
+ {
146
+ $callback = $type;
147
+
148
+ $type = null;
149
+ }
150
+
151
+ if ($type == null && isset($item['sections']))
152
+ {
153
+ $type = 'options-page';
154
+ }
155
+
156
+ if ($type == null && isset($item['settings']))
157
+ {
158
+ $type = 'options-section';
159
+ }
160
+
161
+ if ($type == null)
162
+ {
163
+ $type = 'text';
164
+
165
+ if ($default !== null)
166
+ {
167
+ if (is_bool($default))
168
+ {
169
+ $type = 'boolean';
170
+ }
171
+ else if (is_int($default))
172
+ {
173
+ $type = 'integer';
174
+ }
175
+ else if (is_string($default))
176
+ {
177
+ $type = 'text';
178
+ }
179
+ else if (is_float($default))
180
+ {
181
+ $type = 'decimal';
182
+ }
183
+ }
184
+ }
185
+
186
+ if ($callback != null)
187
+ {
188
+ return $callback->Invoke(array($type, $item));
189
+ }
190
+
191
+ return $type;
192
+ }
193
+
194
+ function synved_option_item_mode(array $item)
195
+ {
196
+ $mode = isset($item['mode']) ? $item['mode'] : null;
197
+
198
+ if ($mode instanceof SynvedOptionCallback)
199
+ {
200
+ $mode = $mode->Invoke(array(null, $item));
201
+ }
202
+
203
+ if ($mode != null && is_string($mode))
204
+ {
205
+ $mode = explode(',', $mode);
206
+ }
207
+
208
+ if ($mode == null)
209
+ {
210
+ $mode = array();
211
+ }
212
+
213
+ return $mode;
214
+ }
215
+
216
+ function synved_option_item_style(array $item)
217
+ {
218
+ $style = isset($item['style']) ? $item['style'] : null;
219
+
220
+ if ($style instanceof SynvedOptionCallback)
221
+ {
222
+ $style = $style->Invoke(array(null, $item));
223
+ }
224
+
225
+ if ($style != null && is_string($style))
226
+ {
227
+ $style = explode(',', $style);
228
+ }
229
+
230
+ if ($style == null)
231
+ {
232
+ $style = array();
233
+ }
234
+
235
+ return $style;
236
+ }
237
+
238
+ function synved_option_item_hidden(array $item)
239
+ {
240
+ $hidden = isset($item['hidden']) ? $item['hidden'] : null;
241
+
242
+ if ($hidden instanceof SynvedOptionCallback)
243
+ {
244
+ $hidden = $hidden->Invoke(array(null, $item));
245
+ }
246
+
247
+ return $hidden;
248
+ }
249
+
250
+ function synved_option_item_label(array $item)
251
+ {
252
+ $label = isset($item['label']) ? $item['label'] : null;
253
+
254
+ if ($label instanceof SynvedOptionCallback)
255
+ {
256
+ $label = $label->Invoke(array(null, $item));
257
+ }
258
+
259
+ return $label;
260
+ }
261
+
262
+ function synved_option_item_title(array $item)
263
+ {
264
+ $title = isset($item['title']) ? $item['title'] : null;
265
+
266
+ if ($title instanceof SynvedOptionCallback)
267
+ {
268
+ $title = $title->Invoke(array(null, $item));
269
+ }
270
+
271
+ return $title;
272
+ }
273
+
274
+ function synved_option_item_tip(array $item)
275
+ {
276
+ $tip = isset($item['tip']) ? $item['tip'] : null;
277
+
278
+ if ($tip instanceof SynvedOptionCallback)
279
+ {
280
+ $tip = $tip->Invoke(array(null, $item));
281
+ }
282
+
283
+ return $tip;
284
+ }
285
+
286
+ function synved_option_item_hint(array $item)
287
+ {
288
+ $hint = isset($item['hint']) ? $item['hint'] : null;
289
+
290
+ if ($hint instanceof SynvedOptionCallback)
291
+ {
292
+ $hint = $hint->Invoke(array(null, $item));
293
+ }
294
+
295
+ return $hint;
296
+ }
297
+
298
+ function synved_option_item_default(array $item)
299
+ {
300
+ $default = isset($item['default']) ? $item['default'] : null;
301
+
302
+ if ($default instanceof SynvedOptionCallback)
303
+ {
304
+ $default = $default->Invoke(array(null, $item));
305
+ }
306
+
307
+ return $default;
308
+ }
309
+
310
+ function synved_option_item_role(array $item)
311
+ {
312
+ $role = isset($item['role']) ? $item['role'] : null;
313
+
314
+ if ($role instanceof SynvedOptionCallback)
315
+ {
316
+ $role = $role->Invoke(array(null, $item));
317
+ }
318
+
319
+ if ($role === null)
320
+ {
321
+ $role = 'manage_options';
322
+ }
323
+
324
+ return $role;
325
+ }
326
+
327
+ function synved_option_item_parent(array $item)
328
+ {
329
+ $parent = isset($item['parent']) ? $item['parent'] : null;
330
+
331
+ if ($parent instanceof SynvedOptionCallback)
332
+ {
333
+ $parent = $parent->Invoke(array(null, $item));
334
+ }
335
+
336
+ switch ($parent)
337
+ {
338
+ case 'dashboard':
339
+ {
340
+ $parent = 'index.php';
341
+
342
+ break;
343
+ }
344
+ case 'posts':
345
+ {
346
+ $parent = 'edit.php';
347
+
348
+ break;
349
+ }
350
+ case 'media':
351
+ {
352
+ $parent = 'upload.php';
353
+
354
+ break;
355
+ }
356
+ case 'links':
357
+ {
358
+ $parent = 'link-manager.php';
359
+
360
+ break;
361
+ }
362
+ case 'pages':
363
+ {
364
+ $parent = 'edit.php?post_type=page';
365
+
366
+ break;
367
+ }
368
+ case 'comments':
369
+ {
370
+ $parent = 'edit-comments.php';
371
+
372
+ break;
373
+ }
374
+ case 'appearance':
375
+ {
376
+ $parent = 'themes.php';
377
+
378
+ break;
379
+ }
380
+ case 'plugins':
381
+ {
382
+ $parent = 'plugins.php';
383
+
384
+ break;
385
+ }
386
+ case 'users':
387
+ {
388
+ $parent = 'users.php';
389
+
390
+ break;
391
+ }
392
+ case 'tools':
393
+ {
394
+ $parent = 'tools.php';
395
+
396
+ break;
397
+ }
398
+ case null:
399
+ case 'settings':
400
+ {
401
+ $parent = 'options-general.php';
402
+
403
+ break;
404
+ }
405
+ }
406
+
407
+ return $parent;
408
+ }
409
+
410
+ function synved_option_item_page($id, $name)
411
+ {
412
+ $items = synved_option_item_list($id);
413
+
414
+ if ($items != null)
415
+ {
416
+ foreach ($items as $page_name => $page)
417
+ {
418
+ $sections = isset($page['sections']) ? $page['sections'] : array();
419
+
420
+ foreach ($sections as $section_name => $section)
421
+ {
422
+ if ($section_name == $name || (isset($section['settings']) && array_key_exists($name, $section['settings'])))
423
+ {
424
+ return $page_name;
425
+ }
426
+ }
427
+ }
428
+ }
429
+
430
+ return null;
431
+ }
432
+
433
+ function synved_option_item_page_link_url($id, $name)
434
+ {
435
+ $page_name = synved_option_item_page($id, $name);
436
+
437
+ if ($page_name != null)
438
+ {
439
+ return synved_option_page_link_url($id, $page_name);
440
+ }
441
+
442
+ return null;
443
+ }
444
+
445
+ function synved_option_item_set_parse(array $item, $set)
446
+ {
447
+ $type = synved_option_item_type($item);
448
+ preg_match_all('/\\s*(?:(\\d+(?:(?:\\.|(?:\\s*-\\s*))\\d+)*)|([^=,]+))\s*(?:=\s*((?:[^,"]+)|(?:"(?:(?:[^"\\\\])|(?:\\.))*")))?(?:,|$)/', $set, $matches, PREG_SET_ORDER);
449
+
450
+ $set = array();
451
+
452
+ foreach ($matches as $match)
453
+ {
454
+ $number = isset($match[1]) ? $match[1] : null;
455
+ $value = isset($match[2]) ? $match[2] : null;
456
+ $label = isset($match[3]) ? $match[3] : null;
457
+
458
+ if ($number != null && $value == null)
459
+ {
460
+ $value = $number;
461
+ }
462
+
463
+ $label = trim($label, '"');
464
+ $value = array($value => $label);
465
+
466
+ if ($number != null)
467
+ {
468
+ $range = explode('-', $number);
469
+ $count = count($range);
470
+
471
+ if ($count > 1)
472
+ {
473
+ $value_range = array();
474
+
475
+ for ($i = 0; $i < $count; $i++)
476
+ {
477
+ $range_item = $range[$i];
478
+ $range_value = synved_option_item_sanitize_value_basic($item, $range_item, 0);
479
+
480
+ if ($range_value == 0)
481
+ {
482
+ $range_value = $range_item;
483
+ }
484
+
485
+ $value_range[$range_value] = $range_value;
486
+ }
487
+
488
+ $value = $value_range;
489
+ }
490
+ }
491
+
492
+ $set[] = $value;
493
+ }
494
+
495
+ return $set;
496
+ }
497
+
498
+ function synved_option_item_set(array $item)
499
+ {
500
+ $set = isset($item['set']) ? $item['set'] : null;
501
+
502
+ if ($set instanceof SynvedOptionCallback)
503
+ {
504
+ $set = $set->Invoke(array(null, $item));
505
+ }
506
+
507
+ if ($set != null && !is_array($set))
508
+ {
509
+ $set = synved_option_item_set_parse($item, $set);
510
+ }
511
+
512
+ return $set;
513
+ }
514
+
515
+ function synved_option_item_callback(array $item, $callback_id, $callback_parameters = null)
516
+ {
517
+ $callback = isset($item[$callback_id]) ? $item[$callback_id] : null;
518
+
519
+ if ($callback != null)
520
+ {
521
+ $callback = trim($callback);
522
+
523
+ if (is_string($callback) && !function_exists($callback))
524
+ {
525
+ $callback = synved_option_callback_create($callback_code, $callback_parameters);
526
+ }
527
+
528
+ if (!($callback instanceof SynvedOptionCallback))
529
+ {
530
+ if (is_callable($callback))
531
+ {
532
+ $callback = synved_option_callback($callback);
533
+ }
534
+ else
535
+ {
536
+ $callback = null;
537
+ }
538
+ }
539
+ }
540
+
541
+ return $callback;
542
+ }
543
+
544
+ function synved_option_item_validate(array $item)
545
+ {
546
+ return synved_option_item_callback($item, 'validate', '$value, $name, $id, $item');
547
+ }
548
+
549
+ function synved_option_item_render(array $item)
550
+ {
551
+ return synved_option_item_callback($item, 'render', '$value, $params, $name, $id, $item');
552
+ }
553
+
554
+ function synved_option_item_sanitize(array $item)
555
+ {
556
+ return synved_option_item_callback($item, 'sanitize', '$value, $name, $id, $item');
557
+ }
558
+
559
+ function synved_option_item_sanitize_raw(array $item)
560
+ {
561
+ return synved_option_item_callback($item, 'sanitize-raw', '$value, $name, $id, $item');
562
+ }
563
+
564
+ function synved_option_item_set_check_value(array $item, $set, $value)
565
+ {
566
+ if ($set == null)
567
+ {
568
+ return true;
569
+ }
570
+
571
+ foreach ($set as $set_it)
572
+ {
573
+ if (!is_array($set_it))
574
+ {
575
+ $set_it = array($set_it);
576
+ }
577
+
578
+ $set_it_keys = array_keys($set_it);
579
+
580
+ if (isset($set_it_keys[1]))
581
+ {
582
+ if ($value >= $set_it_keys[0] && $value <= $set_it_keys[1])
583
+ {
584
+ return true;
585
+ }
586
+ }
587
+ else if (isset($set_it_keys[0]) && $value == $set_it_keys[0])
588
+ {
589
+ return true;
590
+ }
591
+ }
592
+
593
+ return false;
594
+ }
595
+
596
+ function synved_option_item_validate_value($id, $name, $value, &$new_value = null, array $item = null)
597
+ {
598
+ if ($item == null)
599
+ {
600
+ return null;
601
+ }
602
+
603
+ $validate = synved_option_item_validate($item);
604
+ $is_valid = true;
605
+ $error = null;
606
+ $error_list = array();
607
+
608
+ if ($validate != null)
609
+ {
610
+ $new_value = $value;
611
+
612
+ try
613
+ {
614
+ $validate->Invoke(array($new_value, $name, $id, $item));
615
+ }
616
+ catch (Exception $ex)
617
+ {
618
+ $is_valid = false;
619
+
620
+ $error = $ex->getMessage();
621
+ }
622
+ }
623
+
624
+ if (!$is_valid)
625
+ {
626
+ if ($error == null)
627
+ {
628
+ $error = __('Selected value is invalid', 'synved-option');
629
+ }
630
+
631
+ $error_list[] = array('code' => null, 'type' => null, 'message' => $error);
632
+ }
633
+
634
+ return $error_list;
635
+ }
636
+
637
+ function synved_option_item_sanitize_value_basic(array $item, $value, $default = null)
638
+ {
639
+ $type = synved_option_item_type($item);
640
+ $set = isset($item['set']) ? $item['set'] : null;
641
+
642
+ if ($default === null)
643
+ {
644
+ $default = synved_option_item_default($item);
645
+ }
646
+
647
+ switch ($type)
648
+ {
649
+ case 'boolean':
650
+ {
651
+ if ($value === null)
652
+ {
653
+ $value = $default;
654
+ }
655
+
656
+ $value = $value ? true : 0;
657
+
658
+ break;
659
+ }
660
+ case 'integer':
661
+ {
662
+ if ($value === null || $value === '')
663
+ {
664
+ $value = $default;
665
+ }
666
+
667
+ $value = intval($value);
668
+
669
+ break;
670
+ }
671
+ case 'decimal':
672
+ {
673
+ if ($value === null || $value === '')
674
+ {
675
+ $value = $default;
676
+ }
677
+
678
+ $value = floatval($value);
679
+
680
+ break;
681
+ }
682
+ case 'text':
683
+ case 'style':
684
+ case 'script':
685
+ case 'image':
686
+ case 'video':
687
+ {
688
+ $old_value = $value;
689
+ $value = strval($value);
690
+
691
+ if ($old_value === null || ($value == null && $set != null))
692
+ {
693
+ $value = $default;
694
+ }
695
+
696
+ break;
697
+ }
698
+ case 'color':
699
+ {
700
+ $value = strval($value);
701
+
702
+ if ($value == null)
703
+ {
704
+ $value = $default;
705
+ }
706
+
707
+ break;
708
+ }
709
+ }
710
+
711
+ return $value;
712
+ }
713
+
714
+ function synved_option_item_sanitize_value($id, $name, $value, array $item = null)
715
+ {
716
+ if ($item == null)
717
+ {
718
+ $item = synved_option_item($id, $name);
719
+ }
720
+
721
+ if ($item == null)
722
+ {
723
+ return null;
724
+ }
725
+
726
+ $type = synved_option_item_type($item);
727
+ $default = synved_option_item_default($item);
728
+ $set = synved_option_item_set($item);
729
+ $sanitize = synved_option_item_sanitize($item);
730
+ $sanitize_raw = synved_option_item_sanitize_raw($item);
731
+
732
+ if ($sanitize_raw != null)
733
+ {
734
+ return $sanitize_raw->Invoke(array($value, $name, $id));
735
+ }
736
+
737
+ $value = synved_option_item_sanitize_value_basic($item, $value, $default);
738
+ $is_valid = true;
739
+
740
+ if ($set != null)
741
+ {
742
+ if (is_array($value))
743
+ {
744
+ $is_valid = false;
745
+ $new_value = array();
746
+
747
+ foreach ($value as $single_key => $single_value)
748
+ {
749
+ if (synved_option_item_set_check_value($item, $set, $single_value))
750
+ {
751
+ $new_value[$single_key] = $single_value;
752
+ }
753
+ }
754
+
755
+ if ($new_value != null)
756
+ {
757
+ $is_valid = true;
758
+ $value = $new_value;
759
+ }
760
+ }
761
+ else
762
+ {
763
+ if (!synved_option_item_set_check_value($item, $set, $value))
764
+ {
765
+ $value = $default;
766
+ }
767
+ }
768
+ }
769
+
770
+ if ($is_valid)
771
+ {
772
+ if ($sanitize != null)
773
+ {
774
+ $value = $sanitize->Invoke(array($value, $name, $id));
775
+ }
776
+
777
+ return $value;
778
+ }
779
+
780
+ return null;
781
+ }
782
+
783
+ function synved_option_item_addon_is_installed(array $item)
784
+ {
785
+ if ($item != null)
786
+ {
787
+ $type = synved_option_item_type($item);
788
+
789
+ if ($type == 'addon')
790
+ {
791
+ $target = synved_option_item_property($item, 'target');
792
+ $folder = synved_option_item_property($item, 'folder');
793
+
794
+ $path = $target;
795
+
796
+ if ($path != null)
797
+ {
798
+ $path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path);
799
+
800
+ if (substr($path, -1) != DIRECTORY_SEPARATOR)
801
+ {
802
+ $path .= DIRECTORY_SEPARATOR;
803
+ }
804
+
805
+ $path .= $folder;
806
+
807
+ if (is_dir($path))
808
+ {
809
+ return true;
810
+ }
811
+ }
812
+ }
813
+ }
814
+
815
+ return false;
816
+ }
817
+
818
+ ?>
synved-option/synved-option-page.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function synved_option_page_default_name($id)
4
+ {
5
+ return 'page_settings';
6
+ }
7
+
8
+ function synved_option_page_default($id)
9
+ {
10
+ $page = synved_option_page_default_name($id);
11
+
12
+ return array('name' => $page, 'type' => 'options-page', 'label' => synved_option_label_from_id($id));
13
+ }
14
+
15
+ function synved_option_page_slug($id, $name, $item = null)
16
+ {
17
+ if ($item == null)
18
+ {
19
+ $item = synved_option_item($id, $name);
20
+ }
21
+
22
+ $type = synved_option_item_type($item);
23
+ $parent = synved_option_item_parent($item);
24
+
25
+ if ($type == 'options-page')
26
+ {
27
+ global $synved_option_list;
28
+
29
+ if (isset($synved_option_list[$id]['pages'][$name]))
30
+ {
31
+ return $synved_option_list[$id]['pages'][$name]['wp-page-slug'];
32
+ }
33
+ }
34
+
35
+ return null;
36
+ }
37
+
38
+ function synved_option_page_link_url($id, $name, $item = null)
39
+ {
40
+ if ($item == null)
41
+ {
42
+ $item = synved_option_item($id, $name);
43
+ }
44
+
45
+ $type = synved_option_item_type($item);
46
+ $parent = synved_option_item_parent($item);
47
+ $slug = synved_option_page_slug($id, $name, $item);
48
+
49
+ if ($type == 'options-page')
50
+ {
51
+ if ($slug != null)
52
+ {
53
+ return $parent . '?page=' . $slug;
54
+ }
55
+ }
56
+
57
+ return null;
58
+ }
59
+
60
+ function synved_option_page_cb($id, $name, $item)
61
+ {
62
+ $group = synved_option_group_default($id);
63
+ $label = synved_option_item_label($item);
64
+ $title = synved_option_item_title($item);
65
+ $tip = synved_option_item_tip($item);
66
+ $role = synved_option_item_role($item);
67
+
68
+ if (!current_user_can($role))
69
+ {
70
+ wp_die(__('You do not have sufficient permissions to access this page.', 'synved-option'));
71
+ }
72
+
73
+ if ($title === null)
74
+ {
75
+ $title = $label;
76
+ }
77
+
78
+ ?>
79
+ <div class="wrap">
80
+ <div class="icon32" id="icon-options-general"><br/></div>
81
+ <h2><?php echo $title; ?></h2>
82
+ <p><?php echo $tip; ?></p>
83
+ <form action="options.php" method="post">
84
+ <?php settings_fields($group); ?>
85
+ <?php
86
+ $page_slug = synved_option_page_slug($id, $name, $item);
87
+ synved_option_render_page($page_slug);
88
+ ?>
89
+ <p class="submit">
90
+ <input name="Submit" type="submit" class="button-primary" value="<?php esc_attr_e('Save Changes'); ?>" />
91
+ </p>
92
+ </form>
93
+ </div>
94
+ <?php
95
+ }
96
+
97
+ function synved_option_page_add($id, $name, $item)
98
+ {
99
+ global $synved_option_list;
100
+
101
+ $type = synved_option_item_type($item);
102
+
103
+ if ($type == 'options-page')
104
+ {
105
+ $label = synved_option_item_label($item);
106
+ $tip = synved_option_item_tip($item);
107
+ $parent = synved_option_item_parent($item);
108
+ $role = synved_option_item_role($item);
109
+
110
+ if ($label == null)
111
+ {
112
+ $label = $name;
113
+ }
114
+
115
+ $page_slug = $id . '_' . $name;
116
+
117
+ $addfunc = 'add_' . /* */ 'subm' . 'enu_page';
118
+ $page = $addfunc($parent, $label, $label, $role, $page_slug, create_function('', 'return synved_option_page_cb(\'' . $id . '\', \'' . $name . '\', synved_option_item_find(\'' . $id . '\', \'' . $name . '\'));'));
119
+
120
+ $synved_option_list[$id]['pages'][$name]['wp-page-slug'] = $page_slug;
121
+ $synved_option_list[$id]['pages'][$name]['wp-page'] = $page;
122
+
123
+ return $page;
124
+ }
125
+
126
+ return null;
127
+ }
128
+
129
+ function synved_option_page_add_cb()
130
+ {
131
+ global $synved_option_list;
132
+
133
+ if ($synved_option_list != null)
134
+ {
135
+ foreach ($synved_option_list as $id => $list)
136
+ {
137
+ $pages = $list['pages'];
138
+
139
+ foreach ($pages as $name => $item)
140
+ {
141
+ synved_option_page_add($id, $name, $item);
142
+ }
143
+ }
144
+ }
145
+ }
146
+
147
+ ?>
synved-option/synved-option-render.php ADDED
@@ -0,0 +1,471 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function synved_option_render_field_name($id, $name)
4
+ {
5
+ $out_name = synved_option_name_default($id) . '[' . $name . ']';
6
+
7
+ return $out_name;
8
+ }
9
+
10
+ function synved_option_render_field_id($id, $name)
11
+ {
12
+ $out_id = synved_option_name_default($id) . '_' . $name;
13
+
14
+ return $out_id;
15
+ }
16
+
17
+ // XXX taken from WordPres, clean up...
18
+ function synved_option_render_page($page)
19
+ {
20
+ global $wp_settings_sections, $wp_settings_fields;
21
+
22
+ if ( !isset($wp_settings_sections) || !isset($wp_settings_sections[$page]) )
23
+ return;
24
+
25
+ foreach ( (array) $wp_settings_sections[$page] as $section )
26
+ {
27
+ echo "<h3>{$section['title']}</h3>\n";
28
+ call_user_func($section['callback'], $section);
29
+ if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section['id']]) )
30
+ continue;
31
+ echo '<table class="form-table">';
32
+ synved_option_render_section($page, $section['id']);
33
+ echo '</table>';
34
+ }
35
+ }
36
+
37
+ // XXX taken from WordPres, clean up...
38
+ function synved_option_render_section($page, $section)
39
+ {
40
+ global $wp_settings_fields;
41
+
42
+ if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section]) )
43
+ return;
44
+
45
+ $index = 0;
46
+
47
+ foreach ((array) $wp_settings_fields[$page][$section] as $field)
48
+ {
49
+ $callback = $field['callback'];
50
+ $args = $field['args'];
51
+ $id = null;
52
+ $name = null;
53
+ $item = null;
54
+ $class_list = array();
55
+
56
+ if ($callback == 'synved_option_call_array' && $args[0] == 'synved_option_setting_cb')
57
+ {
58
+ $extra_args = $args[1];
59
+ $id = $extra_args[0];
60
+ $name = $extra_args[1];
61
+ $item = $extra_args[2];
62
+
63
+ if ($item != null)
64
+ {
65
+ $type = synved_option_item_type($item);
66
+ $style = synved_option_item_style($item);
67
+
68
+ $class_list[] = 'synved-option-type-' . $type;
69
+
70
+ if ($style != null)
71
+ {
72
+ foreach ($style as $style_name)
73
+ {
74
+ $class_list[] = 'synved-option-style-' . $style_name;
75
+
76
+ // XXX exception
77
+ if ($style_name == 'addon-important')
78
+ {
79
+ if ($type == 'addon')
80
+ {
81
+ if (synved_option_item_addon_is_installed($item))
82
+ {
83
+ $class_list[] = 'synved-option-style-' . $style_name . '-installed';
84
+ }
85
+ }
86
+ }
87
+ else if ($style_name == 'group')
88
+ {
89
+ if ($index > 0)
90
+ {
91
+ $class_list[] = 'synved-option-style-' . $style_name . '-active';
92
+ }
93
+ }
94
+ }
95
+ }
96
+ }
97
+ }
98
+
99
+ if ($class_list != null)
100
+ {
101
+ $class_list = ' class="' . implode(' ', $class_list) . '"';
102
+ }
103
+
104
+ echo '<tr valign="top"' . $class_list . '>';
105
+
106
+ if (!empty($field['args']['label_for']))
107
+ echo '<th scope="row"><label for="' . $field['args']['label_for'] . '">' . $field['title'] . '</label></th>';
108
+ else
109
+ echo '<th scope="row">' . $field['title'] . '</th>';
110
+ echo '<td>';
111
+
112
+ if ($item != null)
113
+ {
114
+ synved_option_render_item($id, $name, $item, true);
115
+ }
116
+ else
117
+ {
118
+ call_user_func($callback, $args);
119
+ }
120
+
121
+ echo '</td>';
122
+ echo '</tr>';
123
+
124
+ $index++;
125
+ }
126
+ }
127
+
128
+ function synved_option_render_item($id, $name, $item = null, $render = false, $params = null, $context = null)
129
+ {
130
+ if ($item == null)
131
+ {
132
+ $item = synved_option_item($id, $name);
133
+ }
134
+
135
+ if ($item == null)
136
+ {
137
+ return null;
138
+ }
139
+
140
+ $value = synved_option_get($id, $name);
141
+ $type = synved_option_item_type($item);
142
+ $style = synved_option_item_style($item);
143
+ $label = synved_option_item_label($item);
144
+ $tip = synved_option_item_tip($item);
145
+ $hint = synved_option_item_hint($item);
146
+ $default = synved_option_item_default($item);
147
+ $set = synved_option_item_set($item);
148
+ $set_is_linear = false;
149
+
150
+ if ($set != null)
151
+ {
152
+ $set_is_linear = true;
153
+
154
+ foreach ($set as $set_it)
155
+ {
156
+ if (count($set_it) > 1)
157
+ {
158
+ $set_is_linear = false;
159
+
160
+ break;
161
+ }
162
+ }
163
+ }
164
+
165
+ $out_name = synved_option_render_field_name($id, $name);
166
+ $out_id = synved_option_render_field_id($id, $name);
167
+ $out = null;
168
+
169
+ if (isset($params['output_name']))
170
+ {
171
+ $out_name = $params['output_name'];
172
+ }
173
+
174
+ if (isset($params['output_id']))
175
+ {
176
+ $out_id = $params['output_id'];
177
+ }
178
+
179
+ if (isset($params['tip']))
180
+ {
181
+ $tip = $params['tip'];
182
+ }
183
+
184
+ if (isset($params['default']))
185
+ {
186
+ $default = $params['default'];
187
+ }
188
+
189
+ if (isset($params['value']))
190
+ {
191
+ $value = $params['value'];
192
+ }
193
+
194
+ $new_value = $value;
195
+ $error_list = synved_option_item_validate_value($id, $name, $value, $new_value, $item);
196
+
197
+ if ($new_value != $value && ($context == null || $context == 'settings'))
198
+ {
199
+ synved_option_set($id, $name, $new_value);
200
+
201
+ $value = synved_option_get($id, $name);
202
+ }
203
+
204
+ if ($error_list != null)
205
+ {
206
+ foreach ($error_list as $error)
207
+ {
208
+ $out .= '<div id="message" class="error"><p>For "<i>' . $label . '</i>": ' . $error['message'] . '</p></div>';
209
+ }
210
+ }
211
+
212
+ if ($set_is_linear)
213
+ {
214
+ $out .= '<select name="' . $out_name . '" id="' . $out_id . '">';
215
+
216
+ // XXX exception...remove at some point
217
+ if (isset($params['set_before']))
218
+ {
219
+ $set_before = $params['set_before'];
220
+
221
+ $set = array_merge($set_before, $set);
222
+ }
223
+
224
+ foreach ($set as $set_it)
225
+ {
226
+ $set_it_keys = array_keys($set_it);
227
+ $selected = $set_it_keys[0] == $value ? ' selected="selected"' : null;
228
+
229
+ $out .= '<option value="' . $set_it_keys[0] . '"' . $selected . '>' . $set_it[$set_it_keys[0]] . '</option>';
230
+ }
231
+
232
+ $out .= '</select>';
233
+ }
234
+ else
235
+ {
236
+ $placeholder = null;
237
+
238
+ if ($hint != null)
239
+ {
240
+ $placeholder = ' placeholder="' . esc_attr($hint) . '"';
241
+ }
242
+
243
+ switch ($type)
244
+ {
245
+ case 'boolean':
246
+ {
247
+ $checked = $value == true ? ' checked="checked"' : null;
248
+
249
+ $out .= '<fieldset><legend class="screen-reader-text"><span>' . $label . '</span></legend><label for="' . $out_id . '"><input type="hidden" name="' . $out_name . '" value="0" /><input name="' . $out_name . '" id="' . $out_id . '" type="checkbox" value="1" class="code" ' . $checked . $placeholder . ' /> ' . $label . '</label>&nbsp;&nbsp;<span class="description" style="vertical-align:middle;">' . $tip . '</span></fieldset>';
250
+
251
+ break;
252
+ }
253
+ case 'text':
254
+ case 'style':
255
+ case 'script':
256
+ case 'image':
257
+ case 'video':
258
+ case 'media':
259
+ {
260
+ $atts = array('name' => $out_name, 'type' => 'text', 'id' => $out_id, 'value' => $value, 'class' => 'regular-text');
261
+ $att_style = array();
262
+ $content = null;
263
+ $tag = 'input';
264
+ $extended = false;
265
+
266
+ if ($style != null)
267
+ {
268
+ if (in_array('wide', $style))
269
+ {
270
+ $atts['class'] = 'wide-text';
271
+ }
272
+
273
+ if (in_array('extend', $style))
274
+ {
275
+ $extended = true;
276
+ }
277
+ }
278
+
279
+ if (in_array($type, array('style', 'script')))
280
+ {
281
+ $extended = true;
282
+
283
+ $att_style['width'] = '450px';
284
+ $att_style['height'] = '250px';
285
+ }
286
+
287
+ if ($extended)
288
+ {
289
+ $tag = 'textarea';
290
+
291
+ if (isset($atts['value']))
292
+ {
293
+ $content = $atts['value'];
294
+
295
+ unset($atts['value']);
296
+ }
297
+
298
+ if ($content == null)
299
+ {
300
+ $content = '';
301
+ }
302
+
303
+ unset($atts['type']);
304
+ }
305
+
306
+ if ($hint != null)
307
+ {
308
+ $atts['placeholder'] = $hint;
309
+ }
310
+
311
+ if ($att_style != null)
312
+ {
313
+ $att_css = null;
314
+
315
+ foreach ($att_style as $style_name => $style_value)
316
+ {
317
+ $att_css .= $style_name . ':' . $style_value . ';';
318
+ }
319
+
320
+ $atts['style'] = $att_css;
321
+ }
322
+
323
+ $out .= '<' . $tag;
324
+
325
+ foreach ($atts as $att_name => $att_value)
326
+ {
327
+ $out .= ' ' . $att_name . '="' . esc_attr($att_value) . '"';
328
+ }
329
+
330
+ if ($content !== null)
331
+ {
332
+ $out .= '>' . esc_html($content) . '</' . $tag . '>';
333
+ }
334
+ else
335
+ {
336
+ $out .= ' />';
337
+ }
338
+
339
+ if (in_array($type, array('image', 'video', 'media')))
340
+ {
341
+ $out .= '<input type="hidden" name="' . esc_attr(synved_option_render_field_name($id, $name . '_info_')) . '" value="' . esc_attr($type) . '" />';
342
+ $out .= '&nbsp;&nbsp;<input type="button" class="synved-option-upload-button" value="' . esc_attr(__('Select File', 'synved-option')) . '"' . $placeholder . ' />';
343
+ }
344
+
345
+ break;
346
+ }
347
+ case 'color':
348
+ {
349
+ $out .= '<div style="position:relative;">';
350
+ $out .= '<input name="' . $out_name . '" id="' . $out_id . '" type="text" value="' . esc_attr($value) . '" class="code medium-text color-input"' . $placeholder . ' />';
351
+ $out .= '<div class="synved-option-color-input-picker" style="background:white;border:solid 1px #ccc;display:none;position:absolute;top:100%;left:0;z-index:10000;"></div>';
352
+ $out .= '</div>';
353
+
354
+ break;
355
+ }
356
+ case 'integer':
357
+ case 'decimal':
358
+ {
359
+ $out .= '<input name="' . $out_name . '" id="' . $out_id . '" type="text" value="' . esc_attr($value) . '" class="code small-text"' . $placeholder . ' />';
360
+
361
+ break;
362
+ }
363
+ case 'user':
364
+ case 'author':
365
+ case 'category':
366
+ case 'page':
367
+ {
368
+ $args = array(
369
+ 'echo' => false, 'name' => $out_name, 'id' => $name, 'selected' => $value,
370
+ 'show_option_all' => __('Every', 'synved-option') . ' ' . ucfirst($type)
371
+ );
372
+
373
+ $drop_out = null;
374
+
375
+ switch ($type)
376
+ {
377
+ case 'author':
378
+ {
379
+ $args['who'] = 'author';
380
+ }
381
+ case 'user':
382
+ {
383
+ $drop_out = wp_dropdown_users($args);
384
+
385
+ break;
386
+ }
387
+ case 'category':
388
+ {
389
+ $drop_out = wp_dropdown_categories($args);
390
+
391
+ break;
392
+ }
393
+ case 'page':
394
+ {
395
+ $args['show_option_no_change'] = $args['show_option_all'];
396
+
397
+ $drop_out = wp_dropdown_pages($args);
398
+
399
+ break;
400
+ }
401
+ }
402
+
403
+ $out .= $drop_out;
404
+
405
+ break;
406
+ }
407
+ case 'tag-list':
408
+ {
409
+ $out .= '<input name="' . $out_name . '" id="' . $out_id . '" type="text" value="' . esc_attr($value) . '" class="regular-text synved-option-tag-selector"' . $placeholder . ' />';
410
+
411
+ break;
412
+ }
413
+ case 'addon':
414
+ {
415
+ if (function_exists('synved_option_render_type_addon'))
416
+ {
417
+ $out .= synved_option_render_type_addon($id, $name, $item, $out_name, array('out_id' => $out_id, 'label' => $label));
418
+ }
419
+
420
+ break;
421
+ }
422
+ }
423
+ }
424
+
425
+ $item_render = synved_option_item_render($item);
426
+
427
+ if ($item_render != null)
428
+ {
429
+ $error = null;
430
+ $new_out = null;
431
+
432
+ try
433
+ {
434
+ $params = array('output_name' => $out_name, 'output_id' => $out_id, 'output' => $out, 'set' => $set, 'label' => $label);
435
+ $new_out = $item_render->Invoke(array($value, $params, $name, $id, $item));
436
+ }
437
+ catch (Exception $ex)
438
+ {
439
+ $new_out = null;
440
+
441
+ $error = $ex->getMessage();
442
+ }
443
+
444
+ if ($new_out !== null)
445
+ {
446
+ $out = $new_out;
447
+ }
448
+ }
449
+
450
+ if ($out != null)
451
+ {
452
+ if ($tip != null && $type != 'boolean')
453
+ {
454
+ $tip_class = ' description-' . $type;
455
+ $out .= '&nbsp;&nbsp;<span class="description' . $tip_class . '">' . $tip . '</span>';
456
+ }
457
+
458
+ if ($render)
459
+ {
460
+ echo $out;
461
+ }
462
+ else
463
+ {
464
+ return $out;
465
+ }
466
+ }
467
+
468
+ return null;
469
+ }
470
+
471
+ ?>
synved-option/synved-option-section.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function synved_option_section_default_name($id, $page)
4
+ {
5
+ return $page . '_section_general';
6
+ }
7
+
8
+ function synved_option_section_default($id, $page)
9
+ {
10
+ $section = synved_option_section_default_name($id, $page);
11
+
12
+ return array('name' => $section, 'type' => 'options-section', 'label' => __('General Settings', 'synved-option'), 'tip' => __('General Settings for', 'synved-option') . ' ' . synved_option_label_from_id($id));
13
+ }
14
+
15
+ function synved_option_settings_section_cb($name, $item)
16
+ {
17
+ $tip = synved_option_item_tip($item);
18
+
19
+ if ($tip != null)
20
+ {
21
+ echo '<p>' . $tip . '</p>';
22
+ }
23
+ }
24
+
25
+ ?>
synved-option/synved-option-setting.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function synved_option_setting_sanitize_cb($id, $values)
4
+ {
5
+ if ($values != null && is_array($values))
6
+ {
7
+ foreach ($values as $name => $value)
8
+ {
9
+ $values[$name] = synved_option_item_sanitize_value($id, $name, $values[$name]);
10
+ }
11
+
12
+ return $values;
13
+ }
14
+
15
+ return array();
16
+ }
17
+
18
+ function synved_option_setting_cb($id, $name, $item)
19
+ {
20
+ return synved_option_render_item($id, $name, $item, true);
21
+ }
22
+
23
+ ?>
synved-option/synved-option.php ADDED
@@ -0,0 +1,955 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Module Name: Synved Option
4
+ Description: Easily add options to your themes or plugins with as little or as much coding as you want. Just create an array of your options, the rest is automated. If you need extra flexibility you can then use the powerful API provided to achieve any level of customization.
5
+ Author: Synved
6
+ Version: 1.3.9
7
+ Author URI: http://synved.com/
8
+ License: GPLv2
9
+
10
+ LEGAL STATEMENTS
11
+
12
+ NO WARRANTY
13
+ All products, support, services, information and software are provided "as is" without warranty of any kind, express or implied, including, but not limited to, the implied warranties of fitness for a particular purpose, and non-infringement.
14
+
15
+ NO LIABILITY
16
+ In no event shall Synved Ltd. be liable to you or any third party for any direct or indirect, special, incidental, or consequential damages in connection with or arising from errors, omissions, delays or other cause of action that may be attributed to your use of any product, support, services, information or software provided, including, but not limited to, lost profits or lost data, even if Synved Ltd. had been advised of the possibility of such damages.
17
+ */
18
+
19
+
20
+ include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'synved-option-item.php');
21
+ include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'synved-option-page.php');
22
+ include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'synved-option-section.php');
23
+ include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'synved-option-render.php');
24
+ include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'synved-option-setting.php');
25
+
26
+
27
+ define('SYNVED_OPTION_LOADED', true);
28
+ define('SYNVED_OPTION_VERSION', 100030009);
29
+ define('SYNVED_OPTION_VERSION_STRING', '1.3.9');
30
+
31
+
32
+ $synved_option = array();
33
+ $synved_option_list = array();
34
+
35
+
36
+ class SynvedOptionCallback
37
+ {
38
+ private $_Object;
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;
46
+ $this->_Callback = $callback;
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];
97
+ }
98
+ else if (isset($arguments[$i]))
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
+ }
122
+
123
+ function synved_option_version()
124
+ {
125
+ return SYNVED_OPTION_VERSION;
126
+ }
127
+
128
+ function synved_option_version_string()
129
+ {
130
+ return SYNVED_OPTION_VERSION_STRING;
131
+ }
132
+
133
+ function synved_option_callback($callback, $default = null, $callback_parameters = null)
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
+
147
+ function synved_option_callback_create($callback_code, $callback_parameters = null)
148
+ {
149
+ if ($callback_parameters === null)
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
+ }
158
+ else if (!is_array($callback_parameters))
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;
188
+ }
189
+ else if (in_array($param_default[0], array('\'', '"')))
190
+ {
191
+ $param_default = trim($param_default, '"\'');
192
+ }
193
+ else if (strpos($param_default, 'array()') === 0)
194
+ {
195
+ $param_default = array();
196
+ }
197
+ else if (strpos($param_default, 'array(') === 0)
198
+ {
199
+ // No array support
200
+ $param_default = null;
201
+ }
202
+ else if (is_string($param_default))
203
+ {
204
+ // int or double (float)
205
+ if (((string)((int) $param_default)) == $param_default)
206
+ {
207
+ $param_default = (int) $param_default;
208
+ }
209
+ else
210
+ {
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) != ';')
236
+ {
237
+ $callback_code .= ';';
238
+ }
239
+
240
+ if (strpos($callback_code, 'return') === false)
241
+ {
242
+ $result = preg_split('/(?:([\'"])([^\\1]*\\1))|(;)/i', $callback_code, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
243
+ $count = count($result);
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;
255
+ $string = null;
256
+ }
257
+ else if ($split == ';')
258
+ {
259
+ $split = $partial;
260
+ $partial = null;
261
+ }
262
+ else if ($split == '\'')
263
+ {
264
+ $string = $split;
265
+ }
266
+ else
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 = create_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 = $synved_option_list[$id]['items'];
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 = $synved_option_list[$id]['options'];
350
+ $options = apply_filters('synved_option_init_list', $options, $id);
351
+ $options = apply_filters('synved_option_init_list_' . $id, $options, $id);
352
+
353
+ $final_list = array();
354
+ $default_page = null;
355
+ $default_section = null;
356
+
357
+ foreach ($options as $name => $item)
358
+ {
359
+ $type = synved_option_item_type($item);
360
+
361
+ if ($type == 'options-page')
362
+ {
363
+ $item = synved_option_prepare_list_item($id, null, null, $name, $item);
364
+
365
+ if ($item != null)
366
+ {
367
+ $final_list[$name] = $item;
368
+ }
369
+ }
370
+ else
371
+ {
372
+ if ($default_page == null)
373
+ {
374
+ $default_page = synved_option_page_default($id);
375
+ $default_page = synved_option_prepare_list_item($id, null, null, $default_page['name'], $default_page);
376
+
377
+ $final_list[$default_page['name']] = &$default_page;
378
+ }
379
+
380
+ if ($type == 'options-section')
381
+ {
382
+ $item = synved_option_prepare_list_item($id, $default_page['name'], null, $name, $item);
383
+
384
+ if ($item != null)
385
+ {
386
+ $default_page['sections'][$name] = $item;
387
+ }
388
+ }
389
+ else
390
+ {
391
+ if ($default_section == null)
392
+ {
393
+ $default_section = synved_option_section_default($id, $default_page['name']);
394
+ $default_section = synved_option_prepare_list_item($id, $default_page['name'], null, $default_section['name'], $default_section);
395
+
396
+ $default_page['sections'][$default_section['name']] = &$default_section;
397
+ }
398
+
399
+ $default_section['settings'][$name] = $item;
400
+ }
401
+ }
402
+ }
403
+
404
+ if ($default_page != null)
405
+ {
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')
455
+ {
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;
494
+ }
495
+ else
496
+ {
497
+ return array();
498
+ }
499
+ }
500
+
501
+ return $synved_option_list[$id]['values'];
502
+ }
503
+
504
+ function synved_option_get($id, $name, $default = null)
505
+ {
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);
518
+ }
519
+ else if ($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
+ $options[$name] = synved_option_item_sanitize_value($id, $name, $value);
534
+
535
+ update_option($options_name, $options);
536
+
537
+ unset($synved_option_list[$id]['values']);
538
+ }
539
+
540
+ function synved_option_label_from_id($id)
541
+ {
542
+ return ucwords(str_replace('_', ' ', $id));
543
+ }
544
+
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
+
573
+ function synved_option_wp_handle_setting($id, $page, $section, $name, $item)
574
+ {
575
+ $type = synved_option_item_type($item);
576
+ $hidden = synved_option_item_hidden($item);
577
+ $label = synved_option_item_label($item);
578
+ $sections = isset($item['sections']) ? $item['sections'] : null;
579
+ $settings = isset($item['settings']) ? $item['settings'] : null;
580
+
581
+ if ($hidden)
582
+ {
583
+ return;
584
+ }
585
+
586
+ if ($type == 'options-page')
587
+ {
588
+ if ($sections != null)
589
+ {
590
+ $page_slug = synved_option_page_slug($id, $name, $item);
591
+
592
+ foreach ($sections as $child_name => $child_item)
593
+ {
594
+ synved_option_wp_handle_setting($id, $page_slug, null, $child_name, $child_item);
595
+ }
596
+ }
597
+ }
598
+ else if ($type == 'options-section')
599
+ {
600
+ add_settings_section($name, $label,
601
+ create_function('', 'return synved_option_settings_section_cb(\'' . $name . '\', synved_option_item_find(\'' . $id . '\', \'' . $name . '\'));'),
602
+ $page);
603
+
604
+ if ($settings != null)
605
+ {
606
+ foreach ($settings as $child_name => $child_item)
607
+ {
608
+ synved_option_wp_handle_setting($id, $page, $name, $child_name, $child_item);
609
+ }
610
+ }
611
+ }
612
+ else
613
+ {
614
+ add_settings_field($name, $label,
615
+ 'synved_option_call_array',
616
+ $page, $section,
617
+ array('synved_option_setting_cb', array($id, $name, $item)));
618
+ }
619
+ }
620
+
621
+ function synved_option_addon_installed($id, $name, $item = null)
622
+ {
623
+ $item = synved_option_item($id, $name);
624
+
625
+ if ($item != null)
626
+ {
627
+ return synved_option_item_addon_is_installed($item);
628
+ }
629
+
630
+ return false;
631
+ }
632
+
633
+ function synved_option_include_addon_list($path, $filter = null)
634
+ {
635
+ $addon_list = synved_plugout_module_addon_scan_path($path, $filter);
636
+
637
+ if ($addon_list != null)
638
+ {
639
+ foreach ($addon_list as $addon_name => $addon_file)
640
+ {
641
+ if (file_exists($addon_file))
642
+ {
643
+ include_once($addon_file);
644
+ }
645
+ }
646
+ }
647
+ }
648
+
649
+ function synved_option_include_module_addon_list($module_id, $filter = null)
650
+ {
651
+ global $synved_option;
652
+
653
+ $synved_option['module-addon-list'][] = array('module-id' => $module_id, 'filter' => $filter);
654
+ }
655
+
656
+ function synved_option_init()
657
+ {
658
+ global $synved_option_list;
659
+
660
+ if ($synved_option_list != null)
661
+ {
662
+ foreach ($synved_option_list as $id => $list)
663
+ {
664
+ $items = synved_option_item_list($id);
665
+ }
666
+ }
667
+
668
+ if ((isset($_POST['action']) && $_POST['action'] == 'synved_option'))
669
+ {
670
+ ob_start();
671
+ }
672
+ }
673
+
674
+ function synved_option_call_array($args)
675
+ {
676
+ call_user_func_array($args[0], $args[1]);
677
+ }
678
+
679
+ function synved_option_path_uri($path = null)
680
+ {
681
+ $uri = plugins_url('/synved-options') . '/synved-option';
682
+
683
+ if (function_exists('synved_plugout_module_uri_get'))
684
+ {
685
+ $mod_uri = synved_plugout_module_uri_get('synved-option');
686
+
687
+ if ($mod_uri != null)
688
+ {
689
+ $uri = $mod_uri;
690
+ }
691
+ }
692
+
693
+ if ($path != null)
694
+ {
695
+ if (substr($uri, -1) != '/' && $path[0] != '/')
696
+ {
697
+ $uri .= '/';
698
+ }
699
+
700
+ $uri .= $path;
701
+ }
702
+
703
+ return $uri;
704
+ }
705
+
706
+ function synved_option_print_head_outputs()
707
+ {
708
+ global $synved_option_list;
709
+
710
+ foreach ($synved_option_list as $id => $list)
711
+ {
712
+ $items = synved_option_item_list($id);
713
+ $outputs = $list['outputs'];
714
+
715
+ foreach ($outputs as $name => $item)
716
+ {
717
+ $type = synved_option_item_type($item);
718
+ $mode = synved_option_item_mode($item);
719
+
720
+ if (in_array('manual', $mode))
721
+ {
722
+ continue;
723
+ }
724
+
725
+ $content = synved_option_get($id, $name);
726
+ $tag = null;
727
+ $attrs = null;
728
+
729
+ if ($type == 'style')
730
+ {
731
+ $tag = $type;
732
+ $attrs['type'] = 'text/css';
733
+ }
734
+ else if ($type == 'script')
735
+ {
736
+ $tag = $type;
737
+ $attrs['type'] = 'text/javascript';
738
+
739
+ $content = '/* <![CDATA[ */' . "\r\n" . $content . "\r\n" . '/* ]]> */';
740
+ }
741
+
742
+ if ($tag != null)
743
+ {
744
+ echo "\r\n" . '<' . $tag;
745
+
746
+ foreach ($attrs as $attr_name => $attr_value)
747
+ {
748
+ echo ' ' . $attr_name . '="' . esc_attr($attr_value) . '"';
749
+ }
750
+
751
+ echo '>';
752
+ echo $content;
753
+ echo '</' . $tag . '>' . "\r\n";
754
+ }
755
+ }
756
+ }
757
+ }
758
+
759
+ function synved_option_wp_after_setup_theme()
760
+ {
761
+ global $synved_option;
762
+
763
+ foreach ($synved_option['module-addon-list'] as $module_addon_load)
764
+ {
765
+ $module_id = $module_addon_load['module-id'];
766
+ $filter = $module_addon_load['filter'];
767
+
768
+ $addon_list = synved_plugout_module_addon_list($module_id, $filter);
769
+
770
+ if ($addon_list != null)
771
+ {
772
+ foreach ($addon_list as $addon_name => $addon_file)
773
+ {
774
+ if (file_exists($addon_file))
775
+ {
776
+ include_once($addon_file);
777
+ }
778
+ }
779
+ }
780
+ }
781
+ }
782
+
783
+ function synved_option_wp_init()
784
+ {
785
+ synved_option_init();
786
+
787
+ if (!is_admin())
788
+ {
789
+ add_action('wp_head', 'synved_option_print_head_outputs');
790
+ }
791
+ }
792
+
793
+ function synved_option_wp_admin_menu()
794
+ {
795
+ synved_option_page_add_cb();
796
+ }
797
+
798
+ function synved_option_wp_admin_init()
799
+ {
800
+ global $synved_option_list;
801
+
802
+ if ($synved_option_list != null)
803
+ {
804
+ foreach ($synved_option_list as $id => $list)
805
+ {
806
+ $dbname = synved_option_name_default($id);
807
+ $group = synved_option_group_default($id);
808
+
809
+ register_setting($group, $dbname, create_function('$value', 'return synved_option_setting_sanitize_cb(\'' . $id . '\', $value);'));
810
+
811
+ $items = synved_option_item_list($id);
812
+
813
+ foreach ($items as $name => $item)
814
+ {
815
+ synved_option_wp_handle_setting($id, null, null, $name, $item);
816
+ }
817
+ }
818
+ }
819
+ }
820
+
821
+ function synved_option_wp_upgrader_source_selection($source, $remote_source, $object = null)
822
+ {
823
+ if (is_wp_error($source))
824
+ {
825
+ return $source;
826
+ }
827
+
828
+ if ($object != null && $object instanceof Plugin_Upgrader && method_exists($object, 'check_package'))
829
+ {
830
+ $result = $object->check_package($source);
831
+
832
+ if (is_wp_error($result))
833
+ {
834
+ $folder_name = basename($source);
835
+ $addon_item = synved_option_item_query(null, array(array('type' => 'addon'), array('folder' => $folder_name)));
836
+
837
+ if ($addon_item != null)
838
+ {
839
+ // XXX fix this $id/$name retrieval...ugly
840
+ $id = $addon_item['_synved_option_id'];
841
+ $name = $addon_item['_synved_option_name'];
842
+ $addon_page = synved_option_item_page($id, $name);
843
+ $page_item = synved_option_item($id, $addon_page);
844
+ $page_label = synved_option_item_label($page_item);
845
+ $page_url = synved_option_item_page_link_url($id, $name);
846
+
847
+ $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), '');
848
+ }
849
+ }
850
+ }
851
+
852
+ return $source;
853
+ }
854
+
855
+ function synved_option_admin_enqueue_scripts()
856
+ {
857
+ $uri = synved_option_path_uri();
858
+
859
+ wp_register_style('synved-option-jquery-ui', $uri . '/jqueryUI/css/snvdopt/jquery-ui-1.9.2.custom.min.css', false, '1.9.2');
860
+ wp_register_style('synved-option-admin', $uri . '/style/admin.css', array('wp-jquery-ui-dialog'), '1.0');
861
+
862
+ 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');
863
+ 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')));
864
+
865
+ wp_enqueue_style('thickbox');
866
+ wp_enqueue_style('farbtastic');
867
+ wp_enqueue_style('wp-pointer');
868
+ wp_enqueue_style('synved-option-jquery-ui');
869
+ wp_enqueue_style('synved-option-admin');
870
+
871
+ wp_enqueue_script('plupload-all');
872
+ wp_enqueue_script('media-upload');
873
+ wp_enqueue_script('suggest');
874
+ wp_enqueue_script('thickbox');
875
+ wp_enqueue_script('farbtastic');
876
+ wp_enqueue_script('synved-option-script-custom');
877
+ }
878
+
879
+ function synved_option_ajax()
880
+ {
881
+ check_ajax_referer('synved-option-submit-nonce', 'synvedSecurity');
882
+
883
+ if (!isset($_POST['synvedAction']) || $_POST['synvedAction'] == null)
884
+ {
885
+ return;
886
+ }
887
+
888
+ $action = $_POST['synvedAction'];
889
+ $params = isset($_POST['synvedParams']) ? $_POST['synvedParams'] : null;
890
+ $response = null;
891
+
892
+ if (is_string($params))
893
+ {
894
+ $parms = json_decode($params, true);
895
+
896
+ if ($parms == null)
897
+ {
898
+ $parms = json_decode(stripslashes($params), true);
899
+ }
900
+
901
+ $params = $parms;
902
+ }
903
+
904
+ switch ($action)
905
+ {
906
+ case 'install-addon':
907
+ {
908
+ if (current_user_can('upload_files') && current_user_can('install_plugins'))
909
+ {
910
+ if (function_exists('synved_option_ajax_type_addon'))
911
+ {
912
+ $response = synved_option_ajax_type_addon($action, $params);
913
+ }
914
+ }
915
+
916
+ break;
917
+ }
918
+ }
919
+
920
+ while (ob_get_level() > 0)
921
+ {
922
+ ob_end_clean();
923
+ }
924
+
925
+ if ($response != null)
926
+ {
927
+ $response = json_encode($response);
928
+
929
+ header('Content-Type: application/json');
930
+
931
+ echo $response;
932
+ }
933
+ else
934
+ {
935
+ header('HTTP/1.1 403 Forbidden');
936
+ }
937
+
938
+ exit();
939
+ }
940
+
941
+ add_action('after_setup_theme', 'synved_option_wp_after_setup_theme');
942
+ add_action('init', 'synved_option_wp_init');
943
+ add_filter('upgrader_source_selection', 'synved_option_wp_upgrader_source_selection', 9, 3);
944
+
945
+ if (is_admin())
946
+ {
947
+ add_action('admin_init', 'synved_option_wp_admin_init');
948
+ add_action('admin_menu', 'synved_option_wp_admin_menu');
949
+ add_action('admin_enqueue_scripts', 'synved_option_admin_enqueue_scripts');
950
+ add_action('wp_ajax_synved_option', 'synved_option_ajax');
951
+ }
952
+
953
+ synved_option_include_module_addon_list('synved-option');
954
+
955
+ ?>
synved-plugout/synved-plugout-core.php ADDED
@@ -0,0 +1,380 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ define('SYNVED_PLUGOUT_LOADED', true);
4
+ define('SYNVED_PLUGOUT_VERSION', 100000000);
5
+ define('SYNVED_PLUGOUT_VERSION_STRING', '1.0');
6
+
7
+
8
+ $synved_plugout = array();
9
+
10
+
11
+ function synved_plugout_version()
12
+ {
13
+ return SYNVED_PLUGOUT_VERSION;
14
+ }
15
+
16
+ function synved_plugout_version_string()
17
+ {
18
+ return SYNVED_PLUGOUT_VERSION_STRING;
19
+ }
20
+
21
+ function synved_plugout_path_default($path_id)
22
+ {
23
+ switch ($path_id)
24
+ {
25
+ case 'module':
26
+ {
27
+ return dirname(dirname(__FILE__));
28
+ }
29
+ }
30
+
31
+ return null;
32
+ }
33
+
34
+ function synved_plugout_path_get($path_id)
35
+ {
36
+ global $synved_plugout;
37
+
38
+ if (isset($synved_plugout['path'][$path_id]))
39
+ {
40
+ return $synved_plugout['path'][$path_id];
41
+ }
42
+
43
+ return synved_plugout_path_default($path_id);
44
+ }
45
+
46
+ function synved_plugout_path_set($path_id, $path)
47
+ {
48
+ global $synved_plugout;
49
+
50
+ $synved_plugout['path'][$path_id] = $path;
51
+ }
52
+
53
+ function synved_plugout_module_register($module_id, $module_prefix = null, $module_name = null)
54
+ {
55
+ global $synved_plugout;
56
+
57
+ if (!isset($synved_plugout['module-list'][$module_id]))
58
+ {
59
+ $synved_plugout['module-list'][$module_id] = array(
60
+ 'id' => $module_id,
61
+ 'name' => $module_name,
62
+ 'prefix' => $module_prefix,
63
+ 'location' => null,
64
+ 'callback-list' => array()
65
+ );
66
+
67
+ return true;
68
+ }
69
+
70
+ return false;
71
+ }
72
+
73
+ function synved_plugout_module_path_add($module_id, $type, $path)
74
+ {
75
+ global $synved_plugout;
76
+
77
+ if (isset($synved_plugout['module-list'][$module_id]))
78
+ {
79
+ $path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $path);
80
+
81
+ $synved_plugout['module-list'][$module_id]['path-list'][$type][] = array('path' => $path);
82
+
83
+ return true;
84
+ }
85
+
86
+ return false;
87
+ }
88
+
89
+ function synved_plugout_module_path_get($module_id, $type)
90
+ {
91
+ $path_list = synved_plugout_module_path_list_get($module_id, $type, 'first');
92
+
93
+ if ($path_list != null)
94
+ {
95
+ return $path_list[0]['path'];
96
+ }
97
+
98
+ return null;
99
+ }
100
+
101
+ function synved_plugout_module_path_list_get($module_id, $type, $criteria = null)
102
+ {
103
+ global $synved_plugout;
104
+
105
+ if (isset($synved_plugout['module-list'][$module_id]))
106
+ {
107
+ $path_list = $synved_plugout['module-list'][$module_id]['path-list'];
108
+
109
+ if ($path_list != null)
110
+ {
111
+ $return_list = array();
112
+
113
+ foreach ($path_list as $path_type => $path_type_list)
114
+ {
115
+ if ($type == null || $type == $path_type)
116
+ {
117
+ foreach ($path_type_list as $path_object)
118
+ {
119
+ $return_item = array();
120
+
121
+ $return_item['type'] = $path_type;
122
+ $return_item['path'] = $path_object['path'];
123
+
124
+ $return_list[] = $return_item;
125
+ }
126
+ }
127
+ }
128
+
129
+ return $return_list;
130
+ }
131
+ }
132
+
133
+ return null;
134
+ }
135
+
136
+ function synved_plugout_module_get($module_id)
137
+ {
138
+ global $synved_plugout;
139
+
140
+ if (isset($synved_plugout['module-list'][$module_id]))
141
+ {
142
+ return $synved_plugout['module-list'][$module_id];
143
+ }
144
+
145
+ return null;
146
+ }
147
+
148
+ function synved_plugout_module_exists($module_id)
149
+ {
150
+ $module = synved_plugout_module_get($module_id);
151
+
152
+ if ($module !== null)
153
+ {
154
+ return true;
155
+ }
156
+
157
+ return false;
158
+ }
159
+
160
+ function synved_plugout_module_version($module_id)
161
+ {
162
+ $module = synved_plugout_module_get($module_id);
163
+
164
+ if ($module !== null)
165
+ {
166
+ $module_cb = isset($module['callback-list']) ? $module['callback-list'] : null;
167
+ $version_cb = str_replace('-', '_', $module_id) . '_version';
168
+
169
+ if (isset($module_cb['version']))
170
+ {
171
+ $version_cb = $module_cb['version'];
172
+ }
173
+
174
+ if (is_callable($version_cb))
175
+ {
176
+ return $version_cb();
177
+ }
178
+ }
179
+
180
+ return false;
181
+ }
182
+
183
+ function synved_plugout_module_location_get($module_id)
184
+ {
185
+ $module = synved_plugout_module_get($module_id);
186
+
187
+ if ($module != null)
188
+ {
189
+ if (isset($module['location']))
190
+ {
191
+ return $module['location'];
192
+ }
193
+ }
194
+
195
+ return null;
196
+ }
197
+
198
+ function synved_plugout_module_directory_get($module_id)
199
+ {
200
+ $location = synved_plugout_module_location_get($module_id);
201
+
202
+ if ($location != null)
203
+ {
204
+ return dirname($location);
205
+ }
206
+
207
+ return null;
208
+ }
209
+
210
+ function synved_plugout_module_uri_get($module_id)
211
+ {
212
+ $directory = synved_plugout_module_directory_get($module_id);
213
+
214
+ if ($directory != null)
215
+ {
216
+ $directory = strtolower($directory);
217
+ $content_dir = strtolower(WP_CONTENT_DIR);
218
+ $base_len = strlen($content_dir);
219
+
220
+ if (substr($directory, 0, $base_len) == $content_dir)
221
+ {
222
+ return content_url(substr($directory, $base_len));
223
+ }
224
+ }
225
+
226
+ return null;
227
+ }
228
+
229
+ function synved_plugout_module_callback_set($module_id, $callback_id, $callback)
230
+ {
231
+
232
+ }
233
+
234
+ function synved_plugout_module_import($module_id)
235
+ {
236
+ // XXX better way to check if the plugin/module is being activated?
237
+ // This is needed because on activation the plugin's code is included *after* the theme code
238
+ if (strpos($_SERVER['REQUEST_URI'], '/plugins.php?') !== false &&
239
+ isset($_GET['action']) && $_GET['action'] == 'activate')
240
+ {
241
+ return false;
242
+ }
243
+
244
+ global $synved_plugout;
245
+
246
+ if (isset($synved_plugout['module-list'][$module_id]))
247
+ {
248
+ $lib_path = synved_plugout_module_path_get($module_id, 'library');
249
+ $core_path = synved_plugout_module_path_get($module_id, 'core');
250
+
251
+ if ($lib_path == null)
252
+ {
253
+ if ($core_path == null)
254
+ {
255
+ $module_path = synved_plugout_path_get('module');
256
+
257
+ if (substr($module_path, -1) != DIRECTORY_SEPARATOR)
258
+ {
259
+ $module_path .= DIRECTORY_SEPARATOR;
260
+ }
261
+
262
+ $core_path = $module_path . $module_id;
263
+ }
264
+
265
+ if (is_dir($core_path))
266
+ {
267
+ if (substr($core_path, -1) != DIRECTORY_SEPARATOR)
268
+ {
269
+ $core_path .= DIRECTORY_SEPARATOR;
270
+ }
271
+
272
+ $lib_path = $core_path . $module_id;
273
+
274
+ if (file_exists($lib_path . '.php'))
275
+ {
276
+ $lib_path .= '.php';
277
+ }
278
+ else if (file_exists($lib_path . '.inc.php'))
279
+ {
280
+ $lib_path .= '.inc.php';
281
+ }
282
+ else
283
+ {
284
+ $lib_path = null;
285
+ }
286
+ }
287
+ }
288
+
289
+ if ($lib_path != null && file_exists($lib_path))
290
+ {
291
+ $version = synved_plugout_module_version($module_id);
292
+
293
+ if ($version === false)
294
+ {
295
+ $synved_plugout['module-list'][$module_id]['location'] = $lib_path;
296
+
297
+ include_once($lib_path);
298
+ }
299
+ else
300
+ {
301
+ // XXX undefine old module, include new one
302
+ }
303
+
304
+ return true;
305
+ }
306
+ }
307
+
308
+ return false;
309
+ }
310
+
311
+ function synved_plugout_module_addon_scan_path($path, $filter = null)
312
+ {
313
+ if ($filter == null)
314
+ {
315
+ $filter = '*';
316
+ }
317
+
318
+ $path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path);
319
+
320
+ if (substr($path, -1) != DIRECTORY_SEPARATOR)
321
+ {
322
+ $path .= DIRECTORY_SEPARATOR;
323
+ }
324
+
325
+ if (is_dir($path))
326
+ {
327
+ $list = glob($path . '*', GLOB_ONLYDIR);
328
+ $addon_list = array();
329
+ $filter_regex = '/' . str_replace(array('*'), array('.*'), $filter) . '/';
330
+
331
+ if ($list != null)
332
+ {
333
+ foreach ($list as $addon_dir)
334
+ {
335
+ $path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $addon_dir);
336
+ $path = rtrim($path, DIRECTORY_SEPARATOR);
337
+ $base = basename($addon_dir);
338
+
339
+ if (preg_match($filter_regex, $base))
340
+ {
341
+ $filename = $addon_dir . DIRECTORY_SEPARATOR . $base . '.php';
342
+
343
+ if (file_exists($filename))
344
+ {
345
+ $addon_list[$base] = $filename;
346
+ }
347
+ }
348
+ }
349
+ }
350
+
351
+ return $addon_list;
352
+ }
353
+ }
354
+
355
+ function synved_plugout_module_addon_list($module_id, $filter = null)
356
+ {
357
+ $path_list = synved_plugout_module_path_list_get($module_id, 'addon');
358
+
359
+ if ($path_list != null)
360
+ {
361
+ $addon_list = array();
362
+
363
+ foreach ($path_list as $path_item)
364
+ {
365
+ $path = $path_item['path'];
366
+ $extra_list = synved_plugout_module_addon_scan_path($path, $filter);
367
+
368
+ if ($extra_list != null)
369
+ {
370
+ $addon_list = array_merge($addon_list, $extra_list);
371
+ }
372
+ }
373
+
374
+ return $addon_list;
375
+ }
376
+
377
+ return null;
378
+ }
379
+
380
+ ?>
synved-plugout/synved-plugout.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Module Name: Synved PlugOut
4
+ Description: Allows to embed modules/plugins transparently into themes or other plugins without creating conflicts with externally installed plugins
5
+ Author: Synved Ltd.
6
+ Version: 1.0
7
+ Author URI: http://www.synved.com/
8
+
9
+ LEGAL STATEMENTS
10
+
11
+ COPYRIGHT
12
+ All documents, text, questions, references, images, audio, programs, source code or other materials whatsoever contained in, or supplied are protected by copyright of the respective copyright holders.
13
+
14
+ Except as explicitly allowed under each specific copyright or license, these materials may not be reproduced in whole or in part, in any form or by any means, including photocopy, electronic storage and retrieval, or translation into any other language without the express written consent of the copyright holder.
15
+
16
+ NO WARRANTY
17
+ All products, support, services, information and software are provided "as is" without warranty of any kind, express or implied, including, but not limited to, the implied warranties of fitness for a particular purpose, and non-infringement.
18
+
19
+ NO LIABILITY
20
+ In no event shall Synved Ltd. be liable to you or any third party for any direct or indirect, special, incidental, or consequential damages in connection with or arising from errors, omissions, delays or other cause of action that may be attributed to your use of any product, support, services, information or software provided, including, but not limited to, lost profits or lost data, even if Synved Ltd. had been advised of the possibility of such damages.
21
+ */
22
+
23
+ if (!function_exists('synved_plugout_version'))
24
+ {
25
+ include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'synved-plugout-core.php');
26
+ }
27
+
28
+ ?>
synved-social/image/icon.png ADDED
Binary file
synved-social/image/social-feather-extra-icons.png ADDED
Binary file
synved-social/image/social-feather-grey-fade-demo.png ADDED
Binary file
synved-social/image/social/regular/16x16/facebook.png ADDED
Binary file
synved-social/image/social/regular/16x16/google_plus.png ADDED
Binary file
synved-social/image/social/regular/16x16/linkedin.png ADDED
Binary file
synved-social/image/social/regular/16x16/mail.png ADDED
Binary file
synved-social/image/social/regular/16x16/reddit.png ADDED
Binary file
synved-social/image/social/regular/16x16/rss.png ADDED
Binary file
synved-social/image/social/regular/16x16/twitter.png ADDED
Binary file
synved-social/image/social/regular/16x16/youtube.png ADDED
Binary file
synved-social/image/social/regular/24x24/facebook.png ADDED
Binary file
synved-social/image/social/regular/24x24/google_plus.png ADDED
Binary file
synved-social/image/social/regular/24x24/linkedin.png ADDED
Binary file
synved-social/image/social/regular/24x24/mail.png ADDED
Binary file
synved-social/image/social/regular/24x24/reddit.png ADDED
Binary file
synved-social/image/social/regular/24x24/rss.png ADDED
Binary file
synved-social/image/social/regular/24x24/twitter.png ADDED
Binary file
synved-social/image/social/regular/24x24/youtube.png ADDED
Binary file
synved-social/image/social/regular/32x32/facebook.png ADDED
Binary file
synved-social/image/social/regular/32x32/google_plus.png ADDED
Binary file
synved-social/image/social/regular/32x32/linkedin.png ADDED
Binary file
synved-social/image/social/regular/32x32/mail.png ADDED
Binary file
synved-social/image/social/regular/32x32/reddit.png ADDED
Binary file
synved-social/image/social/regular/32x32/rss.png ADDED
Binary file
synved-social/image/social/regular/32x32/twitter.png ADDED
Binary file
synved-social/image/social/regular/32x32/youtube.png ADDED
Binary file
synved-social/image/social/regular/48x48/facebook.png ADDED
Binary file
synved-social/image/social/regular/48x48/google_plus.png ADDED
Binary file
synved-social/image/social/regular/48x48/linkedin.png ADDED
Binary file
synved-social/image/social/regular/48x48/mail.png ADDED
Binary file
synved-social/image/social/regular/48x48/reddit.png ADDED
Binary file
synved-social/image/social/regular/48x48/rss.png ADDED
Binary file
synved-social/image/social/regular/48x48/twitter.png ADDED
Binary file
synved-social/image/social/regular/48x48/youtube.png ADDED
Binary file
synved-social/image/social/regular/64x64/facebook.png ADDED
Binary file
synved-social/image/social/regular/64x64/google_plus.png ADDED
Binary file
synved-social/image/social/regular/64x64/linkedin.png ADDED
Binary file
synved-social/image/social/regular/64x64/mail.png ADDED
Binary file
synved-social/image/social/regular/64x64/reddit.png ADDED
Binary file
synved-social/image/social/regular/64x64/rss.png ADDED
Binary file
synved-social/image/social/regular/64x64/twitter.png ADDED
Binary file
synved-social/image/social/regular/64x64/youtube.png ADDED
Binary file
synved-social/image/social/regular/96x96/facebook.png ADDED
Binary file
synved-social/image/social/regular/96x96/google_plus.png ADDED
Binary file
synved-social/image/social/regular/96x96/linkedin.png ADDED
Binary file
synved-social/image/social/regular/96x96/mail.png ADDED
Binary file
synved-social/image/social/regular/96x96/reddit.png ADDED
Binary file
synved-social/image/social/regular/96x96/rss.png ADDED
Binary file
synved-social/image/social/regular/96x96/twitter.png ADDED
Binary file
synved-social/image/social/regular/96x96/youtube.png ADDED
Binary file
synved-social/image/social/regular/preview.png ADDED
Binary file
synved-social/script/custom.js ADDED
File without changes
synved-social/style/style.css ADDED
File without changes
synved-social/synved-social-setup.php ADDED
@@ -0,0 +1,630 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function synved_social_provider_settings()
4
+ {
5
+ $share_providers = synved_social_service_provider_list('share', true);
6
+ $follow_providers = synved_social_service_provider_list('follow', true);
7
+ $provider_list = array_merge($share_providers, $follow_providers);
8
+ $providers_settings = array();
9
+
10
+ foreach ($provider_list as $provider_name => $provider_item)
11
+ {
12
+ $provider_label = ucwords(str_replace(array('-', '_'), ' ', $provider_name));
13
+ $display_set = 'none=None';
14
+ $display_default = 'none';
15
+
16
+ if (isset($provider_item['label']))
17
+ {
18
+ $provider_label = $provider_item['label'];
19
+ }
20
+
21
+ if (isset($share_providers[$provider_name]))
22
+ {
23
+ $display_set .= ',share=Share';
24
+ $display_default = 'share';
25
+ }
26
+
27
+ if (isset($follow_providers[$provider_name]))
28
+ {
29
+ $display_set .= ',follow=Follow';
30
+ $display_default = 'follow';
31
+
32
+ if (isset($share_providers[$provider_name]))
33
+ {
34
+ $display_set .= ',both=Share & Follow';
35
+ $display_default = 'both';
36
+ }
37
+ }
38
+
39
+ $providers_settings = array_merge($providers_settings,
40
+ array(
41
+ $provider_name . '_display' => array(
42
+ 'default' => $display_default,
43
+ 'style' => 'group',
44
+ 'set' => $display_set,
45
+ 'label' => __($provider_label . ' Service', 'synved-social'),
46
+ 'tip' => __('Decides for what types of services ' . $provider_label . ' will be used by default', 'synved-social')
47
+ ),
48
+ )
49
+ );
50
+
51
+ if (isset($share_providers[$provider_name]))
52
+ {
53
+ $share_item = $share_providers[$provider_name];
54
+
55
+ $providers_settings = array_merge($providers_settings,
56
+ array(
57
+ $provider_name . '_share_link' => array(
58
+ 'label' => __($provider_label . ' Share Link', 'synved-social'),
59
+ 'tip' => __('The link used by default for sharing content on ' . $provider_label . ' (a standard one will be used if left empty)', 'synved-social'),
60
+ 'hint' => $share_item['link']
61
+ ),
62
+ $provider_name . '_share_title' => array(
63
+ 'label' => __($provider_label . ' Share Title', 'synved-social'),
64
+ 'tip' => __('The title used by default for the ' . $provider_label . ' share button (a standard one will be used if left empty)', 'synved-social'),
65
+ 'hint' => $share_item['title']
66
+ ),
67
+ )
68
+ );
69
+ }
70
+
71
+ if (isset($follow_providers[$provider_name]))
72
+ {
73
+ $follow_item = $follow_providers[$provider_name];
74
+
75
+ $providers_settings = array_merge($providers_settings,
76
+ array(
77
+ $provider_name . '_follow_link' => array(
78
+ 'label' => __($provider_label . ' Follow Link', 'synved-social'),
79
+ 'tip' => __('The link used by default for following you on ' . $provider_label, 'synved-social'),
80
+ 'hint' => $follow_item['link']
81
+ ),
82
+ $provider_name . '_follow_title' => array(
83
+ 'label' => __($provider_label . ' Follow Title', 'synved-social'),
84
+ 'tip' => __('The title used by default for the ' . $provider_label . ' follow button (a standard one will be used if left empty)', 'synved-social'),
85
+ 'hint' => $follow_item['title']
86
+ ),
87
+ )
88
+ );
89
+ }
90
+ }
91
+
92
+ return $providers_settings;
93
+ }
94
+
95
+ $synved_social_options = array(
96
+ 'settings' => array(
97
+ 'label' => 'Social Media',
98
+ 'title' => 'Social Media Feather',
99
+ 'tip' => synved_option_callback('synved_social_page_settings_tip'),
100
+ 'sections' => array(
101
+ 'section_general' => array(
102
+ 'label' => __('General Settings', 'synved-social'),
103
+ 'tip' => __('Settings affecting the general behavior of the plugin', 'synved-social'),
104
+ 'settings' => array(
105
+ 'use_shortlinks' => array(
106
+ 'default' => false, 'label' => __('Use Shortlinks', 'synved-social'),
107
+ 'tip' => __('Allows for shortened URLs to be used when sharing content if a shortening plugin is installed', 'synved-social')
108
+ ),
109
+ 'shortcode_widgets' => array(
110
+ 'default' => true, 'label' => __('Shortcodes In Widgets', 'synved-social'),
111
+ 'tip' => __('Allow shortcodes in Text widgets', 'synved-social')
112
+ ),
113
+ 'automatic_share' => array(
114
+ 'default' => false, 'label' => __('Display Sharing Buttons', 'synved-social'),
115
+ 'tip' => __('Tries to automatically append sharing buttons to your posts', 'synved-social')
116
+ ),
117
+ 'automatic_share_post_types' => array(
118
+ 'type' => 'custom',
119
+ 'default' => 'post',
120
+ 'set' => synved_option_callback('synved_social_automatic_share_post_types_set', array('post', 'page')),
121
+ 'label' => __('Share Post Types', 'synved-social'),
122
+ 'tip' => __('Post types for which automatic appending should be attempted (CTRL + click to select multiple ones)', 'synved-social'),
123
+ 'render' => 'synved_social_automatic_share_post_types_render'
124
+ ),
125
+ 'show_credit' => array(
126
+ 'default' => true, 'label' => __('Show Credit', 'synved-social'),
127
+ 'tip' => __('Display a small icon with a link to the Social Media Feather page', 'synved-social')
128
+ ),
129
+ )
130
+ ),
131
+ 'section_customize_look' => array(
132
+ 'label' => __('Customize Look', 'synved-social'),
133
+ 'tip' => synved_option_callback('synved_social_section_customize_look_tip', __('Customize the look & feel of Social Media Feather', 'synved-social')),
134
+ 'settings' => array(
135
+ 'icon_skin' => array(
136
+ 'default' => 'regular',
137
+ 'set' => synved_option_callback('synved_social_icon_skin_set', 'regular=Regular'),
138
+ 'label' => __('Icon Skin', 'synved-social'),
139
+ 'tip' => synved_option_callback('synved_social_setting_icon_skin_tip',__('Select the default skin to use for the icons', 'synved-social')),
140
+ 'render' => 'synved_social_icon_skin_render'
141
+ ),
142
+ 'addon_extra_icons' => array(
143
+ 'type' => 'addon',
144
+ 'target' => SYNVED_SOCIAL_ADDON_PATH,
145
+ 'folder' => 'extra-icons',
146
+ 'style' => 'addon-important',
147
+ 'label' => __('Extra Icon Skins', 'synved-social'),
148
+ 'tip' => synved_option_callback('synved_social_option_addon_extra_icons_tip', __('Click the button to install the "Extra Social Icons" addon, get it <a target="_blank" href="http://synved.com/product/feather-extra-social-icons/">here</a>.', 'synved-social'))
149
+ ),
150
+ 'addon_grey_fade' => array(
151
+ 'type' => 'addon',
152
+ 'target' => SYNVED_SOCIAL_ADDON_PATH,
153
+ 'folder' => 'grey-fade',
154
+ 'style' => 'addon-important',
155
+ 'label' => __('Grey Fade Effect', 'synved-social'),
156
+ 'tip' => synved_option_callback('synved_social_option_addon_grey_fade_tip', __('Click the button to install the "Grey Fade" addon, get it <a target="_blank" href="http://synved.com/product/feather-grey-fade/">here</a>.', 'synved-social'))
157
+ ),
158
+ 'icon_size' => array(
159
+ 'default' => 48,
160
+ 'set' => '16=16x16,24=24x24,32=32x32,48=48x48,64=64x64,96=96x96',
161
+ 'label' => __('Icon Size', 'synved-social'),
162
+ 'tip' => __('Select the size in pixels for the icons', 'synved-social')
163
+ ),
164
+ 'icon_spacing' => array(
165
+ 'default' => 5,
166
+ 'label' => __('Icon Spacing', 'synved-social'),
167
+ 'tip' => __('Select the spacing in pixels between the icons', 'synved-social')
168
+ ),
169
+ 'custom_style' => array(
170
+ 'type' => 'style',
171
+ 'label' => __('Extra Styles', 'synved-social'),
172
+ 'tip' => __('Any CSS styling code you type in here will be loaded after all of the Social Media Feather styles.', 'synved-social')
173
+ ),
174
+ )
175
+ ),
176
+ 'section_service_providers' => array(
177
+ 'label' => __('Service Providers', 'synved-social'),
178
+ 'tip' => __('Customize social sharing and following providers', 'synved-social'),
179
+ 'settings' => synved_social_provider_settings()
180
+ )
181
+ )
182
+ )
183
+ );
184
+
185
+
186
+ synved_option_register('synved_social', $synved_social_options);
187
+
188
+ synved_option_include_module_addon_list('synved-social');
189
+
190
+
191
+ function synved_social_page_settings_tip($tip, $item)
192
+ {
193
+ if (!function_exists('synved_shortcode_version'))
194
+ {
195
+ $tip .= ' <div style="background:#f2f2f2;font-size:110%;color:#444;padding:10px 15px;"><b>' . __('Note', 'synved-social') . '</b>: ' . __('The Social Media Feather plugin is fully compatible with our <a target="_blank" href="http://synved.com/wordpress-shortcodes/">WordPress Shortcodes</a> plugin!</span>', 'synved-social') . '</div>';
196
+ }
197
+
198
+ if (function_exists('synved_connect_support_social_follow_render'))
199
+ {
200
+ $tip .= synved_connect_support_social_follow_render();
201
+ }
202
+
203
+ return $tip;
204
+ }
205
+
206
+ function synved_social_section_customize_look_tip($tip, $item)
207
+ {
208
+ return $tip;
209
+ }
210
+
211
+ function synved_social_icon_skin_set($set, $item)
212
+ {
213
+ if ($set != null && !is_array($set))
214
+ {
215
+ $set = synved_option_item_set_parse($item, $set);
216
+ }
217
+
218
+ $set = array();
219
+ $icons = synved_social_icon_skin_list();
220
+
221
+ foreach ($icons as $icon_name => $icon_meta)
222
+ {
223
+ $set[][$icon_name] = $icon_meta['label'];
224
+ }
225
+
226
+ return $set;
227
+ }
228
+
229
+ function synved_social_setting_icon_skin_tip($tip, $item)
230
+ {
231
+ $uri = synved_social_path_uri();
232
+
233
+ if (!synved_option_addon_installed('synved_social', 'addon_extra_icons'))
234
+ {
235
+ $tip .= '<div style="clear:both"><p style="font-size:120%;"><b>Get all 8 extra icon skins you see below with the <a target="_blank" href="http://synved.com/product/feather-extra-social-icons/">Extra Social Icons addon</a></b>:</p> <a target="_blank" href="http://synved.com/product/feather-extra-social-icons/"><img src="' . $uri . '/image/social-feather-extra-icons.png" /></a></div>';
236
+ }
237
+
238
+ return $tip;
239
+ }
240
+
241
+ function synved_social_icon_skin_render($value, $params, $id, $name, $item)
242
+ {
243
+ $uri = synved_social_path_uri();
244
+ $icons = synved_social_icon_skin_list();
245
+
246
+ $out = null;
247
+ $out_name = $params['output_name'];
248
+ $set = $params['set'];
249
+
250
+ $out .= '<div>';
251
+
252
+ foreach ($set as $set_it)
253
+ {
254
+ $set_it_keys = array_keys($set_it);
255
+ $selected = $set_it_keys[0] == $value ? ' checked="checked"' : null;
256
+ $img_src = '';
257
+
258
+ if (isset($icons[$set_it_keys[0]]))
259
+ {
260
+ $img_src = $icons[$set_it_keys[0]]['image'];
261
+ }
262
+
263
+ $out .= '<div style="text-align:center; width:260px; float:left; margin-right:20px;"><label title="Use skin=&quot;' . esc_attr($set_it_keys[0]) . '&quot; in shortcodes"><img src="' . esc_url($img_src) . '" style="border:solid 1px #bbb" /><p><input type="radio" name="' . esc_attr($out_name) . '" value="' . esc_attr($set_it_keys[0]) . '"' . $selected . '/> ' . $set_it[$set_it_keys[0]] . '</p></label></div>';
264
+ }
265
+
266
+ $out .= '</div>';
267
+
268
+ return $out;
269
+ }
270
+
271
+
272
+ function synved_social_automatic_share_post_types_set($set, $item)
273
+ {
274
+ if ($set != null && !is_array($set))
275
+ {
276
+ $set = synved_option_item_set_parse($item, $set);
277
+ }
278
+
279
+ $set = array();
280
+ $types = get_post_types(array('public' => true));
281
+
282
+ foreach ($types as $type_name)
283
+ {
284
+ $set[][$type_name] = $type_name;
285
+ }
286
+
287
+ return $set;
288
+ }
289
+
290
+ function synved_social_automatic_share_post_types_render($value, $params, $id, $name, $item)
291
+ {
292
+ $uri = synved_social_path_uri();
293
+ $icons = synved_social_icon_skin_list();
294
+
295
+ if (!is_array($value))
296
+ {
297
+ if ($value != null)
298
+ {
299
+ $value = array($value);
300
+ }
301
+ else
302
+ {
303
+ $value = array();
304
+ }
305
+ }
306
+
307
+ $out = null;
308
+ $out_name = $params['output_name'];
309
+ $set = $params['set'];
310
+
311
+ $out .= '<select multiple="multiple" name="' . esc_attr($out_name . '[]') . '">';
312
+
313
+ foreach ($set as $set_it)
314
+ {
315
+ $set_it_keys = array_keys($set_it);
316
+ $selected = in_array($set_it_keys[0], $value) ? ' selected="selected"' : null;
317
+
318
+ $out .= '<option value="' . esc_attr($set_it_keys[0]) . '"' . $selected . '>' . $set_it[$set_it_keys[0]] . '</option>';
319
+ }
320
+
321
+ $out .= '</select>';
322
+
323
+ return $out;
324
+ }
325
+
326
+ function synved_social_option_addon_extra_icons_tip($tip, $item)
327
+ {
328
+ if (synved_option_addon_installed('synved_social', 'addon_extra_icons'))
329
+ {
330
+ $tip .= ' <span style="background:#eee;padding:5px 8px;">' . __('The "Extra Social Icons" addon is already installed! You can use the button to re-install it.', 'synved-social') . '</span>';
331
+ }
332
+
333
+ return $tip;
334
+ }
335
+
336
+ function synved_social_option_addon_grey_fade_tip($tip, $item)
337
+ {
338
+ $uri = synved_social_path_uri();
339
+
340
+ if (synved_option_addon_installed('synved_social', 'addon_grey_fade'))
341
+ {
342
+ $tip .= ' <span style="background:#eee;padding:5px 8px;">' . __('The "Grey Fade" addon is already installed! You can use the button to re-install it.', 'synved-social') . '</span>';
343
+ }
344
+ else
345
+ {
346
+ $tip .= '<div style="clear:both"><p style="font-size:120%;"><b>The <a target="_blank" href="http://synved.com/product/feather-grey-fade/">Grey Fade addon</a> allows you to achieve the effect below, <a target="_blank" href="http://synved.com/product/feather-grey-fade/">get it now</a>!</b></p> <a target="_blank" href="http://synved.com/product/feather-grey-fade/"><img src="' . $uri . '/image/social-feather-grey-fade-demo.png" /></a></div>';
347
+ }
348
+
349
+ return $tip;
350
+ }
351
+
352
+ function synved_social_path($path = null)
353
+ {
354
+ $root = dirname(__FILE__);
355
+
356
+ if ($root != null)
357
+ {
358
+ if (substr($root, -1) != '/' && $path[0] != '/')
359
+ {
360
+ $root .= '/';
361
+ }
362
+
363
+ $root .= $path;
364
+ }
365
+
366
+ $root = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $root);
367
+
368
+ return $root;
369
+ }
370
+
371
+ function synved_social_path_uri($path = null)
372
+ {
373
+ $uri = plugins_url('/social-media-feather') . '/synved-social';
374
+
375
+ if (function_exists('synved_plugout_module_uri_get'))
376
+ {
377
+ $mod_uri = synved_plugout_module_uri_get('synved-social');
378
+
379
+ if ($mod_uri != null)
380
+ {
381
+ $uri = $mod_uri;
382
+ }
383
+ }
384
+
385
+ if ($path != null)
386
+ {
387
+ if (substr($uri, -1) != '/' && $path[0] != '/')
388
+ {
389
+ $uri .= '/';
390
+ }
391
+
392
+ $uri .= $path;
393
+ }
394
+
395
+ return $uri;
396
+ }
397
+
398
+ function synved_social_wp_register_common_scripts()
399
+ {
400
+ $uri = synved_social_path_uri();
401
+ }
402
+
403
+ function synved_social_enqueue_scripts()
404
+ {
405
+ $uri = synved_social_path_uri();
406
+
407
+ synved_social_wp_register_common_scripts();
408
+ }
409
+
410
+ function synved_social_print_styles()
411
+ {
412
+ }
413
+
414
+ function synved_social_admin_enqueue_scripts()
415
+ {
416
+ $uri = synved_social_path_uri();
417
+
418
+ synved_social_wp_register_common_scripts();
419
+ }
420
+
421
+ function synved_social_admin_print_styles()
422
+ {
423
+ }
424
+
425
+ function synved_social_wp_tinymce_plugin($plugin_array)
426
+ {
427
+ $plugin_array['synved_social'] = synved_social_path_uri() . '/script/tinymce_plugin.js';
428
+
429
+ return $plugin_array;
430
+ }
431
+
432
+ function synved_social_wp_tinymce_button($buttons)
433
+ {
434
+ array_push($buttons, '|', 'synved_social');
435
+
436
+ return $buttons;
437
+ }
438
+
439
+ function synved_social_ajax_callback()
440
+ {
441
+ check_ajax_referer('synved-social-submit-nonce', 'synvedSecurity');
442
+
443
+ if (!isset($_POST['synvedAction']) || $_POST['synvedAction'] == null)
444
+ {
445
+ return;
446
+ }
447
+
448
+ $action = $_POST['synvedAction'];
449
+ $params = isset($_POST['synvedParams']) ? $_POST['synvedParams'] : null;
450
+ $response = null;
451
+ $response_html = null;
452
+
453
+ if (is_string($params))
454
+ {
455
+ $parms = json_decode($params, true);
456
+
457
+ if ($parms == null)
458
+ {
459
+ $parms = json_decode(stripslashes($params), true);
460
+ }
461
+
462
+ $params = $parms;
463
+ }
464
+
465
+ switch ($action)
466
+ {
467
+ case 'load-ui':
468
+ {
469
+ $uri = synved_social_path_uri();
470
+
471
+ if (current_user_can('edit_posts') || current_user_can('edit_pages'))
472
+ {
473
+ }
474
+
475
+ break;
476
+ }
477
+ case 'preview-code':
478
+ {
479
+ if (current_user_can('edit_posts') || current_user_can('edit_pages'))
480
+ {
481
+ }
482
+
483
+ break;
484
+ }
485
+ }
486
+
487
+ while (ob_get_level() > 0)
488
+ {
489
+ ob_end_clean();
490
+ }
491
+
492
+ if ($response != null)
493
+ {
494
+ $response = json_encode($response);
495
+
496
+ header('Content-Type: application/json');
497
+
498
+ echo $response;
499
+ }
500
+ else if ($response_html != null)
501
+ {
502
+ header('Content-Type: text/html');
503
+
504
+ echo $response_html;
505
+ }
506
+ else
507
+ {
508
+ header('HTTP/1.1 403 Forbidden');
509
+ }
510
+
511
+ exit();
512
+ }
513
+
514
+ function synved_social_register_widgets()
515
+ {
516
+ register_widget('SynvedSocialShareWidget');
517
+ register_widget('SynvedSocialFollowWidget');
518
+ }
519
+
520
+ function synved_social_wp_the_content($content)
521
+ {
522
+ if (synved_option_get('synved_social', 'automatic_share'))
523
+ {
524
+ $post_type = get_post_type();
525
+ $type_list = synved_option_get('synved_social', 'automatic_share_post_types');
526
+
527
+ if (in_array($post_type, $type_list))
528
+ {
529
+ $content .= synved_social_share_markup();
530
+ }
531
+ }
532
+
533
+ return $content;
534
+ }
535
+
536
+ function synved_social_init()
537
+ {
538
+ if (current_user_can('edit_posts') || current_user_can('edit_pages'))
539
+ {
540
+ if (get_user_option('rich_editing') == 'true')
541
+ {
542
+ //add_filter('mce_external_plugins', 'synved_social_wp_tinymce_plugin');
543
+ //add_filter('mce_buttons', 'synved_social_wp_tinymce_button');
544
+ }
545
+ }
546
+
547
+ $priority = defined('SHORTCODE_PRIORITY') ? SHORTCODE_PRIORITY : 11;
548
+
549
+ if (synved_option_get('synved_social', 'shortcode_widgets'))
550
+ {
551
+ remove_filter('widget_text', 'do_shortcode', $priority);
552
+ add_filter('widget_text', 'do_shortcode', $priority);
553
+ }
554
+
555
+ if (function_exists('synved_shortcode_add'))
556
+ {
557
+ synved_shortcode_add('feather_share', 'synved_social_share_shortcode');
558
+ synved_shortcode_add('feather_follow', 'synved_social_follow_shortcode');
559
+
560
+ $size_set = '16,24,32,48,64,96';
561
+ $size_item = synved_option_item('synved_social', 'icon_size');
562
+
563
+ if ($size_item != null)
564
+ {
565
+ $item_set = synved_option_item_set($size_item);
566
+
567
+ if ($item_set != null)
568
+ {
569
+ $set_items = array();
570
+
571
+ foreach ($item_set as $set_item)
572
+ {
573
+ $item_keys = array_keys($set_item);
574
+
575
+ $set_items[] = $item_keys[0];
576
+ }
577
+
578
+ $size_set = implode(',', $set_items);
579
+ }
580
+ }
581
+
582
+ $sh_params = array(
583
+ 'skin' => __('Specify which skin to use for the icons', 'synved-social'),
584
+ 'size' => sprintf(__('Specify the size for the icons, possible values are %s', 'synved-social'), $size_set),
585
+ 'spacing' => __('Determines how much blank space there will be between the buttons, in pixels', 'synved-social'),
586
+ );
587
+
588
+ $share_params = array(
589
+ 'url' => __('URL to use for the sharing buttons, default is the current post URL', 'synved-social'),
590
+ 'title' => __('Title to use for the sharing buttons, default is the current post title', 'synved-social'),
591
+ );
592
+
593
+ synved_shortcode_item_help_set('feather_share', array(
594
+ 'tip' => __('Creates a list of buttons for social sharing as selected in the Social Media options', 'synved-social'),
595
+ 'parameters' => array_merge($sh_params, $share_params)
596
+ ));
597
+ synved_shortcode_item_help_set('feather_follow', array(
598
+ 'tip' => __('Creates a list of buttons for social following as selected in the Social Media options', 'synved-social'),
599
+ 'parameters' => $sh_params
600
+ ));
601
+ }
602
+ else
603
+ {
604
+ add_shortcode('feather_share', 'synved_social_share_shortcode');
605
+ add_shortcode('synved_feather_share', 'synved_social_share_shortcode');
606
+ add_shortcode('feather_follow', 'synved_social_follow_shortcode');
607
+ add_shortcode('synved_feather_follow', 'synved_social_follow_shortcode');
608
+ }
609
+
610
+ //add_action('wp_ajax_synved_social', 'synved_social_ajax_callback');
611
+ //add_action('wp_ajax_nopriv_synved_social', 'synved_social_ajax_callback');
612
+
613
+ if (!is_admin())
614
+ {
615
+ add_action('wp_enqueue_scripts', 'synved_social_enqueue_scripts');
616
+ //add_action('wp_print_styles', 'synved_social_print_styles');
617
+ }
618
+
619
+ if (synved_option_get('synved_social', 'automatic_share'))
620
+ {
621
+ add_filter('the_content', 'synved_social_wp_the_content');
622
+ }
623
+ }
624
+
625
+ add_action('init', 'synved_social_init');
626
+ add_action('admin_enqueue_scripts', 'synved_social_admin_enqueue_scripts');
627
+ add_action('admin_print_styles', 'synved_social_admin_print_styles', 1);
628
+
629
+ add_action('widgets_init', 'synved_social_register_widgets');
630
+
synved-social/synved-social.php ADDED
@@ -0,0 +1,649 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Module Name: Synved Social
4
+ Description: Social sharing and following tools
5
+ Author: Synved
6
+ Version: 1.0
7
+ Author URI: http://synved.com/
8
+ License: GPLv2
9
+
10
+ LEGAL STATEMENTS
11
+
12
+ NO WARRANTY
13
+ All products, support, services, information and software are provided "as is" without warranty of any kind, express or implied, including, but not limited to, the implied warranties of fitness for a particular purpose, and non-infringement.
14
+
15
+ NO LIABILITY
16
+ In no event shall Synved Ltd. be liable to you or any third party for any direct or indirect, special, incidental, or consequential damages in connection with or arising from errors, omissions, delays or other cause of action that may be attributed to your use of any product, support, services, information or software provided, including, but not limited to, lost profits or lost data, even if Synved Ltd. had been advised of the possibility of such damages.
17
+ */
18
+
19
+
20
+ define('SYNVED_SOCIAL_LOADED', true);
21
+ define('SYNVED_SOCIAL_VERSION', 100000000);
22
+ define('SYNVED_SOCIAL_VERSION_STRING', '1.0');
23
+
24
+ define('SYNVED_SOCIAL_ADDON_PATH', str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, dirname(__FILE__) . '/addons'));
25
+
26
+ include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'synved-social-setup.php');
27
+
28
+
29
+ $synved_social = array();
30
+
31
+
32
+ function synved_social_version()
33
+ {
34
+ return SYNVED_SOCIAL_VERSION;
35
+ }
36
+
37
+ function synved_social_version_string()
38
+ {
39
+ return SYNVED_SOCIAL_VERSION_STRING;
40
+ }
41
+
42
+ class SynvedSocialWidget extends WP_Widget
43
+ {
44
+ function __construct($id_base = false, $name = null, $widget_options = array(), $control_options = array() )
45
+ {
46
+ if ($name == null)
47
+ {
48
+ $name = 'Social Media Feather';
49
+ }
50
+
51
+ parent::__construct($id_base, $name, $widget_options, $control_options);
52
+ }
53
+
54
+ function widget( $args, $instance )
55
+ {
56
+ extract( $args ); /* before/after widget, before/after title (defined by themes). */
57
+ extract($instance);
58
+
59
+ echo $before_widget;
60
+
61
+ if ($title != null)
62
+ {
63
+ echo $before_title . $title . $after_title;
64
+ }
65
+
66
+ echo '<div>';
67
+
68
+ $params = array();
69
+
70
+ if ($icon_skin != 'default')
71
+ {
72
+ $params['skin'] = $icon_skin;
73
+ }
74
+
75
+ if ($icon_size != 'default')
76
+ {
77
+ $params['size'] = $icon_size;
78
+ }
79
+
80
+ if ($icon_spacing !== null && $icon_spacing !== '')
81
+ {
82
+ $params['spacing'] = $icon_spacing;
83
+ }
84
+
85
+ $this->render_social_markup($params);
86
+
87
+ echo '</div>';
88
+ echo $after_widget;
89
+ }
90
+
91
+ function get_defaults()
92
+ {
93
+ return array('icon_skin' => 'default', 'icon_size' => 'default', 'icon_spacing' => '');
94
+ }
95
+
96
+ function render_social_markup($params = null)
97
+ {
98
+ }
99
+
100
+ function update($new_instance, $old_instance)
101
+ {
102
+ $instance = $old_instance;
103
+ $instance['title'] = strip_tags($new_instance['title']);
104
+ $instance['icon_skin'] = strip_tags($new_instance['icon_skin']);
105
+ $instance['icon_size'] = strip_tags($new_instance['icon_size']);
106
+ $instance['icon_spacing'] = strip_tags($new_instance['icon_spacing']);
107
+
108
+ return $instance;
109
+ }
110
+
111
+ function form($instance)
112
+ {
113
+ $defaults = $this->get_defaults();
114
+ $instance = wp_parse_args((array) $instance, $defaults);
115
+ ?>
116
+ <p>
117
+ <label for="<?php echo $this->get_field_id('title'); ?>"><?php echo(__('Title', 'synved-social')) ?>:</label>
118
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $instance['title']; ?>" />
119
+ </p>
120
+ <p>
121
+ <label for="<?php echo $this->get_field_id('icon_skin'); ?>"><?php echo(__('Icon Skin', 'synved-social')) ?>:</label>
122
+ <?php
123
+ $params = array(
124
+ 'tip' => '',
125
+ 'output_name' => $this->get_field_name('icon_skin'),
126
+ 'value' => $instance['icon_skin'],
127
+ 'set_before' => array(array('default' => __('Use Default'))),
128
+ );
129
+
130
+ $item = synved_option_item('synved_social', 'icon_skin');
131
+
132
+ if ($item != null)
133
+ {
134
+ // XXX a bit unorthodox...
135
+ if (is_object($item))
136
+ {
137
+ $item = clone $item;
138
+ }
139
+
140
+ unset($item['render']);
141
+
142
+ synved_option_render_item('synved_social', 'icon_skin', $item, true, $params, 'widget');
143
+ }
144
+ ?>
145
+ <br/>
146
+ <label for="<?php echo $this->get_field_id('icon_size'); ?>"><?php echo(__('Icon Size', 'synved-social')) ?>:</label>
147
+ <?php
148
+ $params = array(
149
+ 'tip' => '',
150
+ 'output_name' => $this->get_field_name('icon_size'),
151
+ 'value' => $instance['icon_size'],
152
+ 'set_before' => array(array('default' => __('Use Default'))),
153
+ );
154
+
155
+ synved_option_render_item('synved_social', 'icon_size', null, true, $params, 'widget');
156
+ ?>
157
+ <br/>
158
+ <label for="<?php echo $this->get_field_id('icon_spacing'); ?>"><?php echo(__('Icon Spacing', 'synved-social')) ?>:</label>
159
+ <input type="text" size="3" class="" id="<?php echo $this->get_field_id('icon_spacing'); ?>" name="<?php echo $this->get_field_name('icon_spacing'); ?>" value="<?php echo $instance['icon_spacing']; ?>" />
160
+ </p>
161
+ <?php
162
+ }
163
+ }
164
+
165
+ class SynvedSocialShareWidget extends SynvedSocialWidget
166
+ {
167
+ function __construct()
168
+ {
169
+ parent::__construct('synved_social_share', __('Social Media Feather: Sharing', 'synved-social'));
170
+ }
171
+
172
+ function get_defaults()
173
+ {
174
+ $defaults = parent::get_defaults();
175
+
176
+ return array_merge($defaults, array('title' => __('Sharing', 'synved-social')));
177
+ }
178
+
179
+ function render_social_markup($params = null)
180
+ {
181
+ echo synved_social_share_markup(null, null, $params);
182
+ }
183
+ }
184
+
185
+ class SynvedSocialFollowWidget extends SynvedSocialWidget
186
+ {
187
+ function __construct()
188
+ {
189
+ parent::__construct('synved_social_follow', __('Social Media Feather: Follow Us', 'synved-social'));
190
+ }
191
+
192
+ function get_defaults()
193
+ {
194
+ $defaults = parent::get_defaults();
195
+
196
+ return array_merge($defaults, array('title' => __('Follow Us', 'synved-social')));
197
+ }
198
+
199
+ function render_social_markup($params = null)
200
+ {
201
+ echo synved_social_follow_markup(null, null, $params);
202
+ }
203
+ }
204
+
205
+
206
+ function synved_social_service_provider_list($context, $raw = false)
207
+ {
208
+ $provider_list = array();
209
+
210
+ if ($context == 'share')
211
+ {
212
+ $provider_list = array(
213
+ 'facebook' => array(
214
+ 'link' => 'http://www.facebook.com/sharer.php?u=%%url%%&t=%%title%%',
215
+ 'title' => __('Share on Facebook')
216
+ ),
217
+ 'twitter' => array(
218
+ 'link' => 'http://twitter.com/share?url=%%url%%&text=%%message%%',
219
+ 'title' => __('Share on Twitter'),
220
+ ),
221
+ 'google_plus' => array(
222
+ 'link' => 'https://plus.google.com/share?url=%%url%%',
223
+ 'title' => __('Share on Google+'),
224
+ ),
225
+ 'reddit' => array(
226
+ 'link' => 'http://www.reddit.com/submit?url=%%url%%&title=%%title%%',
227
+ 'title' => __('Share on Reddit'),
228
+ ),
229
+ 'linkedin' => array(
230
+ 'link' => 'http://www.linkedin.com/shareArticle?mini=true&url=%%url%%&title=%%title%%',
231
+ 'title' => __('Share on Linkedin'),
232
+ ),
233
+ 'mail' => array(
234
+ 'link' => 'mailto:?subject=%%title%%&body=%%message%%:%20%%url%%',
235
+ 'title' => __('Share by email'),
236
+ ),
237
+ );
238
+ }
239
+ else if ($context = 'follow')
240
+ {
241
+ $provider_list = array(
242
+ 'facebook' => array(
243
+ 'link' => 'http://www.facebook.com/MyAvatarName',
244
+ 'title' => __('Follow us on Facebook'),
245
+ ),
246
+ 'twitter' => array(
247
+ 'link' => 'http://twitter.com/MyAvatarName',
248
+ 'title' => __('Follow us on Twitter'),
249
+ ),
250
+ 'google_plus' => array(
251
+ 'link' => 'http://plus.google.com/needlessly_long_google_plus_id',
252
+ 'title' => __('Follow us on Google+'),
253
+ ),
254
+ 'linkedin' => array(
255
+ 'link' => 'http://www.linkedin.com/in/yourid',
256
+ 'title' => __('Find us on Linkedin'),
257
+ ),
258
+ 'rss' => array(
259
+ 'label' => 'RSS',
260
+ 'link' => 'http://feeds.feedburner.com/MyFeedName',
261
+ 'title' => __('Subscribe to our RSS Feed'),
262
+ ),
263
+ 'youtube' => array(
264
+ 'link' => 'http://www.youtube.com/MyYouTubeName',
265
+ 'title' => __('Find us on YouTube'),
266
+ ),
267
+ );
268
+ }
269
+
270
+ $return_list = $provider_list;
271
+
272
+ if ($raw == false)
273
+ {
274
+ $return_list = array();
275
+
276
+ foreach ($provider_list as $provider_name => $provider_item)
277
+ {
278
+ $display = synved_option_get('synved_social', $provider_name . '_display');
279
+ $link = synved_option_get('synved_social', $provider_name . '_' . $context . '_link');
280
+ $title = synved_option_get('synved_social', $provider_name . '_' . $context . '_title');
281
+
282
+ if ($display === null || in_array($display, array($context, 'both')))
283
+ {
284
+ if ($link != null)
285
+ {
286
+ $provider_item['link'] = $link;
287
+ }
288
+
289
+ if ($title != null)
290
+ {
291
+ $provider_item['title'] = $title;
292
+ }
293
+
294
+ $return_list[$provider_name] = $provider_item;
295
+ }
296
+ }
297
+ }
298
+
299
+ return apply_filters('synved_social_service_provider_list', $return_list, $context, $raw);
300
+ }
301
+
302
+ function synved_social_icon_skin_list()
303
+ {
304
+ $path = synved_social_path();
305
+ $uri = synved_social_path_uri();
306
+
307
+ $icons = array(
308
+ 'regular' => array(
309
+ 'label' => __('Regular'),
310
+ 'image' => $uri . '/image/social/regular/preview.png',
311
+ 'folder' => '/image/social/regular/',
312
+ 'path' => $path . '/image/social/regular/',
313
+ 'uri' => $uri . '/image/social/regular/'
314
+ )
315
+ );
316
+
317
+ $icons_extra = null;
318
+
319
+ if (function_exists('synved_social_addon_extra_icons_get'))
320
+ {
321
+ $icons_extra = synved_social_addon_extra_icons_get();
322
+ $icons = array_merge($icons, $icons_extra);
323
+ }
324
+
325
+ return $icons;
326
+ }
327
+
328
+ function synved_social_icon_skin_get($name = null)
329
+ {
330
+ $icons = synved_social_icon_skin_list();
331
+
332
+ if ($name != null && !isset($icons[$name]))
333
+ {
334
+ foreach ($icons as $skin_name => $skin)
335
+ {
336
+ if (strtolower($name) == strtolower($skin['label']))
337
+ {
338
+ $name = $skin_name;
339
+
340
+ break;
341
+ }
342
+ }
343
+ }
344
+
345
+ if ($name == null || !isset($icons[$name]))
346
+ {
347
+ $selected = synved_option_get('synved_social', 'icon_skin');
348
+
349
+ $name = $selected;
350
+ }
351
+
352
+ if (isset($icons[$name]))
353
+ {
354
+ return $icons[$name];
355
+ }
356
+
357
+ if (isset($icons['regular']))
358
+ {
359
+ return $icons['regular'];
360
+ }
361
+
362
+ return null;
363
+ }
364
+
365
+ function synved_social_icon_skin_current()
366
+ {
367
+ return synved_social_icon_skin_get();
368
+ }
369
+
370
+ function synved_social_button_list_shortcode($atts, $content = null, $code = '', $context = null)
371
+ {
372
+ $vars_def = array('url' => null, 'title' => null);
373
+ $params_def = array('skin' => null, 'size' => null, 'spacing' => null);
374
+ $vars = shortcode_atts($vars_def, $atts);
375
+ $params = shortcode_atts($params_def, $atts);
376
+ $vars = array_filter($vars);
377
+ $params = array_filter($params);
378
+
379
+ if ($context == 'share')
380
+ {
381
+ return synved_social_share_markup($vars, null, $params);
382
+ }
383
+ else if ($context == 'follow')
384
+ {
385
+ return synved_social_follow_markup($vars, null, $params);
386
+ }
387
+
388
+ return null;
389
+ }
390
+
391
+ function synved_social_share_shortcode($atts, $content = null, $code = '')
392
+ {
393
+ return synved_social_button_list_shortcode($atts, $content, $code, 'share');
394
+ }
395
+
396
+ function synved_social_follow_shortcode($atts, $content = null, $code = '')
397
+ {
398
+ return synved_social_button_list_shortcode($atts, $content, $code, 'follow');
399
+ }
400
+
401
+ function synved_social_button_list_markup($context, $vars = null, $buttons = null, $params = null)
402
+ {
403
+ $buttons_default = synved_social_service_provider_list($context);
404
+
405
+ if ($buttons == null)
406
+ {
407
+ $buttons = $buttons_default;
408
+ }
409
+ else
410
+ {
411
+ $keys = array_keys($buttons);
412
+
413
+ foreach ($keys as $key)
414
+ {
415
+ if ($buttons[$key] == null && isset($buttons_default[$key]))
416
+ {
417
+ $buttons[$key] = $buttons_default[$key];
418
+ }
419
+ }
420
+ }
421
+
422
+ if (!isset($vars['url']))
423
+ {
424
+ $use_shortlinks = synved_option_get('synved_social', 'use_shortlinks');
425
+ $url = get_permalink();
426
+
427
+ if ($use_shortlinks && function_exists('wp_get_shortlink'))
428
+ {
429
+ $short = wp_get_shortlink(null, null, 'query');
430
+
431
+ if ($short != null)
432
+ {
433
+ $url = $short;
434
+ }
435
+ }
436
+
437
+ $vars['url'] = $url;
438
+ }
439
+
440
+ if (!isset($vars['title']))
441
+ {
442
+ $vars['title'] = get_the_title();
443
+ }
444
+
445
+ if (!isset($vars['message']))
446
+ {
447
+ $vars['message'] = __('Hey check this out');
448
+ }
449
+
450
+ $vars = apply_filters('synved_social_markup_variable_list', $vars, $context, $params);
451
+ $params = apply_filters('synved_social_markup_parameter_list', $params, $context, $vars);
452
+
453
+ if ($vars != null)
454
+ {
455
+ $vars = urlencode_deep($vars);
456
+
457
+ // XXX the + character is not recognized as space
458
+ $vars['message'] = str_replace('+', '%20', $vars['message']);
459
+ }
460
+
461
+ $path = synved_social_path();
462
+ $uri = synved_social_path_uri();
463
+ $skin = synved_social_icon_skin_current();
464
+
465
+ if (isset($params['skin']))
466
+ {
467
+ $skin = synved_social_icon_skin_get($params['skin']);
468
+ }
469
+
470
+ $skin_path = isset($skin['path']) ? $skin['path'] : ($path . '/image/social/regular/');
471
+ $skin_uri = isset($skin['uri']) ? $skin['uri'] : ($uri . '/image/social/regular/');
472
+
473
+ $icon_size = synved_option_get('synved_social', 'icon_size');
474
+ $size = 48;
475
+
476
+ if ($icon_size != null)
477
+ {
478
+ $size = $icon_size;
479
+ }
480
+
481
+ if (isset($params['size']))
482
+ {
483
+ $size = $params['size'];
484
+
485
+ if (is_string($size))
486
+ {
487
+ $size = strtolower($size);
488
+ $size_parts = explode('x', $size);
489
+ $size = (int) $size_parts[0];
490
+ }
491
+ }
492
+
493
+ $sizes = glob($skin_path . '*', GLOB_ONLYDIR);
494
+ $sizes = array_map('basename', $sizes);
495
+ $size_list = array();
496
+
497
+ foreach ($sizes as $size_dir)
498
+ {
499
+ $size_parts = explode('x', $size_dir);
500
+ $size_width = (int) $size_parts[0];
501
+
502
+ if ($size_width != null)
503
+ {
504
+ $size_list[] = $size_width;
505
+ }
506
+ }
507
+
508
+ sort($size_list, SORT_NUMERIC);
509
+ $size_count = count($size_list);
510
+ $size_used = $size;
511
+
512
+ if (array_search($size_used, $size_list) === false)
513
+ {
514
+ for ($i = 0; $i < $size_count; $i++)
515
+ {
516
+ $size_width = $size_list[$i];
517
+
518
+ if ($size_width > $size || $i == ($size_count - 1))
519
+ {
520
+ $size_used = $size_width;
521
+
522
+ break;
523
+ }
524
+ }
525
+ }
526
+
527
+ $icon_spacing = synved_option_get('synved_social', 'icon_spacing');
528
+ $spacing = 5;
529
+
530
+ if ($icon_spacing != null)
531
+ {
532
+ $spacing = $icon_spacing;
533
+ }
534
+
535
+ if (isset($params['spacing']))
536
+ {
537
+ $spacing = $params['spacing'];
538
+ }
539
+
540
+ $class = null;
541
+
542
+ if (isset($params['class']))
543
+ {
544
+ $class = $params['class'];
545
+
546
+ if (!is_array($class))
547
+ {
548
+ $class = array($class);
549
+ }
550
+ }
551
+
552
+ $out = null;
553
+ $index = 0;
554
+ $count = count($buttons);
555
+
556
+ foreach ($buttons as $button_key => $button_item)
557
+ {
558
+ $href = $button_item['link'];
559
+ $title = $button_item['title'];
560
+
561
+ $matches = null;
562
+
563
+ if (preg_match_all('/%%(\\w+)%%/', $href, $matches, PREG_SET_ORDER) > 0)
564
+ {
565
+ foreach ($matches as $match)
566
+ {
567
+ $var_key = $match[1];
568
+ $replace = null;
569
+
570
+ if (isset($vars[$var_key]))
571
+ {
572
+ $replace = $vars[$var_key];
573
+ }
574
+
575
+ $href = str_replace($match[0], $replace, $href);
576
+ }
577
+ }
578
+
579
+ $image_sub = '/' . $button_key . '.png';
580
+ $image_size = $size_used;
581
+ $size_name = $image_size . 'x' . $image_size;
582
+ $image_path = $skin_path . $size_name . $image_sub;
583
+ $image_uri = $skin_uri . $size_name . $image_sub;
584
+
585
+ while (!file_exists($image_path))
586
+ {
587
+ $size_index = array_search($image_size, $size_list);
588
+
589
+ if ($size_index === false || $size_index == $size_count - 1)
590
+ {
591
+ break;
592
+ }
593
+
594
+ $image_size = $size_list[$size_index + 1];
595
+ $size_name = $image_size . 'x' . $image_size;
596
+ $image_path = $skin_path . $size_name . $image_sub;
597
+ $image_uri = $skin_uri . $size_name . $image_sub;
598
+ }
599
+
600
+ if (!file_exists($image_path))
601
+ {
602
+ $image_path = apply_filters('synved_social_button_image_path', $image_path, $image_uri, $size_used, $image_sub, $skin_path, $skin_uri, $size_list);
603
+ $image_uri = apply_filters('synved_social_button_image_uri', $image_uri, $image_path, $size_used, $image_sub, $skin_path, $skin_uri, $size_list);
604
+ }
605
+
606
+ $style = 'margin:0;';
607
+
608
+ if (true)
609
+ {
610
+ $style .= 'margin-bottom:' . $spacing . 'px;';
611
+ }
612
+
613
+ if ($index < $count - 1)
614
+ {
615
+ $style .= 'margin-right:' . $spacing . 'px;';
616
+ }
617
+
618
+ $class_extra = null;
619
+
620
+ if ($class != null)
621
+ {
622
+ $class_extra = ' ' . implode(' ', $class);
623
+ }
624
+
625
+ $out .= '<a class="synved-social-button synved-social-button-' . $context . $class_extra . '" target="_blank" rel="nofollow" title="' . $title . '" href="' . esc_url($href) . '">';
626
+ $out .= '<img alt="' . esc_attr($button_key) . '" class="synved-share-image" width="' . $size . '" style="width:' . $size . 'px;' . $style . '" src="' . esc_attr($image_uri) . '" />';
627
+ $out .= '</a>';
628
+
629
+ $index++;
630
+ }
631
+
632
+ if (synved_option_get('synved_social', 'show_credit'))
633
+ {
634
+ $out .= '<a target="_blank" title="' . __('WordPress Social Media Feather', 'synved-social') . '" href="http://synved.com/wordpress-social-media-feather/" style="color:#444; text-decoration:none; font-size:8px; margin-left:5px;vertical-align:10px;white-space:nowrap;"><span>' . __('by ', 'synved-social') . '<img style="margin:0;padding:0;" alt="feather" src="' . $uri . '/image/icon.png" /></a></span>';
635
+ }
636
+
637
+ return $out;
638
+ }
639
+
640
+ function synved_social_share_markup($vars = null, $buttons = null, $params = null)
641
+ {
642
+ return synved_social_button_list_markup('share', $vars, $buttons, $params);
643
+ }
644
+
645
+ function synved_social_follow_markup($vars = null, $buttons = null, $params = null)
646
+ {
647
+ return synved_social_button_list_markup('follow', $vars, $buttons, $params);
648
+ }
649
+