Version Description
- Fixes string offset error
Download this release
Release Info
Developer | clevelandwebdeveloper |
Plugin | Spacer |
Version | 3.0.5 |
Comparing to | |
See all releases |
Code changes from version 3.0.4 to 3.0.5
- index.php +1922 -1917
- readme.txt +7 -4
- sva/sva.php +926 -910
index.php
CHANGED
@@ -1,1917 +1,1922 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
Plugin Name: Spacer
|
5 |
-
Plugin URI: http://www.clevelandwebdeveloper.com/wordpress-plugins/spacer
|
6 |
-
Description: Adds a spacer button to the WYSIWYG visual editor which allows you to add precise custom spacing between lines in your posts and pages.
|
7 |
-
Version: 3.0.
|
8 |
-
Author: Justin Saad
|
9 |
-
Author URI: http://www.clevelandwebdeveloper.com
|
10 |
-
License: GPL2
|
11 |
-
*/
|
12 |
-
|
13 |
-
|
14 |
-
//begin wysiwyg visual editor custom button plugin
|
15 |
-
|
16 |
-
$plugin_label = "Spacer";
|
17 |
-
$plugin_slug = "motech_spacer";
|
18 |
-
|
19 |
-
class motech_spacer {
|
20 |
-
|
21 |
-
public function __construct() {
|
22 |
-
|
23 |
-
global $plugin_label, $plugin_slug;
|
24 |
-
$this->plugin_slug = $plugin_slug;
|
25 |
-
$this->plugin_label = $plugin_label;
|
26 |
-
$this->plugin_dir = plugins_url( '' , __FILE__ );
|
27 |
-
$checkaddspacers = get_option($this->plugin_slug."_addspacer_id");
|
28 |
-
if(!empty($checkaddspacers)){
|
29 |
-
$this->key_array = $checkaddspacers;
|
30 |
-
$this->has_addspacers = true;
|
31 |
-
}else{
|
32 |
-
$this->key_array = array(0);
|
33 |
-
$this->has_addspacers = false;
|
34 |
-
}
|
35 |
-
|
36 |
-
//do when class is instantiated
|
37 |
-
add_shortcode('spacer', array($this, 'addShortcodeHandler'));
|
38 |
-
add_filter( 'tiny_mce_version', array($this, 'my_refresh_mce'));
|
39 |
-
|
40 |
-
//plugin row links
|
41 |
-
add_filter( 'plugin_row_meta', array($this,'plugin_row_links'), 10, 2 );
|
42 |
-
|
43 |
-
if(is_admin()){
|
44 |
-
add_action('admin_init', array($this, 'page_init'));
|
45 |
-
add_action('admin_menu', array($this, 'add_plugin_page'));
|
46 |
-
//custom image picker css for admin page
|
47 |
-
add_action('admin_head', array($this,'motech_imagepicker_admin_css'));
|
48 |
-
//custom image picker jquery for admin page
|
49 |
-
add_action('admin_footer', array($this,'motech_imagepicker_admin_jquery'));
|
50 |
-
//add Settings link to plugin page
|
51 |
-
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array($this, 'add_plugin_action_links') );
|
52 |
-
//image upload script
|
53 |
-
add_action('admin_enqueue_scripts', array($this,'spacer_imageupload_script'));
|
54 |
-
|
55 |
-
add_action( 'admin_enqueue_scripts', array($this, 'enqueue_color_picker') ); //enqueue color picker
|
56 |
-
|
57 |
-
add_action( 'admin_enqueue_scripts', array($this, 'enqueue_motech_javascript'), 50 ); //enqueue color picker
|
58 |
-
|
59 |
-
add_action( 'wp_ajax_motech_spacer', array($this,'motech_spacer_callback') );
|
60 |
-
|
61 |
-
//admin messages
|
62 |
-
add_action('admin_notices', array($this,'admin_show_message'));
|
63 |
-
add_action('admin_init', array($this,'adminmessage_init'));
|
64 |
-
|
65 |
-
add_action( 'admin_enqueue_scripts', array($this,'load_custom_wp_admin_style'), 50 );
|
66 |
-
} else{
|
67 |
-
add_action( 'wp_enqueue_scripts', array($this,'load_custom_wp_admin_style') );
|
68 |
-
}
|
69 |
-
|
70 |
-
//prepare plugin for localization
|
71 |
-
load_plugin_textdomain('motech-spacer', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
72 |
-
}
|
73 |
-
|
74 |
-
function load_custom_wp_admin_style() {
|
75 |
-
if ( current_user_can('edit_posts') or current_user_can('edit_pages') ) {
|
76 |
-
wp_register_style( 'mspacer_wp_admin_css', plugins_url( 'admin-style.css' , __FILE__ ), false, '1.0.0' );
|
77 |
-
wp_enqueue_style( 'mspacer_wp_admin_css' );
|
78 |
-
}
|
79 |
-
if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') { //if we are on our admin page
|
80 |
-
wp_register_style( 'mspacer_wp_adminpage_css', plugins_url( 'adminpage-style.css' , __FILE__ ), false, '1.0.0' );
|
81 |
-
wp_enqueue_style( 'mspacer_wp_adminpage_css' );
|
82 |
-
}
|
83 |
-
}
|
84 |
-
|
85 |
-
function motech_spacer_callback() {
|
86 |
-
$return = array();
|
87 |
-
$checkheight = get_option($this->plugin_slug . '_default_height','20');
|
88 |
-
$checkunit = get_option($this->plugin_slug . '_default_height_unit','px');
|
89 |
-
$return["useheight"] = $checkheight.$checkunit;
|
90 |
-
if($this->has_addspacers){
|
91 |
-
$ids = $this->key_array;
|
92 |
-
$checkaddheights = get_option($this->plugin_slug . '_default_height_addspacers');
|
93 |
-
$checkaddheightunits = get_option($this->plugin_slug . '_default_height_unit_addspacers');
|
94 |
-
$checktitles = get_option($this->plugin_slug . '_title_addspacers');
|
95 |
-
foreach($ids as $key=>$value){
|
96 |
-
$useheight = $checkaddheights[$key];
|
97 |
-
$useunit = $checkaddheightunits[$key];
|
98 |
-
$usetitle = $checktitles[$key];
|
99 |
-
if(empty($usetitle)){
|
100 |
-
$usetitle = "Untitled";
|
101 |
-
}
|
102 |
-
$return["addspacers"][] = array("id"=>$value,"height"=>$useheight.$useunit,"title"=>$usetitle);
|
103 |
-
}
|
104 |
-
}
|
105 |
-
echo json_encode($return);
|
106 |
-
wp_die(); // this is required to terminate immediately and return a proper response
|
107 |
-
}
|
108 |
-
|
109 |
-
function admin_show_message()
|
110 |
-
{
|
111 |
-
$user_id = get_current_user_id();
|
112 |
-
//there is no default spacer height set, and nag message not ignored...
|
113 |
-
//$checkdefault = get_option($this->plugin_slug . '_default_height_mobile','');
|
114 |
-
if ( ( ! get_user_meta($user_id, 'spacer2295_nag_ignore') ) && (current_user_can( 'manage_options' )) ) {
|
115 |
-
echo '<div id="message" class="updated fade notice"><p>';
|
116 |
-
echo "<b>".__("Take more time as you craft article updates. Designate 'draft' content with one-click! Try the new Spacer add-on, Draft It!", "motech-spacer")."</b>";
|
117 |
-
echo "</p>";
|
118 |
-
echo "<p><strong><a href=\"http://www.clevelandwebdeveloper.com/?p=1269&utm_medium=plugin&utm_source=plugin-notice-msg&utm_campaign=Spacer+Notice+Msg&utm_content=Draftit+Notice\" target=\"_blank\">".__('Start Drafting »', 'motech-spacer')."</a> | <a class=\"dismiss-notice\" style=\"color:red;\" href=\"".get_bloginfo( 'wpurl' ) . "/wp-admin/options-general.php?page=".$this->plugin_slug."-setting-admin&spacer2295_nag_ignore=0\" target=\"_parent\">".__('I got it. Thanks.', 'motech-spacer')." [X]</a></strong></p></div>";
|
119 |
-
}
|
120 |
-
}
|
121 |
-
|
122 |
-
function adminmessage_init()
|
123 |
-
{
|
124 |
-
if ( isset($_GET['spacer2295_nag_ignore']) && '0' == $_GET['spacer2295_nag_ignore'] ) {
|
125 |
-
$user_id = get_current_user_id();
|
126 |
-
add_user_meta($user_id, 'spacer2295_nag_ignore', 'true', true);
|
127 |
-
if (wp_get_referer()) {
|
128 |
-
/* Redirects user to where they were before */
|
129 |
-
wp_safe_redirect(wp_get_referer());
|
130 |
-
} else {
|
131 |
-
/* if there is no referrer you redirect to home */
|
132 |
-
wp_safe_redirect(home_url());
|
133 |
-
}
|
134 |
-
}
|
135 |
-
}
|
136 |
-
|
137 |
-
function enqueue_color_picker( $hook_suffix ) {
|
138 |
-
wp_enqueue_style( 'wp-color-picker' );
|
139 |
-
wp_enqueue_script( $this->plugin_slug.'-script-handle', plugins_url('js/motech-color-picker.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
|
140 |
-
}
|
141 |
-
|
142 |
-
function enqueue_motech_javascript( ) {
|
143 |
-
if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') {
|
144 |
-
wp_enqueue_script( $this->plugin_slug.'-motech-javascript', plugins_url('js/motech-javascript.js', __FILE__ ), array('jquery'), false, true );
|
145 |
-
}
|
146 |
-
}
|
147 |
-
|
148 |
-
function spacer_imageupload_script() {
|
149 |
-
if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') {
|
150 |
-
if(function_exists('wp_enqueue_media')){
|
151 |
-
wp_enqueue_media();
|
152 |
-
}
|
153 |
-
wp_register_script('spacer_imageupload-js', plugins_url( 'js/spacer_imageupload.js' , __FILE__ ), array('jquery'));
|
154 |
-
wp_enqueue_script('spacer_imageupload-js');
|
155 |
-
}
|
156 |
-
}
|
157 |
-
|
158 |
-
function activespacer($id="") { #return attributes for active spacer based on id.
|
159 |
-
$return = array();
|
160 |
-
if($this->has_addspacers && $id!=""){
|
161 |
-
$ids = $this->key_array;
|
162 |
-
$key = array_search($id, $ids);
|
163 |
-
if($key){
|
164 |
-
#associated spacer id found so we return those values
|
165 |
-
$get = get_option($this->plugin_slug . '_spacer_style_addspacers');
|
166 |
-
$return["defaultstyle"] = $get[$key];
|
167 |
-
$get = get_option($this->plugin_slug . '_default_height_mobile_addspacers');
|
168 |
-
$return["mobile_height_default"] = $get[$key];
|
169 |
-
$return["mobile_height"] = $return["mobile_height_default"];
|
170 |
-
$get = get_option($this->plugin_slug . '_default_height_mobile_unit_addspacers');
|
171 |
-
$return["mobileunit"] = $get[$key];
|
172 |
-
$get = get_option($this->plugin_slug . '_default_height_addspacers');
|
173 |
-
$return["checkheight"] = $get[$key];
|
174 |
-
$get = get_option($this->plugin_slug . '_default_height_unit_addspacers');
|
175 |
-
$return["checkunit"] = $get[$key];
|
176 |
-
//$get = get_option($this->plugin_slug.'_custom_background_image_upload_addspacers');
|
177 |
-
//$return["bg"] = $get[$key];
|
178 |
-
//$get = get_option($this->plugin_slug . '_background_color_addspacers');
|
179 |
-
//$return["bgcolor"] = $get[$key];
|
180 |
-
$get = get_option($this->plugin_slug . '_spacer_class_addspacers');
|
181 |
-
$return["defaultclasses"] = $get[$key];
|
182 |
-
if(has_filter('spacer_add_to_extras')) {
|
183 |
-
$return = apply_filters('spacer_add_to_extras',$return,$key);
|
184 |
-
}
|
185 |
-
return $return;
|
186 |
-
}
|
187 |
-
|
188 |
-
|
189 |
-
}
|
190 |
-
|
191 |
-
#no associated spacer id found so we return default spacer values
|
192 |
-
$return["mobile_height_default"] = get_option($this->plugin_slug . '_default_height_mobile','');
|
193 |
-
$return["mobile_height"] = get_option($this->plugin_slug . '_default_height_mobile','');
|
194 |
-
$return["mobileunit"] = get_option($this->plugin_slug . '_default_height_mobile_unit','px');
|
195 |
-
$return["checkheight"] = get_option($this->plugin_slug . '_default_height','20');
|
196 |
-
$return["checkunit"] = get_option($this->plugin_slug . '_default_height_unit','px');
|
197 |
-
//$return["bg"] = get_option($this->plugin_slug.'_custom_background_image_upload');
|
198 |
-
//$return["bgcolor"] = get_option($this->plugin_slug.'_background_color');
|
199 |
-
$return["defaultclasses"] = get_option($this->plugin_slug.'_spacer_class','');
|
200 |
-
$return["defaultstyle"] = get_option($this->plugin_slug.'_spacer_style','');
|
201 |
-
if(has_filter('spacer_add_to_default')) {
|
202 |
-
$return = apply_filters('spacer_add_to_default', $return);
|
203 |
-
}
|
204 |
-
|
205 |
-
return $return;
|
206 |
-
}
|
207 |
-
|
208 |
-
// add the shortcode handler
|
209 |
-
function addShortcodeHandler($atts, $content = null) {
|
210 |
-
extract(shortcode_atts(array( "height" => '', "mheight" => '', "class" => '', "id" => '', "style" => '' ), $atts));
|
211 |
-
$activespacer = $this->activespacer($id);
|
212 |
-
|
213 |
-
//prep variables
|
214 |
-
$spacer_css = "";
|
215 |
-
$classes = "";
|
216 |
-
|
217 |
-
//prep mobile height, if it's empty we will use desktop height. if set to 0 we will hide the spacer on mobile devices.
|
218 |
-
$mobile_height = "";
|
219 |
-
$mobile_height_inline = "";
|
220 |
-
$mobile_height_default = $activespacer["mobile_height_default"];
|
221 |
-
|
222 |
-
//first check for inline height, then check default mobile height
|
223 |
-
if(isset($mheight) && $mheight != ""){
|
224 |
-
$mobile_height = $mheight;
|
225 |
-
$mobile_height_inline = $mheight;
|
226 |
-
}elseif(isset($mobile_height_default) && $mobile_height_default != ""){
|
227 |
-
$mobile_height = $activespacer["mobile_height"];
|
228 |
-
$mobile_height_default = $mobile_height;
|
229 |
-
}
|
230 |
-
|
231 |
-
|
232 |
-
//determine the height to use for the spacer. if it's a mobile device and there is a mobile height set, use that. otherwise use desktop height
|
233 |
-
if( function_exists('wp_is_mobile') && wp_is_mobile() && (isset($mobile_height) && $mobile_height != "")) {
|
234 |
-
$mobileunit = $activespacer["mobileunit"];
|
235 |
-
|
236 |
-
|
237 |
-
if(isset($mobile_height_inline) && $mobile_height_inline != "") {
|
238 |
-
if ($mobile_height_inline > 0 ) {
|
239 |
-
$spacer_css .= "padding-top: " . $mobile_height_inline . ";";
|
240 |
-
} elseif($mobile_height_inline < 0) {
|
241 |
-
$spacer_css .= "margin-top: " . $mobile_height_inline . ";";
|
242 |
-
} elseif($mobile_height_inline == 0){
|
243 |
-
$spacer_css .= "display:none;";
|
244 |
-
}
|
245 |
-
} elseif(isset($mobile_height_default) && $mobile_height_default != ""){
|
246 |
-
if($mobile_height_default > 0){
|
247 |
-
$spacer_css .= "padding-top: " . $mobile_height_default . $mobileunit.";";
|
248 |
-
}elseif($mobile_height_default < 0){
|
249 |
-
$spacer_css .= "margin-top: " . $mobile_height_default . $mobileunit. ";";
|
250 |
-
}elseif($mobile_height_default == 0){;
|
251 |
-
$spacer_css .= "display:none;";
|
252 |
-
}
|
253 |
-
}
|
254 |
-
|
255 |
-
} elseif($height=="default"){ //there is no mobile height set. use the desktop default height
|
256 |
-
|
257 |
-
//for now assume positive. in a sec add logic for if negative
|
258 |
-
$checkheight = $activespacer["checkheight"];
|
259 |
-
$checkunit = $activespacer["checkunit"];
|
260 |
-
|
261 |
-
if($checkheight > 0){
|
262 |
-
$spacer_css .= "padding-top: " . $checkheight . $checkunit.";";
|
263 |
-
}elseif($checkheight < 0){
|
264 |
-
$spacer_css .= "margin-top: " . $checkheight . $checkunit. ";";
|
265 |
-
}
|
266 |
-
} elseif ($height > 0 ) { #no default for desktop, use positive inline height
|
267 |
-
$spacer_css .= "padding-top: " . $height . ";";
|
268 |
-
} elseif($height < 0) { #no positive inline for desktop, use negative inline height
|
269 |
-
$spacer_css .= "margin-top: " . $height . ";";
|
270 |
-
}
|
271 |
-
|
272 |
-
|
273 |
-
//custom background image
|
274 |
-
/* $bg = $activespacer["bg"];
|
275 |
-
if(!empty($bg)) {
|
276 |
-
$spacer_css .= "background: url(".$bg.");";
|
277 |
-
}*/
|
278 |
-
|
279 |
-
//custom background image position
|
280 |
-
//$spacer_css .= $this->background_position();
|
281 |
-
|
282 |
-
//background color
|
283 |
-
/* $bgcolor = $activespacer["bgcolor"];
|
284 |
-
if(!empty($bgcolor)) {
|
285 |
-
$spacer_css .= "background-color:".$bgcolor.";";
|
286 |
-
}*/
|
287 |
-
|
288 |
-
//classes
|
289 |
-
$defaultclasses = $activespacer["defaultclasses"];
|
290 |
-
$classes .= $defaultclasses;
|
291 |
-
if(!empty($class)){
|
292 |
-
$classes .= " ".$class;
|
293 |
-
}
|
294 |
-
|
295 |
-
if(has_filter('spacer_add_css')) {
|
296 |
-
$spacer_css = apply_filters('spacer_add_css', $spacer_css, $activespacer);
|
297 |
-
}
|
298 |
-
|
299 |
-
//styles
|
300 |
-
$defaultstyle = $activespacer["defaultstyle"];
|
301 |
-
$spacer_css .= $defaultstyle;
|
302 |
-
if(!empty($style)){
|
303 |
-
$spacer_css .= " ".$style;
|
304 |
-
}
|
305 |
-
|
306 |
-
//create the spacer after all settings have been loaded
|
307 |
-
return '<span class="'.$classes.'" style="display:block;clear:both;height: 0px;'.$spacer_css.'"></span>';
|
308 |
-
}
|
309 |
-
|
310 |
-
function background_position(){
|
311 |
-
$bgposition = get_option($this->plugin_slug.'_custom_background_image_position','repeat');
|
312 |
-
if($bgposition=="repeat"){
|
313 |
-
return "background-repeat:repeat;";
|
314 |
-
} elseif($bgposition=="croptofit"){
|
315 |
-
return "background-size:cover;background-position:center;";
|
316 |
-
} elseif($bgposition=="stretch"){
|
317 |
-
return "background-size: 100% 100%;background-repeat: no-repeat;background-position: center;";
|
318 |
-
} elseif($bgposition=="propstretch"){
|
319 |
-
return "background-size: contain;background-repeat: no-repeat;background-position: center;";
|
320 |
-
}
|
321 |
-
}
|
322 |
-
|
323 |
-
|
324 |
-
function add_custom_button() {
|
325 |
-
if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )
|
326 |
-
return;
|
327 |
-
if ( get_user_option('rich_editing') == 'true') {
|
328 |
-
add_filter('mce_external_plugins', array($this, 'add_custom_tinymce_plugin'),99999999);
|
329 |
-
add_filter('mce_buttons', array($this, 'register_custom_button'),99999999);
|
330 |
-
global $wp_version;
|
331 |
-
//if($wp_version < 3.9){
|
332 |
-
add_action('admin_head', array($this,'motech_spacer_prepjsbuttons'));
|
333 |
-
add_action('wp_head', array($this,'motech_spacer_prepjsbuttons'));
|
334 |
-
//}
|
335 |
-
}
|
336 |
-
|
337 |
-
}
|
338 |
-
|
339 |
-
function register_custom_button($buttons) {
|
340 |
-
array_push($buttons, "|", get_class($this));
|
341 |
-
return $buttons;
|
342 |
-
}
|
343 |
-
|
344 |
-
function add_custom_tinymce_plugin($plugin_array) {
|
345 |
-
global $wp_version;
|
346 |
-
//use this in a plugin
|
347 |
-
if($wp_version >= 3.9){
|
348 |
-
$plugin_array[get_class($this)] = plugins_url( 'editor_plugin.js' , __FILE__ );
|
349 |
-
}else {
|
350 |
-
$plugin_array[get_class($this)] = plugins_url( 'editor_plugin_back.js' , __FILE__ );
|
351 |
-
}
|
352 |
-
//use this in a theme
|
353 |
-
//$plugin_array[get_class($this)] = get_bloginfo('template_url').'/editor_plugin.js';
|
354 |
-
return $plugin_array;
|
355 |
-
}
|
356 |
-
|
357 |
-
function my_refresh_mce($ver) {
|
358 |
-
$ver += 5;
|
359 |
-
return $ver;
|
360 |
-
}
|
361 |
-
|
362 |
-
function plugin_row_links($links, $file) {
|
363 |
-
$plugin = plugin_basename(__FILE__);
|
364 |
-
if ($file == $plugin) // only for this plugin
|
365 |
-
return array_merge( $links,
|
366 |
-
array( '<a target="_blank" href="http://www.clevelandwebdeveloper.com/wordpress-plugins/spacer/">' . __('Project homepage', 'motech-spacer' ) . '</a>' ),
|
367 |
-
array( '<a target="_blank" href="http://www.linkedin.com/in/ClevelandWebDeveloper/">' . __('Find me on LinkedIn', 'motech-spacer' ) . '</a>' ),
|
368 |
-
array( '<a target="_blank" href="http://twitter.com/ClevelandWebDev">' . __('Follow me on Twitter', 'motech-spacer') . '</a>' )
|
369 |
-
);
|
370 |
-
return $links;
|
371 |
-
}
|
372 |
-
|
373 |
-
public function create_admin_page(){
|
374 |
-
?>
|
375 |
-
<div class="wrap" style="position:relative">
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
<span
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
<h2><?php _e('
|
398 |
-
<div class="updated below-h2"
|
399 |
-
<div class="
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
<div class="
|
406 |
-
|
407 |
-
<div class="
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
<div class="
|
419 |
-
|
420 |
-
<div class="
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
<span
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
<h2><?php _e('
|
456 |
-
<div class="updated below-h2"
|
457 |
-
<div class="
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
<div class="
|
464 |
-
|
465 |
-
<div class="
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
<div class="
|
477 |
-
|
478 |
-
<div class="
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
<span
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
<h2><?php _e('
|
514 |
-
<div class="updated below-h2"
|
515 |
-
<div class="
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
<div class="
|
522 |
-
|
523 |
-
<div class="
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
<div class="
|
535 |
-
|
536 |
-
<div class="
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
<span
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
<a href="#
|
574 |
-
|
575 |
-
|
576 |
-
<a href="#
|
577 |
-
<a href="#
|
578 |
-
<a href="#
|
579 |
-
|
580 |
-
<a href="#
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
<
|
606 |
-
|
607 |
-
|
608 |
-
<
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
<
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
<
|
651 |
-
|
652 |
-
<
|
653 |
-
<
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
?>
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
?>
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
?>
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
?>
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
<
|
725 |
-
<div
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
$key_array
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
$
|
757 |
-
$
|
758 |
-
$
|
759 |
-
|
760 |
-
|
761 |
-
$
|
762 |
-
$
|
763 |
-
|
764 |
-
$this->plugin_slug.'
|
765 |
-
|
766 |
-
|
767 |
-
"
|
768 |
-
"
|
769 |
-
"
|
770 |
-
"
|
771 |
-
"
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
$
|
778 |
-
$
|
779 |
-
$
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
$
|
784 |
-
$
|
785 |
-
|
786 |
-
$this->plugin_slug.'
|
787 |
-
|
788 |
-
|
789 |
-
"
|
790 |
-
"
|
791 |
-
"
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
$
|
805 |
-
$
|
806 |
-
$
|
807 |
-
|
808 |
-
|
809 |
-
$
|
810 |
-
$
|
811 |
-
|
812 |
-
$this->plugin_slug.'
|
813 |
-
|
814 |
-
|
815 |
-
"
|
816 |
-
"
|
817 |
-
"
|
818 |
-
"
|
819 |
-
"
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
$
|
826 |
-
$
|
827 |
-
$
|
828 |
-
|
829 |
-
array("label" => "
|
830 |
-
array("label" => "
|
831 |
-
array("label" => "
|
832 |
-
|
833 |
-
);
|
834 |
-
|
835 |
-
|
836 |
-
$
|
837 |
-
$
|
838 |
-
|
839 |
-
$this->plugin_slug.'
|
840 |
-
|
841 |
-
|
842 |
-
"
|
843 |
-
"
|
844 |
-
"
|
845 |
-
"
|
846 |
-
"
|
847 |
-
"
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
$
|
861 |
-
$
|
862 |
-
$
|
863 |
-
|
864 |
-
|
865 |
-
$
|
866 |
-
$
|
867 |
-
|
868 |
-
$this->plugin_slug.'
|
869 |
-
|
870 |
-
|
871 |
-
"
|
872 |
-
"
|
873 |
-
"
|
874 |
-
"
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
$
|
881 |
-
$
|
882 |
-
$
|
883 |
-
|
884 |
-
array("label" => "
|
885 |
-
array("label" => "
|
886 |
-
array("label" => "
|
887 |
-
|
888 |
-
);
|
889 |
-
|
890 |
-
|
891 |
-
$
|
892 |
-
$
|
893 |
-
|
894 |
-
$this->plugin_slug.'
|
895 |
-
|
896 |
-
|
897 |
-
"
|
898 |
-
"
|
899 |
-
"
|
900 |
-
"
|
901 |
-
"
|
902 |
-
"
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
$
|
916 |
-
$
|
917 |
-
$
|
918 |
-
|
919 |
-
|
920 |
-
$
|
921 |
-
$
|
922 |
-
|
923 |
-
$this->plugin_slug.'
|
924 |
-
|
925 |
-
|
926 |
-
"
|
927 |
-
"
|
928 |
-
"
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
$
|
935 |
-
$
|
936 |
-
$
|
937 |
-
|
938 |
-
|
939 |
-
$
|
940 |
-
$
|
941 |
-
|
942 |
-
$this->plugin_slug.'
|
943 |
-
|
944 |
-
|
945 |
-
"
|
946 |
-
"
|
947 |
-
"
|
948 |
-
"
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
$
|
955 |
-
$
|
956 |
-
$
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
$
|
961 |
-
$
|
962 |
-
|
963 |
-
$this->plugin_slug.'
|
964 |
-
|
965 |
-
|
966 |
-
"
|
967 |
-
"
|
968 |
-
"
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
$
|
987 |
-
$
|
988 |
-
$
|
989 |
-
|
990 |
-
|
991 |
-
$
|
992 |
-
$
|
993 |
-
|
994 |
-
$this->plugin_slug.'
|
995 |
-
|
996 |
-
|
997 |
-
"
|
998 |
-
"
|
999 |
-
"
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
$
|
1006 |
-
$
|
1007 |
-
$
|
1008 |
-
|
1009 |
-
array("label" => "
|
1010 |
-
array("label" => "
|
1011 |
-
array("label" => "
|
1012 |
-
|
1013 |
-
);
|
1014 |
-
|
1015 |
-
|
1016 |
-
$
|
1017 |
-
$
|
1018 |
-
|
1019 |
-
$this->plugin_slug.'
|
1020 |
-
|
1021 |
-
|
1022 |
-
"
|
1023 |
-
"
|
1024 |
-
"
|
1025 |
-
"
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
$
|
1041 |
-
$
|
1042 |
-
$
|
1043 |
-
|
1044 |
-
|
1045 |
-
$
|
1046 |
-
$
|
1047 |
-
|
1048 |
-
$this->plugin_slug.'
|
1049 |
-
|
1050 |
-
|
1051 |
-
"
|
1052 |
-
"
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
$
|
1059 |
-
$
|
1060 |
-
$
|
1061 |
-
|
1062 |
-
|
1063 |
-
$
|
1064 |
-
$
|
1065 |
-
|
1066 |
-
$this->plugin_slug.'
|
1067 |
-
|
1068 |
-
|
1069 |
-
"
|
1070 |
-
"
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
$this->
|
1091 |
-
$this->
|
1092 |
-
$this
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
$
|
1116 |
-
$
|
1117 |
-
$
|
1118 |
-
|
1119 |
-
|
1120 |
-
$
|
1121 |
-
$
|
1122 |
-
|
1123 |
-
$this->plugin_slug.'
|
1124 |
-
|
1125 |
-
|
1126 |
-
"
|
1127 |
-
"
|
1128 |
-
"
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
$
|
1135 |
-
$
|
1136 |
-
$
|
1137 |
-
|
1138 |
-
array("label" => "
|
1139 |
-
array("label" => "
|
1140 |
-
array("label" => "
|
1141 |
-
|
1142 |
-
);
|
1143 |
-
|
1144 |
-
|
1145 |
-
$
|
1146 |
-
$
|
1147 |
-
|
1148 |
-
$this->plugin_slug.'
|
1149 |
-
|
1150 |
-
|
1151 |
-
"
|
1152 |
-
"
|
1153 |
-
"
|
1154 |
-
"
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
*
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
?>
|
1186 |
-
<input class="
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
$current_image
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
$
|
1215 |
-
$getarray
|
1216 |
-
|
1217 |
-
$
|
1218 |
-
}
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
echo "<span class='description'>".
|
1228 |
-
}
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
$placeholder_html = "";
|
1255 |
-
}
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
$max_length_html = "";
|
1261 |
-
}
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
$default =
|
1266 |
-
}
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
$placeholder_html = "";
|
1285 |
-
}
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
$max_length_html = "";
|
1291 |
-
}
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
$usevalue =
|
1305 |
-
}
|
1306 |
-
|
1307 |
-
|
1308 |
-
//
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
$placeholder_html = "";
|
1322 |
-
}
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
$default =
|
1328 |
-
}
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
$placeholder_html = "";
|
1342 |
-
}
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
$default =
|
1348 |
-
}
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
}
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
$
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
if(isset($args["
|
1397 |
-
$
|
1398 |
-
} else {
|
1399 |
-
$
|
1400 |
-
}
|
1401 |
-
$
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
$
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
if(isset($args["
|
1424 |
-
$
|
1425 |
-
} else {
|
1426 |
-
|
1427 |
-
}
|
1428 |
-
if(
|
1429 |
-
$args["
|
1430 |
-
}
|
1431 |
-
|
1432 |
-
|
1433 |
-
if(!isset($
|
1434 |
-
|
1435 |
-
}
|
1436 |
-
|
1437 |
-
|
1438 |
-
$
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
$
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
}
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
.
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
padding-bottom:
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
font-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
}
|
1515 |
-
.
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
#
|
1569 |
-
#
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
#
|
1574 |
-
|
1575 |
-
.
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
1580 |
-
.
|
1581 |
-
.
|
1582 |
-
.
|
1583 |
-
.
|
1584 |
-
.
|
1585 |
-
.motech_purchase_button.
|
1586 |
-
.
|
1587 |
-
.
|
1588 |
-
.motech_purchase_button {
|
1589 |
-
.motech_purchase_button .
|
1590 |
-
.motech_purchase_button:
|
1591 |
-
.motech_purchase_button.three_use .
|
1592 |
-
.motech_purchase_button.unlimited_use .
|
1593 |
-
.
|
1594 |
-
.
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
1598 |
-
|
1599 |
-
.
|
1600 |
-
.
|
1601 |
-
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
}
|
1609 |
-
|
1610 |
-
|
1611 |
-
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
1619 |
-
|
1620 |
-
|
1621 |
-
.motech_purchase_button {
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
.
|
1628 |
-
}
|
1629 |
-
@media only screen and (max-width:
|
1630 |
-
.
|
1631 |
-
}
|
1632 |
-
@media only screen and (max-width:
|
1633 |
-
.
|
1634 |
-
}
|
1635 |
-
@media only screen and (max-width:
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
}
|
1643 |
-
|
1644 |
-
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
}
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
|
1686 |
-
|
1687 |
-
|
1688 |
-
|
1689 |
-
|
1690 |
-
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
1694 |
-
if (
|
1695 |
-
|
1696 |
-
}
|
1697 |
-
|
1698 |
-
|
1699 |
-
|
1700 |
-
|
1701 |
-
|
1702 |
-
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
1706 |
-
|
1707 |
-
|
1708 |
-
|
1709 |
-
|
1710 |
-
|
1711 |
-
|
1712 |
-
|
1713 |
-
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
1729 |
-
|
1730 |
-
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
1738 |
-
|
1739 |
-
|
1740 |
-
|
1741 |
-
|
1742 |
-
|
1743 |
-
|
1744 |
-
|
1745 |
-
|
1746 |
-
|
1747 |
-
|
1748 |
-
|
1749 |
-
|
1750 |
-
|
1751 |
-
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
-
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
-
|
1760 |
-
|
1761 |
-
|
1762 |
-
|
1763 |
-
|
1764 |
-
|
1765 |
-
|
1766 |
-
|
1767 |
-
|
1768 |
-
|
1769 |
-
|
1770 |
-
|
1771 |
-
|
1772 |
-
|
1773 |
-
|
1774 |
-
|
1775 |
-
|
1776 |
-
|
1777 |
-
|
1778 |
-
|
1779 |
-
|
1780 |
-
|
1781 |
-
|
1782 |
-
|
1783 |
-
|
1784 |
-
|
1785 |
-
|
1786 |
-
|
1787 |
-
$
|
1788 |
-
|
1789 |
-
|
1790 |
-
|
1791 |
-
|
1792 |
-
|
1793 |
-
|
1794 |
-
|
1795 |
-
|
1796 |
-
|
1797 |
-
|
1798 |
-
|
1799 |
-
|
1800 |
-
|
1801 |
-
|
1802 |
-
|
1803 |
-
|
1804 |
-
|
1805 |
-
|
1806 |
-
|
1807 |
-
|
1808 |
-
|
1809 |
-
|
1810 |
-
|
1811 |
-
|
1812 |
-
|
1813 |
-
|
1814 |
-
|
1815 |
-
|
1816 |
-
|
1817 |
-
|
1818 |
-
|
1819 |
-
|
1820 |
-
|
1821 |
-
|
1822 |
-
|
1823 |
-
|
1824 |
-
|
1825 |
-
|
1826 |
-
|
1827 |
-
|
1828 |
-
|
1829 |
-
|
1830 |
-
|
1831 |
-
|
1832 |
-
|
1833 |
-
|
1834 |
-
|
1835 |
-
|
1836 |
-
|
1837 |
-
|
1838 |
-
|
1839 |
-
jQuery("
|
1840 |
-
|
1841 |
-
|
1842 |
-
|
1843 |
-
|
1844 |
-
|
1845 |
-
|
1846 |
-
|
1847 |
-
|
1848 |
-
|
1849 |
-
|
1850 |
-
|
1851 |
-
|
1852 |
-
|
1853 |
-
|
1854 |
-
|
1855 |
-
|
1856 |
-
|
1857 |
-
|
1858 |
-
|
1859 |
-
|
1860 |
-
|
1861 |
-
|
1862 |
-
|
1863 |
-
|
1864 |
-
|
1865 |
-
|
1866 |
-
|
1867 |
-
|
1868 |
-
|
1869 |
-
|
1870 |
-
|
1871 |
-
|
1872 |
-
|
1873 |
-
|
1874 |
-
|
1875 |
-
|
1876 |
-
|
1877 |
-
|
1878 |
-
|
1879 |
-
|
1880 |
-
|
1881 |
-
|
1882 |
-
|
1883 |
-
|
1884 |
-
|
1885 |
-
|
1886 |
-
|
1887 |
-
|
1888 |
-
|
1889 |
-
|
1890 |
-
|
1891 |
-
|
1892 |
-
|
1893 |
-
|
1894 |
-
|
1895 |
-
|
1896 |
-
|
1897 |
-
|
1898 |
-
|
1899 |
-
|
1900 |
-
|
1901 |
-
|
1902 |
-
|
1903 |
-
|
1904 |
-
|
1905 |
-
|
1906 |
-
|
1907 |
-
|
1908 |
-
|
1909 |
-
|
1910 |
-
|
1911 |
-
|
1912 |
-
|
1913 |
-
|
1914 |
-
|
1915 |
-
|
1916 |
-
|
1917 |
-
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
Plugin Name: Spacer
|
5 |
+
Plugin URI: http://www.clevelandwebdeveloper.com/wordpress-plugins/spacer
|
6 |
+
Description: Adds a spacer button to the WYSIWYG visual editor which allows you to add precise custom spacing between lines in your posts and pages.
|
7 |
+
Version: 3.0.5
|
8 |
+
Author: Justin Saad
|
9 |
+
Author URI: http://www.clevelandwebdeveloper.com
|
10 |
+
License: GPL2
|
11 |
+
*/
|
12 |
+
|
13 |
+
|
14 |
+
//begin wysiwyg visual editor custom button plugin
|
15 |
+
|
16 |
+
$plugin_label = "Spacer";
|
17 |
+
$plugin_slug = "motech_spacer";
|
18 |
+
|
19 |
+
class motech_spacer {
|
20 |
+
|
21 |
+
public function __construct() {
|
22 |
+
|
23 |
+
global $plugin_label, $plugin_slug;
|
24 |
+
$this->plugin_slug = $plugin_slug;
|
25 |
+
$this->plugin_label = $plugin_label;
|
26 |
+
$this->plugin_dir = plugins_url( '' , __FILE__ );
|
27 |
+
$checkaddspacers = get_option($this->plugin_slug."_addspacer_id");
|
28 |
+
if(!empty($checkaddspacers)){
|
29 |
+
$this->key_array = $checkaddspacers;
|
30 |
+
$this->has_addspacers = true;
|
31 |
+
}else{
|
32 |
+
$this->key_array = array(0);
|
33 |
+
$this->has_addspacers = false;
|
34 |
+
}
|
35 |
+
|
36 |
+
//do when class is instantiated
|
37 |
+
add_shortcode('spacer', array($this, 'addShortcodeHandler'));
|
38 |
+
add_filter( 'tiny_mce_version', array($this, 'my_refresh_mce'));
|
39 |
+
|
40 |
+
//plugin row links
|
41 |
+
add_filter( 'plugin_row_meta', array($this,'plugin_row_links'), 10, 2 );
|
42 |
+
|
43 |
+
if(is_admin()){
|
44 |
+
add_action('admin_init', array($this, 'page_init'));
|
45 |
+
add_action('admin_menu', array($this, 'add_plugin_page'));
|
46 |
+
//custom image picker css for admin page
|
47 |
+
add_action('admin_head', array($this,'motech_imagepicker_admin_css'));
|
48 |
+
//custom image picker jquery for admin page
|
49 |
+
add_action('admin_footer', array($this,'motech_imagepicker_admin_jquery'));
|
50 |
+
//add Settings link to plugin page
|
51 |
+
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array($this, 'add_plugin_action_links') );
|
52 |
+
//image upload script
|
53 |
+
add_action('admin_enqueue_scripts', array($this,'spacer_imageupload_script'));
|
54 |
+
|
55 |
+
add_action( 'admin_enqueue_scripts', array($this, 'enqueue_color_picker') ); //enqueue color picker
|
56 |
+
|
57 |
+
add_action( 'admin_enqueue_scripts', array($this, 'enqueue_motech_javascript'), 50 ); //enqueue color picker
|
58 |
+
|
59 |
+
add_action( 'wp_ajax_motech_spacer', array($this,'motech_spacer_callback') );
|
60 |
+
|
61 |
+
//admin messages
|
62 |
+
add_action('admin_notices', array($this,'admin_show_message'));
|
63 |
+
add_action('admin_init', array($this,'adminmessage_init'));
|
64 |
+
|
65 |
+
add_action( 'admin_enqueue_scripts', array($this,'load_custom_wp_admin_style'), 50 );
|
66 |
+
} else{
|
67 |
+
add_action( 'wp_enqueue_scripts', array($this,'load_custom_wp_admin_style') );
|
68 |
+
}
|
69 |
+
|
70 |
+
//prepare plugin for localization
|
71 |
+
load_plugin_textdomain('motech-spacer', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
72 |
+
}
|
73 |
+
|
74 |
+
function load_custom_wp_admin_style() {
|
75 |
+
if ( current_user_can('edit_posts') or current_user_can('edit_pages') ) {
|
76 |
+
wp_register_style( 'mspacer_wp_admin_css', plugins_url( 'admin-style.css' , __FILE__ ), false, '1.0.0' );
|
77 |
+
wp_enqueue_style( 'mspacer_wp_admin_css' );
|
78 |
+
}
|
79 |
+
if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') { //if we are on our admin page
|
80 |
+
wp_register_style( 'mspacer_wp_adminpage_css', plugins_url( 'adminpage-style.css' , __FILE__ ), false, '1.0.0' );
|
81 |
+
wp_enqueue_style( 'mspacer_wp_adminpage_css' );
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
function motech_spacer_callback() {
|
86 |
+
$return = array();
|
87 |
+
$checkheight = get_option($this->plugin_slug . '_default_height','20');
|
88 |
+
$checkunit = get_option($this->plugin_slug . '_default_height_unit','px');
|
89 |
+
$return["useheight"] = $checkheight.$checkunit;
|
90 |
+
if($this->has_addspacers){
|
91 |
+
$ids = $this->key_array;
|
92 |
+
$checkaddheights = get_option($this->plugin_slug . '_default_height_addspacers');
|
93 |
+
$checkaddheightunits = get_option($this->plugin_slug . '_default_height_unit_addspacers');
|
94 |
+
$checktitles = get_option($this->plugin_slug . '_title_addspacers');
|
95 |
+
foreach($ids as $key=>$value){
|
96 |
+
$useheight = $checkaddheights[$key];
|
97 |
+
$useunit = $checkaddheightunits[$key];
|
98 |
+
$usetitle = $checktitles[$key];
|
99 |
+
if(empty($usetitle)){
|
100 |
+
$usetitle = "Untitled";
|
101 |
+
}
|
102 |
+
$return["addspacers"][] = array("id"=>$value,"height"=>$useheight.$useunit,"title"=>$usetitle);
|
103 |
+
}
|
104 |
+
}
|
105 |
+
echo json_encode($return);
|
106 |
+
wp_die(); // this is required to terminate immediately and return a proper response
|
107 |
+
}
|
108 |
+
|
109 |
+
function admin_show_message()
|
110 |
+
{
|
111 |
+
$user_id = get_current_user_id();
|
112 |
+
//there is no default spacer height set, and nag message not ignored...
|
113 |
+
//$checkdefault = get_option($this->plugin_slug . '_default_height_mobile','');
|
114 |
+
if ( ( ! get_user_meta($user_id, 'spacer2295_nag_ignore') ) && (current_user_can( 'manage_options' )) ) {
|
115 |
+
echo '<div id="message" class="updated fade notice"><p>';
|
116 |
+
echo "<b>".__("Take more time as you craft article updates. Designate 'draft' content with one-click! Try the new Spacer add-on, Draft It!", "motech-spacer")."</b>";
|
117 |
+
echo "</p>";
|
118 |
+
echo "<p><strong><a href=\"http://www.clevelandwebdeveloper.com/?p=1269&utm_medium=plugin&utm_source=plugin-notice-msg&utm_campaign=Spacer+Notice+Msg&utm_content=Draftit+Notice\" target=\"_blank\">".__('Start Drafting »', 'motech-spacer')."</a> | <a class=\"dismiss-notice\" style=\"color:red;\" href=\"".get_bloginfo( 'wpurl' ) . "/wp-admin/options-general.php?page=".$this->plugin_slug."-setting-admin&spacer2295_nag_ignore=0\" target=\"_parent\">".__('I got it. Thanks.', 'motech-spacer')." [X]</a></strong></p></div>";
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
function adminmessage_init()
|
123 |
+
{
|
124 |
+
if ( isset($_GET['spacer2295_nag_ignore']) && '0' == $_GET['spacer2295_nag_ignore'] ) {
|
125 |
+
$user_id = get_current_user_id();
|
126 |
+
add_user_meta($user_id, 'spacer2295_nag_ignore', 'true', true);
|
127 |
+
if (wp_get_referer()) {
|
128 |
+
/* Redirects user to where they were before */
|
129 |
+
wp_safe_redirect(wp_get_referer());
|
130 |
+
} else {
|
131 |
+
/* if there is no referrer you redirect to home */
|
132 |
+
wp_safe_redirect(home_url());
|
133 |
+
}
|
134 |
+
}
|
135 |
+
}
|
136 |
+
|
137 |
+
function enqueue_color_picker( $hook_suffix ) {
|
138 |
+
wp_enqueue_style( 'wp-color-picker' );
|
139 |
+
wp_enqueue_script( $this->plugin_slug.'-script-handle', plugins_url('js/motech-color-picker.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
|
140 |
+
}
|
141 |
+
|
142 |
+
function enqueue_motech_javascript( ) {
|
143 |
+
if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') {
|
144 |
+
wp_enqueue_script( $this->plugin_slug.'-motech-javascript', plugins_url('js/motech-javascript.js', __FILE__ ), array('jquery'), false, true );
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
function spacer_imageupload_script() {
|
149 |
+
if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') {
|
150 |
+
if(function_exists('wp_enqueue_media')){
|
151 |
+
wp_enqueue_media();
|
152 |
+
}
|
153 |
+
wp_register_script('spacer_imageupload-js', plugins_url( 'js/spacer_imageupload.js' , __FILE__ ), array('jquery'));
|
154 |
+
wp_enqueue_script('spacer_imageupload-js');
|
155 |
+
}
|
156 |
+
}
|
157 |
+
|
158 |
+
function activespacer($id="") { #return attributes for active spacer based on id.
|
159 |
+
$return = array();
|
160 |
+
if($this->has_addspacers && $id!=""){
|
161 |
+
$ids = $this->key_array;
|
162 |
+
$key = array_search($id, $ids);
|
163 |
+
if($key){
|
164 |
+
#associated spacer id found so we return those values
|
165 |
+
$get = get_option($this->plugin_slug . '_spacer_style_addspacers');
|
166 |
+
$return["defaultstyle"] = $get[$key];
|
167 |
+
$get = get_option($this->plugin_slug . '_default_height_mobile_addspacers');
|
168 |
+
$return["mobile_height_default"] = $get[$key];
|
169 |
+
$return["mobile_height"] = $return["mobile_height_default"];
|
170 |
+
$get = get_option($this->plugin_slug . '_default_height_mobile_unit_addspacers');
|
171 |
+
$return["mobileunit"] = $get[$key];
|
172 |
+
$get = get_option($this->plugin_slug . '_default_height_addspacers');
|
173 |
+
$return["checkheight"] = $get[$key];
|
174 |
+
$get = get_option($this->plugin_slug . '_default_height_unit_addspacers');
|
175 |
+
$return["checkunit"] = $get[$key];
|
176 |
+
//$get = get_option($this->plugin_slug.'_custom_background_image_upload_addspacers');
|
177 |
+
//$return["bg"] = $get[$key];
|
178 |
+
//$get = get_option($this->plugin_slug . '_background_color_addspacers');
|
179 |
+
//$return["bgcolor"] = $get[$key];
|
180 |
+
$get = get_option($this->plugin_slug . '_spacer_class_addspacers');
|
181 |
+
$return["defaultclasses"] = $get[$key];
|
182 |
+
if(has_filter('spacer_add_to_extras')) {
|
183 |
+
$return = apply_filters('spacer_add_to_extras',$return,$key);
|
184 |
+
}
|
185 |
+
return $return;
|
186 |
+
}
|
187 |
+
|
188 |
+
|
189 |
+
}
|
190 |
+
|
191 |
+
#no associated spacer id found so we return default spacer values
|
192 |
+
$return["mobile_height_default"] = get_option($this->plugin_slug . '_default_height_mobile','');
|
193 |
+
$return["mobile_height"] = get_option($this->plugin_slug . '_default_height_mobile','');
|
194 |
+
$return["mobileunit"] = get_option($this->plugin_slug . '_default_height_mobile_unit','px');
|
195 |
+
$return["checkheight"] = get_option($this->plugin_slug . '_default_height','20');
|
196 |
+
$return["checkunit"] = get_option($this->plugin_slug . '_default_height_unit','px');
|
197 |
+
//$return["bg"] = get_option($this->plugin_slug.'_custom_background_image_upload');
|
198 |
+
//$return["bgcolor"] = get_option($this->plugin_slug.'_background_color');
|
199 |
+
$return["defaultclasses"] = get_option($this->plugin_slug.'_spacer_class','');
|
200 |
+
$return["defaultstyle"] = get_option($this->plugin_slug.'_spacer_style','');
|
201 |
+
if(has_filter('spacer_add_to_default')) {
|
202 |
+
$return = apply_filters('spacer_add_to_default', $return);
|
203 |
+
}
|
204 |
+
|
205 |
+
return $return;
|
206 |
+
}
|
207 |
+
|
208 |
+
// add the shortcode handler
|
209 |
+
function addShortcodeHandler($atts, $content = null) {
|
210 |
+
extract(shortcode_atts(array( "height" => '', "mheight" => '', "class" => '', "id" => '', "style" => '' ), $atts));
|
211 |
+
$activespacer = $this->activespacer($id);
|
212 |
+
|
213 |
+
//prep variables
|
214 |
+
$spacer_css = "";
|
215 |
+
$classes = "";
|
216 |
+
|
217 |
+
//prep mobile height, if it's empty we will use desktop height. if set to 0 we will hide the spacer on mobile devices.
|
218 |
+
$mobile_height = "";
|
219 |
+
$mobile_height_inline = "";
|
220 |
+
$mobile_height_default = $activespacer["mobile_height_default"];
|
221 |
+
|
222 |
+
//first check for inline height, then check default mobile height
|
223 |
+
if(isset($mheight) && $mheight != ""){
|
224 |
+
$mobile_height = $mheight;
|
225 |
+
$mobile_height_inline = $mheight;
|
226 |
+
}elseif(isset($mobile_height_default) && $mobile_height_default != ""){
|
227 |
+
$mobile_height = $activespacer["mobile_height"];
|
228 |
+
$mobile_height_default = $mobile_height;
|
229 |
+
}
|
230 |
+
|
231 |
+
|
232 |
+
//determine the height to use for the spacer. if it's a mobile device and there is a mobile height set, use that. otherwise use desktop height
|
233 |
+
if( function_exists('wp_is_mobile') && wp_is_mobile() && (isset($mobile_height) && $mobile_height != "")) {
|
234 |
+
$mobileunit = $activespacer["mobileunit"];
|
235 |
+
|
236 |
+
|
237 |
+
if(isset($mobile_height_inline) && $mobile_height_inline != "") {
|
238 |
+
if ($mobile_height_inline > 0 ) {
|
239 |
+
$spacer_css .= "padding-top: " . $mobile_height_inline . ";";
|
240 |
+
} elseif($mobile_height_inline < 0) {
|
241 |
+
$spacer_css .= "margin-top: " . $mobile_height_inline . ";";
|
242 |
+
} elseif($mobile_height_inline == 0){
|
243 |
+
$spacer_css .= "display:none;";
|
244 |
+
}
|
245 |
+
} elseif(isset($mobile_height_default) && $mobile_height_default != ""){
|
246 |
+
if($mobile_height_default > 0){
|
247 |
+
$spacer_css .= "padding-top: " . $mobile_height_default . $mobileunit.";";
|
248 |
+
}elseif($mobile_height_default < 0){
|
249 |
+
$spacer_css .= "margin-top: " . $mobile_height_default . $mobileunit. ";";
|
250 |
+
}elseif($mobile_height_default == 0){;
|
251 |
+
$spacer_css .= "display:none;";
|
252 |
+
}
|
253 |
+
}
|
254 |
+
|
255 |
+
} elseif($height=="default"){ //there is no mobile height set. use the desktop default height
|
256 |
+
|
257 |
+
//for now assume positive. in a sec add logic for if negative
|
258 |
+
$checkheight = $activespacer["checkheight"];
|
259 |
+
$checkunit = $activespacer["checkunit"];
|
260 |
+
|
261 |
+
if($checkheight > 0){
|
262 |
+
$spacer_css .= "padding-top: " . $checkheight . $checkunit.";";
|
263 |
+
}elseif($checkheight < 0){
|
264 |
+
$spacer_css .= "margin-top: " . $checkheight . $checkunit. ";";
|
265 |
+
}
|
266 |
+
} elseif ($height > 0 ) { #no default for desktop, use positive inline height
|
267 |
+
$spacer_css .= "padding-top: " . $height . ";";
|
268 |
+
} elseif($height < 0) { #no positive inline for desktop, use negative inline height
|
269 |
+
$spacer_css .= "margin-top: " . $height . ";";
|
270 |
+
}
|
271 |
+
|
272 |
+
|
273 |
+
//custom background image
|
274 |
+
/* $bg = $activespacer["bg"];
|
275 |
+
if(!empty($bg)) {
|
276 |
+
$spacer_css .= "background: url(".$bg.");";
|
277 |
+
}*/
|
278 |
+
|
279 |
+
//custom background image position
|
280 |
+
//$spacer_css .= $this->background_position();
|
281 |
+
|
282 |
+
//background color
|
283 |
+
/* $bgcolor = $activespacer["bgcolor"];
|
284 |
+
if(!empty($bgcolor)) {
|
285 |
+
$spacer_css .= "background-color:".$bgcolor.";";
|
286 |
+
}*/
|
287 |
+
|
288 |
+
//classes
|
289 |
+
$defaultclasses = $activespacer["defaultclasses"];
|
290 |
+
$classes .= $defaultclasses;
|
291 |
+
if(!empty($class)){
|
292 |
+
$classes .= " ".$class;
|
293 |
+
}
|
294 |
+
|
295 |
+
if(has_filter('spacer_add_css')) {
|
296 |
+
$spacer_css = apply_filters('spacer_add_css', $spacer_css, $activespacer);
|
297 |
+
}
|
298 |
+
|
299 |
+
//styles
|
300 |
+
$defaultstyle = $activespacer["defaultstyle"];
|
301 |
+
$spacer_css .= $defaultstyle;
|
302 |
+
if(!empty($style)){
|
303 |
+
$spacer_css .= " ".$style;
|
304 |
+
}
|
305 |
+
|
306 |
+
//create the spacer after all settings have been loaded
|
307 |
+
return '<span class="'.$classes.'" style="display:block;clear:both;height: 0px;'.$spacer_css.'"></span>';
|
308 |
+
}
|
309 |
+
|
310 |
+
function background_position(){
|
311 |
+
$bgposition = get_option($this->plugin_slug.'_custom_background_image_position','repeat');
|
312 |
+
if($bgposition=="repeat"){
|
313 |
+
return "background-repeat:repeat;";
|
314 |
+
} elseif($bgposition=="croptofit"){
|
315 |
+
return "background-size:cover;background-position:center;";
|
316 |
+
} elseif($bgposition=="stretch"){
|
317 |
+
return "background-size: 100% 100%;background-repeat: no-repeat;background-position: center;";
|
318 |
+
} elseif($bgposition=="propstretch"){
|
319 |
+
return "background-size: contain;background-repeat: no-repeat;background-position: center;";
|
320 |
+
}
|
321 |
+
}
|
322 |
+
|
323 |
+
|
324 |
+
function add_custom_button() {
|
325 |
+
if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )
|
326 |
+
return;
|
327 |
+
if ( get_user_option('rich_editing') == 'true') {
|
328 |
+
add_filter('mce_external_plugins', array($this, 'add_custom_tinymce_plugin'),99999999);
|
329 |
+
add_filter('mce_buttons', array($this, 'register_custom_button'),99999999);
|
330 |
+
global $wp_version;
|
331 |
+
//if($wp_version < 3.9){
|
332 |
+
add_action('admin_head', array($this,'motech_spacer_prepjsbuttons'));
|
333 |
+
add_action('wp_head', array($this,'motech_spacer_prepjsbuttons'));
|
334 |
+
//}
|
335 |
+
}
|
336 |
+
|
337 |
+
}
|
338 |
+
|
339 |
+
function register_custom_button($buttons) {
|
340 |
+
array_push($buttons, "|", get_class($this));
|
341 |
+
return $buttons;
|
342 |
+
}
|
343 |
+
|
344 |
+
function add_custom_tinymce_plugin($plugin_array) {
|
345 |
+
global $wp_version;
|
346 |
+
//use this in a plugin
|
347 |
+
if($wp_version >= 3.9){
|
348 |
+
$plugin_array[get_class($this)] = plugins_url( 'editor_plugin.js' , __FILE__ );
|
349 |
+
}else {
|
350 |
+
$plugin_array[get_class($this)] = plugins_url( 'editor_plugin_back.js' , __FILE__ );
|
351 |
+
}
|
352 |
+
//use this in a theme
|
353 |
+
//$plugin_array[get_class($this)] = get_bloginfo('template_url').'/editor_plugin.js';
|
354 |
+
return $plugin_array;
|
355 |
+
}
|
356 |
+
|
357 |
+
function my_refresh_mce($ver) {
|
358 |
+
$ver += 5;
|
359 |
+
return $ver;
|
360 |
+
}
|
361 |
+
|
362 |
+
function plugin_row_links($links, $file) {
|
363 |
+
$plugin = plugin_basename(__FILE__);
|
364 |
+
if ($file == $plugin) // only for this plugin
|
365 |
+
return array_merge( $links,
|
366 |
+
array( '<a target="_blank" href="http://www.clevelandwebdeveloper.com/wordpress-plugins/spacer/">' . __('Project homepage', 'motech-spacer' ) . '</a>' ),
|
367 |
+
array( '<a target="_blank" href="http://www.linkedin.com/in/ClevelandWebDeveloper/">' . __('Find me on LinkedIn', 'motech-spacer' ) . '</a>' ),
|
368 |
+
array( '<a target="_blank" href="http://twitter.com/ClevelandWebDev">' . __('Follow me on Twitter', 'motech-spacer') . '</a>' )
|
369 |
+
);
|
370 |
+
return $links;
|
371 |
+
}
|
372 |
+
|
373 |
+
public function create_admin_page(){
|
374 |
+
?>
|
375 |
+
<div class="wrap" style="position:relative">
|
376 |
+
<h2 class="aplabel"><?php echo $this->plugin_label ?></h2>
|
377 |
+
|
378 |
+
|
379 |
+
<div id="green_ribbon">
|
380 |
+
<div class="grwrap visualartist" style="display:none;">
|
381 |
+
<div id="green_ribbon_top">
|
382 |
+
<div id="green_ribbon_left">
|
383 |
+
</div>
|
384 |
+
<div id="green_ribbon_base">
|
385 |
+
<span id="hms_get_premium" addonname="visualartist"><?php _e('NEW! Get Premium »', 'motech-spacer')?></span>
|
386 |
+
<span class="hms_get_premium_meta"><?php _e('Visual Artist Add-On now available for as low as $20!', 'motech-spacer')?></span>
|
387 |
+
</div>
|
388 |
+
<div id="green_ribbon_right">
|
389 |
+
</div>
|
390 |
+
</div>
|
391 |
+
|
392 |
+
<div class="motech_premium_box">
|
393 |
+
|
394 |
+
|
395 |
+
<div class="motech_premium_box_wrap">
|
396 |
+
<h2><?php _e('Get Visual Artist', 'motech-spacer')?></h2>
|
397 |
+
<div class="updated below-h2" style="margin-bottom: -20px !important;"><p><strong><?php _e('Purchase will be processed via PayPal.', 'motech-spacer')?></strong></p></div>
|
398 |
+
<div class="updated below-h2"><p><strong><?php _e('Every license is valid for the lifetime of the website where it\'s installed.', 'motech-spacer')?></strong></p></div>
|
399 |
+
<div class="motech_purchase_buttons">
|
400 |
+
|
401 |
+
<div class="motech_purchase_button unlimited_use">
|
402 |
+
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input name="cmd" value="_s-xclick" type="hidden"><input name="hosted_button_id" value="FK8RLFRUBCL5N" type="hidden"><input type="hidden" name="page_style" value="visual_artist">
|
403 |
+
<button name="submit">
|
404 |
+
<div class="purchase_graphic"><?php _e('Buy', 'motech-spacer')?> <span><?php _e('Unlimited', 'motech-spacer')?></span></div>
|
405 |
+
<div class="purchase_bubble">
|
406 |
+
<div class="purchase_price">$50</div>
|
407 |
+
<div class="purchase_meta"><?php _e('Unlimited sites forever!', 'motech-spacer')?></div>
|
408 |
+
</div>
|
409 |
+
</button>
|
410 |
+
<img src="https://www.paypal.com/en_US/i/scr/pixel.gif" alt="" border="0" height="1" width="1">
|
411 |
+
</form>
|
412 |
+
</div>
|
413 |
+
|
414 |
+
<div class="motech_purchase_button one_use">
|
415 |
+
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input name="cmd" value="_s-xclick" type="hidden"><input name="hosted_button_id" value="C59XHASJBCHLQ" type="hidden"><input type="hidden" name="page_style" value="visual_artist">
|
416 |
+
<button name="submit">
|
417 |
+
<div class="purchase_graphic"><?php _e('Buy 1 Use', 'motech-spacer')?></div>
|
418 |
+
<div class="purchase_bubble">
|
419 |
+
<div class="purchase_price">$20</div>
|
420 |
+
<div class="purchase_meta"><?php _e('1 site license', 'motech-spacer')?></div>
|
421 |
+
</div>
|
422 |
+
</button>
|
423 |
+
<img src="https://www.paypal.com/en_US/i/scr/pixel.gif" alt="" border="0" height="1" width="1">
|
424 |
+
</form>
|
425 |
+
</div>
|
426 |
+
|
427 |
+
</div>
|
428 |
+
|
429 |
+
<div class="motech_premium_cancel"><span><?php _e('Cancel', 'motech-spacer')?></span></div>
|
430 |
+
|
431 |
+
</div>
|
432 |
+
|
433 |
+
</div>
|
434 |
+
</div>
|
435 |
+
|
436 |
+
|
437 |
+
<div class="grwrap lineonsidesheaders" style="display:none;">
|
438 |
+
|
439 |
+
<div id="green_ribbon_top">
|
440 |
+
<div id="green_ribbon_left">
|
441 |
+
</div>
|
442 |
+
<div id="green_ribbon_base">
|
443 |
+
<span id="hms_get_premium" addonname="lineonsidesheaders"><?php _e('NEW! Get Premium »', 'motech-spacer')?></span>
|
444 |
+
<span class="hms_get_premium_meta"><?php _e('Header Add-On now available for as low as $10!', 'motech-spacer')?></span>
|
445 |
+
</div>
|
446 |
+
<div id="green_ribbon_right">
|
447 |
+
</div>
|
448 |
+
</div>
|
449 |
+
|
450 |
+
<div class="motech_premium_box">
|
451 |
+
|
452 |
+
|
453 |
+
<div class="motech_premium_box_wrap">
|
454 |
+
<h2><?php _e('Get Line-On-Sides Headers', 'motech-spacer')?></h2>
|
455 |
+
<div class="updated below-h2" style="margin-bottom: -20px !important;"><p><strong><?php _e('Purchase will be processed via PayPal.', 'motech-spacer')?></strong></p></div>
|
456 |
+
<div class="updated below-h2"><p><strong><?php _e('Every license is valid for the lifetime of the website where it\'s installed.', 'motech-spacer')?></strong></p></div>
|
457 |
+
<div class="motech_purchase_buttons">
|
458 |
+
|
459 |
+
<div class="motech_purchase_button unlimited_use">
|
460 |
+
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input name="cmd" value="_s-xclick" type="hidden"><input name="hosted_button_id" value="D2R9YPYQHK63L" type="hidden">
|
461 |
+
<button name="submit">
|
462 |
+
<div class="purchase_graphic"><?php _e('Buy', 'motech-spacer')?> <span><?php _e('Unlimited', 'motech-spacer')?></span></div>
|
463 |
+
<div class="purchase_bubble">
|
464 |
+
<div class="purchase_price">$25</div>
|
465 |
+
<div class="purchase_meta"><?php _e('Unlimited sites forever!', 'motech-spacer')?></div>
|
466 |
+
</div>
|
467 |
+
</button>
|
468 |
+
<img src="https://www.paypal.com/en_US/i/scr/pixel.gif" alt="" border="0" height="1" width="1">
|
469 |
+
</form>
|
470 |
+
</div>
|
471 |
+
|
472 |
+
<div class="motech_purchase_button one_use">
|
473 |
+
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input name="cmd" value="_s-xclick" type="hidden"><input name="hosted_button_id" value="F2CNV7FMSGAN8" type="hidden">
|
474 |
+
<button name="submit">
|
475 |
+
<div class="purchase_graphic"><?php _e('Buy 1 Use', 'motech-spacer')?></div>
|
476 |
+
<div class="purchase_bubble">
|
477 |
+
<div class="purchase_price">$10</div>
|
478 |
+
<div class="purchase_meta"><?php _e('1 site license', 'motech-spacer')?></div>
|
479 |
+
</div>
|
480 |
+
</button>
|
481 |
+
<img src="https://www.paypal.com/en_US/i/scr/pixel.gif" alt="" border="0" height="1" width="1">
|
482 |
+
</form>
|
483 |
+
</div>
|
484 |
+
|
485 |
+
</div>
|
486 |
+
|
487 |
+
<div class="motech_premium_cancel"><span><?php _e('Cancel', 'motech-spacer')?></span></div>
|
488 |
+
|
489 |
+
</div>
|
490 |
+
|
491 |
+
</div>
|
492 |
+
</div>
|
493 |
+
|
494 |
+
|
495 |
+
<div class="grwrap panels" style="display:none;">
|
496 |
+
|
497 |
+
<div id="green_ribbon_top">
|
498 |
+
<div id="green_ribbon_left">
|
499 |
+
</div>
|
500 |
+
<div id="green_ribbon_base">
|
501 |
+
<span id="hms_get_premium" addonname="panels"><?php _e('NEW! Get Premium »', 'motech-spacer')?></span>
|
502 |
+
<span class="hms_get_premium_meta"><?php _e('Panels Add-On now available for as low as $10!', 'motech-spacer')?></span>
|
503 |
+
</div>
|
504 |
+
<div id="green_ribbon_right">
|
505 |
+
</div>
|
506 |
+
</div>
|
507 |
+
|
508 |
+
<div class="motech_premium_box">
|
509 |
+
|
510 |
+
|
511 |
+
<div class="motech_premium_box_wrap">
|
512 |
+
<h2><?php _e('Get Panels', 'motech-spacer')?></h2>
|
513 |
+
<div class="updated below-h2" style="margin-bottom: -20px !important;"><p><strong><?php _e('Purchase will be processed via PayPal.', 'motech-spacer')?></strong></p></div>
|
514 |
+
<div class="updated below-h2"><p><strong><?php _e('Every license is valid for the lifetime of the website where it\'s installed.', 'motech-spacer')?></strong></p></div>
|
515 |
+
<div class="motech_purchase_buttons">
|
516 |
+
|
517 |
+
<div class="motech_purchase_button unlimited_use">
|
518 |
+
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input name="cmd" value="_s-xclick" type="hidden"><input name="hosted_button_id" value="ZV77J555HXJTE" type="hidden">
|
519 |
+
<button name="submit">
|
520 |
+
<div class="purchase_graphic"><?php _e('Buy', 'motech-spacer')?> <span><?php _e('Unlimited', 'motech-spacer')?></span></div>
|
521 |
+
<div class="purchase_bubble">
|
522 |
+
<div class="purchase_price">$25</div>
|
523 |
+
<div class="purchase_meta"><?php _e('Unlimited sites forever!', 'motech-spacer')?></div>
|
524 |
+
</div>
|
525 |
+
</button>
|
526 |
+
<img src="https://www.paypal.com/en_US/i/scr/pixel.gif" alt="" border="0" height="1" width="1">
|
527 |
+
</form>
|
528 |
+
</div>
|
529 |
+
|
530 |
+
<div class="motech_purchase_button one_use">
|
531 |
+
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input name="cmd" value="_s-xclick" type="hidden"><input name="hosted_button_id" value="GNBBYMDBN3UUE" type="hidden">
|
532 |
+
<button name="submit">
|
533 |
+
<div class="purchase_graphic"><?php _e('Buy 1 Use', 'motech-spacer')?></div>
|
534 |
+
<div class="purchase_bubble">
|
535 |
+
<div class="purchase_price">$10</div>
|
536 |
+
<div class="purchase_meta"><?php _e('1 site license', 'motech-spacer')?></div>
|
537 |
+
</div>
|
538 |
+
</button>
|
539 |
+
<img src="https://www.paypal.com/en_US/i/scr/pixel.gif" alt="" border="0" height="1" width="1">
|
540 |
+
</form>
|
541 |
+
</div>
|
542 |
+
|
543 |
+
</div>
|
544 |
+
|
545 |
+
<div class="motech_premium_cancel"><span><?php _e('Cancel', 'motech-spacer')?></span></div>
|
546 |
+
|
547 |
+
</div>
|
548 |
+
|
549 |
+
</div>
|
550 |
+
</div>
|
551 |
+
|
552 |
+
|
553 |
+
</div>
|
554 |
+
|
555 |
+
<div class="grwrap draftit">
|
556 |
+
|
557 |
+
<div id="green_ribbon_top">
|
558 |
+
<div id="green_ribbon_left">
|
559 |
+
</div>
|
560 |
+
<div id="green_ribbon_base">
|
561 |
+
<span id="hms_get_premium" addonname="gotourl" useurl="http://www.clevelandwebdeveloper.com/?p=1269&utm_medium=plugin&utm_source=plugin-notice-msg&utm_campaign=Spacer+Notice+Msg&utm_content=Draftit+Notice"><?php _e('NEW! Get Draft It! »', 'motech-spacer')?></span>
|
562 |
+
<span class="hms_get_premium_meta"><?php _e('Draft It! Add-On now available for as low as $19!', 'motech-spacer')?></span>
|
563 |
+
</div>
|
564 |
+
<div id="green_ribbon_right">
|
565 |
+
</div>
|
566 |
+
</div>
|
567 |
+
|
568 |
+
</div>
|
569 |
+
|
570 |
+
|
571 |
+
<h2 class="nav-tab-wrapper">
|
572 |
+
<a href="#defaultspacer" class="nav-tab nav-tab-active"><?php _e('Default', 'motech-spacer')?></a>
|
573 |
+
<a href="#addspacers" class="nav-tab"><span class="dashicons dashicons-plus dashicons-plus-alt"></span> <?php _e('Add Spacers', 'motech-spacer')?></a>
|
574 |
+
<?php do_action( 'spacer_sectiontabhook' ); #use this hook to add additional section tabs ?>
|
575 |
+
<a href="#suggestionbox" class="nav-tab"><span class="dashicons dashicons-email-alt"></span> <?php _e('Suggestion Box', 'motech-spacer')?></a>
|
576 |
+
<a href="#addons" class="nav-tab"><span class="dashicons dashicons-admin-plugins"></span> <?php _e('Add-Ons', 'motech-spacer')?></a>
|
577 |
+
<a href="#licenses" class="nav-tab"><span class="dashicons dashicons-admin-network"></span> <?php _e('Licenses', 'motech-spacer')?></a>
|
578 |
+
<?php /*?> <a href="#privacy-settings" class="nav-tab">Privacy settings</a>
|
579 |
+
<a href="#admin-custom" class="nav-tab">Admin Customizations</a>
|
580 |
+
<a href="#smtp" class="nav-tab">Smtp Settings</a><?php */?>
|
581 |
+
</h2>
|
582 |
+
|
583 |
+
<form method="post" action="options.php" class="<?php echo $this->plugin_slug ?>_form">
|
584 |
+
<?php
|
585 |
+
// This prints out all hidden setting fields
|
586 |
+
settings_fields($this->plugin_slug.'_option_group');
|
587 |
+
?>
|
588 |
+
<div id="defaultspacer" class="metabox-holder mainsection aspacerunit">
|
589 |
+
<div class="motech-spacer-options section general wrap" style="border-bottom: solid 1px #BFBFBF;padding-bottom: 3px;">
|
590 |
+
<?php do_settings_sections($this->plugin_slug.'-setting-admin'); ?>
|
591 |
+
</div>
|
592 |
+
<div class="motech-spacer-options section mobileoptions" style="border-bottom: solid 1px #BFBFBF;padding-bottom: 3px;">
|
593 |
+
<?php do_settings_sections($this->plugin_slug.'-setting-admin_mobileoptions'); ?>
|
594 |
+
</div>
|
595 |
+
<div class="motech-spacer-options section styleoptions">
|
596 |
+
<?php do_settings_sections($this->plugin_slug.'-setting-admin_styleoptions'); ?>
|
597 |
+
</div>
|
598 |
+
<?php
|
599 |
+
if(has_filter('spacer_default_sections')) {
|
600 |
+
apply_filters('spacer_default_sections', '',$this);
|
601 |
+
}
|
602 |
+
?>
|
603 |
+
<div class="spacer_preview_area_container">
|
604 |
+
<h2><?php _e('Preview', 'motech-spacer')?></h2>
|
605 |
+
<div class="spacer_preview_area">
|
606 |
+
<p><?php _e('Sample text before Spacer', 'motech-spacer')?></p>
|
607 |
+
<span class="spacer_preview" style="display:block;clear:both;height: 0px;padding-top: 20px;"></span>
|
608 |
+
<p><?php _e('Sample text after Spacer', 'motech-spacer')?></p>
|
609 |
+
</div>
|
610 |
+
</div>
|
611 |
+
<div class="hidden" style="display:none;"><?php do_settings_sections($this->plugin_slug.'-setting-admin_hdoptions'); ?></div>
|
612 |
+
</div>
|
613 |
+
<div id="addspacers" class="metabox-holder mainsection hidden wrap">
|
614 |
+
<h2 style="padding-bottom:20px;"><?php _e('Add New Spacers', 'motech-spacer')?></h2>
|
615 |
+
<div class="nothinghere hidden"><div style="font-weight: bold;font-size: 127px;line-height: normal;margin-bottom: 10px;">:-(</div><div style="font-size: 19px; line-height: normal;margin-bottom: 30px;"><?php _e('You don\'t have any additional Spacers yet', 'motech-spacer')?></div></div>
|
616 |
+
<?php
|
617 |
+
$key_array = $this->key_array;
|
618 |
+
$getoption = get_option($this->plugin_slug.'_title_addspacers','');
|
619 |
+
foreach($key_array as $key=>$value){
|
620 |
+
if(isset($getoption[$key])){
|
621 |
+
$gettitle = $getoption[$key];
|
622 |
+
}
|
623 |
+
if(empty($gettitle)){
|
624 |
+
$gettitle = "Untitled";
|
625 |
+
}
|
626 |
+
?>
|
627 |
+
<div class="aspacerunit addspacerunit postbox closed">
|
628 |
+
<button type="button" class="handlediv button-link" aria-expanded="true"><span class="toggle-indicator" aria-hidden="true"></span></button>
|
629 |
+
<h2 class="hndle ui-sortable-handle"><span><?php echo $gettitle ?></span></h2>
|
630 |
+
<div class="inside">
|
631 |
+
<div class="motech-spacer-options section title" style="border-bottom: solid 1px #eee;padding-bottom: 3px;">
|
632 |
+
<?php do_settings_sections($this->plugin_slug.'-setting-admin_title_addspacers'.$key); ?>
|
633 |
+
</div>
|
634 |
+
<div class="motech-spacer-options section general" style="border-bottom: solid 1px #eee;padding-bottom: 3px;">
|
635 |
+
<?php do_settings_sections($this->plugin_slug.'-setting-admin_addspacers'.$key); ?>
|
636 |
+
</div>
|
637 |
+
<div class="motech-spacer-options section mobileoptions" style="border-bottom: solid 1px #eee;padding-bottom: 3px;">
|
638 |
+
<?php do_settings_sections($this->plugin_slug.'-setting-admin_mobileoptions_addspacers'.$key); ?>
|
639 |
+
</div>
|
640 |
+
<div class="motech-spacer-options section styleoptions">
|
641 |
+
<?php do_settings_sections($this->plugin_slug.'-setting-admin_styleoptions_addspacers'.$key); ?>
|
642 |
+
</div>
|
643 |
+
<?php
|
644 |
+
if(has_filter('spacer_addspacer_sections'.$key)) {
|
645 |
+
apply_filters('spacer_addspacer_sections'.$key, '',$key);
|
646 |
+
}
|
647 |
+
?>
|
648 |
+
<div class="spacer_preview_area_container">
|
649 |
+
<h2><?php _e('Preview', 'motech-spacer')?></h2>
|
650 |
+
<div class="spacer_preview_area">
|
651 |
+
<p><?php _e('Sample text before Spacer', 'motech-spacer')?></p>
|
652 |
+
<span class="spacer_preview" style="display:block;clear:both;height: 0px;padding-top: 20px;"></span>
|
653 |
+
<p><?php _e('Sample text after Spacer', 'motech-spacer')?></p>
|
654 |
+
</div>
|
655 |
+
</div>
|
656 |
+
<div class="hiddenx" style="display:none;">
|
657 |
+
<?php do_settings_sections($this->plugin_slug.'-setting-admin_hd_addspacers'.$key); ?>
|
658 |
+
</div>
|
659 |
+
<div class="removebutton"><span class="dashicons dashicons-post-trash"></span> <?php _e('REMOVE', 'motech-spacer') ?></div>
|
660 |
+
</div>
|
661 |
+
</div>
|
662 |
+
<?php } ?>
|
663 |
+
|
664 |
+
<div class="newbutton"><span class="dashicons dashicons-plus dashicons-plus-alt"></span> <?php _e('NEW SPACER', 'motech-spacer') ?></div>
|
665 |
+
|
666 |
+
|
667 |
+
</div>
|
668 |
+
<?php do_action( 'spacer_sectionshook' ); #use this hook to add additional sections ?>
|
669 |
+
<div id="addons" class="metabox-holder mainsection hidden wrap">
|
670 |
+
<?php
|
671 |
+
$actionbutton = '<a href="#" title="'.__('Buy Visual Artist', 'motech-spacer').'" class="button-primary msbutton buynowbutton" addonname="visualartist">'.__('Buy Now', 'motech-spacer').'</a>';
|
672 |
+
if( is_plugin_active( 'spacer-visual-artist/index.php' ) ) {
|
673 |
+
$actionbutton = '<a href="javascript:void(0)" title="'.__('Active', 'motech-spacer').'" class="button-secondary msbutton">'.__('Active', 'motech-spacer').'</a>';
|
674 |
+
} elseif( file_exists(plugin_dir_path(__FILE__) . '../spacer-visual-artist/index.php') ) {
|
675 |
+
$actionbutton = '<a href="javascript:void(0)" title="'.__('Installed', 'motech-spacer').'" class="button-secondary msbutton">'.__('Installed', 'motech-spacer').'</a>';
|
676 |
+
}
|
677 |
+
?>
|
678 |
+
<div class="msaddon mscol"><img src="<?php echo plugins_url( 'images/vart.png' , __FILE__ ) ?>"><h2><?php _e('Visual Artist', 'motech-spacer') ?></h2><div class="msaddon-content"><p><?php _e('Design fancy dividers, horizontal rules, and other ornate section breaks. Incorporate rich colors and images, all without mastering css.', 'motech-spacer') ?></p><div class="msaddon-buttons"><a href="http://www.clevelandwebdeveloper.com/?p=644&utm_medium=plugin&utm_source=plugin-addons-page&utm_campaign=Spacers+Addons+Page&utm_content=Spacer+Learn" target="_blank" class="button-secondary msdbutton"><?php _e('Learn More', 'motech-spacer') ?></a><?php echo $actionbutton ?></div></div></div>
|
679 |
+
|
680 |
+
<?php
|
681 |
+
$actionbutton = '<a href="#" title="'.__('Buy Line-On-Sides Headers', 'motech-spacer').'" class="button-primary msbutton buynowbutton" addonname="lineonsidesheaders">'.__('Buy Now', 'motech-spacer').'</a>';
|
682 |
+
if( is_plugin_active( 'spacer-lineonsides-headers/index.php' ) ) {
|
683 |
+
$actionbutton = '<a href="javascript:void(0)" title="'.__('Active', 'motech-spacer').'" class="button-secondary msbutton">'.__('Active', 'motech-spacer').'</a>';
|
684 |
+
} elseif( file_exists(plugin_dir_path(__FILE__) . '../spacer-lineonsides-headers/index.php') ) {
|
685 |
+
$actionbutton = '<a href="javascript:void(0)" title="'.__('Installed', 'motech-spacer').'" class="button-secondary msbutton">'.__('Installed', 'motech-spacer').'</a>';
|
686 |
+
}
|
687 |
+
?>
|
688 |
+
<div class="msaddon mscol"><img src="<?php echo plugins_url( 'images/lhart.png' , __FILE__ ) ?>"><h2><?php _e('Line-On-Sides Headers', 'motech-spacer') ?></h2><div class="msaddon-content"><p><?php _e('Create headers that really stand out with lines on the sides.', 'motech-spacer') ?></p><div class="msaddon-buttons"><a href="http://www.clevelandwebdeveloper.com/?p=868&utm_medium=plugin&utm_source=plugin-addons-page&utm_campaign=Spacers+Addons+Page&utm_content=Lineonsides+Learn" target="_blank" class="button-secondary msdbutton"><?php _e('Learn More', 'motech-spacer') ?></a><?php echo $actionbutton ?></div></div></div>
|
689 |
+
|
690 |
+
<?php
|
691 |
+
$actionbutton = '<a href="#" title="'.__('Buy Panels', 'motech-spacer').'" class="button-primary msbutton buynowbutton" addonname="panels">'.__('Buy Now', 'motech-spacer').'</a>';
|
692 |
+
if( is_plugin_active( 'spacer-panels/index.php' ) ) {
|
693 |
+
$actionbutton = '<a href="javascript:void(0)" title="'.__('Active', 'motech-spacer').'" class="button-secondary msbutton">'.__('Active', 'motech-spacer').'</a>';
|
694 |
+
} elseif( file_exists(plugin_dir_path(__FILE__) . '../spacer-panels/index.php') ) {
|
695 |
+
$actionbutton = '<a href="javascript:void(0)" title="'.__('Installed', 'motech-spacer').'" class="button-secondary msbutton">'.__('Installed', 'motech-spacer').'</a>';
|
696 |
+
}
|
697 |
+
?>
|
698 |
+
<div class="msaddon mscol"><img src="<?php echo plugins_url( 'images/part.png' , __FILE__ ) ?>"><h2><?php _e('Panels', 'motech-spacer') ?></h2><div class="msaddon-content"><p><?php _e('Style your own panels (think alerts, info boxes) and use them in your posts and pages whenever they are needed.', 'motech-spacer') ?></p><div class="msaddon-buttons"><a href="http://www.clevelandwebdeveloper.com/?p=931&utm_medium=plugin&utm_source=plugin-addons-page&utm_campaign=Spacers+Addons+Page&utm_content=Panels+Learn" target="_blank" class="button-secondary msdbutton"><?php _e('Learn More', 'motech-spacer') ?></a><?php echo $actionbutton ?></div></div></div>
|
699 |
+
|
700 |
+
<?php
|
701 |
+
$actionbutton = '<a href="http://www.clevelandwebdeveloper.com/?p=1269&utm_medium=plugin&utm_source=plugin-addons-page&utm_campaign=Spacers+Addons+Page&utm_content=Draftit+Learn" target="_blank" title="'.__('Buy Draft It!', 'motech-spacer').'" class="button-primary msbutton">'.__('Buy Now', 'motech-spacer').'</a>';
|
702 |
+
if( is_plugin_active( 'spacer-draftit/index.php' ) ) {
|
703 |
+
$actionbutton = '<a href="javascript:void(0)" title="'.__('Active', 'motech-spacer').'" class="button-secondary msbutton">'.__('Active', 'motech-spacer').'</a>';
|
704 |
+
} elseif( file_exists(plugin_dir_path(__FILE__) . '../spacer-draftit/index.php') ) {
|
705 |
+
$actionbutton = '<a href="javascript:void(0)" title="'.__('Installed', 'motech-spacer').'" class="button-secondary msbutton">'.__('Installed', 'motech-spacer').'</a>';
|
706 |
+
}
|
707 |
+
?>
|
708 |
+
<div class="msaddon mscol"><img src="<?php echo plugins_url( 'images/diart.png' , __FILE__ ) ?>"><h2><?php _e('Draft It!', 'motech-spacer') ?></h2><div class="msaddon-content"><p><?php _e("Take more time as you craft article updates. Designate 'draft' content with one-click!", "motech-spacer") ?></p><div class="msaddon-buttons"><a href="http://www.clevelandwebdeveloper.com/?p=1269&utm_medium=plugin&utm_source=plugin-addons-page&utm_campaign=Spacers+Addons+Page&utm_content=Draftit+Learn" target="_blank" class="button-secondary msdbutton"><?php _e('Learn More', 'motech-spacer') ?></a><?php echo $actionbutton ?></div></div></div>
|
709 |
+
|
710 |
+
</div>
|
711 |
+
<div id="licenses" class="metabox-holder mainsection hidden wrap">
|
712 |
+
<div class="motech-spacer-options section general wrap">
|
713 |
+
<?php do_settings_sections($this->plugin_slug.'-setting-admin_licenses'); ?>
|
714 |
+
</div>
|
715 |
+
</div>
|
716 |
+
<div id="suggestionbox" class="metabox-holder mainsection hidden wrap">
|
717 |
+
<div class="motech-spacer-options section general wrap">
|
718 |
+
<h1>Have a good suggestion for a Spacer add-on or a feature request? Let's hear it...</h1>
|
719 |
+
<?php
|
720 |
+
global $current_user;
|
721 |
+
wp_get_current_user();
|
722 |
+
?>
|
723 |
+
<textarea style="width:100%;min-height:250px;" name="mysuggestion" placeholder="Suggestions go here"></textarea>
|
724 |
+
<div style="font-size:20px;line-height:normal;margin: 25px 0px;margin-bottom: 35px;"><input type="checkbox" name="signmeup" value="yes" checked="checked">Yes, I want to subscribe to the Spacer newsletter and be the first to know of important Spacer news and upcoming releases. I want to stay notified about exclusive discounts and insider deals on premium features. My email address is: <input type="text" name="myemail" value="<?php echo $current_user->user_email ?>" /> <div style="font-size:14px;">(The Spacer newsletter is personally written and sent out about once a month (at most). It's not remotely annoying or spammy. We promise.)</div></div>
|
725 |
+
<div class="sendhook">
|
726 |
+
<div class="newbutton readysend"><span class="dashicons dashicons-email-alt"></span> <span class="readysendlabel"><?php _e('SEND', 'motech-spacer') ?></span></div>
|
727 |
+
<div class="responsehook" style="margin-top: -20px;padding: 15px;margin-left: 10px;margin-right: 10px;background: rgb(252, 248, 227); color: rgb(138, 109, 59);border: 1px solid rgb(252, 220, 126);border-radius: 3px;display:none;"></div>
|
728 |
+
</div>
|
729 |
+
</div>
|
730 |
+
</div>
|
731 |
+
<div class="wrap"><div class="savebutton"><button type="submit"><span class="dashicons dashicons-yes"></span> <?php _e('SAVE CHANGES!', 'motech-spacer') ?></button></div></div>
|
732 |
+
</form>
|
733 |
+
</div>
|
734 |
+
<?php
|
735 |
+
}
|
736 |
+
|
737 |
+
public function DisplayAddSpacers(){
|
738 |
+
$key_array = $this->key_array;
|
739 |
+
foreach($key_array as $key=>$value){
|
740 |
+
add_settings_section(
|
741 |
+
$this->plugin_slug.'_setting_section',
|
742 |
+
__('', 'motech-spacer'),
|
743 |
+
false,
|
744 |
+
$this->plugin_slug.'-setting-admin_title_addspacers'.$key
|
745 |
+
);
|
746 |
+
|
747 |
+
add_settings_section(
|
748 |
+
$this->plugin_slug.'_setting_section',
|
749 |
+
__('', 'motech-spacer'),
|
750 |
+
false,
|
751 |
+
$this->plugin_slug.'-setting-admin_hd_addspacers'.$key
|
752 |
+
);
|
753 |
+
|
754 |
+
//add text input field
|
755 |
+
$field_slug = "title_addspacers";
|
756 |
+
$field_label = __('Spacer Title', 'motech-spacer');
|
757 |
+
$field_id = $this->plugin_slug.'_'.$field_slug;
|
758 |
+
register_setting($this->plugin_slug.'_option_group', $field_id);
|
759 |
+
add_settings_field(
|
760 |
+
$field_id,
|
761 |
+
$field_label,
|
762 |
+
array($this, 'create_a_text_input_array'), //callback function for text input
|
763 |
+
$this->plugin_slug.'-setting-admin_title_addspacers'.$key,
|
764 |
+
$this->plugin_slug.'_setting_section',
|
765 |
+
array( // The array of arguments to pass to the callback.
|
766 |
+
"id" => $field_id, //sends field id to callback
|
767 |
+
"key" => $key,
|
768 |
+
"class" => "addingspacer",
|
769 |
+
"desc" => __('Give this Spacer a title.', 'motech-spacer'), //description of the field (optional)
|
770 |
+
"placeholder" => __('eg: Medium Spacer', 'motech-spacer')
|
771 |
+
//"default" => '20' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
772 |
+
)
|
773 |
+
);
|
774 |
+
|
775 |
+
//add text input field
|
776 |
+
$field_slug = "addspacer_id";
|
777 |
+
$field_label = "Spacer ID";
|
778 |
+
$field_id = $this->plugin_slug.'_'.$field_slug;
|
779 |
+
register_setting($this->plugin_slug.'_option_group', $field_id);
|
780 |
+
$desc = "";
|
781 |
+
add_settings_field(
|
782 |
+
$field_id,
|
783 |
+
$field_label,
|
784 |
+
array($this, 'create_a_text_input_array'), //callback function for text input
|
785 |
+
$this->plugin_slug.'-setting-admin_hd_addspacers'.$key,
|
786 |
+
$this->plugin_slug.'_setting_section',
|
787 |
+
array( // The array of arguments to pass to the callback.
|
788 |
+
"id" => $field_id, //sends field id to callback
|
789 |
+
"key" => $key,
|
790 |
+
"class" => "hmshidden addspacer_id",
|
791 |
+
"desc" => $desc, //description of the field (optional)
|
792 |
+
)
|
793 |
+
);
|
794 |
+
|
795 |
+
add_settings_section(
|
796 |
+
$this->plugin_slug.'_setting_section',
|
797 |
+
__('', 'motech-spacer'),
|
798 |
+
false,
|
799 |
+
$this->plugin_slug.'-setting-admin_addspacers'.$key
|
800 |
+
);
|
801 |
+
|
802 |
+
//add text input field
|
803 |
+
$field_slug = "default_height_addspacers";
|
804 |
+
$field_label = __('Default Height', 'motech-spacer');
|
805 |
+
$field_id = $this->plugin_slug.'_'.$field_slug;
|
806 |
+
register_setting($this->plugin_slug.'_option_group', $field_id);
|
807 |
+
add_settings_field(
|
808 |
+
$field_id,
|
809 |
+
$field_label,
|
810 |
+
array($this, 'create_a_text_input_array'), //callback function for text input
|
811 |
+
$this->plugin_slug.'-setting-admin_addspacers'.$key,
|
812 |
+
$this->plugin_slug.'_setting_section',
|
813 |
+
array( // The array of arguments to pass to the callback.
|
814 |
+
"id" => $field_id, //sends field id to callback
|
815 |
+
"key" => $key,
|
816 |
+
"class" => 'sheight',
|
817 |
+
"desc" => __('Set a default height. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
|
818 |
+
"placeholder" => __('eg: 20', 'motech-spacer'),
|
819 |
+
"default" => '20' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
820 |
+
)
|
821 |
+
);
|
822 |
+
|
823 |
+
//add a select input field
|
824 |
+
$field_slug = "default_height_unit_addspacers";
|
825 |
+
$field_label = __('Height Unit', 'motech-spacer');
|
826 |
+
$field_id = $this->plugin_slug.'_'.$field_slug;
|
827 |
+
$this->unit_options = array(
|
828 |
+
array("label" => "px", "value" => "px"),
|
829 |
+
array("label" => "em", "value" => "em"),
|
830 |
+
array("label" => "rem", "value" => "rem"),
|
831 |
+
array("label" => "%", "value" => "%"),
|
832 |
+
);
|
833 |
+
register_setting($this->plugin_slug.'_option_group', $field_id);
|
834 |
+
add_settings_field(
|
835 |
+
$field_id,
|
836 |
+
$field_label,
|
837 |
+
array($this, 'create_a_select_input_array'), //callback function for select input
|
838 |
+
$this->plugin_slug.'-setting-admin_addspacers'.$key,
|
839 |
+
$this->plugin_slug.'_setting_section',
|
840 |
+
array( // The array of arguments to pass to the callback.
|
841 |
+
"id" => $field_id, //sends select field id to callback
|
842 |
+
"default" => 'px', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
843 |
+
"desc" => __('Select a unit of measurement to use with your default spacer height.', 'motech-spacer'), //description of the field (optional)
|
844 |
+
"key" => $key,
|
845 |
+
"class" => "msunit",
|
846 |
+
"meta" => 'style="max-width:450px;"',
|
847 |
+
"select_options" => $this->unit_options //sets select option data
|
848 |
+
)
|
849 |
+
);
|
850 |
+
|
851 |
+
add_settings_section(
|
852 |
+
$this->plugin_slug.'_setting_section',
|
853 |
+
__('', 'motech-spacer'),
|
854 |
+
false,
|
855 |
+
$this->plugin_slug.'-setting-admin_mobileoptions_addspacers'.$key
|
856 |
+
);
|
857 |
+
|
858 |
+
//add text input field
|
859 |
+
$field_slug = "default_height_mobile_addspacers";
|
860 |
+
$field_label = __('Default Height On Mobile (Optional)', 'motech-spacer');
|
861 |
+
$field_id = $this->plugin_slug.'_'.$field_slug;
|
862 |
+
register_setting($this->plugin_slug.'_option_group', $field_id);
|
863 |
+
add_settings_field(
|
864 |
+
$field_id,
|
865 |
+
$field_label,
|
866 |
+
array($this, 'create_a_text_input_array'), //callback function for text input
|
867 |
+
$this->plugin_slug.'-setting-admin_mobileoptions_addspacers'.$key,
|
868 |
+
$this->plugin_slug.'_setting_section',
|
869 |
+
array( // The array of arguments to pass to the callback.
|
870 |
+
"id" => $field_id, //sends field id to callback
|
871 |
+
"desc" => __('Set the default height on mobile devices. If left empty, the mobile height will be the same as the desktop height. If set to 0, the spacer will be hidden on mobile.', 'motech-spacer'), //description of the field (optional)
|
872 |
+
"key" => $key,
|
873 |
+
"placeholder" => __('eg: 10', 'motech-spacer'),
|
874 |
+
"default" => '' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
875 |
+
)
|
876 |
+
);
|
877 |
+
|
878 |
+
//add a select input field
|
879 |
+
$field_slug = "default_height_mobile_unit_addspacers";
|
880 |
+
$field_label = __('Height Unit On Mobile', 'motech-spacer');
|
881 |
+
$field_id = $this->plugin_slug.'_'.$field_slug;
|
882 |
+
$this->unit_options = array(
|
883 |
+
array("label" => "px", "value" => "px"),
|
884 |
+
array("label" => "em", "value" => "em"),
|
885 |
+
array("label" => "rem", "value" => "rem"),
|
886 |
+
array("label" => "%", "value" => "%"),
|
887 |
+
);
|
888 |
+
register_setting($this->plugin_slug.'_option_group', $field_id);
|
889 |
+
add_settings_field(
|
890 |
+
$field_id,
|
891 |
+
$field_label,
|
892 |
+
array($this, 'create_a_select_input_array'), //callback function for select input
|
893 |
+
$this->plugin_slug.'-setting-admin_mobileoptions_addspacers'.$key,
|
894 |
+
$this->plugin_slug.'_setting_section',
|
895 |
+
array( // The array of arguments to pass to the callback.
|
896 |
+
"id" => $field_id, //sends select field id to callback
|
897 |
+
"default" => 'px', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
898 |
+
"desc" => __('Select a unit of measurement to use with your default spacer height on mobile devices. This only applies if you have a default spacer height set for mobile.', 'motech-spacer'), //description of the field (optional)
|
899 |
+
"key" => $key,
|
900 |
+
"class"=> "msunitmobile",
|
901 |
+
"meta" => 'style="max-width:450px;"',
|
902 |
+
"select_options" => $this->unit_options //sets select option data
|
903 |
+
)
|
904 |
+
);
|
905 |
+
|
906 |
+
add_settings_section(
|
907 |
+
$this->plugin_slug.'_setting_section',
|
908 |
+
__('', 'motech-spacer'),
|
909 |
+
false,
|
910 |
+
$this->plugin_slug.'-setting-admin_styleoptions_addspacers'.$key
|
911 |
+
);
|
912 |
+
|
913 |
+
//add text input field
|
914 |
+
$field_slug = "spacer_class_addspacers";
|
915 |
+
$field_label = __('Default Class (Optional)', 'motech-spacer');
|
916 |
+
$field_id = $this->plugin_slug.'_'.$field_slug;
|
917 |
+
register_setting($this->plugin_slug.'_option_group', $field_id);
|
918 |
+
add_settings_field(
|
919 |
+
$field_id,
|
920 |
+
$field_label,
|
921 |
+
array($this, 'create_a_text_input_array'), //callback function for text input
|
922 |
+
$this->plugin_slug.'-setting-admin_styleoptions_addspacers'.$key,
|
923 |
+
$this->plugin_slug.'_setting_section',
|
924 |
+
array( // The array of arguments to pass to the callback.
|
925 |
+
"id" => $field_id, //sends field id to callback
|
926 |
+
"desc" => __('Enter a custom css class to apply to all of your spacer elements. Multiple classes can be added by putting a blank space between each class name', 'motech-spacer'), //description of the field (optional)
|
927 |
+
"key" => $key,
|
928 |
+
"placeholder" => __('eg: MyClass1 Class2', 'motech-spacer')
|
929 |
+
)
|
930 |
+
);
|
931 |
+
|
932 |
+
//add textarea input field
|
933 |
+
$field_slug = "spacer_style_addspacers";
|
934 |
+
$field_label = __('Style (Optional)', 'motech-spacer');
|
935 |
+
$field_id = $this->plugin_slug.'_'.$field_slug;
|
936 |
+
register_setting($this->plugin_slug.'_option_group', $field_id);
|
937 |
+
add_settings_field(
|
938 |
+
$field_id,
|
939 |
+
$field_label,
|
940 |
+
array($this, 'create_a_textarea_input_array'), //callback function for textarea input
|
941 |
+
$this->plugin_slug.'-setting-admin_styleoptions_addspacers'.$key,
|
942 |
+
$this->plugin_slug.'_setting_section',
|
943 |
+
array( // The array of arguments to pass to the callback.
|
944 |
+
"id" => $field_id, //sends field id to callback
|
945 |
+
"desc" => __('Enter custom css to apply to all of your spacer elements. This is for advanced users. Just leave this empty if you\'re not sure what this means or if you don\'t have a use for it.<br><span style="color:red">NEW:</span> Want to create visually stunning divider elements, without needing to know any CSS? See <a href="http://www.clevelandwebdeveloper.com/wordpress-plugins/visual-artist/?utm_medium=plugin&utm_source=plugin-settings-page&utm_campaign=Spacers+Settings+Page&utm_content=Spacer+Inline" target="_blank">examples of what you can do with the Visual Artist add-on »</a><br>Ready to make your own? <a href="#" class="buynowbutton" addonname="visualartist">Buy It Now »</a>', 'motech-spacer'), //description of the field (optional)
|
946 |
+
"key" => $key,
|
947 |
+
"class" => 'msstyle',
|
948 |
+
"placeholder" => __('(for example)', 'motech-spacer').' border-top: solid 2px black; border-bottom: solid 2px black; margin-bottom: 25px;' //sets the field placeholder which appears when the field is empty (optional)
|
949 |
+
)
|
950 |
+
);
|
951 |
+
|
952 |
+
//add text input field
|
953 |
+
$field_slug = "addspacer_index";
|
954 |
+
$field_label = "Add Spacer index";
|
955 |
+
$field_id = $this->plugin_slug.'_'.$field_slug;
|
956 |
+
register_setting($this->plugin_slug.'_option_group', $field_id);
|
957 |
+
$desc = "";
|
958 |
+
add_settings_field(
|
959 |
+
$field_id,
|
960 |
+
$field_label,
|
961 |
+
array($this, 'create_a_text_input'), //callback function for text input
|
962 |
+
$this->plugin_slug.'-setting-admin_hdoptions',
|
963 |
+
$this->plugin_slug.'_setting_section',
|
964 |
+
array( // The array of arguments to pass to the callback.
|
965 |
+
"id" => $field_id, //sends field id to callback
|
966 |
+
"class" => "hmshidden",
|
967 |
+
"default" => "1",
|
968 |
+
"desc" => $desc, //description of the field (optional)
|
969 |
+
)
|
970 |
+
);
|
971 |
+
|
972 |
+
}
|
973 |
+
|
974 |
+
}
|
975 |
+
|
976 |
+
public function DisplayMobileOptions(){
|
977 |
+
add_settings_section(
|
978 |
+
$this->plugin_slug.'_setting_section',
|
979 |
+
__('', 'motech-spacer'),
|
980 |
+
false,
|
981 |
+
$this->plugin_slug.'-setting-admin_mobileoptions'
|
982 |
+
);
|
983 |
+
|
984 |
+
//add text input field
|
985 |
+
$field_slug = "default_height_mobile";
|
986 |
+
$field_label = __('Default Spacer Height On Mobile (Optional)', 'motech-spacer');
|
987 |
+
$field_id = $this->plugin_slug.'_'.$field_slug;
|
988 |
+
register_setting($this->plugin_slug.'_option_group', $field_id);
|
989 |
+
add_settings_field(
|
990 |
+
$field_id,
|
991 |
+
$field_label,
|
992 |
+
array($this, 'create_a_text_input'), //callback function for text input
|
993 |
+
$this->plugin_slug.'-setting-admin_mobileoptions',
|
994 |
+
$this->plugin_slug.'_setting_section',
|
995 |
+
array( // The array of arguments to pass to the callback.
|
996 |
+
"id" => $field_id, //sends field id to callback
|
997 |
+
"desc" => __('Set the default spacer height on mobile devices. If left empty, the spacer mobile height will be the same as the spacer desktop height. If set to 0, the spacer will be hidden on mobile.', 'motech-spacer'), //description of the field (optional)
|
998 |
+
"placeholder" => __('eg: 10', 'motech-spacer'),
|
999 |
+
"default" => '' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
1000 |
+
)
|
1001 |
+
);
|
1002 |
+
|
1003 |
+
//add a select input field
|
1004 |
+
$field_slug = "default_height_mobile_unit";
|
1005 |
+
$field_label = __('Spacer Height Unit On Mobile', 'motech-spacer');
|
1006 |
+
$field_id = $this->plugin_slug.'_'.$field_slug;
|
1007 |
+
$this->unit_options = array(
|
1008 |
+
array("label" => "px", "value" => "px"),
|
1009 |
+
array("label" => "em", "value" => "em"),
|
1010 |
+
array("label" => "rem", "value" => "rem"),
|
1011 |
+
array("label" => "%", "value" => "%"),
|
1012 |
+
);
|
1013 |
+
register_setting($this->plugin_slug.'_option_group', $field_id);
|
1014 |
+
add_settings_field(
|
1015 |
+
$field_id,
|
1016 |
+
$field_label,
|
1017 |
+
array($this, 'create_a_select_input'), //callback function for select input
|
1018 |
+
$this->plugin_slug.'-setting-admin_mobileoptions',
|
1019 |
+
$this->plugin_slug.'_setting_section',
|
1020 |
+
array( // The array of arguments to pass to the callback.
|
1021 |
+
"id" => $field_id, //sends select field id to callback
|
1022 |
+
"default" => 'px', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
1023 |
+
"desc" => __('Select a unit of measurement to use with your default spacer height on mobile devices. This only applies if you have a default spacer height set for mobile.', 'motech-spacer'), //description of the field (optional)
|
1024 |
+
"meta" => 'style="max-width:450px;"',
|
1025 |
+
"select_options" => $this->unit_options //sets select option data
|
1026 |
+
)
|
1027 |
+
);
|
1028 |
+
}
|
1029 |
+
|
1030 |
+
public function DisplayStyleOptions(){
|
1031 |
+
add_settings_section(
|
1032 |
+
$this->plugin_slug.'_setting_section',
|
1033 |
+
__('', 'motech-spacer'),
|
1034 |
+
false,
|
1035 |
+
$this->plugin_slug.'-setting-admin_styleoptions'
|
1036 |
+
);
|
1037 |
+
|
1038 |
+
//add text input field
|
1039 |
+
$field_slug = "spacer_class";
|
1040 |
+
$field_label = __('Default Spacer Class (Optional)', 'motech-spacer');
|
1041 |
+
$field_id = $this->plugin_slug.'_'.$field_slug;
|
1042 |
+
register_setting($this->plugin_slug.'_option_group', $field_id);
|
1043 |
+
add_settings_field(
|
1044 |
+
$field_id,
|
1045 |
+
$field_label,
|
1046 |
+
array($this, 'create_a_text_input'), //callback function for text input
|
1047 |
+
$this->plugin_slug.'-setting-admin_styleoptions',
|
1048 |
+
$this->plugin_slug.'_setting_section',
|
1049 |
+
array( // The array of arguments to pass to the callback.
|
1050 |
+
"id" => $field_id, //sends field id to callback
|
1051 |
+
"desc" => __('Enter a custom css class to apply to all of your spacer elements. Multiple classes can be added by putting a blank space between each class name', 'motech-spacer'), //description of the field (optional)
|
1052 |
+
"placeholder" => __('eg: MyClass1 Class2', 'motech-spacer')
|
1053 |
+
)
|
1054 |
+
);
|
1055 |
+
|
1056 |
+
//add textarea input field
|
1057 |
+
$field_slug = "spacer_style";
|
1058 |
+
$field_label = __('Spacer Style (Optional)', 'motech-spacer');
|
1059 |
+
$field_id = $this->plugin_slug.'_'.$field_slug;
|
1060 |
+
register_setting($this->plugin_slug.'_option_group', $field_id);
|
1061 |
+
add_settings_field(
|
1062 |
+
$field_id,
|
1063 |
+
$field_label,
|
1064 |
+
array($this, 'create_a_textarea_input'), //callback function for textarea input
|
1065 |
+
$this->plugin_slug.'-setting-admin_styleoptions',
|
1066 |
+
$this->plugin_slug.'_setting_section',
|
1067 |
+
array( // The array of arguments to pass to the callback.
|
1068 |
+
"id" => $field_id, //sends field id to callback
|
1069 |
+
"desc" => __('Enter custom css to apply to all of your spacer elements. This is for advanced users. Just leave this empty if you\'re not sure what this means or if you don\'t have a use for it.<br><span style="color:red">NEW:</span> Want to create visually stunning divider elements, without needing to know any CSS? See <a href="http://www.clevelandwebdeveloper.com/wordpress-plugins/visual-artist/?utm_medium=plugin&utm_source=plugin-settings-page&utm_campaign=Spacers+Settings+Page&utm_content=Spacer+Inline" target="_blank">examples of what you can do with the Visual Artist add-on »</a><br>Ready to make your own? <a href="#" class="buynowbutton" addonname="visualartist">Buy It Now »</a>', 'motech-spacer'), //description of the field (optional)
|
1070 |
+
"placeholder" => __('(for example)', 'motech-spacer').' border-top: solid 2px black; border-bottom: solid 2px black; margin-bottom: 25px;' //sets the field placeholder which appears when the field is empty (optional)
|
1071 |
+
)
|
1072 |
+
);
|
1073 |
+
|
1074 |
+
if(has_filter('spacer_default_settings')) {
|
1075 |
+
apply_filters('spacer_default_settings','',$this);
|
1076 |
+
}
|
1077 |
+
|
1078 |
+
add_settings_section(
|
1079 |
+
$this->plugin_slug.'_setting_section',
|
1080 |
+
__('', 'motech-spacer'),
|
1081 |
+
false,
|
1082 |
+
$this->plugin_slug.'-setting-admin_hdoptions'
|
1083 |
+
);
|
1084 |
+
}
|
1085 |
+
|
1086 |
+
public function page_init(){
|
1087 |
+
|
1088 |
+
//register other settings sections
|
1089 |
+
$this->DisplayMobileOptions();
|
1090 |
+
$this->DisplayStyleOptions();
|
1091 |
+
$this->DisplayAddSpacers();
|
1092 |
+
do_action( 'spacer_sectionfieldhook', $this ); #use this hook to add additional field sections
|
1093 |
+
|
1094 |
+
|
1095 |
+
add_settings_section(
|
1096 |
+
$this->plugin_slug.'_setting_section',
|
1097 |
+
__('Configure Default Spacer', 'motech-spacer'),
|
1098 |
+
array($this, 'print_section_info'),
|
1099 |
+
$this->plugin_slug.'-setting-admin'
|
1100 |
+
);
|
1101 |
+
|
1102 |
+
add_settings_section(
|
1103 |
+
$this->plugin_slug.'_setting_section',
|
1104 |
+
__('Licenses', 'motech-spacer'),
|
1105 |
+
array($this, 'print_section_info_licenses'),
|
1106 |
+
$this->plugin_slug.'-setting-admin_licenses'
|
1107 |
+
);
|
1108 |
+
|
1109 |
+
if(has_filter('spacer_licenses_settings')) {
|
1110 |
+
apply_filters('spacer_licenses_settings','',$this);
|
1111 |
+
}
|
1112 |
+
|
1113 |
+
//add text input field
|
1114 |
+
$field_slug = "default_height";
|
1115 |
+
$field_label = __('Default Spacer Height', 'motech-spacer');
|
1116 |
+
$field_id = $this->plugin_slug.'_'.$field_slug;
|
1117 |
+
register_setting($this->plugin_slug.'_option_group', $field_id);
|
1118 |
+
add_settings_field(
|
1119 |
+
$field_id,
|
1120 |
+
$field_label,
|
1121 |
+
array($this, 'create_a_text_input'), //callback function for text input
|
1122 |
+
$this->plugin_slug.'-setting-admin',
|
1123 |
+
$this->plugin_slug.'_setting_section',
|
1124 |
+
array( // The array of arguments to pass to the callback.
|
1125 |
+
"id" => $field_id, //sends field id to callback
|
1126 |
+
"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
|
1127 |
+
"placeholder" => __('eg: 20', 'motech-spacer'),
|
1128 |
+
"default" => '20' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
1129 |
+
)
|
1130 |
+
);
|
1131 |
+
|
1132 |
+
//add a select input field
|
1133 |
+
$field_slug = "default_height_unit";
|
1134 |
+
$field_label = __('Spacer Height Unit', 'motech-spacer');
|
1135 |
+
$field_id = $this->plugin_slug.'_'.$field_slug;
|
1136 |
+
$this->unit_options = array(
|
1137 |
+
array("label" => "px", "value" => "px"),
|
1138 |
+
array("label" => "em", "value" => "em"),
|
1139 |
+
array("label" => "rem", "value" => "rem"),
|
1140 |
+
array("label" => "%", "value" => "%"),
|
1141 |
+
);
|
1142 |
+
register_setting($this->plugin_slug.'_option_group', $field_id);
|
1143 |
+
add_settings_field(
|
1144 |
+
$field_id,
|
1145 |
+
$field_label,
|
1146 |
+
array($this, 'create_a_select_input'), //callback function for select input
|
1147 |
+
$this->plugin_slug.'-setting-admin',
|
1148 |
+
$this->plugin_slug.'_setting_section',
|
1149 |
+
array( // The array of arguments to pass to the callback.
|
1150 |
+
"id" => $field_id, //sends select field id to callback
|
1151 |
+
"default" => 'px', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
1152 |
+
"desc" => __('Select a unit of measurement to use with your default spacer height.', 'motech-spacer'), //description of the field (optional)
|
1153 |
+
"meta" => 'style="max-width:450px;"',
|
1154 |
+
"select_options" => $this->unit_options //sets select option data
|
1155 |
+
)
|
1156 |
+
);
|
1157 |
+
|
1158 |
+
|
1159 |
+
//add radio option
|
1160 |
+
//$option_id = "status";
|
1161 |
+
//add_settings_field($option_id, 'Status', array($this, 'create_radio_field'), 'wordpresshidesite-setting-admin', 'setting_section_id', array("option_id" => $option_id));
|
1162 |
+
|
1163 |
+
} //end page_init
|
1164 |
+
|
1165 |
+
|
1166 |
+
/**
|
1167 |
+
* This following set of functions handle all input field creation
|
1168 |
+
*
|
1169 |
+
*/
|
1170 |
+
function create_image_upload($args) {
|
1171 |
+
?>
|
1172 |
+
<?php
|
1173 |
+
//set default value if applicable
|
1174 |
+
if(isset($args["default"])) {
|
1175 |
+
$default = $args["default"];
|
1176 |
+
} else {
|
1177 |
+
$default = false;
|
1178 |
+
}
|
1179 |
+
if(isset($args["meta"])) {
|
1180 |
+
$meta = $args["meta"];
|
1181 |
+
} else {
|
1182 |
+
$meta = "";
|
1183 |
+
}
|
1184 |
+
?>
|
1185 |
+
<input class="motech_upload_image" type="text" name="<?php echo $args["id"] ?>" value="<?php echo get_option($args["id"], $default) ?>" <?php echo $meta ?> />
|
1186 |
+
<input class="motech_upload_image_button" class="button" type="button" value="<?php _e('Upload Image', 'motech-spacer')?>" />
|
1187 |
+
<br />
|
1188 |
+
<?php
|
1189 |
+
if(isset($args["desc"])) {
|
1190 |
+
echo "<span class='description'>".$args["desc"]."</span>";
|
1191 |
+
} else {
|
1192 |
+
echo "<span class='description'>".__('Enter a URL or upload an image.', 'motech-spacer')."</span>";
|
1193 |
+
}
|
1194 |
+
?>
|
1195 |
+
<?php /*?> <?php
|
1196 |
+
$current_image = get_option($args["id"],$default);
|
1197 |
+
if(!empty($current_image)) {
|
1198 |
+
echo "<span class='motech_spacer_preview_image_container'><br><strong>".__('Image Preview', 'motech-spacer')."</strong><br><span class='motech_spacer_preview_image' style='background-size: contain;background-position: 0% 0%;background-repeat: no-repeat;margin-left:20px;display:block; width:75px; height: 75px;background-image:url(".$current_image.");'></span></span>";
|
1199 |
+
}
|
1200 |
+
?><?php */?>
|
1201 |
+
<?php
|
1202 |
+
} // end create_image_upload
|
1203 |
+
|
1204 |
+
function create_image_upload_array($args) {
|
1205 |
+
?>
|
1206 |
+
<?php
|
1207 |
+
//set default value if applicable
|
1208 |
+
if(isset($args["default"])) {
|
1209 |
+
$default = $args["default"];
|
1210 |
+
} else {
|
1211 |
+
$default = false;
|
1212 |
+
}
|
1213 |
+
$key = $args["key"];
|
1214 |
+
$getarray = get_option($args["id"]);
|
1215 |
+
if(!isset($getarray[$key])){
|
1216 |
+
//$getarray[$key] = "";
|
1217 |
+
$usevalue = "";
|
1218 |
+
} else {
|
1219 |
+
$usevalue = $getarray[$key];
|
1220 |
+
}
|
1221 |
+
?>
|
1222 |
+
<input class="motech_upload_image" type="text" name="<?php echo $args["id"]."[".$key."]" ?>" value="<?php echo $usevalue ?>" />
|
1223 |
+
<input class="motech_upload_image_button" class="button" type="button" value="<?php _e('Upload Image', 'motech-spacer')?>" />
|
1224 |
+
<br />
|
1225 |
+
<?php
|
1226 |
+
if(isset($args["desc"])) {
|
1227 |
+
echo "<span class='description'>".$args["desc"]."</span>";
|
1228 |
+
} else {
|
1229 |
+
echo "<span class='description'>".__('Enter a URL or upload an image.', 'motech-spacer')."</span>";
|
1230 |
+
}
|
1231 |
+
?>
|
1232 |
+
<?php /*?> <?php
|
1233 |
+
$current_image = $getarray[$key];
|
1234 |
+
if(!empty($current_image)) {
|
1235 |
+
echo "<span class='motech_spacer_preview_image_container'><br><strong>".__('Image Preview', 'motech-spacer')."</strong><br><span class='motech_spacer_preview_image' style='background-size: contain;background-position: 0% 0%;background-repeat: no-repeat;margin-left:20px;display:block; width:75px; height: 75px;background-image:url(".$current_image.");'></span>";
|
1236 |
+
}
|
1237 |
+
?><?php */?>
|
1238 |
+
<?php
|
1239 |
+
} // end create_image_upload
|
1240 |
+
|
1241 |
+
function create_a_checkbox($args) {
|
1242 |
+
$html = '<input type="checkbox" id="' . $args["id"] . '" name="' . $args["id"] . '" value="1" ' . checked(1, get_option($args["id"], $args["default"]), false) . '/>';
|
1243 |
+
|
1244 |
+
// Here, we will take the desc argument of the array and add it to a label next to the checkbox
|
1245 |
+
$html .= '<label for="' . $args["id"] . '"> ' . $args["desc"] . '</label>';
|
1246 |
+
|
1247 |
+
echo $html;
|
1248 |
+
|
1249 |
+
} // end create_a_checkbox
|
1250 |
+
|
1251 |
+
function create_a_text_input($args) {
|
1252 |
+
//grab placeholder if there is one
|
1253 |
+
if(isset($args["placeholder"])) {
|
1254 |
+
$placeholder_html = "placeholder=\"".$args["placeholder"]."\"";
|
1255 |
+
} else {
|
1256 |
+
$placeholder_html = "";
|
1257 |
+
}
|
1258 |
+
//grab maxlength if there is one
|
1259 |
+
if(isset($args["maxlength"])) {
|
1260 |
+
$max_length_html = "maxlength=\"".$args["maxlength"]."\"";
|
1261 |
+
} else {
|
1262 |
+
$max_length_html = "";
|
1263 |
+
}
|
1264 |
+
if(isset($args["default"])) {
|
1265 |
+
$default = $args["default"];
|
1266 |
+
} else {
|
1267 |
+
$default = false;
|
1268 |
+
}
|
1269 |
+
if(!isset($args["class"])){
|
1270 |
+
$args["class"] = "";
|
1271 |
+
}
|
1272 |
+
// Render the output
|
1273 |
+
echo '<input type="text" ' . $placeholder_html . $max_length_html . ' id="' . $args["id"] . '" class="' . $args["class"]. '" name="' . $args["id"] . '" value="' . get_option($args["id"], $default) . '" />';
|
1274 |
+
if(isset($args["desc"])) {
|
1275 |
+
echo "<p class='description'>".$args["desc"]."</p>";
|
1276 |
+
}
|
1277 |
+
|
1278 |
+
|
1279 |
+
} // end create_a_text_input
|
1280 |
+
|
1281 |
+
function create_a_text_input_array($args) {
|
1282 |
+
//grab placeholder if there is one
|
1283 |
+
if(isset($args["placeholder"])) {
|
1284 |
+
$placeholder_html = "placeholder=\"".$args["placeholder"]."\"";
|
1285 |
+
} else {
|
1286 |
+
$placeholder_html = "";
|
1287 |
+
}
|
1288 |
+
//grab maxlength if there is one
|
1289 |
+
if(isset($args["maxlength"])) {
|
1290 |
+
$max_length_html = "maxlength=\"".$args["maxlength"]."\"";
|
1291 |
+
} else {
|
1292 |
+
$max_length_html = "";
|
1293 |
+
}
|
1294 |
+
if(isset($args["default"])) {
|
1295 |
+
$usevalue = $args["default"];
|
1296 |
+
}
|
1297 |
+
if(!isset($args["class"])){
|
1298 |
+
$args["class"] = "";
|
1299 |
+
}
|
1300 |
+
$key = $args["key"];
|
1301 |
+
$getarray = get_option($args["id"]);
|
1302 |
+
if(!isset($getarray[$key])){
|
1303 |
+
//$getarray[$key] = "";
|
1304 |
+
$usevalue = "";
|
1305 |
+
} else {
|
1306 |
+
$usevalue = $getarray[$key];
|
1307 |
+
}
|
1308 |
+
// Render the output
|
1309 |
+
echo '<input type="text" ' . $placeholder_html . $max_length_html . ' class="' . $args["class"]. '" name="' . $args["id"] . '['.$key.']" value="' . $usevalue . '" />';
|
1310 |
+
//echo '<input type="text" ' . ' name="' . $args["id"] . '['.$key.']" value="' . $value . '" />';
|
1311 |
+
if(isset($args["desc"])) {
|
1312 |
+
echo "<p class='description'>".$args["desc"]."</p>";
|
1313 |
+
}
|
1314 |
+
|
1315 |
+
|
1316 |
+
} // end create_a_text_input
|
1317 |
+
|
1318 |
+
function create_a_textarea_input($args) {
|
1319 |
+
//grab placeholder if there is one
|
1320 |
+
if($args["placeholder"]) {
|
1321 |
+
$placeholder_html = "placeholder=\"".$args["placeholder"]."\"";
|
1322 |
+
} else {
|
1323 |
+
$placeholder_html = "";
|
1324 |
+
}
|
1325 |
+
//get default value if there is one
|
1326 |
+
if(isset($args["default"])) {
|
1327 |
+
$default = $args["default"];
|
1328 |
+
} else {
|
1329 |
+
$default = false;
|
1330 |
+
}
|
1331 |
+
// Render the output
|
1332 |
+
echo '<textarea ' . $placeholder_html . ' id="' . $args["id"] . '" name="' . $args["id"] . '" rows="5" cols="50">' . get_option($args["id"], $default) . '</textarea>';
|
1333 |
+
if($args["desc"]) {
|
1334 |
+
echo "<p class='description'>".$args["desc"]."</p>";
|
1335 |
+
}
|
1336 |
+
}
|
1337 |
+
|
1338 |
+
function create_a_textarea_input_array($args) {
|
1339 |
+
//grab placeholder if there is one
|
1340 |
+
if($args["placeholder"]) {
|
1341 |
+
$placeholder_html = "placeholder=\"".$args["placeholder"]."\"";
|
1342 |
+
} else {
|
1343 |
+
$placeholder_html = "";
|
1344 |
+
}
|
1345 |
+
//get default value if there is one
|
1346 |
+
if(isset($args["default"])) {
|
1347 |
+
$default = $args["default"];
|
1348 |
+
} else {
|
1349 |
+
$default = false;
|
1350 |
+
}
|
1351 |
+
if(!isset($args["class"])){
|
1352 |
+
$args["class"] = "";
|
1353 |
+
}
|
1354 |
+
$key = $args["key"];
|
1355 |
+
$getarray = get_option($args["id"], $default);
|
1356 |
+
if(!isset($getarray[$key])){
|
1357 |
+
//$getarray[$key] = "";
|
1358 |
+
$usevalue = "";
|
1359 |
+
} else {
|
1360 |
+
$usevalue = $getarray[$key];
|
1361 |
+
}
|
1362 |
+
// Render the output
|
1363 |
+
echo '<textarea ' . $placeholder_html . ' id="' . $args["id"] . $args["key"] .'" class="' . $args["class"]. '" name="' . $args["id"] . '['.$key.']" rows="5" cols="50">' . $usevalue . '</textarea>';
|
1364 |
+
if($args["desc"]) {
|
1365 |
+
echo "<p class='description'>".$args["desc"]."</p>";
|
1366 |
+
}
|
1367 |
+
}
|
1368 |
+
|
1369 |
+
function create_a_radio_input($args) {
|
1370 |
+
|
1371 |
+
$radio_options = $args["radio_options"];
|
1372 |
+
$html = "";
|
1373 |
+
if($args["desc"]) {
|
1374 |
+
$html .= $args["desc"] . "<br>";
|
1375 |
+
}
|
1376 |
+
//get default value if there is one
|
1377 |
+
if(isset($args["default"])) {
|
1378 |
+
$default = $args["default"];
|
1379 |
+
} else {
|
1380 |
+
$default = false;
|
1381 |
+
}
|
1382 |
+
foreach($radio_options as $radio_option) {
|
1383 |
+
$html .= '<input type="radio" id="' . $args["id"] . '_' . $radio_option["value"] . '" name="' . $args["id"] . '" value="'.$radio_option["value"].'" ' . checked($radio_option["value"], get_option($args['id'], $default), false) . '/>';
|
1384 |
+
$html .= '<label for="' . $args["id"] . '_' . $radio_option["value"] . '"> '.$radio_option["label"].'</label><br>';
|
1385 |
+
}
|
1386 |
+
|
1387 |
+
echo $html;
|
1388 |
+
|
1389 |
+
} // end create_a_radio_input callback
|
1390 |
+
|
1391 |
+
function create_a_select_input($args) {
|
1392 |
+
|
1393 |
+
$select_options = $args["select_options"];
|
1394 |
+
$html = "";
|
1395 |
+
//get default value if there is one
|
1396 |
+
if(isset($args["default"])) {
|
1397 |
+
$default = $args["default"];
|
1398 |
+
} else {
|
1399 |
+
$default = false;
|
1400 |
+
}
|
1401 |
+
if(isset($args["meta"])) {
|
1402 |
+
$meta = $args["meta"];
|
1403 |
+
} else {
|
1404 |
+
$meta = "";
|
1405 |
+
}
|
1406 |
+
$html .= '<select id="' . $args["id"] . '" name="' . $args["id"] . '" ' . $meta . '" >';
|
1407 |
+
foreach($select_options as $select_option) {
|
1408 |
+
$html .= '<option value="'.$select_option["value"].'" ' . selected( $select_option["value"], get_option($args["id"], $default), false) . '>'.$select_option["label"].'</option>';
|
1409 |
+
}
|
1410 |
+
$html .= '</select>';
|
1411 |
+
if(isset($args["desc"])) {
|
1412 |
+
$html .= "<p class='description'>".$args["desc"]."</p>";
|
1413 |
+
}
|
1414 |
+
echo $html;
|
1415 |
+
|
1416 |
+
} // end create_a_select_input callback
|
1417 |
+
|
1418 |
+
function create_a_select_input_array($args) {
|
1419 |
+
|
1420 |
+
$select_options = $args["select_options"];
|
1421 |
+
$html = "";
|
1422 |
+
//get default value if there is one
|
1423 |
+
if(isset($args["default"])) {
|
1424 |
+
$usevalue = $args["default"];
|
1425 |
+
} else {
|
1426 |
+
//$default = false;
|
1427 |
+
}
|
1428 |
+
if(isset($args["meta"])) {
|
1429 |
+
$meta = $args["meta"];
|
1430 |
+
} else {
|
1431 |
+
$meta = "";
|
1432 |
+
}
|
1433 |
+
if(!isset($args["class"])){
|
1434 |
+
$args["class"] = "";
|
1435 |
+
}
|
1436 |
+
$key = $args["key"];
|
1437 |
+
$getarray = get_option($args["id"]);
|
1438 |
+
if(!isset($getarray[$key])){
|
1439 |
+
//$getarray[$key] = "";
|
1440 |
+
} else {
|
1441 |
+
$usevalue = $getarray[$key];
|
1442 |
+
}
|
1443 |
+
$html .= '<select id="' . $args["id"] . $args["key"] . '" class="' . $args["class"]. '" name="' . $args["id"]. '['.$key.']" ' . $meta . '" >';
|
1444 |
+
foreach($select_options as $select_option) {
|
1445 |
+
$html .= '<option value="'.$select_option["value"].'" ' . selected( $select_option["value"], $usevalue, false) . '>'.$select_option["label"].'</option>';
|
1446 |
+
}
|
1447 |
+
$html .= '</select>';
|
1448 |
+
if(isset($args["desc"])) {
|
1449 |
+
$html .= "<p class='description'>".$args["desc"]."</p>";
|
1450 |
+
}
|
1451 |
+
echo $html;
|
1452 |
+
|
1453 |
+
} // end create_a_select_input callback
|
1454 |
+
|
1455 |
+
public function print_section_info(){ //section summary info goes here
|
1456 |
+
//print 'This is the where you set the password for your site.';
|
1457 |
+
}
|
1458 |
+
|
1459 |
+
public function print_section_info_licenses(){ //section summary info goes here
|
1460 |
+
if(!has_filter('spacer_licenses_settings')) {
|
1461 |
+
_e('To activate licenses for Spacer add ons you must first install and activate the chosen add on. License settings will then appear below.', 'motech-spacer');
|
1462 |
+
}
|
1463 |
+
}
|
1464 |
+
|
1465 |
+
public function add_plugin_page(){
|
1466 |
+
// This page will be under "Settings"
|
1467 |
+
add_options_page('Settings Admin', $this->plugin_label, 'manage_options', $this->plugin_slug.'-setting-admin', array($this, 'create_admin_page'));
|
1468 |
+
}
|
1469 |
+
|
1470 |
+
//add plugin action links logic
|
1471 |
+
function add_plugin_action_links( $links ) {
|
1472 |
+
|
1473 |
+
|
1474 |
+
return array_merge(
|
1475 |
+
array(
|
1476 |
+
'settings' => '<a href="' . get_bloginfo( 'wpurl' ) . '/wp-admin/options-general.php?page='.$this->plugin_slug.'-setting-admin">'.__('Settings', 'motech-spacer').'</a>'
|
1477 |
+
),
|
1478 |
+
$links
|
1479 |
+
);
|
1480 |
+
|
1481 |
+
}
|
1482 |
+
|
1483 |
+
function motech_imagepicker_admin_css() {
|
1484 |
+
if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') { //if we are on our admin page
|
1485 |
+
?>
|
1486 |
+
<style>
|
1487 |
+
.motech_spacer_preview_image { -moz-transition: all .5s ease-out;
|
1488 |
+
-o-transition: all .5s ease-out;
|
1489 |
+
transition: all .5s ease-out;}
|
1490 |
+
.spacer_preview_area_container h2 {margin-bottom:3px;}
|
1491 |
+
.addspacerunit .spacer_preview_area_container h2 {font-size:1.3em;font-weight:bold; padding-bottom: 0px; margin-bottom: -3px;}
|
1492 |
+
.spacer_preview_area { min-height: 75px; overflow: hidden;
|
1493 |
+
background: white;
|
1494 |
+
padding-left: 25px;
|
1495 |
+
padding-top: 1px;
|
1496 |
+
padding-bottom: 11px;
|
1497 |
+
padding-right: 25px;box-shadow: 0 1px 1px rgba(0,0,0,.04); border: #e5e5e5 solid 1px;}
|
1498 |
+
.spacer_preview {-moz-transition: all .5s ease-out;-o-transition: all .5s ease-out;transition: all .5s ease-out;}
|
1499 |
+
.spacer_preview_area p {
|
1500 |
+
font-size: 15px;}
|
1501 |
+
.nothinghere {text-align:center;color:#9C9C98;}
|
1502 |
+
.newbutton,.removebutton,.savebutton {
|
1503 |
+
font-family: Helvetica,Verdana,sans-serif!important;
|
1504 |
+
margin: 10px;
|
1505 |
+
background: #3ba0ff;
|
1506 |
+
color:#fff;
|
1507 |
+
display:block;
|
1508 |
+
font-weight:700;
|
1509 |
+
font-size:14px;
|
1510 |
+
padding:10px;
|
1511 |
+
text-shadow:none;
|
1512 |
+
text-align: center;cursor:pointer; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none;
|
1513 |
+
user-select: none; transition: background 300ms ease-out;
|
1514 |
+
}
|
1515 |
+
.motech-spacer-options.general h3{
|
1516 |
+
font-size: 23px !important;
|
1517 |
+
font-weight: normal;
|
1518 |
+
padding-left: 0px;
|
1519 |
+
}
|
1520 |
+
.newbutton:hover{background:#1E7CD4;}
|
1521 |
+
.newbutton{margin-bottom:50px;}
|
1522 |
+
.removebutton{background:red;margin-top: 27px; margin-bottom: 26px;}
|
1523 |
+
.removebutton:hover{background:#a00;}
|
1524 |
+
.js .postbox .handlediv { background: transparent;float: right;
|
1525 |
+
border: 0;
|
1526 |
+
outline: 0;}
|
1527 |
+
.js .postbox .handlediv .toggle-indicator:before {
|
1528 |
+
margin-top: 4px;
|
1529 |
+
width: 20px;
|
1530 |
+
-webkit-border-radius: 50%;
|
1531 |
+
border-radius: 50%;
|
1532 |
+
text-indent: -1px;
|
1533 |
+
}
|
1534 |
+
.savebutton {padding: 0px;background:#45CE58;margin-top: 40px;}
|
1535 |
+
.savebutton:hover {background:#39b54a;}
|
1536 |
+
.savebutton button{width: 100%;
|
1537 |
+
border: 0;
|
1538 |
+
outline: 0;
|
1539 |
+
padding: 10px;
|
1540 |
+
background: none;
|
1541 |
+
cursor: pointer;
|
1542 |
+
color: white;}
|
1543 |
+
.savebutton .dashicons{
|
1544 |
+
font-size: 28px;
|
1545 |
+
position: relative;
|
1546 |
+
top: -4px;
|
1547 |
+
left: -2px;
|
1548 |
+
}
|
1549 |
+
.js .postbox .toggle-indicator:before, .js .sidebar-name .sidebar-name-arrow:before {
|
1550 |
+
content: "\f142";
|
1551 |
+
display: inline-block;
|
1552 |
+
font: 400 20px/1 dashicons;
|
1553 |
+
speak: none;
|
1554 |
+
-webkit-font-smoothing: antialiased;
|
1555 |
+
-moz-osx-font-smoothing: grayscale;
|
1556 |
+
text-decoration: none!important;
|
1557 |
+
}
|
1558 |
+
.js .postbox.closed .handlediv .toggle-indicator:before, .js .widgets-holder-wrap.closed .sidebar-name-arrow:before {
|
1559 |
+
content: "\f140";
|
1560 |
+
}
|
1561 |
+
.motech_spacer_form .postbox.closed .hndle {border-bottom: 1px solid #ccd0d4;}
|
1562 |
+
.motech_spacer_form .postbox .hndle {cursor:pointer;font-size: 14px;
|
1563 |
+
font-weight: bold;
|
1564 |
+
padding: 8px 12px;
|
1565 |
+
line-height: 1.4;
|
1566 |
+
border-bottom: 1px solid #eee;}
|
1567 |
+
.hmshidden {display:none;}
|
1568 |
+
#wpbody h3 {font-size:20px;}
|
1569 |
+
#hide_my_site_current_theme {display:none;}
|
1570 |
+
div.updated.success {background-color: rgb(169, 252, 169);border-color: rgb(85, 151, 85);}
|
1571 |
+
.mvalid {background-color: rgb(169, 252, 169);border-color: rgb(85, 151, 85);width: 127px;font-weight: bold;padding-left: 10px;border: solid 1px rgb(85, 151, 85);border-radius: 3px;}
|
1572 |
+
.motech_premium_only {color:red;}
|
1573 |
+
#green_ribbon_top {position:relative;z-index:2;}
|
1574 |
+
#green_ribbon_left {background:url(<?php echo $this->plugin_dir ?>/images/green_ribbon_left.png) no-repeat -11px 0px;width: 80px;height: 60px;float: left;}
|
1575 |
+
#green_ribbon_right {background:url(<?php echo $this->plugin_dir ?>/images/green_ribbon_right.png) no-repeat;width: 80px;height: 60px;position: absolute;top: 0px;right: -10px;}
|
1576 |
+
#green_ribbon_base {background:url(<?php echo $this->plugin_dir ?>/images/green_ribbon_base.png) repeat-x;height: 60px;margin-left: 49px;margin-right: 70px;}
|
1577 |
+
#green_ribbon_base span {display: inline-block;color: white;position: relative;top: 11px;height: 35px; line-height:33px;font-size: 17px;font-weight: bold;font-style: italic;text-shadow: 1px 3px 2px #597c2a;}
|
1578 |
+
#hms_get_premium {background: rgb(58, 80, 27);background: rgba(58, 80, 27, 0.73);cursor:pointer;padding: 0px 12px;margin-left: -17px;font-style: normal !important;margin-right: 12px;text-shadow: 1px 3px 2px #364C18 !important;}
|
1579 |
+
#hms_get_premium:hover {background:rgb(30, 43, 12);background:rgba(30, 43, 12, 0.73);text-shadow: 1px 3px 2px #21310B !important;}
|
1580 |
+
.motech_premium_box {background:url(<?php echo $this->plugin_dir ?>/images/premium_back.png); margin-left: 49px;padding-top: 29px;padding-bottom:36px;margin-right: 70px;position:relative;top:-16px;display:none;}
|
1581 |
+
.motech_premium_box_wrap {margin-left:20px; margin-right:20px;}
|
1582 |
+
.motech_premium_box h2 {text-align: center;color: #585858;font-size: 36px;text-shadow: 1px 3px 2px #acabab;}
|
1583 |
+
.motech_premium_box .updated {margin-bottom: 20px !important;margin-top: 29px !important;}
|
1584 |
+
.motech_premium_box button {background: none;border: none; position:relative;cursor: pointer;overflow: visible;}
|
1585 |
+
.motech_purchase_button .purchase_graphic {background:url(<?php echo $this->plugin_dir ?>/images/buy_sprite.png) no-repeat;height: 100px;width: 101px;background-position: -17px -24px;color: white;font-size: 22px;padding: 20px 42px;padding-top: 57px;text-shadow: 1px 1px 7px black;position: absolute;top: -80px;left: -80px;line-height:normal;font-family: 'Open Sans', sans-serif;}
|
1586 |
+
.redeem_info{margin-top:20px;display:none;}
|
1587 |
+
.motech_purchase_button.unlimited_use .purchase_graphic {width: 115px;padding: 21px 36px;padding-top: 57px;}
|
1588 |
+
.motech_purchase_button.unlimited_use .purchase_graphic span {font-weight:bold;}
|
1589 |
+
.motech_purchase_button .purchase_bubble {background: white;border-radius: 9px;width: 350px;height: 123px;margin-bottom: 5px;-webkit-transition: all .2s ease-out; -moz-transition: all .2s ease-out;-o-transition: all .2s ease-out;transition: all .2s ease-out;}
|
1590 |
+
.motech_purchase_button:hover .purchase_bubble { background-color: #99dcf8;box-shadow:2px 3px 2px rgba(0, 0, 0, 0.31);}
|
1591 |
+
.motech_purchase_button.three_use:hover .purchase_bubble { background-color: #96f5e4;}
|
1592 |
+
.motech_purchase_button.unlimited_use:hover .purchase_bubble { background-color: #f8c4c6;}
|
1593 |
+
.motech_purchase_buttons {padding-top:90px;text-align:center;}
|
1594 |
+
.motech_purchase_button {display:inline-block;margin-right: 100px;vertical-align:top;}
|
1595 |
+
.motech_purchase_button .purchase_price {font-size: 60px;color: #585858;line-height:normal;}
|
1596 |
+
.motech_purchase_button:last-child {margin-right:0px;}
|
1597 |
+
.motech_purchase_button.three_use .purchase_graphic {background-position: -208px -24px;}
|
1598 |
+
.motech_purchase_button.unlimited_use .purchase_graphic {background-position: -397px -24px;}
|
1599 |
+
.motech_premium_cancel {color:#626262;text-align:center;font-size:22px;margin-top:43px;}
|
1600 |
+
.motech_premium_cancel span:hover {cursor:pointer;text-decoration:underline;}
|
1601 |
+
.<?php echo $this->plugin_slug ?>_form > .form-table {max-width:770px;}
|
1602 |
+
|
1603 |
+
|
1604 |
+
/*css for the image picker*/
|
1605 |
+
.motech_image_picker img {border-radius: 14px;box-shadow: 0px 0px 0px 2px rgba(0, 0, 255, 0.3);}
|
1606 |
+
.motech_image_picker_wrap:hover img, .motech_image_picker_wrap:focus img {box-shadow: 0px 0px 0px 2px rgba(0, 0, 255, 0.56);}
|
1607 |
+
.motech_image_picker_wrap.current img, .motech_image_picker_wrap:active img {box-shadow: 0px 0px 0px 4px rgba(0, 0, 255, 0.9);}
|
1608 |
+
.motech_image_picker_wrap {display:inline-block;cursor: pointer;margin-right:20px;margin-bottom: 30px;}
|
1609 |
+
.motech_image_picker_wrap div {font-weight:bold;font-size:16px;margin-top:10px;color:rgba(0, 0, 0, 0.47);}
|
1610 |
+
</style>
|
1611 |
+
<?php
|
1612 |
+
if(has_filter('spacer_add_to_admincss')) {
|
1613 |
+
apply_filters('spacer_add_to_admincss','');
|
1614 |
+
}
|
1615 |
+
?>
|
1616 |
+
<style>
|
1617 |
+
|
1618 |
+
/* Begin Responsive
|
1619 |
+
====================================================================== */
|
1620 |
+
@media only screen and (max-width: 1700px) {
|
1621 |
+
.motech_purchase_button .purchase_price {font-size: 42px;padding-top: 18px;}
|
1622 |
+
.motech_purchase_button .purchase_bubble {width: 252px;}
|
1623 |
+
}
|
1624 |
+
@media only screen and (max-width: 1535px) {
|
1625 |
+
.motech_purchase_button .purchase_bubble {width: 131px;padding-top: 69px;}
|
1626 |
+
.motech_purchase_button .purchase_graphic {left: -23px;}
|
1627 |
+
.motech_purchase_button {margin-right:70px;}
|
1628 |
+
}
|
1629 |
+
@media only screen and (max-width: 1255px) {
|
1630 |
+
.motechdonate {height: 55px;}
|
1631 |
+
}
|
1632 |
+
@media only screen and (max-width: 1025px) {
|
1633 |
+
.hms_get_premium_meta {display:none !important;}
|
1634 |
+
}
|
1635 |
+
@media only screen and (max-width: 980px) {
|
1636 |
+
.motech_purchase_button {display:block;margin-bottom: 80px;margin-right:0px;}
|
1637 |
+
}
|
1638 |
+
@media only screen and (max-width: 445px) {
|
1639 |
+
.motech_premium_box h2 {font-size:22px;}
|
1640 |
+
}
|
1641 |
+
@media only screen and (max-width: 380px) {
|
1642 |
+
#green_ribbon_base span {font-size: 12px;}
|
1643 |
+
#hms_get_premium {margin-right:0px;}
|
1644 |
+
}
|
1645 |
+
@media only screen and (max-width: 330px) {
|
1646 |
+
.motech_purchase_button {
|
1647 |
+
margin-left: -9px;
|
1648 |
+
}
|
1649 |
+
</style>
|
1650 |
+
|
1651 |
+
<!--[if lt IE 9]>
|
1652 |
+
<style>
|
1653 |
+
.motech_image_picker_wrap.current img, .motech_image_picker_wrap:active img {
|
1654 |
+
border: 4px solid rgb(0, 0, 255);
|
1655 |
+
margin:-4px;
|
1656 |
+
}
|
1657 |
+
.motech_purchase_button {
|
1658 |
+
display: block;
|
1659 |
+
padding-bottom: 70px;
|
1660 |
+
margin-right: 0px;
|
1661 |
+
}
|
1662 |
+
.motech_purchase_button.unlimited_use {
|
1663 |
+
padding-bottom: 0px;
|
1664 |
+
}
|
1665 |
+
.hms_get_premium_meta {display:none !important;}
|
1666 |
+
</style>
|
1667 |
+
<![endif]-->
|
1668 |
+
<?php
|
1669 |
+
}
|
1670 |
+
}
|
1671 |
+
|
1672 |
+
function po($input) {
|
1673 |
+
if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
|
1674 |
+
return $input;
|
1675 |
+
}
|
1676 |
+
if(is_array($input)){
|
1677 |
+
foreach($input as $val){
|
1678 |
+
if (!empty($val)) {
|
1679 |
+
add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
|
1680 |
+
}
|
1681 |
+
}
|
1682 |
+
} else {
|
1683 |
+
if (!empty($input)) {
|
1684 |
+
add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
|
1685 |
+
}
|
1686 |
+
}
|
1687 |
+
|
1688 |
+
}
|
1689 |
+
|
1690 |
+
function po_px($input) {
|
1691 |
+
if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
|
1692 |
+
return $input;
|
1693 |
+
}
|
1694 |
+
if ($input != "px") {
|
1695 |
+
add_settings_error('plk_error_id82',esc_attr('settings_updated_82'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
|
1696 |
+
}
|
1697 |
+
}
|
1698 |
+
|
1699 |
+
function po_repeat($input) {
|
1700 |
+
if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
|
1701 |
+
return $input;
|
1702 |
+
}
|
1703 |
+
|
1704 |
+
if(is_array($input)){
|
1705 |
+
foreach($input as $val){
|
1706 |
+
if ($val != "repeat") {
|
1707 |
+
add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
|
1708 |
+
}
|
1709 |
+
}
|
1710 |
+
} else {
|
1711 |
+
if ((!empty($input))&&($input != "repeat")) {
|
1712 |
+
add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
|
1713 |
+
}
|
1714 |
+
}
|
1715 |
+
|
1716 |
+
}
|
1717 |
+
|
1718 |
+
function po_solid($input) {
|
1719 |
+
if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
|
1720 |
+
return $input;
|
1721 |
+
}
|
1722 |
+
|
1723 |
+
if(is_array($input)){
|
1724 |
+
foreach($input as $val){
|
1725 |
+
if ($val != "solid") {
|
1726 |
+
add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
|
1727 |
+
}
|
1728 |
+
}
|
1729 |
+
} else {
|
1730 |
+
if ((!empty($input))&&($input != "solid")) {
|
1731 |
+
add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
|
1732 |
+
}
|
1733 |
+
}
|
1734 |
+
|
1735 |
+
}
|
1736 |
+
|
1737 |
+
function po_none($input) {
|
1738 |
+
if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
|
1739 |
+
return $input;
|
1740 |
+
}
|
1741 |
+
|
1742 |
+
if(is_array($input)){
|
1743 |
+
foreach($input as $val){
|
1744 |
+
if ($val != "none") {
|
1745 |
+
add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
|
1746 |
+
}
|
1747 |
+
}
|
1748 |
+
} else {
|
1749 |
+
if ((!empty($input))&&($input != "none")) {
|
1750 |
+
add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
|
1751 |
+
}
|
1752 |
+
}
|
1753 |
+
|
1754 |
+
}
|
1755 |
+
|
1756 |
+
function po_20($input) {
|
1757 |
+
if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
|
1758 |
+
return $input;
|
1759 |
+
}
|
1760 |
+
if ($input != "20") {
|
1761 |
+
add_settings_error('plk_error_id83',esc_attr('settings_updated_83'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
|
1762 |
+
}
|
1763 |
+
return "20";
|
1764 |
+
}
|
1765 |
+
|
1766 |
+
function get_premium_warning() {
|
1767 |
+
if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
|
1768 |
+
return '';
|
1769 |
+
} else {
|
1770 |
+
return '<span class="motech_premium_only"> ('.__('Premium Only', 'motech-spacer').')</span>';
|
1771 |
+
}
|
1772 |
+
}
|
1773 |
+
|
1774 |
+
function motech_spacer_prepjsbuttons(){
|
1775 |
+
?>
|
1776 |
+
<script type="text/javascript">
|
1777 |
+
<?php
|
1778 |
+
$checkheight = get_option($this->plugin_slug . '_default_height','20');
|
1779 |
+
$checkunit = get_option($this->plugin_slug . '_default_height_unit','px');
|
1780 |
+
$return["useheight"] = $checkheight.$checkunit;
|
1781 |
+
if($this->has_addspacers){
|
1782 |
+
$ids = $this->key_array;
|
1783 |
+
$checkaddheights = get_option($this->plugin_slug . '_default_height_addspacers');
|
1784 |
+
$checkaddheightunits = get_option($this->plugin_slug . '_default_height_unit_addspacers');
|
1785 |
+
$checktitles = get_option($this->plugin_slug . '_title_addspacers');
|
1786 |
+
foreach($ids as $key=>$value){
|
1787 |
+
$useheight = $checkaddheights[$key];
|
1788 |
+
$useunit = $checkaddheightunits[$key];
|
1789 |
+
$usetitle = $checktitles[$key];
|
1790 |
+
if(empty($usetitle)){
|
1791 |
+
$usetitle = "Untitled";
|
1792 |
+
}
|
1793 |
+
$return["addspacers"][] = array("id"=>$value,"height"=>$useheight.$useunit,"title"=>$usetitle);
|
1794 |
+
}
|
1795 |
+
}
|
1796 |
+
?>
|
1797 |
+
|
1798 |
+
var motech_spacer_prepjsbuttons = <?php echo json_encode($return); ?>;
|
1799 |
+
</script>
|
1800 |
+
<?php
|
1801 |
+
}
|
1802 |
+
|
1803 |
+
function motech_imagepicker_admin_jquery() {
|
1804 |
+
if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') { //if we are on our admin page
|
1805 |
+
?>
|
1806 |
+
<script>
|
1807 |
+
jQuery(function() {
|
1808 |
+
|
1809 |
+
jQuery("body").on("click",".sendhook .newbutton.readysend", function() {
|
1810 |
+
buttonelement = jQuery(this);
|
1811 |
+
jQuery(this).find(".readysendlabel").html("SENDING...");
|
1812 |
+
jQuery(this).removeClass("readysend").addClass("notreadysend").css("cursor","not-allowed");
|
1813 |
+
suggestion = jQuery("textarea[name=mysuggestion]").val();
|
1814 |
+
signmeup = jQuery("input[name=signmeup]:checked").val();
|
1815 |
+
myemail = jQuery("input[name=myemail]").val();
|
1816 |
+
|
1817 |
+
//user doesn't want to sign up for mailing list, email not sent
|
1818 |
+
if(typeof signmeup == 'undefined'){
|
1819 |
+
myemail = "";
|
1820 |
+
}
|
1821 |
+
|
1822 |
+
jQuery.ajax({
|
1823 |
+
type: "POST",
|
1824 |
+
dataType: "json",
|
1825 |
+
url: "http://www.justinsaad.com/suggestions/response.php",
|
1826 |
+
data: { suggestion : suggestion, signmeup : signmeup, myemail : myemail },
|
1827 |
+
success: function(data) { //data is the response from the php page
|
1828 |
+
jQuery(".responsehook").text(data['response']).fadeIn('slow');
|
1829 |
+
buttonelement.find(".readysendlabel").html("SENT!");
|
1830 |
+
}
|
1831 |
+
});
|
1832 |
+
|
1833 |
+
});
|
1834 |
+
|
1835 |
+
//jquery for color picker
|
1836 |
+
jQuery('tr.motech-color-field').removeClass('motech-color-field');
|
1837 |
+
|
1838 |
+
//jquery for image picker
|
1839 |
+
jQuery(".motech_image_picker_wrap").click(function(){
|
1840 |
+
jQuery(this).closest(".motech_image_picker").find(".motech_image_picker_wrap").removeClass("current");
|
1841 |
+
jQuery(this).addClass("current");
|
1842 |
+
selectedvalue = jQuery(this).find("img").attr("alt");
|
1843 |
+
jQuery("#<?php echo $this->plugin_slug ?>_current_theme").val(selectedvalue);
|
1844 |
+
});
|
1845 |
+
jQuery("#<?php echo $this->plugin_slug ?>_current_theme").parent().parent().hide();
|
1846 |
+
<?php if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') : ?>
|
1847 |
+
<?php
|
1848 |
+
if(get_option('hide_my_site_premium_expansion_plk','') != '') {
|
1849 |
+
$useval = get_option('hide_my_site_premium_expansion_plk','');
|
1850 |
+
} elseif(get_option($this->plugin_slug . '_plk','') != '') {
|
1851 |
+
$useval = get_option('hide_my_site_premium_expansion_plk','');
|
1852 |
+
}
|
1853 |
+
?>
|
1854 |
+
useval = '<?php echo $useval ?>';
|
1855 |
+
jQuery("#hide_my_site_plk").replaceWith("<div>"+useval+"</div>");
|
1856 |
+
<?php else : ?>
|
1857 |
+
jQuery("#hide_my_site_plk").replaceWith("<div></div>");
|
1858 |
+
<?php endif ?>
|
1859 |
+
|
1860 |
+
jQuery("#hms_get_premium").click(function(){
|
1861 |
+
//jQuery(".motech_premium_box").slideToggle(200);
|
1862 |
+
});
|
1863 |
+
|
1864 |
+
jQuery(".motech_premium_cancel span").click(function(){
|
1865 |
+
jQuery(".motech_premium_box").slideUp(200, function() {
|
1866 |
+
// Animation complete.
|
1867 |
+
//jQuery("#green_ribbon").hide();
|
1868 |
+
});
|
1869 |
+
|
1870 |
+
});
|
1871 |
+
jQuery(".how_to_redeem").click(function(){
|
1872 |
+
jQuery(".redeem_info").slideToggle(200);
|
1873 |
+
});
|
1874 |
+
|
1875 |
+
jQuery("body").on('click', '#hms_get_premium, .hms_get_premium, .buynowbutton', function(e) {
|
1876 |
+
e.preventDefault();
|
1877 |
+
jQuery("html, body").animate({ scrollTop: 0 }, 300, function() {
|
1878 |
+
// Animation complete.
|
1879 |
+
jQuery("#green_ribbon").show();
|
1880 |
+
jQuery(".motech_premium_box").slideDown(200);
|
1881 |
+
|
1882 |
+
});
|
1883 |
+
|
1884 |
+
//switch to different add on if set
|
1885 |
+
var addonname = jQuery(this).attr('addonname');
|
1886 |
+
console.log(addonname);
|
1887 |
+
// For some browsers, `attr` is undefined; for others, `attr` is false. Check for both.
|
1888 |
+
if (typeof addonname !== typeof undefined && addonname !== false) {
|
1889 |
+
// Element has this attribute
|
1890 |
+
if(addonname=="gotourl"){
|
1891 |
+
var useurl = jQuery(this).attr('useurl');
|
1892 |
+
window.open(useurl);
|
1893 |
+
}else{
|
1894 |
+
jQuery(".grwrap").hide();
|
1895 |
+
jQuery(".grwrap."+addonname).show();
|
1896 |
+
}
|
1897 |
+
}
|
1898 |
+
|
1899 |
+
});
|
1900 |
+
|
1901 |
+
|
1902 |
+
});
|
1903 |
+
</script>
|
1904 |
+
<?php
|
1905 |
+
}
|
1906 |
+
}
|
1907 |
+
|
1908 |
+
|
1909 |
+
} //end class
|
1910 |
+
|
1911 |
+
function load_sva() {
|
1912 |
+
if( !class_exists( 'spacer_layout_aid' ) ) {
|
1913 |
+
|
1914 |
+
include 'sva/sva.php';
|
1915 |
+
|
1916 |
+
}
|
1917 |
+
}
|
1918 |
+
add_action( 'plugins_loaded', 'load_sva' );
|
1919 |
+
|
1920 |
+
$class = new motech_spacer();
|
1921 |
+
|
1922 |
+
add_action('init', array($class, 'add_custom_button'));
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: clevelandwebdeveloper
|
|
3 |
Donate link: http://www.clevelandwebdeveloper.com/wordpress-plugins/donate.php
|
4 |
Tags: spacer, spacing, line space
|
5 |
Requires at least: 3.5
|
6 |
-
Tested up to:
|
7 |
-
Stable tag: 3.0.
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -85,6 +85,9 @@ Try adding <code>margin-bottom: 25px;</code> to the Spacer's Style setting.
|
|
85 |
|
86 |
== Changelog ==
|
87 |
|
|
|
|
|
|
|
88 |
= 3.0.4 =
|
89 |
* Adds compatibility with Draft It! add-on
|
90 |
* WP tested up to version 4.6.1
|
@@ -133,5 +136,5 @@ Try adding <code>margin-bottom: 25px;</code> to the Spacer's Style setting.
|
|
133 |
|
134 |
== Upgrade Notice ==
|
135 |
|
136 |
-
= 3.0.
|
137 |
-
New: This version
|
3 |
Donate link: http://www.clevelandwebdeveloper.com/wordpress-plugins/donate.php
|
4 |
Tags: spacer, spacing, line space
|
5 |
Requires at least: 3.5
|
6 |
+
Tested up to: 6.0.2
|
7 |
+
Stable tag: 3.0.5
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
85 |
|
86 |
== Changelog ==
|
87 |
|
88 |
+
= 3.0.5 =
|
89 |
+
* Fixes string offset error
|
90 |
+
|
91 |
= 3.0.4 =
|
92 |
* Adds compatibility with Draft It! add-on
|
93 |
* WP tested up to version 4.6.1
|
136 |
|
137 |
== Upgrade Notice ==
|
138 |
|
139 |
+
= 3.0.5 =
|
140 |
+
New: This version fixes the string offset error - Enjoy!
|
sva/sva.php
CHANGED
@@ -1,911 +1,927 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$sva_plugin_label = "Spacer - Visual Artist";
|
4 |
-
$sva_plugin_slug = "spacer_layout_aid_preview";
|
5 |
-
|
6 |
-
class spacer_layout_aid_preview {
|
7 |
-
|
8 |
-
public function __construct(){
|
9 |
-
|
10 |
-
global $sva_plugin_label, $plugin_slug;
|
11 |
-
$this->sva_plugin_slug = $plugin_slug;
|
12 |
-
$this->sva_plugin_label = $sva_plugin_label;
|
13 |
-
|
14 |
-
$checkaddspacers = get_option("motech_spacer_addspacer_id");
|
15 |
-
if(!empty($checkaddspacers)){
|
16 |
-
$this->key_array = $checkaddspacers;
|
17 |
-
$this->has_addspacers = true;
|
18 |
-
}else{
|
19 |
-
$this->key_array = array(0);
|
20 |
-
$this->has_addspacers = false;
|
21 |
-
}
|
22 |
-
|
23 |
-
$this->ihmsa = 'hmsia';
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
//uncomment the following line to enqueue color picker
|
28 |
-
//add_action( 'admin_enqueue_scripts', array($this, 'enqueue_color_picker') );
|
29 |
-
|
30 |
-
//uncomment following line to add extra plugin row links under plugin description
|
31 |
-
//add_filter( 'plugin_row_meta', array($this,'plugin_row_links'), 10, 2 );
|
32 |
-
|
33 |
-
add_filter('spacer_add_css', array($this,'spacer_add_css'),50,2);
|
34 |
-
|
35 |
-
add_filter('spacer_add_to_default', array($this,'spacer_add_to_default'),50);
|
36 |
-
add_filter('spacer_add_to_extras', array($this,'spacer_add_to_extras'),50,2);
|
37 |
-
|
38 |
-
if(is_admin()){
|
39 |
-
|
40 |
-
//uncomment following line to add Settings link to plugin page
|
41 |
-
//add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array($this, 'add_plugin_action_links') );
|
42 |
-
|
43 |
-
//uncomment following line to add admin notices
|
44 |
-
//add_action( 'admin_notices', array($this, 'admin_notices') );
|
45 |
-
|
46 |
-
//add_action('admin_menu', array($this, 'add_plugin_page'));
|
47 |
-
//add_action('admin_init', array($this, 'page_init'));
|
48 |
-
//add_filter('spacer_licenses_settings', array($this,'add_layout_licenses_section'),50,2);
|
49 |
-
|
50 |
-
add_action( 'admin_enqueue_scripts', array($this, 'enqueue_motech_javascript'), 10 ); //enqueue color picker. set this to a number lower than 50, so it will load before spacer javascript.
|
51 |
-
add_filter('spacer_default_settings', array($this,'add_layout_aid_section'),50,2);
|
52 |
-
if($this->ihmsa == 'hmsia'){
|
53 |
-
add_filter('spacer_default_sections', array($this,'add_layout_aid_section_container'),50,2);
|
54 |
-
}
|
55 |
-
add_filter('spacer_add_to_admincss', array($this,'spacer_add_to_admincss'),50);
|
56 |
-
if($this->ihmsa == 'hmsia'){
|
57 |
-
add_action( 'admin_enqueue_scripts', array($this,'load_custom_wp_admin_style'), 60 ); //set this to a number higher than 50, so it will load after spacer core
|
58 |
-
}
|
59 |
-
$key_array = $this->key_array;
|
60 |
-
$getoption = get_option($this->sva_plugin_slug.'_title_addspacers','');
|
61 |
-
if($this->ihmsa == 'hmsia'){
|
62 |
-
foreach($key_array as $key=>$value){
|
63 |
-
add_filter('spacer_addspacer_sections'.$key, array($this,'add_layout_aid_addspacer_section_container'),50,2);
|
64 |
-
}
|
65 |
-
}
|
66 |
-
}
|
67 |
-
|
68 |
-
}
|
69 |
-
|
70 |
-
function load_custom_wp_admin_style() {
|
71 |
-
|
72 |
-
//wp_register_style( 'mspacerlayout_wp_admin_css', plugins_url( 'admin-style.css' , __FILE__ ), false, '1.0.0' );
|
73 |
-
//wp_enqueue_style( 'mspacerlayout_wp_admin_css' );
|
74 |
-
}
|
75 |
-
|
76 |
-
function spacer_add_to_admincss($val){
|
77 |
-
?>
|
78 |
-
<style>
|
79 |
-
<?php if ($this->ihmsa == 'hmsia') { ?> #motech_spacer_visualartist_license{display:none;} <?php } ?>
|
80 |
-
/*css for column box - move to add on css via hook instead */
|
81 |
-
.columnbox { background: #fff;
|
82 |
-
padding: 0 8px;
|
83 |
-
margin-bottom: 9px;
|
84 |
-
outline: 0;
|
85 |
-
margin: 10px 0 0;
|
86 |
-
border: 1px solid #e5e5e5;
|
87 |
-
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
88 |
-
box-shadow: 0 1px 1px rgba(0,0,0,.04); float: left; width: 21%;margin-right:16px;overflow:hidden;}
|
89 |
-
|
90 |
-
.columnbox h2,.postbox .inside .columnbox h2 {
|
91 |
-
background: #fafafa;
|
92 |
-
color: #23282d;
|
93 |
-
margin: 0;
|
94 |
-
padding: 15px;
|
95 |
-
font-size: 1em;
|
96 |
-
line-height: 1;
|
97 |
-
overflow: hidden;
|
98 |
-
white-space: nowrap;
|
99 |
-
text-overflow: ellipsis;
|
100 |
-
padding-left: 9px;
|
101 |
-
margin-left: -10px;
|
102 |
-
border-bottom: 1px solid #e5e5e5;
|
103 |
-
margin-right: -10px;
|
104 |
-
font-weight:600;
|
105 |
-
}
|
106 |
-
|
107 |
-
.columnbox .form-table th {font-weight: normal; }
|
108 |
-
.columnbox .form-table td { padding-left: 0px;}
|
109 |
-
.addspacerunit .columnbox { background: #fafafa;}
|
110 |
-
.addspacerunit .columnbox h2, .addspacerunit .postbox .inside .columnbox h2 {background:white;}
|
111 |
-
.motech_spacer_preview_image_container {display:none;}
|
112 |
-
.wp-picker-holder {position:absolute;}
|
113 |
-
|
114 |
-
@media only screen and (max-width: 1370px) {
|
115 |
-
.columnbox input[type="text"], .columnbox select {max-width:50%;}
|
116 |
-
.columnbox {width:auto;float:none;margin-right:0px;}
|
117 |
-
}
|
118 |
-
|
119 |
-
@media only screen and (max-width: 1050px) {
|
120 |
-
.columnbox {width:auto;float:none;margin-right:0px;}
|
121 |
-
}
|
122 |
-
</style>
|
123 |
-
<?php
|
124 |
-
}
|
125 |
-
|
126 |
-
function spacer_add_to_default($return) {
|
127 |
-
//return is an array like $return["checkheight"], we want to add elements to it
|
128 |
-
$return["bgcolor"] = get_option('motech_spacer_default_bg_color');
|
129 |
-
$return["bgimage"] = get_option('motech_spacer_default_background_image_upload');
|
130 |
-
$return["bordertopwidth"] = get_option('motech_spacer_default_border_top_width');
|
131 |
-
$return["bordertopstyle"] = get_option('motech_spacer_default_border_top_style');
|
132 |
-
$return["bordertopcolor"] = get_option('motech_spacer_default_border_top_color');
|
133 |
-
$return["borderbottomwidth"] = get_option('motech_spacer_default_border_bottom_width');
|
134 |
-
$return["borderbottomstyle"] = get_option('motech_spacer_default_border_bottom_style');
|
135 |
-
$return["borderbottomcolor"] = get_option('motech_spacer_default_border_bottom_color');
|
136 |
-
$return["bottommargin"] = get_option('motech_spacer_default_bottom_margin');
|
137 |
-
$return["shadow"] = get_option('motech_spacer_default_shadow');
|
138 |
-
$return["bgimageposition"] = get_option('motech_spacer_custom_background_image_position');
|
139 |
-
|
140 |
-
//$spacer_css .= "background:red;";
|
141 |
-
return $return;
|
142 |
-
}
|
143 |
-
|
144 |
-
function spacer_add_to_extras($return,$key) {
|
145 |
-
$get = get_option('motech_spacer_default_bg_color_addspacers');
|
146 |
-
$
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
$get
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
$
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
$get = get_option('
|
161 |
-
$
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
$get
|
167 |
-
|
168 |
-
|
169 |
-
$get = get_option('
|
170 |
-
$
|
171 |
-
|
172 |
-
|
173 |
-
$
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
return
|
188 |
-
}
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
}
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
}
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
$spacer_css .= "
|
234 |
-
}
|
235 |
-
if(!empty($
|
236 |
-
$spacer_css .= "border-
|
237 |
-
}
|
238 |
-
if(!empty($
|
239 |
-
$spacer_css .= "border-
|
240 |
-
}
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
if
|
258 |
-
|
259 |
-
}
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
<div class="columnbox"><h2><?php _e('
|
290 |
-
<div
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
$
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
"
|
395 |
-
)
|
396 |
-
);
|
397 |
-
|
398 |
-
//add
|
399 |
-
$field_slug = "
|
400 |
-
$field_label = "Image
|
401 |
-
$field_id = $object->plugin_slug.'_'.$field_slug;
|
402 |
-
$object->
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
$
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
$
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
"
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
$
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
$
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
$
|
477 |
-
$
|
478 |
-
array(
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
"
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
$
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
$
|
496 |
-
$
|
497 |
-
array(
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
"
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
$
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
$
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
$
|
543 |
-
$
|
544 |
-
array(
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
"
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
$
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
$
|
562 |
-
$
|
563 |
-
array(
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
"
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
$
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
$
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
);
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
"
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
$
|
672 |
-
$
|
673 |
-
$
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
$
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
$
|
703 |
-
$
|
704 |
-
array(
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
"
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
);
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
$
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
"
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
);
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
$
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
"
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
);
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
$
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
"
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
);
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
$
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
"
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
);
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
return
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
911 |
$custom_plugin = new $sva_plugin_slug();
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$sva_plugin_label = "Spacer - Visual Artist";
|
4 |
+
$sva_plugin_slug = "spacer_layout_aid_preview";
|
5 |
+
|
6 |
+
class spacer_layout_aid_preview {
|
7 |
+
|
8 |
+
public function __construct(){
|
9 |
+
|
10 |
+
global $sva_plugin_label, $plugin_slug;
|
11 |
+
$this->sva_plugin_slug = $plugin_slug;
|
12 |
+
$this->sva_plugin_label = $sva_plugin_label;
|
13 |
+
|
14 |
+
$checkaddspacers = get_option("motech_spacer_addspacer_id");
|
15 |
+
if(!empty($checkaddspacers)){
|
16 |
+
$this->key_array = $checkaddspacers;
|
17 |
+
$this->has_addspacers = true;
|
18 |
+
}else{
|
19 |
+
$this->key_array = array(0);
|
20 |
+
$this->has_addspacers = false;
|
21 |
+
}
|
22 |
+
|
23 |
+
$this->ihmsa = 'hmsia';
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
//uncomment the following line to enqueue color picker
|
28 |
+
//add_action( 'admin_enqueue_scripts', array($this, 'enqueue_color_picker') );
|
29 |
+
|
30 |
+
//uncomment following line to add extra plugin row links under plugin description
|
31 |
+
//add_filter( 'plugin_row_meta', array($this,'plugin_row_links'), 10, 2 );
|
32 |
+
|
33 |
+
add_filter('spacer_add_css', array($this,'spacer_add_css'),50,2);
|
34 |
+
|
35 |
+
add_filter('spacer_add_to_default', array($this,'spacer_add_to_default'),50);
|
36 |
+
add_filter('spacer_add_to_extras', array($this,'spacer_add_to_extras'),50,2);
|
37 |
+
|
38 |
+
if(is_admin()){
|
39 |
+
|
40 |
+
//uncomment following line to add Settings link to plugin page
|
41 |
+
//add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array($this, 'add_plugin_action_links') );
|
42 |
+
|
43 |
+
//uncomment following line to add admin notices
|
44 |
+
//add_action( 'admin_notices', array($this, 'admin_notices') );
|
45 |
+
|
46 |
+
//add_action('admin_menu', array($this, 'add_plugin_page'));
|
47 |
+
//add_action('admin_init', array($this, 'page_init'));
|
48 |
+
//add_filter('spacer_licenses_settings', array($this,'add_layout_licenses_section'),50,2);
|
49 |
+
|
50 |
+
add_action( 'admin_enqueue_scripts', array($this, 'enqueue_motech_javascript'), 10 ); //enqueue color picker. set this to a number lower than 50, so it will load before spacer javascript.
|
51 |
+
add_filter('spacer_default_settings', array($this,'add_layout_aid_section'),50,2);
|
52 |
+
if($this->ihmsa == 'hmsia'){
|
53 |
+
add_filter('spacer_default_sections', array($this,'add_layout_aid_section_container'),50,2);
|
54 |
+
}
|
55 |
+
add_filter('spacer_add_to_admincss', array($this,'spacer_add_to_admincss'),50);
|
56 |
+
if($this->ihmsa == 'hmsia'){
|
57 |
+
add_action( 'admin_enqueue_scripts', array($this,'load_custom_wp_admin_style'), 60 ); //set this to a number higher than 50, so it will load after spacer core
|
58 |
+
}
|
59 |
+
$key_array = $this->key_array;
|
60 |
+
$getoption = get_option($this->sva_plugin_slug.'_title_addspacers','');
|
61 |
+
if($this->ihmsa == 'hmsia'){
|
62 |
+
foreach($key_array as $key=>$value){
|
63 |
+
add_filter('spacer_addspacer_sections'.$key, array($this,'add_layout_aid_addspacer_section_container'),50,2);
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
}
|
69 |
+
|
70 |
+
function load_custom_wp_admin_style() {
|
71 |
+
|
72 |
+
//wp_register_style( 'mspacerlayout_wp_admin_css', plugins_url( 'admin-style.css' , __FILE__ ), false, '1.0.0' );
|
73 |
+
//wp_enqueue_style( 'mspacerlayout_wp_admin_css' );
|
74 |
+
}
|
75 |
+
|
76 |
+
function spacer_add_to_admincss($val){
|
77 |
+
?>
|
78 |
+
<style>
|
79 |
+
<?php if ($this->ihmsa == 'hmsia') { ?> #motech_spacer_visualartist_license{display:none;} <?php } ?>
|
80 |
+
/*css for column box - move to add on css via hook instead */
|
81 |
+
.columnbox { background: #fff;
|
82 |
+
padding: 0 8px;
|
83 |
+
margin-bottom: 9px;
|
84 |
+
outline: 0;
|
85 |
+
margin: 10px 0 0;
|
86 |
+
border: 1px solid #e5e5e5;
|
87 |
+
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
88 |
+
box-shadow: 0 1px 1px rgba(0,0,0,.04); float: left; width: 21%;margin-right:16px;overflow:hidden;}
|
89 |
+
|
90 |
+
.columnbox h2,.postbox .inside .columnbox h2 {
|
91 |
+
background: #fafafa;
|
92 |
+
color: #23282d;
|
93 |
+
margin: 0;
|
94 |
+
padding: 15px;
|
95 |
+
font-size: 1em;
|
96 |
+
line-height: 1;
|
97 |
+
overflow: hidden;
|
98 |
+
white-space: nowrap;
|
99 |
+
text-overflow: ellipsis;
|
100 |
+
padding-left: 9px;
|
101 |
+
margin-left: -10px;
|
102 |
+
border-bottom: 1px solid #e5e5e5;
|
103 |
+
margin-right: -10px;
|
104 |
+
font-weight:600;
|
105 |
+
}
|
106 |
+
|
107 |
+
.columnbox .form-table th {font-weight: normal; }
|
108 |
+
.columnbox .form-table td { padding-left: 0px;}
|
109 |
+
.addspacerunit .columnbox { background: #fafafa;}
|
110 |
+
.addspacerunit .columnbox h2, .addspacerunit .postbox .inside .columnbox h2 {background:white;}
|
111 |
+
.motech_spacer_preview_image_container {display:none;}
|
112 |
+
.wp-picker-holder {position:absolute;}
|
113 |
+
|
114 |
+
@media only screen and (max-width: 1370px) {
|
115 |
+
.columnbox input[type="text"], .columnbox select {max-width:50%;}
|
116 |
+
.columnbox {width:auto;float:none;margin-right:0px;}
|
117 |
+
}
|
118 |
+
|
119 |
+
@media only screen and (max-width: 1050px) {
|
120 |
+
.columnbox {width:auto;float:none;margin-right:0px;}
|
121 |
+
}
|
122 |
+
</style>
|
123 |
+
<?php
|
124 |
+
}
|
125 |
+
|
126 |
+
function spacer_add_to_default($return) {
|
127 |
+
//return is an array like $return["checkheight"], we want to add elements to it
|
128 |
+
$return["bgcolor"] = get_option('motech_spacer_default_bg_color');
|
129 |
+
$return["bgimage"] = get_option('motech_spacer_default_background_image_upload');
|
130 |
+
$return["bordertopwidth"] = get_option('motech_spacer_default_border_top_width');
|
131 |
+
$return["bordertopstyle"] = get_option('motech_spacer_default_border_top_style');
|
132 |
+
$return["bordertopcolor"] = get_option('motech_spacer_default_border_top_color');
|
133 |
+
$return["borderbottomwidth"] = get_option('motech_spacer_default_border_bottom_width');
|
134 |
+
$return["borderbottomstyle"] = get_option('motech_spacer_default_border_bottom_style');
|
135 |
+
$return["borderbottomcolor"] = get_option('motech_spacer_default_border_bottom_color');
|
136 |
+
$return["bottommargin"] = get_option('motech_spacer_default_bottom_margin');
|
137 |
+
$return["shadow"] = get_option('motech_spacer_default_shadow');
|
138 |
+
$return["bgimageposition"] = get_option('motech_spacer_custom_background_image_position');
|
139 |
+
|
140 |
+
//$spacer_css .= "background:red;";
|
141 |
+
return $return;
|
142 |
+
}
|
143 |
+
|
144 |
+
function spacer_add_to_extras($return,$key) {
|
145 |
+
$get = get_option('motech_spacer_default_bg_color_addspacers');
|
146 |
+
if(isset($get[$key])){
|
147 |
+
$return["bgcolor"] = $get[$key];
|
148 |
+
}
|
149 |
+
|
150 |
+
$get = get_option('motech_spacer_default_background_image_upload_addspacers');
|
151 |
+
if(isset($get[$key])){
|
152 |
+
$return["bgimage"] = $get[$key];
|
153 |
+
}
|
154 |
+
|
155 |
+
$get = get_option('motech_spacer_default_border_top_width_addspacers');
|
156 |
+
if(isset($get[$key])){
|
157 |
+
$return["bordertopwidth"] = $get[$key];
|
158 |
+
}
|
159 |
+
|
160 |
+
$get = get_option('motech_spacer_default_border_top_style_addspacers');
|
161 |
+
if(isset($get[$key])){
|
162 |
+
$return["bordertopstyle"] = $get[$key];
|
163 |
+
}
|
164 |
+
|
165 |
+
$get = get_option('motech_spacer_default_border_top_color_addspacers');
|
166 |
+
if(isset($get[$key])){
|
167 |
+
$return["bordertopcolor"] = $get[$key];
|
168 |
+
}
|
169 |
+
$get = get_option('motech_spacer_default_border_bottom_width_addspacers');
|
170 |
+
if(isset($get[$key])){
|
171 |
+
$return["borderbottomwidth"] = $get[$key];
|
172 |
+
}
|
173 |
+
$get = get_option('motech_spacer_default_border_bottom_style_addspacers');
|
174 |
+
if(isset($get[$key])){
|
175 |
+
$return["borderbottomstyle"] = $get[$key];
|
176 |
+
}
|
177 |
+
$get = get_option('motech_spacer_default_border_bottom_color_addspacers');
|
178 |
+
if(isset($get[$key])){
|
179 |
+
$return["borderbottomcolor"] = $get[$key];
|
180 |
+
}
|
181 |
+
$get = get_option('motech_spacer_default_bottom_margin_addspacers');
|
182 |
+
if(isset($get[$key])){
|
183 |
+
$return["bottommargin"] = $get[$key];
|
184 |
+
}
|
185 |
+
$get = get_option('motech_spacer_default_shadow_addspacers');
|
186 |
+
if(isset($get[$key])){
|
187 |
+
$return["shadow"] = $get[$key];
|
188 |
+
}
|
189 |
+
$get = get_option('motech_spacer_custom_background_image_position_addspacers');
|
190 |
+
if(isset($get[$key])){
|
191 |
+
$return["bgimageposition"] = $get[$key];
|
192 |
+
}
|
193 |
+
|
194 |
+
//$spacer_css .= "background:red;";
|
195 |
+
return $return;
|
196 |
+
}
|
197 |
+
|
198 |
+
|
199 |
+
function use_shadow($shadow){
|
200 |
+
if($shadow=="light"){
|
201 |
+
return "box-shadow:0px 2px 3px rgba(119, 119, 119,0.5);";
|
202 |
+
}elseif($shadow=="medium"){
|
203 |
+
return "box-shadow:0px 2px 4px #777;";
|
204 |
+
}elseif($shadow=="heavy"){
|
205 |
+
return "box-shadow:0px 2px 10px #888;";
|
206 |
+
}
|
207 |
+
|
208 |
+
}
|
209 |
+
|
210 |
+
function use_bgimageposition($bgimageposition){
|
211 |
+
if($bgimageposition=="repeat"){
|
212 |
+
return "background-repeat:repeat;";
|
213 |
+
}elseif($bgimageposition=="croptofit"){
|
214 |
+
return "background-size:cover;background-position:center;";
|
215 |
+
}elseif($bgimageposition=="stretch"){
|
216 |
+
return "background-size:100% 100%;background-repeat:no-repeat;background-position:center;";
|
217 |
+
}elseif($bgimageposition=="propstretch"){
|
218 |
+
return "background-size:contain;background-repeat:no-repeat;background-position:center;";
|
219 |
+
}elseif($bgimageposition=="proprepeat"){
|
220 |
+
return "background-size:contain;background-repeat:repeat;background-position:center;";
|
221 |
+
}
|
222 |
+
|
223 |
+
}
|
224 |
+
|
225 |
+
function spacer_add_css($spacer_css,$activespacer) {
|
226 |
+
|
227 |
+
extract($activespacer);
|
228 |
+
|
229 |
+
if(!empty($bgcolor)) {
|
230 |
+
$spacer_css .= "background-color:".$bgcolor.";";
|
231 |
+
}
|
232 |
+
if(!empty($bgimage)) {
|
233 |
+
$spacer_css .= "background-image:url(".$bgimage.");";
|
234 |
+
}
|
235 |
+
if(!empty($bordertopstyle)) {
|
236 |
+
$spacer_css .= "border-top-style:".$bordertopstyle.";";
|
237 |
+
}
|
238 |
+
if(!empty($bordertopwidth)) {
|
239 |
+
$spacer_css .= "border-top-width:".$bordertopwidth."px;";
|
240 |
+
} else{
|
241 |
+
$spacer_css .= "border-top-width:0px;";
|
242 |
+
}
|
243 |
+
if(!empty($bordertopcolor)) {
|
244 |
+
$spacer_css .= "border-top-color:".$bordertopcolor.";";
|
245 |
+
}
|
246 |
+
if(!empty($borderbottomwidth)) {
|
247 |
+
$spacer_css .= "border-bottom-width:".$borderbottomwidth."px;";
|
248 |
+
}else{
|
249 |
+
$spacer_css .= "border-bottom-width:0px;";
|
250 |
+
}
|
251 |
+
if(!empty($borderbottomstyle)) {
|
252 |
+
$spacer_css .= "border-bottom-style:".$borderbottomstyle.";";
|
253 |
+
}
|
254 |
+
if(!empty($borderbottomcolor)) {
|
255 |
+
$spacer_css .= "border-bottom-color:".$borderbottomcolor.";";
|
256 |
+
}
|
257 |
+
if(!empty($bottommargin)) {
|
258 |
+
$spacer_css .= "margin-bottom:".$bottommargin."px;";
|
259 |
+
}
|
260 |
+
if(!empty($shadow)) {
|
261 |
+
$spacer_css .= $this->use_shadow($shadow);
|
262 |
+
}
|
263 |
+
if(!empty($bgimageposition)) {
|
264 |
+
$spacer_css .= $this->use_bgimageposition($bgimageposition);
|
265 |
+
}
|
266 |
+
|
267 |
+
//imaqe position
|
268 |
+
|
269 |
+
return $spacer_css;
|
270 |
+
}
|
271 |
+
|
272 |
+
function enqueue_motech_javascript( ) {
|
273 |
+
if (isset($_GET['page']) && $_GET['page'] == 'motech_spacer-setting-admin') {
|
274 |
+
wp_enqueue_script( $this->sva_plugin_slug.'-motech-javascript2', plugins_url('js/motech-javascript.js', __FILE__ ), array('jquery'), false, true );
|
275 |
+
}
|
276 |
+
}
|
277 |
+
|
278 |
+
|
279 |
+
function add_layout_aid_section_container($val,$object){
|
280 |
+
?>
|
281 |
+
<div class="motech-spacer-options section layoutaid" style="border-top: solid 1px #BFBFBF;margin-top: 3px;">
|
282 |
+
<div class="postbox closed" style="margin-top:20px;margin-bottom:12px;">
|
283 |
+
<button type="button" class="handlediv button-link" aria-expanded="true"><span class="toggle-indicator" aria-hidden="true"></span></button>
|
284 |
+
<h2 class="hndle ui-sortable-handle" style="font-size: 1.3em;font-weight: bold;padding-left: 51px;position: relative;"><img style="position: absolute;top: -1px;width: 42px;left: 7px;" src="<?php echo plugins_url('images/palette.png', __FILE__ ) ?>" /><span><?php _e('Visual Artist', 'spacer-layout-aid') ?><?php echo $object->get_premium_warning() ?></span></h2>
|
285 |
+
<div class="inside">
|
286 |
+
<div class="columnbox"><h2><?php _e('Background', 'spacer-layout-aid') ?></h2><?php do_settings_sections($object->plugin_slug.'-setting-admin_layoutaidbg'); ?></div>
|
287 |
+
<div class="columnbox"><h2><?php _e('Top Border', 'spacer-layout-aid') ?></h2><?php do_settings_sections($object->plugin_slug.'-setting-admin_layoutaidtb'); ?></div>
|
288 |
+
<div class="columnbox"><h2><?php _e('Bottom Border', 'spacer-layout-aid') ?></h2><?php do_settings_sections($object->plugin_slug.'-setting-admin_layoutaidbb'); ?></div>
|
289 |
+
<div class="columnbox" style="margin-right:0px;"><h2><?php _e('Other', 'spacer-layout-aid') ?></h2><?php do_settings_sections($object->plugin_slug.'-setting-admin_layoutaidother'); ?></div>
|
290 |
+
<div style="clear:both;"></div>
|
291 |
+
</div>
|
292 |
+
</div>
|
293 |
+
</div>
|
294 |
+
<?php
|
295 |
+
}
|
296 |
+
|
297 |
+
function add_layout_aid_addspacer_section_container($val,$key){
|
298 |
+
?>
|
299 |
+
<div class="motech-spacer-options section layoutaid aslayoutaid" style="border-top: solid 1px #eee;margin-top: 3px;">
|
300 |
+
<?php /*?><?php do_settings_sections('motech_spacer-setting-admin_layoutaid_addspacer'.$key); ?><?php */?>
|
301 |
+
<div class="postbox closed" style="margin-top:20px;margin-bottom:12px;background: #fafafa;">
|
302 |
+
<button type="button" class="handlediv button-link" aria-expanded="true"><span class="toggle-indicator" aria-hidden="true"></span></button>
|
303 |
+
<h2 class="hndle ui-sortable-handle" style="font-size: 1.3em;font-weight: bold;padding-left: 51px;position: relative;"><img style="position: absolute;top: -1px;width: 42px;left: 7px;" src="<?php echo plugins_url('images/palette.png', __FILE__ ) ?>" /><span><?php _e('Visual Artist', 'spacer-layout-aid') ?><?php echo '<span class="motech_premium_only"> ('.__('Premium Only', 'motech-spacer').')</span>'?></span></h2>
|
304 |
+
<div class="inside">
|
305 |
+
<div class="columnbox"><h2><?php _e('Background', 'spacer-layout-aid') ?></h2><?php do_settings_sections('motech_spacer-setting-admin_layoutaidbg_addspacer'.$key); ?></div>
|
306 |
+
<div class="columnbox"><h2><?php _e('Top Border', 'spacer-layout-aid') ?></h2><?php do_settings_sections('motech_spacer-setting-admin_layoutaidtb_addspacer'.$key); ?></div>
|
307 |
+
<div class="columnbox"><h2><?php _e('Bottom Border', 'spacer-layout-aid') ?></h2><?php do_settings_sections('motech_spacer-setting-admin_layoutaidbb_addspacer'.$key); ?></div>
|
308 |
+
<div class="columnbox" style="margin-right:0px;"><h2><?php _e('Other', 'spacer-layout-aid') ?></h2><?php do_settings_sections('motech_spacer-setting-admin_layoutaidother_addspacer'.$key); ?></div>
|
309 |
+
<div style="clear:both;"></div>
|
310 |
+
</div>
|
311 |
+
</div>
|
312 |
+
</div>
|
313 |
+
<?php
|
314 |
+
}
|
315 |
+
|
316 |
+
|
317 |
+
|
318 |
+
function add_layout_licenses_section($val,$object){
|
319 |
+
//update_option('motech_spacer_visualartist_license','');
|
320 |
+
//update_option('motech_spacer_visualartist_ihmsa','');
|
321 |
+
//add text input field
|
322 |
+
$field_slug = "visualartist_license";
|
323 |
+
$field_label = __('Visual Artist Key', 'spacer-layout-aid');
|
324 |
+
$field_id = $object->plugin_slug.'_'.$field_slug;
|
325 |
+
//register_setting($object->plugin_slug.'_option_group', $field_id);
|
326 |
+
register_setting($object->plugin_slug.'_option_group', $field_id, array($this, 'license_v'));
|
327 |
+
if ($this->ihmsa == 'hmsia') {
|
328 |
+
$desc = "<div class='mvalid'>".__('Valid', 'spacer-layout-aid')."</div>";
|
329 |
+
} else {
|
330 |
+
//$desc = "Enter your license key to unlock premium features. <a href='#' class='hms_validate_alt'>Alernative Method</a>";
|
331 |
+
$desc = __("You will find this included with your purchase email. If this doesn't work, try the <a href='#' class='motech_spacer_visualartist_validate_alt'>Alternative Method</a>", "spacer-layout-aid");
|
332 |
+
}
|
333 |
+
add_settings_field(
|
334 |
+
$field_id,
|
335 |
+
$field_label,
|
336 |
+
array($object, 'create_a_text_input'), //callback function for text input
|
337 |
+
$object->plugin_slug.'-setting-admin_licenses',
|
338 |
+
$object->plugin_slug.'_setting_section',
|
339 |
+
array( // The array of arguments to pass to the callback.
|
340 |
+
"id" => $field_id, //sends field id to callback
|
341 |
+
//"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
|
342 |
+
//"placeholder" => __('5', 'spacer-layout-aid'),
|
343 |
+
"desc" => $desc,
|
344 |
+
"default" => '' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
345 |
+
)
|
346 |
+
);
|
347 |
+
}
|
348 |
+
|
349 |
+
function add_layout_aid_section($val,$object){
|
350 |
+
|
351 |
+
add_settings_section(
|
352 |
+
$object->plugin_slug.'_setting_section',
|
353 |
+
__('', 'spacer-layout-aid'),
|
354 |
+
false,
|
355 |
+
$object->plugin_slug.'-setting-admin_layoutaidbg'
|
356 |
+
);
|
357 |
+
|
358 |
+
add_settings_section(
|
359 |
+
$object->plugin_slug.'_setting_section',
|
360 |
+
__('', 'spacer-layout-aid'),
|
361 |
+
false,
|
362 |
+
$object->plugin_slug.'-setting-admin_layoutaidtb'
|
363 |
+
);
|
364 |
+
|
365 |
+
add_settings_section(
|
366 |
+
$object->plugin_slug.'_setting_section',
|
367 |
+
__('', 'spacer-layout-aid'),
|
368 |
+
false,
|
369 |
+
$object->plugin_slug.'-setting-admin_layoutaidbb'
|
370 |
+
);
|
371 |
+
|
372 |
+
add_settings_section(
|
373 |
+
$object->plugin_slug.'_setting_section',
|
374 |
+
__('', 'spacer-layout-aid'),
|
375 |
+
false,
|
376 |
+
$object->plugin_slug.'-setting-admin_layoutaidother'
|
377 |
+
);
|
378 |
+
|
379 |
+
//add color picker text input field
|
380 |
+
$field_slug = "default_bg_color";
|
381 |
+
$field_label = __('Color', 'spacer-layout-aid');
|
382 |
+
$field_id = $object->plugin_slug.'_'.$field_slug;
|
383 |
+
register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
|
384 |
+
add_settings_field(
|
385 |
+
$field_id,
|
386 |
+
$field_label,
|
387 |
+
array($object, 'create_a_text_input'), //callback function for text input
|
388 |
+
$object->plugin_slug.'-setting-admin_layoutaidbg',
|
389 |
+
$object->plugin_slug.'_setting_section',
|
390 |
+
array( // The array of arguments to pass to the callback.
|
391 |
+
"id" => $field_id, //sends field id to callback
|
392 |
+
//"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
|
393 |
+
"default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
394 |
+
"class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
|
395 |
+
)
|
396 |
+
);
|
397 |
+
|
398 |
+
//add image upload field
|
399 |
+
$field_slug = "default_background_image_upload";
|
400 |
+
$field_label = "Image";
|
401 |
+
$field_id = $object->plugin_slug.'_'.$field_slug;
|
402 |
+
register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
|
403 |
+
add_settings_field(
|
404 |
+
$field_id, // ID of the option
|
405 |
+
$field_label, // Title of the option
|
406 |
+
array($object, 'create_image_upload'), // Callback used to render the input field
|
407 |
+
$object->plugin_slug.'-setting-admin_layoutaidbg', // Page to associate this option with
|
408 |
+
$object->plugin_slug.'_setting_section', // Section to associate this option with
|
409 |
+
array( // The array of arguments to pass to the callback.
|
410 |
+
"id" => $field_id //sends field id to callback
|
411 |
+
)
|
412 |
+
);
|
413 |
+
|
414 |
+
//add an image select input field
|
415 |
+
$field_slug = "custom_background_image_position";
|
416 |
+
$field_label = "Image Position";
|
417 |
+
$field_id = $object->plugin_slug.'_'.$field_slug;
|
418 |
+
$object->back_options = array(
|
419 |
+
array("label" => "Repeat", "value" => "repeat"),
|
420 |
+
array("label" => "Proportional Stretch", "value" => "propstretch"),
|
421 |
+
array("label" => "Proportional Repeat", "value" => "proprepeat"),
|
422 |
+
array("label" => "Crop to Fit", "value" => "croptofit"),
|
423 |
+
array("label" => "Stretch", "value" => "stretch")
|
424 |
+
);
|
425 |
+
register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_repeat'));
|
426 |
+
add_settings_field(
|
427 |
+
$field_id,
|
428 |
+
$field_label,
|
429 |
+
array($object, 'create_a_select_input'), //callback function for select input
|
430 |
+
$object->plugin_slug.'-setting-admin_layoutaidbg',
|
431 |
+
$object->plugin_slug.'_setting_section',
|
432 |
+
array( // The array of arguments to pass to the callback.
|
433 |
+
"id" => $field_id, //sends select field id to callback
|
434 |
+
"default" => 'repeat', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
435 |
+
"select_options" => $object->back_options //sets select option data
|
436 |
+
)
|
437 |
+
);
|
438 |
+
|
439 |
+
//add text input field
|
440 |
+
$field_slug = "default_border_top_width";
|
441 |
+
$field_label = __('Width (px)', 'spacer-layout-aid');
|
442 |
+
$field_id = $object->plugin_slug.'_'.$field_slug;
|
443 |
+
register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
|
444 |
+
add_settings_field(
|
445 |
+
$field_id,
|
446 |
+
$field_label,
|
447 |
+
array($object, 'create_a_text_input'), //callback function for text input
|
448 |
+
$object->plugin_slug.'-setting-admin_layoutaidtb',
|
449 |
+
$object->plugin_slug.'_setting_section',
|
450 |
+
array( // The array of arguments to pass to the callback.
|
451 |
+
"id" => $field_id, //sends field id to callback
|
452 |
+
//"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
|
453 |
+
"placeholder" => __('eg: 5', 'spacer-layout-aid'),
|
454 |
+
"default" => '' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
455 |
+
)
|
456 |
+
);
|
457 |
+
|
458 |
+
//add a select input field
|
459 |
+
$field_slug = "default_border_top_style";
|
460 |
+
$field_label = __('Style', 'spacer-layout-aid');
|
461 |
+
$field_id = $object->plugin_slug.'_'.$field_slug;
|
462 |
+
$object->unit_options = array(
|
463 |
+
array("label" => "Solid", "value" => "solid"),
|
464 |
+
array("label" => "Dotted", "value" => "dotted"),
|
465 |
+
array("label" => "Dashed", "value" => "dashed"),
|
466 |
+
array("label" => "Double", "value" => "double"),
|
467 |
+
array("label" => "Groove", "value" => "groove"),
|
468 |
+
array("label" => "Inset", "value" => "inset"),
|
469 |
+
array("label" => "Outset", "value" => "outset"),
|
470 |
+
);
|
471 |
+
register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_solid'));
|
472 |
+
add_settings_field(
|
473 |
+
$field_id,
|
474 |
+
$field_label,
|
475 |
+
array($object, 'create_a_select_input'), //callback function for select input
|
476 |
+
$object->plugin_slug.'-setting-admin_layoutaidtb',
|
477 |
+
$object->plugin_slug.'_setting_section',
|
478 |
+
array( // The array of arguments to pass to the callback.
|
479 |
+
"id" => $field_id, //sends select field id to callback
|
480 |
+
"default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
481 |
+
"meta" => 'style="max-width:450px;"',
|
482 |
+
"select_options" => $object->unit_options //sets select option data
|
483 |
+
)
|
484 |
+
);
|
485 |
+
|
486 |
+
//add color picker text input field
|
487 |
+
$field_slug = "default_border_top_color";
|
488 |
+
$field_label = __('Color', 'spacer-layout-aid');
|
489 |
+
$field_id = $object->plugin_slug.'_'.$field_slug;
|
490 |
+
register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
|
491 |
+
add_settings_field(
|
492 |
+
$field_id,
|
493 |
+
$field_label,
|
494 |
+
array($object, 'create_a_text_input'), //callback function for text input
|
495 |
+
$object->plugin_slug.'-setting-admin_layoutaidtb',
|
496 |
+
$object->plugin_slug.'_setting_section',
|
497 |
+
array( // The array of arguments to pass to the callback.
|
498 |
+
"id" => $field_id, //sends field id to callback
|
499 |
+
//"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
|
500 |
+
"default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
501 |
+
"class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
|
502 |
+
)
|
503 |
+
);
|
504 |
+
|
505 |
+
//add text input field
|
506 |
+
$field_slug = "default_border_bottom_width";
|
507 |
+
$field_label = __('Width (px)', 'spacer-layout-aid');
|
508 |
+
$field_id = $object->plugin_slug.'_'.$field_slug;
|
509 |
+
register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
|
510 |
+
add_settings_field(
|
511 |
+
$field_id,
|
512 |
+
$field_label,
|
513 |
+
array($object, 'create_a_text_input'), //callback function for text input
|
514 |
+
$object->plugin_slug.'-setting-admin_layoutaidbb',
|
515 |
+
$object->plugin_slug.'_setting_section',
|
516 |
+
array( // The array of arguments to pass to the callback.
|
517 |
+
"id" => $field_id, //sends field id to callback
|
518 |
+
//"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
|
519 |
+
"placeholder" => __('eg: 5', 'spacer-layout-aid'),
|
520 |
+
"default" => '' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
521 |
+
)
|
522 |
+
);
|
523 |
+
|
524 |
+
//add a select input field
|
525 |
+
$field_slug = "default_border_bottom_style";
|
526 |
+
$field_label = __('Style', 'spacer-layout-aid');
|
527 |
+
$field_id = $object->plugin_slug.'_'.$field_slug;
|
528 |
+
$object->unit_options = array(
|
529 |
+
array("label" => "Solid", "value" => "solid"),
|
530 |
+
array("label" => "Dotted", "value" => "dotted"),
|
531 |
+
array("label" => "Dashed", "value" => "dashed"),
|
532 |
+
array("label" => "Double", "value" => "double"),
|
533 |
+
array("label" => "Groove", "value" => "groove"),
|
534 |
+
array("label" => "Inset", "value" => "inset"),
|
535 |
+
array("label" => "Outset", "value" => "outset"),
|
536 |
+
);
|
537 |
+
register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_solid'));
|
538 |
+
add_settings_field(
|
539 |
+
$field_id,
|
540 |
+
$field_label,
|
541 |
+
array($object, 'create_a_select_input'), //callback function for select input
|
542 |
+
$object->plugin_slug.'-setting-admin_layoutaidbb',
|
543 |
+
$object->plugin_slug.'_setting_section',
|
544 |
+
array( // The array of arguments to pass to the callback.
|
545 |
+
"id" => $field_id, //sends select field id to callback
|
546 |
+
"default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
547 |
+
"meta" => 'style="max-width:450px;"',
|
548 |
+
"select_options" => $object->unit_options //sets select option data
|
549 |
+
)
|
550 |
+
);
|
551 |
+
|
552 |
+
//add color picker text input field
|
553 |
+
$field_slug = "default_border_bottom_color";
|
554 |
+
$field_label = __('Color', 'spacer-layout-aid');
|
555 |
+
$field_id = $object->plugin_slug.'_'.$field_slug;
|
556 |
+
register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
|
557 |
+
add_settings_field(
|
558 |
+
$field_id,
|
559 |
+
$field_label,
|
560 |
+
array($object, 'create_a_text_input'), //callback function for text input
|
561 |
+
$object->plugin_slug.'-setting-admin_layoutaidbb',
|
562 |
+
$object->plugin_slug.'_setting_section',
|
563 |
+
array( // The array of arguments to pass to the callback.
|
564 |
+
"id" => $field_id, //sends field id to callback
|
565 |
+
//"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
|
566 |
+
"default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
567 |
+
"class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
|
568 |
+
)
|
569 |
+
);
|
570 |
+
|
571 |
+
//add text input field
|
572 |
+
$field_slug = "default_bottom_margin";
|
573 |
+
$field_label = __('Bottom Margin (px)', 'spacer-layout-aid');
|
574 |
+
$field_id = $object->plugin_slug.'_'.$field_slug;
|
575 |
+
register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
|
576 |
+
add_settings_field(
|
577 |
+
$field_id,
|
578 |
+
$field_label,
|
579 |
+
array($object, 'create_a_text_input'), //callback function for text input
|
580 |
+
$object->plugin_slug.'-setting-admin_layoutaidother',
|
581 |
+
$object->plugin_slug.'_setting_section',
|
582 |
+
array( // The array of arguments to pass to the callback.
|
583 |
+
"id" => $field_id, //sends field id to callback
|
584 |
+
//"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
|
585 |
+
"placeholder" => __('eg: 5', 'spacer-layout-aid'),
|
586 |
+
"default" => '' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
587 |
+
)
|
588 |
+
);
|
589 |
+
|
590 |
+
//add a select input field
|
591 |
+
$field_slug = "default_shadow";
|
592 |
+
$field_label = __('Shadow', 'spacer-layout-aid');
|
593 |
+
$field_id = $object->plugin_slug.'_'.$field_slug;
|
594 |
+
$object->unit_options = array(
|
595 |
+
array("label" => "None", "value" => "none"),
|
596 |
+
array("label" => "Light", "value" => "light"),
|
597 |
+
array("label" => "Medium", "value" => "medium"),
|
598 |
+
array("label" => "Heavy", "value" => "heavy")
|
599 |
+
);
|
600 |
+
register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_none'));
|
601 |
+
add_settings_field(
|
602 |
+
$field_id,
|
603 |
+
$field_label,
|
604 |
+
array($object, 'create_a_select_input'), //callback function for select input
|
605 |
+
$object->plugin_slug.'-setting-admin_layoutaidother',
|
606 |
+
$object->plugin_slug.'_setting_section',
|
607 |
+
array( // The array of arguments to pass to the callback.
|
608 |
+
"id" => $field_id, //sends select field id to callback
|
609 |
+
"default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
610 |
+
"meta" => 'style="max-width:450px;"',
|
611 |
+
"select_options" => $object->unit_options //sets select option data
|
612 |
+
)
|
613 |
+
);
|
614 |
+
|
615 |
+
|
616 |
+
|
617 |
+
//BEGIN ADD SPACER LAYOUT FIELDS
|
618 |
+
|
619 |
+
$key_array = $object->key_array;
|
620 |
+
foreach($key_array as $key=>$value){
|
621 |
+
add_settings_section(
|
622 |
+
$object->plugin_slug.'_setting_section',
|
623 |
+
__('', 'spacer-layout-aid'),
|
624 |
+
false,
|
625 |
+
$object->plugin_slug.'-setting-admin_layoutaidbg_addspacer'.$key
|
626 |
+
);
|
627 |
+
|
628 |
+
add_settings_section(
|
629 |
+
$object->plugin_slug.'_setting_section',
|
630 |
+
__('', 'spacer-layout-aid'),
|
631 |
+
false,
|
632 |
+
$object->plugin_slug.'-setting-admin_layoutaidtb_addspacer'.$key
|
633 |
+
);
|
634 |
+
|
635 |
+
add_settings_section(
|
636 |
+
$object->plugin_slug.'_setting_section',
|
637 |
+
__('', 'spacer-layout-aid'),
|
638 |
+
false,
|
639 |
+
$object->plugin_slug.'-setting-admin_layoutaidbb_addspacer'.$key
|
640 |
+
);
|
641 |
+
|
642 |
+
add_settings_section(
|
643 |
+
$object->plugin_slug.'_setting_section',
|
644 |
+
__('', 'spacer-layout-aid'),
|
645 |
+
false,
|
646 |
+
$object->plugin_slug.'-setting-admin_layoutaidother_addspacer'.$key
|
647 |
+
);
|
648 |
+
|
649 |
+
//add color picker text input field
|
650 |
+
$field_slug = "default_bg_color_addspacers";
|
651 |
+
$field_label = __('Color', 'spacer-layout-aid');
|
652 |
+
$field_id = $object->plugin_slug.'_'.$field_slug;
|
653 |
+
register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
|
654 |
+
add_settings_field(
|
655 |
+
$field_id,
|
656 |
+
$field_label,
|
657 |
+
array($object, 'create_a_text_input_array'), //callback function for text input
|
658 |
+
$object->plugin_slug.'-setting-admin_layoutaidbg_addspacer'.$key,
|
659 |
+
$object->plugin_slug.'_setting_section',
|
660 |
+
array( // The array of arguments to pass to the callback.
|
661 |
+
"id" => $field_id, //sends field id to callback
|
662 |
+
//"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
|
663 |
+
"default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
664 |
+
"key" => $key,
|
665 |
+
"class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
|
666 |
+
)
|
667 |
+
);
|
668 |
+
|
669 |
+
//add image upload field
|
670 |
+
$field_slug = "default_background_image_upload_addspacers";
|
671 |
+
$field_label = "Image";
|
672 |
+
$field_id = $object->plugin_slug.'_'.$field_slug;
|
673 |
+
register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
|
674 |
+
add_settings_field(
|
675 |
+
$field_id, // ID of the option
|
676 |
+
$field_label, // Title of the option
|
677 |
+
array($object, 'create_image_upload_array'), // Callback used to render the input field
|
678 |
+
$object->plugin_slug.'-setting-admin_layoutaidbg_addspacer'.$key, // Page to associate this option with
|
679 |
+
$object->plugin_slug.'_setting_section', // Section to associate this option with
|
680 |
+
array( // The array of arguments to pass to the callback.
|
681 |
+
"id" => $field_id, //sends field id to callback
|
682 |
+
"key" => $key
|
683 |
+
)
|
684 |
+
);
|
685 |
+
|
686 |
+
//add an image select input field
|
687 |
+
$field_slug = "custom_background_image_position_addspacers";
|
688 |
+
$field_label = "Image Position";
|
689 |
+
$field_id = $object->plugin_slug.'_'.$field_slug;
|
690 |
+
$object->back_options = array(
|
691 |
+
array("label" => "Repeat", "value" => "repeat"),
|
692 |
+
array("label" => "Proportional Stretch", "value" => "propstretch"),
|
693 |
+
array("label" => "Proportional Repeat", "value" => "proprepeat"),
|
694 |
+
array("label" => "Crop to Fit", "value" => "croptofit"),
|
695 |
+
array("label" => "Stretch", "value" => "stretch")
|
696 |
+
);
|
697 |
+
register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_repeat'));
|
698 |
+
add_settings_field(
|
699 |
+
$field_id,
|
700 |
+
$field_label,
|
701 |
+
array($object, 'create_a_select_input_array'), //callback function for select input
|
702 |
+
$object->plugin_slug.'-setting-admin_layoutaidbg_addspacer'.$key,
|
703 |
+
$object->plugin_slug.'_setting_section',
|
704 |
+
array( // The array of arguments to pass to the callback.
|
705 |
+
"id" => $field_id, //sends select field id to callback
|
706 |
+
"default" => 'repeat', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
707 |
+
"key" => $key,
|
708 |
+
"select_options" => $object->back_options //sets select option data
|
709 |
+
)
|
710 |
+
);
|
711 |
+
|
712 |
+
//add text input field
|
713 |
+
$field_slug = "default_border_top_width_addspacers";
|
714 |
+
$field_label = __('Width (px)', 'spacer-layout-aid');
|
715 |
+
$field_id = $object->plugin_slug.'_'.$field_slug;
|
716 |
+
register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
|
717 |
+
add_settings_field(
|
718 |
+
$field_id,
|
719 |
+
$field_label,
|
720 |
+
array($object, 'create_a_text_input_array'), //callback function for text input
|
721 |
+
$object->plugin_slug.'-setting-admin_layoutaidtb_addspacer'.$key,
|
722 |
+
$object->plugin_slug.'_setting_section',
|
723 |
+
array( // The array of arguments to pass to the callback.
|
724 |
+
"id" => $field_id, //sends field id to callback
|
725 |
+
//"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
|
726 |
+
"placeholder" => __('eg: 5', 'spacer-layout-aid'),
|
727 |
+
"key" => $key,
|
728 |
+
"default" => '0' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
729 |
+
)
|
730 |
+
);
|
731 |
+
|
732 |
+
//add a select input field
|
733 |
+
$field_slug = "default_border_top_style_addspacers";
|
734 |
+
$field_label = __('Style', 'spacer-layout-aid');
|
735 |
+
$field_id = $object->plugin_slug.'_'.$field_slug;
|
736 |
+
$object->unit_options = array(
|
737 |
+
array("label" => "Solid", "value" => "solid"),
|
738 |
+
array("label" => "Dotted", "value" => "dotted"),
|
739 |
+
array("label" => "Dashed", "value" => "dashed"),
|
740 |
+
array("label" => "Double", "value" => "double"),
|
741 |
+
array("label" => "Groove", "value" => "groove"),
|
742 |
+
array("label" => "Inset", "value" => "inset"),
|
743 |
+
array("label" => "Outset", "value" => "outset"),
|
744 |
+
);
|
745 |
+
register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_solid'));
|
746 |
+
add_settings_field(
|
747 |
+
$field_id,
|
748 |
+
$field_label,
|
749 |
+
array($object, 'create_a_select_input_array'), //callback function for select input
|
750 |
+
$object->plugin_slug.'-setting-admin_layoutaidtb_addspacer'.$key,
|
751 |
+
$object->plugin_slug.'_setting_section',
|
752 |
+
array( // The array of arguments to pass to the callback.
|
753 |
+
"id" => $field_id, //sends select field id to callback
|
754 |
+
"default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
755 |
+
"meta" => 'style="max-width:450px;"',
|
756 |
+
"key" => $key,
|
757 |
+
"select_options" => $object->unit_options //sets select option data
|
758 |
+
)
|
759 |
+
);
|
760 |
+
|
761 |
+
//add color picker text input field
|
762 |
+
$field_slug = "default_border_top_color_addspacers";
|
763 |
+
$field_label = __('Color', 'spacer-layout-aid');
|
764 |
+
$field_id = $object->plugin_slug.'_'.$field_slug;
|
765 |
+
register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
|
766 |
+
add_settings_field(
|
767 |
+
$field_id,
|
768 |
+
$field_label,
|
769 |
+
array($object, 'create_a_text_input_array'), //callback function for text input
|
770 |
+
$object->plugin_slug.'-setting-admin_layoutaidtb_addspacer'.$key,
|
771 |
+
$object->plugin_slug.'_setting_section',
|
772 |
+
array( // The array of arguments to pass to the callback.
|
773 |
+
"id" => $field_id, //sends field id to callback
|
774 |
+
//"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
|
775 |
+
"default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
776 |
+
"key" => $key,
|
777 |
+
"class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
|
778 |
+
)
|
779 |
+
);
|
780 |
+
|
781 |
+
//add text input field
|
782 |
+
$field_slug = "default_border_bottom_width_addspacers";
|
783 |
+
$field_label = __('Width (px)', 'spacer-layout-aid');
|
784 |
+
$field_id = $object->plugin_slug.'_'.$field_slug;
|
785 |
+
register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
|
786 |
+
add_settings_field(
|
787 |
+
$field_id,
|
788 |
+
$field_label,
|
789 |
+
array($object, 'create_a_text_input_array'), //callback function for text input
|
790 |
+
$object->plugin_slug.'-setting-admin_layoutaidbb_addspacer'.$key,
|
791 |
+
$object->plugin_slug.'_setting_section',
|
792 |
+
array( // The array of arguments to pass to the callback.
|
793 |
+
"id" => $field_id, //sends field id to callback
|
794 |
+
//"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
|
795 |
+
"placeholder" => __('eg: 5', 'spacer-layout-aid'),
|
796 |
+
"key" => $key,
|
797 |
+
"default" => '0' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
798 |
+
)
|
799 |
+
);
|
800 |
+
|
801 |
+
//add a select input field
|
802 |
+
$field_slug = "default_border_bottom_style_addspacers";
|
803 |
+
$field_label = __('Style', 'spacer-layout-aid');
|
804 |
+
$field_id = $object->plugin_slug.'_'.$field_slug;
|
805 |
+
$object->unit_options = array(
|
806 |
+
array("label" => "Solid", "value" => "solid"),
|
807 |
+
array("label" => "Dotted", "value" => "dotted"),
|
808 |
+
array("label" => "Dashed", "value" => "dashed"),
|
809 |
+
array("label" => "Double", "value" => "double"),
|
810 |
+
array("label" => "Groove", "value" => "groove"),
|
811 |
+
array("label" => "Inset", "value" => "inset"),
|
812 |
+
array("label" => "Outset", "value" => "outset"),
|
813 |
+
);
|
814 |
+
register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_solid'));
|
815 |
+
add_settings_field(
|
816 |
+
$field_id,
|
817 |
+
$field_label,
|
818 |
+
array($object, 'create_a_select_input_array'), //callback function for select input
|
819 |
+
$object->plugin_slug.'-setting-admin_layoutaidbb_addspacer'.$key,
|
820 |
+
$object->plugin_slug.'_setting_section',
|
821 |
+
array( // The array of arguments to pass to the callback.
|
822 |
+
"id" => $field_id, //sends select field id to callback
|
823 |
+
"default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
824 |
+
"meta" => 'style="max-width:450px;"',
|
825 |
+
"key" => $key,
|
826 |
+
"select_options" => $object->unit_options //sets select option data
|
827 |
+
)
|
828 |
+
);
|
829 |
+
|
830 |
+
//add color picker text input field
|
831 |
+
$field_slug = "default_border_bottom_color_addspacers";
|
832 |
+
$field_label = __('Color', 'spacer-layout-aid');
|
833 |
+
$field_id = $object->plugin_slug.'_'.$field_slug;
|
834 |
+
register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
|
835 |
+
add_settings_field(
|
836 |
+
$field_id,
|
837 |
+
$field_label,
|
838 |
+
array($object, 'create_a_text_input_array'), //callback function for text input
|
839 |
+
$object->plugin_slug.'-setting-admin_layoutaidbb_addspacer'.$key,
|
840 |
+
$object->plugin_slug.'_setting_section',
|
841 |
+
array( // The array of arguments to pass to the callback.
|
842 |
+
"id" => $field_id, //sends field id to callback
|
843 |
+
//"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
|
844 |
+
"default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
845 |
+
"key" => $key,
|
846 |
+
"class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
|
847 |
+
)
|
848 |
+
);
|
849 |
+
|
850 |
+
//add text input field
|
851 |
+
$field_slug = "default_bottom_margin_addspacers";
|
852 |
+
$field_label = __('Bottom Margin (px)', 'spacer-layout-aid');
|
853 |
+
$field_id = $object->plugin_slug.'_'.$field_slug;
|
854 |
+
register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
|
855 |
+
add_settings_field(
|
856 |
+
$field_id,
|
857 |
+
$field_label,
|
858 |
+
array($object, 'create_a_text_input_array'), //callback function for text input
|
859 |
+
$object->plugin_slug.'-setting-admin_layoutaidother_addspacer'.$key,
|
860 |
+
$object->plugin_slug.'_setting_section',
|
861 |
+
array( // The array of arguments to pass to the callback.
|
862 |
+
"id" => $field_id, //sends field id to callback
|
863 |
+
//"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
|
864 |
+
"placeholder" => __('eg: 5', 'spacer-layout-aid'),
|
865 |
+
"key" => $key,
|
866 |
+
"default" => '0' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
867 |
+
)
|
868 |
+
);
|
869 |
+
|
870 |
+
//add a select input field
|
871 |
+
$field_slug = "default_shadow_addspacers";
|
872 |
+
$field_label = __('Shadow', 'spacer-layout-aid');
|
873 |
+
$field_id = $object->plugin_slug.'_'.$field_slug;
|
874 |
+
$object->unit_options = array(
|
875 |
+
array("label" => "None", "value" => "none"),
|
876 |
+
array("label" => "Light", "value" => "light"),
|
877 |
+
array("label" => "Medium", "value" => "medium"),
|
878 |
+
array("label" => "Heavy", "value" => "heavy")
|
879 |
+
);
|
880 |
+
register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_none'));
|
881 |
+
add_settings_field(
|
882 |
+
$field_id,
|
883 |
+
$field_label,
|
884 |
+
array($object, 'create_a_select_input_array'), //callback function for select input
|
885 |
+
$object->plugin_slug.'-setting-admin_layoutaidother_addspacer'.$key,
|
886 |
+
$object->plugin_slug.'_setting_section',
|
887 |
+
array( // The array of arguments to pass to the callback.
|
888 |
+
"id" => $field_id, //sends select field id to callback
|
889 |
+
"default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
|
890 |
+
"meta" => 'style="max-width:450px;"',
|
891 |
+
"key" => $key,
|
892 |
+
"select_options" => $object->unit_options //sets select option data
|
893 |
+
)
|
894 |
+
);
|
895 |
+
|
896 |
+
}
|
897 |
+
|
898 |
+
}
|
899 |
+
|
900 |
+
|
901 |
+
|
902 |
+
|
903 |
+
//add plugin action links logic
|
904 |
+
function add_plugin_action_links( $links ) {
|
905 |
+
|
906 |
+
return array_merge(
|
907 |
+
array(
|
908 |
+
'settings' => '<a href="' . get_bloginfo( 'wpurl' ) . '/wp-admin/options-general.php?page='.$this->sva_plugin_slug.'-setting-admin">Settings</a>'
|
909 |
+
),
|
910 |
+
$links
|
911 |
+
);
|
912 |
+
|
913 |
+
}
|
914 |
+
|
915 |
+
public function plugin_row_links($links, $file) {
|
916 |
+
$plugin = plugin_basename(__FILE__);
|
917 |
+
if ($file == $plugin) // only for this plugin
|
918 |
+
return array_merge( $links,
|
919 |
+
array( '<a target="_blank" href="http://www.linkedin.com/in/ClevelandWebDeveloper/">' . __('Find me on LinkedIn' ) . '</a>' ),
|
920 |
+
array( '<a target="_blank" href="http://twitter.com/ClevelandWebDev">' . __('Follow me on Twitter') . '</a>' )
|
921 |
+
);
|
922 |
+
return $links;
|
923 |
+
}
|
924 |
+
|
925 |
+
} //end of plugin class
|
926 |
+
|
927 |
$custom_plugin = new $sva_plugin_slug();
|