PluginProbe
QuadMenu – Mega Menu / 3.3.8
QuadMenu – Mega Menu v3.3.8
3.3.8 3.3.7 3.3.6 trunk 1.8.4 1.8.5 1.8.7 1.8.8 1.8.9 1.9.0 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 88 releases
quadmenu / redux / ReduxCore / inc / fields / section / field_section.php

field_section.php in QuadMenu – Mega Menu 3.3.8, at redux/ReduxCore/inc/fields/section/field_section.php

134 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Redux Framework is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * any later version.
7 * Redux Framework is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 * You should have received a copy of the GNU General Public License
12 * along with Redux Framework. If not, see <http://www.gnu.org/licenses/>.
13 *
14 * @package ReduxFrameworkLegacy
15 * @subpackage Field_Section
16 * @author Tobias Karnetze (athoss.de)
17 * @version 1.0.0
18 */
19
20 // Exit if accessed directly
21 if ( ! defined( 'ABSPATH' ) ) {
22 exit;
23 }
24
25 // Don't duplicate me!
26 if ( ! class_exists( 'ReduxFrameworkLegacy_section' ) ) {
27
28 /**
29 * Main ReduxFrameworkLegacy_heading class
30 *
31 * @since 1.0.0
32 */
33 class ReduxFrameworkLegacy_section {
34
35 public $parent;
36 public $field;
37 public $value;
38
39 /**
40 * Field Constructor.
41 * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function
42 *
43 * @since 1.0.0
44 * @access public
45 * @return void
46 */
47 public function __construct( $field = array(), $value = '', $parent = null ) {
48 $this->parent = $parent;
49 $this->field = $field;
50 $this->value = $value;
51 }
52
53 /**
54 * Field Render Function.
55 * Takes the vars and outputs the HTML for the field in the settings
56 *
57 * @since 1.0.0
58 * @access public
59 * @return void
60 */
61 public function render() {
62
63 // No errors please
64 $defaults = array(
65 'indent' => '',
66 'style' => '',
67 'class' => '',
68 'title' => '',
69 'subtitle' => '',
70 );
71 $this->field = wp_parse_args( $this->field, $defaults );
72
73 $guid = uniqid();
74
75 $add_class = '';
76 if ( isset( $this->field['indent'] ) && true === $this->field['indent'] ) {
77 $add_class = ' form-table-section-indented';
78 } elseif ( ! isset( $this->field['indent'] ) || ( isset( $this->field['indent'] ) && false !== $this->field['indent'] ) ) {
79 $add_class = ' hide';
80 }
81
82 echo '<input type="hidden" id="' . esc_attr( $this->field['id'] ) . '-marker"></td></tr></table>';
83
84 echo '<div id="section-' . esc_attr( $this->field['id'] ) . '" class="redux-section-field redux-field ' . esc_attr( $this->field['style'] ) . ' ' . esc_attr( $this->field['class'] ) . ' ">';
85
86 if ( ! empty( $this->field['title'] ) ) {
87 echo '<h3>' . esc_html( $this->field['title'] ) . '</h3>';
88 }
89
90 if ( ! empty( $this->field['subtitle'] ) ) {
91 echo '<div class="redux-section-desc">' . esc_html( $this->field['subtitle'] ) . '</div>';
92 }
93
94 echo '</div><table id="section-table-' . esc_attr( $this->field['id'] ) . '" data-id="' . esc_attr( $this->field['id'] ) . '" class="form-table form-table-section no-border' . esc_attr( $add_class ) . '"><tbody><tr><th></th><td id="' . esc_attr( $guid ) . '">';
95
96 // delete the tr afterwards
97 ?>
98 <script type="text/javascript">
99 jQuery( document ).ready(
100 function() {
101 jQuery( '#<?php echo $this->field['id']; ?>-marker' ).parents( 'tr:first' ).css( {display: 'none'} ).prev('tr' ).css('border-bottom','none');;
102 var group = jQuery( '#<?php echo $this->field['id']; ?>-marker' ).parents( '.redux-group-tab:first' );
103 if ( !group.hasClass( 'sectionsChecked' ) ) {
104 group.addClass( 'sectionsChecked' );
105 var test = group.find( '.redux-section-indent-start h3' );
106 jQuery.each(
107 test, function( key, value ) {
108 jQuery( value ).css( 'margin-top', '20px' )
109 }
110 );
111 if ( group.find( 'h3:first' ).css( 'margin-top' ) == "20px" ) {
112 group.find( 'h3:first' ).css( 'margin-top', '0' );
113 }
114 }
115 }
116 );
117 </script>
118 <?php
119 }
120
121 public function enqueue() {
122 if ( $this->parent->args['dev_mode'] ) {
123 wp_enqueue_style(
124 'redux-field-section-css',
125 ReduxFrameworkLegacy::$_url . 'inc/fields/section/field_section.css',
126 array(),
127 time(),
128 'all'
129 );
130 }
131 }
132 }
133 }
134