PluginProbe ʕ •ᴥ•ʔ
Slider Ultimate / 2.0.8
Slider Ultimate v2.0.8
trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9
ultimate-slider / lib / simple-admin-pages / classes / AdminPageSetting.Count.class.php
ultimate-slider / lib / simple-admin-pages / classes Last commit date
AdminPage.Menu.class.php 4 years ago AdminPage.Submenu.class.php 4 years ago AdminPage.Themes.class.php 4 years ago AdminPage.class.php 4 years ago AdminPageSection.class.php 4 years ago AdminPageSetting.Address.class.php 4 years ago AdminPageSetting.Checkbox.class.php 4 years ago AdminPageSetting.ColorPicker.class.php 4 years ago AdminPageSetting.Count.class.php 4 years ago AdminPageSetting.Editor.class.php 4 years ago AdminPageSetting.FileUpload.class.php 4 years ago AdminPageSetting.HTML.class.php 4 years ago AdminPageSetting.Image.class.php 4 years ago AdminPageSetting.InfiniteTable.class.php 4 years ago AdminPageSetting.McApiKey.class.php 4 years ago AdminPageSetting.McListMerge.class.php 4 years ago AdminPageSetting.Number.class.php 4 years ago AdminPageSetting.OpeningHours.class.php 4 years ago AdminPageSetting.Ordering.class.php 4 years ago AdminPageSetting.Radio.class.php 4 years ago AdminPageSetting.Scheduler.class.php 4 years ago AdminPageSetting.Select.class.php 4 years ago AdminPageSetting.SelectMenu.class.php 4 years ago AdminPageSetting.SelectPost.class.php 4 years ago AdminPageSetting.SelectTaxonomy.class.php 4 years ago AdminPageSetting.Text.class.php 4 years ago AdminPageSetting.Textarea.class.php 4 years ago AdminPageSetting.Time.class.php 4 years ago AdminPageSetting.Toggle.class.php 4 years ago AdminPageSetting.WarningTip.class.php 4 years ago AdminPageSetting.class.php 4 years ago Library.class.php 4 years ago
AdminPageSetting.Count.class.php
118 lines
1 <?php
2
3 /**
4 * Register, display and save a count/unit option with drop-down menus.
5 *
6 * This setting accepts the following arguments in its constructor function.
7 *
8 * $args = array(
9 * 'id' => 'setting_id', // Unique id
10 * 'title' => 'My Setting', // Title or label for the setting
11 * 'description' => 'Description', // Help text description
12 * 'blank_option' => true, // Whether or not to show a blank option
13 * 'min_value' => 0, // The lowest value to include
14 * 'max_value' => 10, // The highest value to include
15 * 'increment' => 1, // How many values to increase by each loop
16 * 'units' => array( // An array of key/value pairs which
17 * 'unit_one' => 'Unit 1', // Define the units.
18 * 'unit_two' => 'Unit 2',
19 * ...
20 * );
21 * );
22 *
23 * @since 2.0
24 * @package Simple Admin Pages
25 */
26
27 class sapAdminPageSettingCount_2_6_1 extends sapAdminPageSetting_2_6_1 {
28
29 public $sanitize_callback = 'sanitize_text_field';
30
31 /**
32 * Add in the JS requried for rows to be added and the values to be stored
33 * @since 2.0
34 */
35 public $scripts = array(
36 'sap-count' => array(
37 'path' => 'js/count.js',
38 'dependencies' => array( 'jquery' ),
39 'version' => SAP_VERSION,
40 'footer' => true,
41 ),
42 );
43
44 // Whether or not to display a blank option
45 public $blank_option = true;
46
47 // The default value for the field when none has been set
48 public $default;
49
50 // The lowest value to include
51 public $min_value = 0;
52
53 // The lowest value to include
54 public $max_value = 10;
55
56 // The lowest value to include
57 public $increment = 1;
58
59 // An array of options for this select field, accepted as a key/value pair.
60 public $units = array();
61
62 /**
63 * Display this setting
64 * @since 1.0
65 */
66 public function display_setting() {
67
68 $this->value = $this->value ? $this->value : $this->default;
69
70 $count = strpos( $this->value, '_' ) !== false ? substr( $this->value, 0, strpos( $this->value, '_' ) ) : $this->value;
71 $unit = strpos( $this->value, '_' ) !== false ? substr( $this->value, strpos( $this->value, '_' ) + 1 ) : '';
72
73 ?>
74
75 <fieldset <?php $this->print_conditional_data(); ?>>
76 <input id='<?php echo $this->id; ?>' type='hidden' name='<?php echo $this->get_input_name(); ?>' value='<?php echo $this->value; ?>' />
77 <select id="<?php echo $this->id; ?>_count" <?php echo ( $this->disabled ? 'disabled' : ''); ?> class='sap-count-count' data-id='<?php echo $this->id; ?>'>
78
79 <?php if ( $this->blank_option === true ) : ?>
80 <option></option>
81 <?php endif; ?>
82
83 <?php for ( $i = $this->min_value; $i <= $this->max_value; $i = $i + $this->increment ) : ?>
84 <option value="<?php echo $i; ?>"<?php if( $count == $i ) : ?> selected="selected"<?php endif; ?>><?php echo $i; ?></option>
85 <?php endfor; ?>
86
87 </select>
88
89 <?php if ( ! empty($this->units) ) { ?>
90
91 <?php if ( sizeof( $this->units ) == 1 ) { ?>
92 <input type='hidden' id='<?php echo $this->id; ?>_unit' data-id='<?php echo $this->id; ?>' /><span><?php echo esc_html( reset( $this->units ) ); ?></span>
93 <?php } else { ?>
94 <select id='<?php echo $this->id; ?>_unit' <?php echo ( $this->disabled ? 'disabled' : ''); ?> class='sap-count-unit' data-id='<?php echo $this->id; ?>'>
95
96 <?php if ( $this->blank_option === true ) : ?>
97 <option></option>
98 <?php endif; ?>
99
100 <?php foreach ( $this->units as $id => $title ) : ?>
101 <option value='<?php echo esc_attr( $id ); ?>' <?php if( $unit == $id ) : ?> selected="selected"<?php endif; ?>><?php echo esc_html( $title ); ?></option>
102 <?php endforeach; ?>
103
104 </select>
105 <?php } ?>
106
107 <?php } ?>
108 <?php $this->display_disabled(); ?>
109 </fieldset>
110
111 <?php
112
113 $this->display_description();
114
115 }
116
117 }
118