| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Redux Framework is free software: you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU General Public License as published by |
| 6 |
* the Free Software Foundation, either version 2 of the License, or |
| 7 |
* any later version. |
| 8 |
* Redux Framework is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
* GNU General Public License for more details. |
| 12 |
* You should have received a copy of the GNU General Public License |
| 13 |
* along with Redux Framework. If not, see <http://www.gnu.org/licenses/>. |
| 14 |
* |
| 15 |
* @package ReduxFramework |
| 16 |
* @subpackage Field_Divide |
| 17 |
* @author Daniel J Griffiths (Ghost1227) |
| 18 |
* @author Dovy Paukstys |
| 19 |
* @version 3.0.0 |
| 20 |
*/ |
| 21 |
|
| 22 |
// Exit if accessed directly |
| 23 |
if ( !defined ( 'ABSPATH' ) ) { |
| 24 |
exit; |
| 25 |
} |
| 26 |
|
| 27 |
// Don't duplicate me! |
| 28 |
if ( !class_exists ( 'ReduxFramework_divide' ) ) { |
| 29 |
|
| 30 |
/** |
| 31 |
* Main ReduxFramework_divide class |
| 32 |
* |
| 33 |
* @since 1.0.0 |
| 34 |
*/ |
| 35 |
class ReduxFramework_divide { |
| 36 |
|
| 37 |
/** |
| 38 |
* Field Constructor. |
| 39 |
* Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function |
| 40 |
* |
| 41 |
* @since 1.0.0 |
| 42 |
* @access public |
| 43 |
* @return void |
| 44 |
*/ |
| 45 |
function __construct ( $field = array(), $value = '', $parent ) { |
| 46 |
$this->parent = $parent; |
| 47 |
$this->field = $field; |
| 48 |
$this->value = $value; |
| 49 |
} |
| 50 |
|
| 51 |
/** |
| 52 |
* Field Render Function. |
| 53 |
* Takes the vars and outputs the HTML for the field in the settings |
| 54 |
* |
| 55 |
* @since 1.0.0 |
| 56 |
* @access public |
| 57 |
* @return void |
| 58 |
*/ |
| 59 |
public function render () { |
| 60 |
echo '</td></tr></table>'; |
| 61 |
echo '<div data-id="' . $this->field[ 'id' ] . '" id="divide-' . $this->field[ 'id' ] . '" class="divide ' . $this->field[ 'class' ] . '"><div class="inner"><span> </span></div></div>'; |
| 62 |
echo '<table class="form-table no-border"><tbody><tr><th></th><td>'; |
| 63 |
} |
| 64 |
|
| 65 |
/** |
| 66 |
* Enqueue Function. |
| 67 |
* If this field requires any scripts, or css define this function and register/enqueue the scripts/css |
| 68 |
* |
| 69 |
* @since 1.0.0 |
| 70 |
* @access public |
| 71 |
* @return void |
| 72 |
*/ |
| 73 |
public function enqueue() { |
| 74 |
if ($this->parent->args['dev_mode']) { |
| 75 |
wp_enqueue_style( |
| 76 |
'redux-field-divide', |
| 77 |
ReduxFramework::$_url . 'inc/fields/divide/field_divide.css', |
| 78 |
array(), |
| 79 |
time(), |
| 80 |
'all' |
| 81 |
); |
| 82 |
} |
| 83 |
} |
| 84 |
} |
| 85 |
} |