alignment.php
1 month ago
animation.php
1 month ago
behavior.php
1 month ago
days-dates.php
1 month ago
devices.php
1 month ago
settings.php
1 month ago
state.php
1 month ago
styling.php
1 month ago
upsell.php
1 month ago
visibility.php
1 month ago
behavior.php
272 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Settings Widget Options |
| 5 | * |
| 6 | * @copyright Copyright (c) 2015, Jeffrey Carandang |
| 7 | * @since 1.0 |
| 8 | */ |
| 9 | |
| 10 | // Exit if accessed directly |
| 11 | if (!defined('ABSPATH')) exit; |
| 12 | |
| 13 | /** |
| 14 | * Add Settings Widget Options Tab |
| 15 | * |
| 16 | * @since 1.0 |
| 17 | * @return void |
| 18 | */ |
| 19 | |
| 20 | /** |
| 21 | * Called on 'extended_widget_opts_tabs' |
| 22 | * create new tab navigation for alignment options |
| 23 | */ |
| 24 | function widgetopts_tab_behavior($args) |
| 25 | { ?> |
| 26 | <li class="extended-widget-opts-tab-behavior"> |
| 27 | <a href="#extended-widget-opts-tab-<?php echo $args['id']; ?>-behavior" title="<?php _e('Misc & Class,ID', 'widget-options'); ?>"><span class="dashicons dashicons-admin-generic"></span> <span class="tabtitle"><?php _e('Behavior', 'widget-options'); ?></span></a> |
| 28 | </li> |
| 29 | <?php |
| 30 | } |
| 31 | add_action('extended_widget_opts_tabs', 'widgetopts_tab_behavior', 7); |
| 32 | |
| 33 | /** |
| 34 | * Called on 'extended_widget_opts_tabcontent' |
| 35 | * create new tab content options for alignment options |
| 36 | */ |
| 37 | if (!function_exists('widgetopts_tabcontent_behavior')) : |
| 38 | function widgetopts_tabcontent_behavior($args) |
| 39 | { |
| 40 | global $widget_options; |
| 41 | |
| 42 | $id = ''; |
| 43 | $classes = ''; |
| 44 | $logic = ''; |
| 45 | $selected = 0; |
| 46 | $check = ''; |
| 47 | if (isset($args['params']) && isset($args['params']['class'])) { |
| 48 | if (isset($args['params']['class']['id'])) { |
| 49 | $id = $args['params']['class']['id']; |
| 50 | } |
| 51 | if (isset($args['params']['class']['classes'])) { |
| 52 | $classes = $args['params']['class']['classes']; |
| 53 | } |
| 54 | if (isset($args['params']['class']['selected'])) { |
| 55 | $selected = $args['params']['class']['selected']; |
| 56 | } |
| 57 | if (isset($args['params']['class']['logic'])) { |
| 58 | $logic = $args['params']['class']['logic']; |
| 59 | } |
| 60 | if (isset($args['params']['class']['title']) && $args['params']['class']['title'] == '1') { |
| 61 | $check = 'checked="checked"'; |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | $predefined = array(); |
| 66 | if (isset($widget_options['settings']['classes']) && isset($widget_options['settings']['classes']['classlists']) && !empty($widget_options['settings']['classes']['classlists'])) { |
| 67 | $predefined = $widget_options['settings']['classes']['classlists']; |
| 68 | } |
| 69 | ?> |
| 70 | <div id="extended-widget-opts-tab-<?php echo $args['id']; ?>-behavior" class="extended-widget-opts-tabcontent extended-widget-opts-inside-tabcontent extended-widget-opts-tabcontent-class"> |
| 71 | |
| 72 | <div class="extended-widget-opts-settings-tabs extended-widget-opts-inside-tabs"> |
| 73 | <input type="hidden" id="extended-widget-opts-settings-selectedtab" value="<?php echo $selected; ?>" name="<?php echo $args['namespace']; ?>[extended_widget_opts][class][selected]" /> |
| 74 | <!-- start tab nav --> |
| 75 | <ul style="margin-top: 10px;" class="extended-widget-opts-settings-tabnav-ul"> |
| 76 | <?php if ('activate' == $widget_options['hide_title']) { ?> |
| 77 | <li class="extended-widget-opts-settings-tab-title"> |
| 78 | <a style="padding: 5px !important;" href="#extended-widget-opts-settings-tab-<?php echo $args['id']; ?>-title" title="<?php _e('Widget Title', 'widget-options'); ?>"><?php _e('Widget Title', 'widget-options'); ?></a> |
| 79 | </li> |
| 80 | <?php } ?> |
| 81 | |
| 82 | |
| 83 | <li class="extended-widget-opts-settings-tab-links"> |
| 84 | <a style="padding: 5px !important;" href="#extended-widget-opts-settings-tab-<?php echo $args['id']; ?>-links" title="<?php _e('Link Widget', 'widget-options'); ?>"><?php _e('Link Widget', 'widget-options'); ?></a> |
| 85 | </li> |
| 86 | |
| 87 | |
| 88 | |
| 89 | <li class="extended-widget-opts-settings-tab-fixed"> |
| 90 | <a style="padding: 5px !important;" href="#extended-widget-opts-settings-tab-<?php echo $args['id']; ?>-fixed" title="<?php _e('Fixed Widget', 'widget-options'); ?>"><?php _e('Fixed Widget', 'widget-options'); ?></a> |
| 91 | </li> |
| 92 | |
| 93 | |
| 94 | <?php if ('activate' == $widget_options['classes']) { ?> |
| 95 | <li class="extended-widget-opts-settings-tab-class"> |
| 96 | <a style="padding: 5px !important;" href="#extended-widget-opts-settings-tab-<?php echo $args['id']; ?>-class" title="<?php _e('Class & ID', 'widget-options'); ?>"><?php _e('Class & ID', 'widget-options'); ?></a> |
| 97 | </li> |
| 98 | <?php } ?> |
| 99 | <div class="extended-widget-opts-clearfix"></div> |
| 100 | </ul><!-- end tab nav --> |
| 101 | <div class="extended-widget-opts-clearfix"></div> |
| 102 | |
| 103 | <?php if ('activate' == $widget_options['hide_title']) { ?> |
| 104 | <!-- start title tab content --> |
| 105 | <div id="extended-widget-opts-settings-tab-<?php echo $args['id']; ?>-title" class="extended-widget-opts-settings-tabcontent extended-widget-opts-inner-tabcontent"> |
| 106 | <div class="widget-opts-title"> |
| 107 | <?php if ('activate' == $widget_options['hide_title']) { ?> |
| 108 | <p class="widgetopts-subtitle"><?php _e('Hide Widget Title', 'widget-options'); ?></p> |
| 109 | <p> |
| 110 | <input type="checkbox" name="<?php echo $args['namespace']; ?>[extended_widget_opts][class][title]" id="opts-class-title-<?php echo $args['id']; ?>" value="1" <?php echo $check; ?> /> |
| 111 | <label for="opts-class-title-<?php echo $args['id']; ?>"><?php _e('Check to hide widget title', 'widget-options'); ?></label> |
| 112 | </p> |
| 113 | <?php } ?> |
| 114 | </div> |
| 115 | </div><!-- end title tab content --> |
| 116 | <?php } ?> |
| 117 | |
| 118 | <!-- start links tab content --> |
| 119 | <div id="extended-widget-opts-settings-tab-<?php echo $args['id']; ?>-links" class="extended-widget-opts-settings-tabcontent extended-widget-opts-inner-tabcontent"> |
| 120 | <div class="widget-opts-title"> |
| 121 | <div class="widgetopts-widget-opts-wrapper disabled-section"> |
| 122 | <div class="extended-widget-opts-demo-warning"> |
| 123 | <p class="widgetopts-unlock-features"> |
| 124 | <span class="dashicons dashicons-lock"></span><br> |
| 125 | Unlock all Features<br> |
| 126 | <a href="https://widget-options.com/?utm_source=wordpressadmin&utm_medium=widgettabs&utm_campaign=widgetoptsprotab" class="button-primary" target="_blank">Learn More</a> |
| 127 | </p> |
| 128 | </div> |
| 129 | |
| 130 | <div class="idgetopts-links-widget-opts"> |
| 131 | <p class="widgetopts-subtitle"><?php _e('Link Widget', 'widget-options'); ?></p> |
| 132 | <table class="form-table"> |
| 133 | <tbody> |
| 134 | <tr valign="top"> |
| 135 | <td scope="row"><strong><?php _e('Link:', 'widget-options'); ?></strong></td> |
| 136 | <td><input type="text" class="widefat" disabled name="pro[class][link]" value="" /></td> |
| 137 | </tr> |
| 138 | <tr valign="top"> |
| 139 | <td scope="row"> </td> |
| 140 | <td> |
| 141 | <input type="checkbox" disabled id="opts-class-target-<?php echo $args['id']; ?>" name="pro[class][target]" value="1" /> |
| 142 | <label class="opts-label-small" for="opts-class-target-<?php echo $args['id']; ?>"><?php _e('Open to new tab', 'widget-options'); ?></label> |
| 143 | </td> |
| 144 | </tr> |
| 145 | <tr valign="top"> |
| 146 | <td scope="row"> </td> |
| 147 | <td> |
| 148 | <input type="checkbox" disabled id="opts-class-nofollow-<?php echo $args['id']; ?>" name="pro[class][nofollow]" value="1" /> |
| 149 | <label class="opts-label-small" for="opts-class-nofollow-<?php echo $args['id']; ?>"><?php _e('rel="nofollow"', 'widget-options'); ?></label> |
| 150 | </td> |
| 151 | </tr> |
| 152 | <tr valign="top"> |
| 153 | <td scope="row"> </td> |
| 154 | <td> |
| 155 | <input type="checkbox" disabled id="opts-class-totitle-<?php echo $args['id']; ?>" name="pro[class][link_title]" value="1" /> |
| 156 | <label class="opts-label-small" for="opts-class-totitle-<?php echo $args['id']; ?>"><?php _e('Apply to title only', 'widget-options'); ?></label> |
| 157 | </td> |
| 158 | </tr> |
| 159 | <tr valign="top"> |
| 160 | <td scope="row"> </td> |
| 161 | <td> |
| 162 | <input type="checkbox" disabled id="opts-class-http-<?php echo $args['id']; ?>" name="pro[class][http]" value="1" /> |
| 163 | <label class="opts-label-small" for="opts-class-http-<?php echo $args['id']; ?>"><?php _e('Do not add http', 'widget-options'); ?></label> |
| 164 | </td> |
| 165 | </tr> |
| 166 | </tbody> |
| 167 | </table> |
| 168 | </div> |
| 169 | |
| 170 | </div> |
| 171 | </div> |
| 172 | </div><!-- end links tab content --> |
| 173 | |
| 174 | <!-- start fixed tab content --> |
| 175 | <div id="extended-widget-opts-settings-tab-<?php echo $args['id']; ?>-fixed" class="extended-widget-opts-settings-tabcontent extended-widget-opts-inner-tabcontent"> |
| 176 | <div class="widget-opts-title"> |
| 177 | <div class="widgetopts-widget-opts-wrapper disabled-section"> |
| 178 | <div class="extended-widget-opts-demo-warning"> |
| 179 | <p class="widgetopts-unlock-features"> |
| 180 | <span class="dashicons dashicons-lock"></span><br> |
| 181 | Unlock all Features<br> |
| 182 | <a href="https://widget-options.com/?utm_source=wordpressadmin&utm_medium=widgettabs&utm_campaign=widgetoptsprotab" class="button-primary" target="_blank">Learn More</a> |
| 183 | </p> |
| 184 | </div> |
| 185 | |
| 186 | |
| 187 | <div class="widgetopts-fixed-widget-opts" style="min-height: 204px;"> |
| 188 | |
| 189 | <p class="widgetopts-subtitle"><?php _e('Fixed Widget', 'widget-options'); ?></p> |
| 190 | <p> |
| 191 | <input type="checkbox" disabled name="pro[class][fixed]" id="opts-class-fixed-<?php echo $args['id']; ?>" value="1" /> |
| 192 | <label for="opts-class-fixed-<?php echo $args['id']; ?>"><?php _e('Check to fixed widget on scroll', 'widget-options'); ?></label> |
| 193 | </p> |
| 194 | </div> |
| 195 | |
| 196 | </div> |
| 197 | </div> |
| 198 | </div><!-- end fixed tab content --> |
| 199 | |
| 200 | <?php if ('activate' == $widget_options['classes']) { ?> |
| 201 | <!-- start class tab content --> |
| 202 | <div id="extended-widget-opts-settings-tab-<?php echo $args['id']; ?>-class" class="extended-widget-opts-settings-tabcontent extended-widget-opts-inner-tabcontent"> |
| 203 | <div class="widget-opts-class"> |
| 204 | <table class="form-table"> |
| 205 | <tbody> |
| 206 | <?php if (isset($widget_options['settings']['classes']) && (isset($widget_options['settings']['classes']['id']) && '1' == $widget_options['settings']['classes']['id'])) { ?> |
| 207 | <tr valign="top" class="widgetopts_id_fld"> |
| 208 | <td scope="row"> |
| 209 | <strong><?php _e('Widget CSS ID:', 'widget-options'); ?></strong><br /> |
| 210 | <input type="text" id="opts-class-id-<?php echo $args['id']; ?>" class="widefat" name="<?php echo $args['namespace']; ?>[extended_widget_opts][class][id]" value="<?php echo $id; ?>" /> |
| 211 | </td> |
| 212 | </tr> |
| 213 | <?php } ?> |
| 214 | |
| 215 | <?php if ( |
| 216 | !isset($widget_options['settings']['classes']) || |
| 217 | (isset($widget_options['settings']['classes']) && isset($widget_options['settings']['classes']['type']) && !in_array($widget_options['settings']['classes']['type'], array('hide', 'predefined'))) |
| 218 | ) { ?> |
| 219 | <tr valign="top"> |
| 220 | <td scope="row"> |
| 221 | <strong><?php _e('Widget CSS Classes:', 'widget-options'); ?></strong><br /> |
| 222 | <input type="text" id="opts-class-classes-<?php echo $args['id']; ?>" class="widefat" name="<?php echo $args['namespace']; ?>[extended_widget_opts][class][classes]" value="<?php echo $classes; ?>" /> |
| 223 | <small><em><?php _e('Separate each class with space.', 'widget-options'); ?></em></small> |
| 224 | </td> |
| 225 | </tr> |
| 226 | <?php } ?> |
| 227 | <?php if ( |
| 228 | !isset($widget_options['settings']['classes']) || |
| 229 | (isset($widget_options['settings']['classes']) && isset($widget_options['settings']['classes']['type']) && !in_array($widget_options['settings']['classes']['type'], array('hide', 'text'))) |
| 230 | ) { ?> |
| 231 | <?php if (is_array($predefined) && !empty($predefined)) { |
| 232 | $predefined = array_unique($predefined); //remove dups |
| 233 | ?> |
| 234 | <tr valign="top"> |
| 235 | <td scope="row"> |
| 236 | <strong><?php _e('Available Widget Classes:', 'widget-options'); ?></strong><br /> |
| 237 | <div class="extended-widget-opts-class-lists" style="max-height: 230px;padding: 5px;overflow:auto;"> |
| 238 | <?php foreach ($predefined as $key => $value) { |
| 239 | if ( |
| 240 | isset($args['params']['class']['predefined']) && |
| 241 | is_array($args['params']['class']['predefined']) && |
| 242 | in_array($value, $args['params']['class']['predefined']) |
| 243 | ) { |
| 244 | $checked = 'checked="checked"'; |
| 245 | } else { |
| 246 | $checked = ''; |
| 247 | } |
| 248 | ?> |
| 249 | <p> |
| 250 | <input type="checkbox" name="<?php echo $args['namespace']; ?>[extended_widget_opts][class][predefined][]" id="<?php echo $args['id']; ?>-opts-class-<?php echo $key; ?>" value="<?php echo $value; ?>" <?php echo $checked; ?> /> |
| 251 | <label for="<?php echo $args['id']; ?>-opts-class-<?php echo $key; ?>"><?php echo $value; ?></label> |
| 252 | </p> |
| 253 | <?php } ?> |
| 254 | </div> |
| 255 | </td> |
| 256 | </tr> |
| 257 | <?php } ?> |
| 258 | <?php } ?> |
| 259 | </tbody> |
| 260 | </table> |
| 261 | </div> |
| 262 | </div><!-- end class tab content --> |
| 263 | <?php } ?> |
| 264 | |
| 265 | </div><!-- end .extended-widget-opts-settings-tabs --> |
| 266 | |
| 267 | |
| 268 | </div> |
| 269 | <?php |
| 270 | } |
| 271 | add_action('extended_widget_opts_tabcontent', 'widgetopts_tabcontent_behavior'); |
| 272 | endif; ?> |