PluginProbe
LoftLoader / 1.0.1
LoftLoader v1.0.1
trunk 1.0.0 1.0.1 1.0.2 2.0.0 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.3 2.3.1 2.3.2 2.3.3 All 34 releases
loftloader / settings / form / class-loftloader-checkbox.php

class-loftloader-checkbox.php in LoftLoader 1.0.1, at settings/form/class-loftloader-checkbox.php

42 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // Not allowed by directly accessing.
3 if(!defined('ABSPATH')){
4 die('Access not allowed!');
5 }
6 /**
7 * Plugin option form element class
8 * Type Checkbox
9 *
10 * @package LoftLoader
11 * @version 1.0
12 * @link http://www.loftocean.com/
13 * @author Suihai Huang from Loft Ocean Team
14
15 * @since version 1.0
16 */
17
18 if(!class_exists('LoftLoader_Checkbox')){
19 class LoftLoader_Checkbox extends LoftLoader_Form_Base{
20 /**
21 * @description rewrite the content function
22 */
23 protected function content(){
24 $html = '';
25 if($this->options){
26 $value = $this->values;
27 $class = '';
28 $id = '';
29 if(count($this->options) == 1){
30 $class = (isset($this->extra['class']) && $this->extra['class'])? ' class="' . $this->extra['class'] . '"' : '';
31 $id = (isset($this->extra['id']) && $this->extra['id']) ? ' id="'. $this->extra['id'] . '"' : '';
32 }
33 foreach($this->options as $val=>$attr){
34 $checked = checked($value, $val, false);
35 $disabled = (isset($attr['disabled']) && $attr['disabled']) ? ' disabled' : '';
36 $html .= '<label><input' . $id . $class . ' type="checkbox" name="' . $this->name . '" value="' . $val . '"' . $checked . $disabled . '>' . $attr['label'] . '<div class="on-off"><span></span></div></label>';
37 }
38 }
39 return $html;
40 }
41 }
42 }