@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | $the_value = $k; |
| 96 | 96 | |
| 97 | - if ( ! empty( $this->field['tiles'] ) && true === (bool) $this->field['tiles'] ) { |
|
| 97 | + if ( ! empty( $this->field['tiles'] ) && true === ( bool ) $this->field['tiles'] ) { |
|
| 98 | 98 | $the_value = $v['img']; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -123,14 +123,14 @@ discard block |
||
| 123 | 123 | } else { |
| 124 | 124 | foreach ( $v['presets'] as $pk => $pv ) { |
| 125 | 125 | if ( isset( $v['merge'] ) && false !== $v['merge'] ) { |
| 126 | - if ( ( true === $v['merge'] || in_array( $pk, $v['merge'], true ) ) && is_array( $this->parent->options[ $pk ] ) ) { |
|
| 127 | - $pv = array_merge( $this->parent->options[ $pk ], $pv ); |
|
| 126 | + if ( ( true === $v['merge'] || in_array( $pk, $v['merge'], true ) ) && is_array( $this->parent->options[$pk] ) ) { |
|
| 127 | + $pv = array_merge( $this->parent->options[$pk], $pv ); |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - if ( empty( $pv ) && isset( $this->parent->options[ $pk ] ) && ! empty( $this->parent->options[ $pk ] ) ) { |
|
| 131 | + if ( empty( $pv ) && isset( $this->parent->options[$pk] ) && ! empty( $this->parent->options[$pk] ) ) { |
|
| 132 | 132 | $selected = false; |
| 133 | - } elseif ( ! empty( $pv ) && ! isset( $this->parent->options[ $pk ] ) ) { |
|
| 133 | + } elseif ( ! empty( $pv ) && ! isset( $this->parent->options[$pk] ) ) { |
|
| 134 | 134 | $selected = false; |
| 135 | 135 | } |
| 136 | 136 | |
@@ -227,10 +227,10 @@ discard block |
||
| 227 | 227 | if ( ! empty( $data ) && ! is_array( $data ) ) { |
| 228 | 228 | switch ( $mode ) { |
| 229 | 229 | case 'background-image': |
| 230 | - if ( isset( $this->field['tiles'] ) && true === (bool) $this->field['tiles'] ) { |
|
| 230 | + if ( isset( $this->field['tiles'] ) && true === ( bool ) $this->field['tiles'] ) { |
|
| 231 | 231 | $img = $data; |
| 232 | 232 | } else { |
| 233 | - $img = $this->field['options'][ $data ]['img'] ?? ''; |
|
| 233 | + $img = $this->field['options'][$data]['img'] ?? ''; |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | if ( '' !== $img ) { |
@@ -12,243 +12,243 @@ |
||
| 12 | 12 | // Don't duplicate me! |
| 13 | 13 | if ( ! class_exists( 'Redux_Image_Select', false ) ) { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Main Redux_image_select class |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - */ |
|
| 20 | - class Redux_Image_Select extends Redux_Field { |
|
| 21 | - |
|
| 22 | - /** |
|
| 23 | - * Set field defaults. |
|
| 24 | - */ |
|
| 25 | - public function set_defaults() { |
|
| 26 | - $defaults = array( |
|
| 27 | - 'tiles' => false, |
|
| 28 | - 'mode' => 'background-image', |
|
| 29 | - 'presets' => false, |
|
| 30 | - 'options' => array(), |
|
| 31 | - 'width' => '', |
|
| 32 | - 'height' => '', |
|
| 33 | - ); |
|
| 34 | - |
|
| 35 | - $this->field = wp_parse_args( $this->field, $defaults ); |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * Field Render Function. |
|
| 40 | - * Takes the vars and outputs the HTML for the field in the settings |
|
| 41 | - * |
|
| 42 | - * @since 1.0.0 |
|
| 43 | - * @access public |
|
| 44 | - * @return void |
|
| 45 | - */ |
|
| 46 | - public function render() { |
|
| 47 | - if ( ! empty( $this->field['options'] ) ) { |
|
| 48 | - echo '<div class="redux-table-container">'; |
|
| 49 | - echo '<ul class="redux-image-select">'; |
|
| 50 | - |
|
| 51 | - $x = 1; |
|
| 52 | - |
|
| 53 | - foreach ( $this->field['options'] as $k => $v ) { |
|
| 54 | - |
|
| 55 | - if ( ! is_array( $v ) ) { |
|
| 56 | - $v = array( 'img' => $v ); |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - if ( ! isset( $v['title'] ) ) { |
|
| 60 | - $v['title'] = ''; |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - if ( ! isset( $v['alt'] ) ) { |
|
| 64 | - $v['alt'] = $v['title']; |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - if ( ! isset( $v['class'] ) ) { |
|
| 68 | - $v['class'] = ''; |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - $style = ''; |
|
| 72 | - |
|
| 73 | - if ( ! empty( $this->field['width'] ) ) { |
|
| 74 | - $style .= 'width: ' . $this->field['width']; |
|
| 75 | - |
|
| 76 | - if ( is_numeric( $this->field['width'] ) ) { |
|
| 77 | - $style .= 'px'; |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - $style .= ';'; |
|
| 81 | - } else { |
|
| 82 | - $style .= ' width: 100%; '; |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - if ( ! empty( $this->field['height'] ) ) { |
|
| 86 | - $style .= 'height: ' . $this->field['height']; |
|
| 87 | - |
|
| 88 | - if ( is_numeric( $this->field['height'] ) ) { |
|
| 89 | - $style .= 'px'; |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - $style .= ';'; |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - $the_value = $k; |
|
| 96 | - |
|
| 97 | - if ( ! empty( $this->field['tiles'] ) && true === (bool) $this->field['tiles'] ) { |
|
| 98 | - $the_value = $v['img']; |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - $selected = ( '' !== checked( $this->value, $the_value, false ) ) ? ' redux-image-select-selected' : ''; |
|
| 102 | - |
|
| 103 | - $presets = ''; |
|
| 104 | - $is_preset = false; |
|
| 105 | - |
|
| 106 | - $this->field['class'] = trim( str_replace( 'no-update', '', $this->field['class'] ) ); |
|
| 107 | - $this->field['class'] .= ' no-update '; |
|
| 108 | - |
|
| 109 | - if ( isset( $this->field['presets'] ) && false !== $this->field['presets'] ) { |
|
| 110 | - $this->field['class'] = trim( $this->field['class'] ); |
|
| 111 | - if ( ! isset( $v['presets'] ) ) { |
|
| 112 | - $v['presets'] = array(); |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - if ( ! is_array( $v['presets'] ) ) { |
|
| 116 | - $v['presets'] = json_decode( $v['presets'], true ); |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - // Only highlight the preset if it's the same. |
|
| 120 | - if ( $selected ) { |
|
| 121 | - if ( empty( $v['presets'] ) ) { |
|
| 122 | - $selected = false; |
|
| 123 | - } else { |
|
| 124 | - foreach ( $v['presets'] as $pk => $pv ) { |
|
| 125 | - if ( isset( $v['merge'] ) && false !== $v['merge'] ) { |
|
| 126 | - if ( ( true === $v['merge'] || in_array( $pk, $v['merge'], true ) ) && is_array( $this->parent->options[ $pk ] ) ) { |
|
| 127 | - $pv = array_merge( $this->parent->options[ $pk ], $pv ); |
|
| 128 | - } |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - if ( empty( $pv ) && isset( $this->parent->options[ $pk ] ) && ! empty( $this->parent->options[ $pk ] ) ) { |
|
| 132 | - $selected = false; |
|
| 133 | - } elseif ( ! empty( $pv ) && ! isset( $this->parent->options[ $pk ] ) ) { |
|
| 134 | - $selected = false; |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - if ( ! $selected ) { // We're still not using the same preset. Let's unset that shall we? |
|
| 138 | - $this->value = ''; |
|
| 139 | - break; |
|
| 140 | - } |
|
| 141 | - } |
|
| 142 | - } |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - $v['presets']['redux-backup'] = 1; |
|
| 146 | - |
|
| 147 | - $presets = ' data-presets="' . esc_attr( htmlspecialchars( wp_json_encode( $v['presets'] ), ENT_QUOTES ) ) . '"'; |
|
| 148 | - $is_preset = true; |
|
| 149 | - |
|
| 150 | - $this->field['class'] = trim( $this->field['class'] ) . ' redux-presets'; |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - $is_preset_class = $is_preset ? '-preset-' : ' '; |
|
| 154 | - |
|
| 155 | - $merge = ''; |
|
| 156 | - if ( isset( $v['merge'] ) && false !== $v['merge'] ) { |
|
| 157 | - $merge = is_array( $v['merge'] ) ? implode( '|', $v['merge'] ) : 'true'; |
|
| 158 | - $merge = ' data-merge="' . esc_attr( htmlspecialchars( $merge, ENT_QUOTES ) ) . '"'; |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - echo '<li class="redux-image-select">'; |
|
| 162 | - echo '<label class="' . esc_attr( $selected ) . ' redux-image-select' . esc_attr( $is_preset_class ) . esc_attr( $this->field['id'] . '_' . $x ) . '" for="' . esc_attr( $this->field['id'] . '_' . ( array_search( $k, array_keys( $this->field['options'] ), true ) + 1 ) ) . '">'; |
|
| 163 | - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 164 | - echo '<input type="radio" class="' . esc_attr( $this->field['class'] ) . '" id="' . esc_attr( $this->field['id'] . '_' . ( array_search( $k, array_keys( $this->field['options'] ), true ) + 1 ) ) . '" name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '" value="' . esc_attr( $the_value ) . '" ' . checked( $this->value, $the_value, false ) . $presets . $merge . '/>'; |
|
| 165 | - if ( ! empty( $this->field['tiles'] ) && true === $this->field['tiles'] ) { |
|
| 166 | - echo '<span class="tiles ' . esc_attr( $v['class'] ) . '" style="background-image: url(' . esc_url( $v['img'] ) . ');" rel="' . esc_url( $v['img'] ) . '""> </span>'; |
|
| 167 | - } else { |
|
| 168 | - // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage -- No image/icon to enqueue. |
|
| 169 | - echo '<img src="' . esc_url( $v['img'] ) . '" title="' . esc_attr( $v['alt'] ) . '" alt="' . esc_attr( $v['alt'] ) . '" class="' . esc_attr( $v['class'] ) . '" style="' . esc_attr( $style ) . '"' . esc_attr( $presets ) . esc_attr( $merge ) . ' />'; |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - if ( '' !== $v['title'] ) { |
|
| 173 | - echo '<br /><span>' . wp_kses_post( ( $v['title'] ) ) . '</span>'; |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - echo '</label>'; |
|
| 177 | - echo '</li>'; |
|
| 178 | - |
|
| 179 | - ++$x; |
|
| 180 | - } |
|
| 181 | - |
|
| 182 | - echo '</ul>'; |
|
| 183 | - echo '</div>'; |
|
| 184 | - } |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - /** |
|
| 188 | - * Enqueue Function. |
|
| 189 | - * If this field requires any scripts, or css define this function and register/enqueue the scripts/css |
|
| 190 | - * |
|
| 191 | - * @since 1.0.0 |
|
| 192 | - * @access public |
|
| 193 | - * @return void |
|
| 194 | - */ |
|
| 195 | - public function enqueue() { |
|
| 196 | - |
|
| 197 | - wp_enqueue_script( |
|
| 198 | - 'redux-field-image-select', |
|
| 199 | - Redux_Core::$url . 'inc/fields/image_select/redux-image-select' . Redux_Functions::is_min() . '.js', |
|
| 200 | - array( 'jquery', 'redux-js' ), |
|
| 201 | - $this->timestamp, |
|
| 202 | - true |
|
| 203 | - ); |
|
| 204 | - |
|
| 205 | - if ( $this->parent->args['dev_mode'] ) { |
|
| 206 | - wp_enqueue_style( |
|
| 207 | - 'redux-field-image-select', |
|
| 208 | - Redux_Core::$url . 'inc/fields/image_select/redux-image-select.css', |
|
| 209 | - array(), |
|
| 210 | - $this->timestamp |
|
| 211 | - ); |
|
| 212 | - } |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - /** |
|
| 216 | - * Compile CSS data for output. |
|
| 217 | - * |
|
| 218 | - * @param string $data css string. |
|
| 219 | - * |
|
| 220 | - * @return string |
|
| 221 | - */ |
|
| 222 | - public function css_style( $data ): string { |
|
| 223 | - $css = ''; |
|
| 224 | - $output = ''; |
|
| 225 | - |
|
| 226 | - $mode = ( isset( $this->field['mode'] ) && ! empty( $this->field['mode'] ) ? $this->field['mode'] : 'background-image' ); |
|
| 227 | - |
|
| 228 | - if ( ! empty( $data ) && ! is_array( $data ) ) { |
|
| 229 | - switch ( $mode ) { |
|
| 230 | - case 'background-image': |
|
| 231 | - if ( isset( $this->field['tiles'] ) && true === (bool) $this->field['tiles'] ) { |
|
| 232 | - $img = $data; |
|
| 233 | - } else { |
|
| 234 | - $img = $this->field['options'][ $data ]['img'] ?? ''; |
|
| 235 | - } |
|
| 236 | - |
|
| 237 | - if ( '' !== $img ) { |
|
| 238 | - $output = "background-image: url('" . esc_url( $img ) . "');"; |
|
| 239 | - } |
|
| 240 | - break; |
|
| 241 | - |
|
| 242 | - default: |
|
| 243 | - $output = $mode . ': ' . $data . ';'; |
|
| 244 | - } |
|
| 245 | - } |
|
| 246 | - |
|
| 247 | - $css .= $output; |
|
| 248 | - |
|
| 249 | - return $css; |
|
| 250 | - } |
|
| 251 | - } |
|
| 15 | + /** |
|
| 16 | + * Main Redux_image_select class |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + */ |
|
| 20 | + class Redux_Image_Select extends Redux_Field { |
|
| 21 | + |
|
| 22 | + /** |
|
| 23 | + * Set field defaults. |
|
| 24 | + */ |
|
| 25 | + public function set_defaults() { |
|
| 26 | + $defaults = array( |
|
| 27 | + 'tiles' => false, |
|
| 28 | + 'mode' => 'background-image', |
|
| 29 | + 'presets' => false, |
|
| 30 | + 'options' => array(), |
|
| 31 | + 'width' => '', |
|
| 32 | + 'height' => '', |
|
| 33 | + ); |
|
| 34 | + |
|
| 35 | + $this->field = wp_parse_args( $this->field, $defaults ); |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * Field Render Function. |
|
| 40 | + * Takes the vars and outputs the HTML for the field in the settings |
|
| 41 | + * |
|
| 42 | + * @since 1.0.0 |
|
| 43 | + * @access public |
|
| 44 | + * @return void |
|
| 45 | + */ |
|
| 46 | + public function render() { |
|
| 47 | + if ( ! empty( $this->field['options'] ) ) { |
|
| 48 | + echo '<div class="redux-table-container">'; |
|
| 49 | + echo '<ul class="redux-image-select">'; |
|
| 50 | + |
|
| 51 | + $x = 1; |
|
| 52 | + |
|
| 53 | + foreach ( $this->field['options'] as $k => $v ) { |
|
| 54 | + |
|
| 55 | + if ( ! is_array( $v ) ) { |
|
| 56 | + $v = array( 'img' => $v ); |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + if ( ! isset( $v['title'] ) ) { |
|
| 60 | + $v['title'] = ''; |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + if ( ! isset( $v['alt'] ) ) { |
|
| 64 | + $v['alt'] = $v['title']; |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + if ( ! isset( $v['class'] ) ) { |
|
| 68 | + $v['class'] = ''; |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + $style = ''; |
|
| 72 | + |
|
| 73 | + if ( ! empty( $this->field['width'] ) ) { |
|
| 74 | + $style .= 'width: ' . $this->field['width']; |
|
| 75 | + |
|
| 76 | + if ( is_numeric( $this->field['width'] ) ) { |
|
| 77 | + $style .= 'px'; |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + $style .= ';'; |
|
| 81 | + } else { |
|
| 82 | + $style .= ' width: 100%; '; |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + if ( ! empty( $this->field['height'] ) ) { |
|
| 86 | + $style .= 'height: ' . $this->field['height']; |
|
| 87 | + |
|
| 88 | + if ( is_numeric( $this->field['height'] ) ) { |
|
| 89 | + $style .= 'px'; |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + $style .= ';'; |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + $the_value = $k; |
|
| 96 | + |
|
| 97 | + if ( ! empty( $this->field['tiles'] ) && true === (bool) $this->field['tiles'] ) { |
|
| 98 | + $the_value = $v['img']; |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + $selected = ( '' !== checked( $this->value, $the_value, false ) ) ? ' redux-image-select-selected' : ''; |
|
| 102 | + |
|
| 103 | + $presets = ''; |
|
| 104 | + $is_preset = false; |
|
| 105 | + |
|
| 106 | + $this->field['class'] = trim( str_replace( 'no-update', '', $this->field['class'] ) ); |
|
| 107 | + $this->field['class'] .= ' no-update '; |
|
| 108 | + |
|
| 109 | + if ( isset( $this->field['presets'] ) && false !== $this->field['presets'] ) { |
|
| 110 | + $this->field['class'] = trim( $this->field['class'] ); |
|
| 111 | + if ( ! isset( $v['presets'] ) ) { |
|
| 112 | + $v['presets'] = array(); |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + if ( ! is_array( $v['presets'] ) ) { |
|
| 116 | + $v['presets'] = json_decode( $v['presets'], true ); |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + // Only highlight the preset if it's the same. |
|
| 120 | + if ( $selected ) { |
|
| 121 | + if ( empty( $v['presets'] ) ) { |
|
| 122 | + $selected = false; |
|
| 123 | + } else { |
|
| 124 | + foreach ( $v['presets'] as $pk => $pv ) { |
|
| 125 | + if ( isset( $v['merge'] ) && false !== $v['merge'] ) { |
|
| 126 | + if ( ( true === $v['merge'] || in_array( $pk, $v['merge'], true ) ) && is_array( $this->parent->options[ $pk ] ) ) { |
|
| 127 | + $pv = array_merge( $this->parent->options[ $pk ], $pv ); |
|
| 128 | + } |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + if ( empty( $pv ) && isset( $this->parent->options[ $pk ] ) && ! empty( $this->parent->options[ $pk ] ) ) { |
|
| 132 | + $selected = false; |
|
| 133 | + } elseif ( ! empty( $pv ) && ! isset( $this->parent->options[ $pk ] ) ) { |
|
| 134 | + $selected = false; |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + if ( ! $selected ) { // We're still not using the same preset. Let's unset that shall we? |
|
| 138 | + $this->value = ''; |
|
| 139 | + break; |
|
| 140 | + } |
|
| 141 | + } |
|
| 142 | + } |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + $v['presets']['redux-backup'] = 1; |
|
| 146 | + |
|
| 147 | + $presets = ' data-presets="' . esc_attr( htmlspecialchars( wp_json_encode( $v['presets'] ), ENT_QUOTES ) ) . '"'; |
|
| 148 | + $is_preset = true; |
|
| 149 | + |
|
| 150 | + $this->field['class'] = trim( $this->field['class'] ) . ' redux-presets'; |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + $is_preset_class = $is_preset ? '-preset-' : ' '; |
|
| 154 | + |
|
| 155 | + $merge = ''; |
|
| 156 | + if ( isset( $v['merge'] ) && false !== $v['merge'] ) { |
|
| 157 | + $merge = is_array( $v['merge'] ) ? implode( '|', $v['merge'] ) : 'true'; |
|
| 158 | + $merge = ' data-merge="' . esc_attr( htmlspecialchars( $merge, ENT_QUOTES ) ) . '"'; |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + echo '<li class="redux-image-select">'; |
|
| 162 | + echo '<label class="' . esc_attr( $selected ) . ' redux-image-select' . esc_attr( $is_preset_class ) . esc_attr( $this->field['id'] . '_' . $x ) . '" for="' . esc_attr( $this->field['id'] . '_' . ( array_search( $k, array_keys( $this->field['options'] ), true ) + 1 ) ) . '">'; |
|
| 163 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 164 | + echo '<input type="radio" class="' . esc_attr( $this->field['class'] ) . '" id="' . esc_attr( $this->field['id'] . '_' . ( array_search( $k, array_keys( $this->field['options'] ), true ) + 1 ) ) . '" name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '" value="' . esc_attr( $the_value ) . '" ' . checked( $this->value, $the_value, false ) . $presets . $merge . '/>'; |
|
| 165 | + if ( ! empty( $this->field['tiles'] ) && true === $this->field['tiles'] ) { |
|
| 166 | + echo '<span class="tiles ' . esc_attr( $v['class'] ) . '" style="background-image: url(' . esc_url( $v['img'] ) . ');" rel="' . esc_url( $v['img'] ) . '""> </span>'; |
|
| 167 | + } else { |
|
| 168 | + // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage -- No image/icon to enqueue. |
|
| 169 | + echo '<img src="' . esc_url( $v['img'] ) . '" title="' . esc_attr( $v['alt'] ) . '" alt="' . esc_attr( $v['alt'] ) . '" class="' . esc_attr( $v['class'] ) . '" style="' . esc_attr( $style ) . '"' . esc_attr( $presets ) . esc_attr( $merge ) . ' />'; |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + if ( '' !== $v['title'] ) { |
|
| 173 | + echo '<br /><span>' . wp_kses_post( ( $v['title'] ) ) . '</span>'; |
|
| 174 | + } |
|
| 175 | + |
|
| 176 | + echo '</label>'; |
|
| 177 | + echo '</li>'; |
|
| 178 | + |
|
| 179 | + ++$x; |
|
| 180 | + } |
|
| 181 | + |
|
| 182 | + echo '</ul>'; |
|
| 183 | + echo '</div>'; |
|
| 184 | + } |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + /** |
|
| 188 | + * Enqueue Function. |
|
| 189 | + * If this field requires any scripts, or css define this function and register/enqueue the scripts/css |
|
| 190 | + * |
|
| 191 | + * @since 1.0.0 |
|
| 192 | + * @access public |
|
| 193 | + * @return void |
|
| 194 | + */ |
|
| 195 | + public function enqueue() { |
|
| 196 | + |
|
| 197 | + wp_enqueue_script( |
|
| 198 | + 'redux-field-image-select', |
|
| 199 | + Redux_Core::$url . 'inc/fields/image_select/redux-image-select' . Redux_Functions::is_min() . '.js', |
|
| 200 | + array( 'jquery', 'redux-js' ), |
|
| 201 | + $this->timestamp, |
|
| 202 | + true |
|
| 203 | + ); |
|
| 204 | + |
|
| 205 | + if ( $this->parent->args['dev_mode'] ) { |
|
| 206 | + wp_enqueue_style( |
|
| 207 | + 'redux-field-image-select', |
|
| 208 | + Redux_Core::$url . 'inc/fields/image_select/redux-image-select.css', |
|
| 209 | + array(), |
|
| 210 | + $this->timestamp |
|
| 211 | + ); |
|
| 212 | + } |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + /** |
|
| 216 | + * Compile CSS data for output. |
|
| 217 | + * |
|
| 218 | + * @param string $data css string. |
|
| 219 | + * |
|
| 220 | + * @return string |
|
| 221 | + */ |
|
| 222 | + public function css_style( $data ): string { |
|
| 223 | + $css = ''; |
|
| 224 | + $output = ''; |
|
| 225 | + |
|
| 226 | + $mode = ( isset( $this->field['mode'] ) && ! empty( $this->field['mode'] ) ? $this->field['mode'] : 'background-image' ); |
|
| 227 | + |
|
| 228 | + if ( ! empty( $data ) && ! is_array( $data ) ) { |
|
| 229 | + switch ( $mode ) { |
|
| 230 | + case 'background-image': |
|
| 231 | + if ( isset( $this->field['tiles'] ) && true === (bool) $this->field['tiles'] ) { |
|
| 232 | + $img = $data; |
|
| 233 | + } else { |
|
| 234 | + $img = $this->field['options'][ $data ]['img'] ?? ''; |
|
| 235 | + } |
|
| 236 | + |
|
| 237 | + if ( '' !== $img ) { |
|
| 238 | + $output = "background-image: url('" . esc_url( $img ) . "');"; |
|
| 239 | + } |
|
| 240 | + break; |
|
| 241 | + |
|
| 242 | + default: |
|
| 243 | + $output = $mode . ': ' . $data . ';'; |
|
| 244 | + } |
|
| 245 | + } |
|
| 246 | + |
|
| 247 | + $css .= $output; |
|
| 248 | + |
|
| 249 | + return $css; |
|
| 250 | + } |
|
| 251 | + } |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | class_alias( 'Redux_Image_Select', 'ReduxFramework_Image_Select' ); |
@@ -12,67 +12,67 @@ discard block |
||
| 12 | 12 | // Don't duplicate me! |
| 13 | 13 | if ( ! class_exists( 'Redux_Color_Rgba', false ) ) { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Main Redux_color_rgba class |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - */ |
|
| 20 | - class Redux_Color_Rgba extends Redux_Field { |
|
| 21 | - |
|
| 22 | - /** |
|
| 23 | - * Set field and value defaults. |
|
| 24 | - */ |
|
| 25 | - public function set_defaults() { |
|
| 26 | - $defaults = array( |
|
| 27 | - 'color' => '', |
|
| 28 | - 'alpha' => 1, |
|
| 29 | - 'rgba' => '', |
|
| 30 | - ); |
|
| 31 | - |
|
| 32 | - $option_defaults = array( |
|
| 33 | - 'show_input' => true, |
|
| 34 | - 'show_initial' => false, |
|
| 35 | - 'show_alpha' => true, |
|
| 36 | - 'show_palette' => false, |
|
| 37 | - 'show_palette_only' => false, |
|
| 38 | - 'max_palette_size' => 10, |
|
| 39 | - 'show_selection_palette' => false, |
|
| 40 | - 'allow_empty' => true, |
|
| 41 | - 'clickout_fires_change' => false, |
|
| 42 | - 'choose_text' => esc_html__( 'Choose', 'redux-framework' ), |
|
| 43 | - 'cancel_text' => esc_html__( 'Cancel', 'redux-framework' ), |
|
| 44 | - 'show_buttons' => true, |
|
| 45 | - 'input_text' => esc_html__( 'Select Color', 'redux-framework' ), |
|
| 46 | - 'palette' => null, |
|
| 47 | - ); |
|
| 48 | - |
|
| 49 | - $this->value = wp_parse_args( $this->value, $defaults ); |
|
| 50 | - |
|
| 51 | - if ( isset( $this->field ) && ! is_array( $this->field ) ) { |
|
| 52 | - return; |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - $this->field['options'] = isset( $this->field['options'] ) ? wp_parse_args( $this->field['options'], $option_defaults ) : $option_defaults; |
|
| 56 | - |
|
| 57 | - // Convert an empty array to null, if there. |
|
| 58 | - $this->field['options']['palette'] = empty( $this->field['options']['palette'] ) ? null : $this->field['options']['palette']; |
|
| 59 | - |
|
| 60 | - $this->field['output_transparent'] = $this->field['output_transparent'] ?? false; |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * Field Render Function. |
|
| 65 | - * Takes the vars and outputs the HTML for the field in the settings |
|
| 66 | - * |
|
| 67 | - * @since 1.0.0 |
|
| 68 | - * @access public |
|
| 69 | - * @return void |
|
| 70 | - */ |
|
| 71 | - public function render() { |
|
| 72 | - $field_id = $this->field['id']; |
|
| 73 | - |
|
| 74 | - // Color picker container. |
|
| 75 | - echo '<div |
|
| 15 | + /** |
|
| 16 | + * Main Redux_color_rgba class |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + */ |
|
| 20 | + class Redux_Color_Rgba extends Redux_Field { |
|
| 21 | + |
|
| 22 | + /** |
|
| 23 | + * Set field and value defaults. |
|
| 24 | + */ |
|
| 25 | + public function set_defaults() { |
|
| 26 | + $defaults = array( |
|
| 27 | + 'color' => '', |
|
| 28 | + 'alpha' => 1, |
|
| 29 | + 'rgba' => '', |
|
| 30 | + ); |
|
| 31 | + |
|
| 32 | + $option_defaults = array( |
|
| 33 | + 'show_input' => true, |
|
| 34 | + 'show_initial' => false, |
|
| 35 | + 'show_alpha' => true, |
|
| 36 | + 'show_palette' => false, |
|
| 37 | + 'show_palette_only' => false, |
|
| 38 | + 'max_palette_size' => 10, |
|
| 39 | + 'show_selection_palette' => false, |
|
| 40 | + 'allow_empty' => true, |
|
| 41 | + 'clickout_fires_change' => false, |
|
| 42 | + 'choose_text' => esc_html__( 'Choose', 'redux-framework' ), |
|
| 43 | + 'cancel_text' => esc_html__( 'Cancel', 'redux-framework' ), |
|
| 44 | + 'show_buttons' => true, |
|
| 45 | + 'input_text' => esc_html__( 'Select Color', 'redux-framework' ), |
|
| 46 | + 'palette' => null, |
|
| 47 | + ); |
|
| 48 | + |
|
| 49 | + $this->value = wp_parse_args( $this->value, $defaults ); |
|
| 50 | + |
|
| 51 | + if ( isset( $this->field ) && ! is_array( $this->field ) ) { |
|
| 52 | + return; |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + $this->field['options'] = isset( $this->field['options'] ) ? wp_parse_args( $this->field['options'], $option_defaults ) : $option_defaults; |
|
| 56 | + |
|
| 57 | + // Convert an empty array to null, if there. |
|
| 58 | + $this->field['options']['palette'] = empty( $this->field['options']['palette'] ) ? null : $this->field['options']['palette']; |
|
| 59 | + |
|
| 60 | + $this->field['output_transparent'] = $this->field['output_transparent'] ?? false; |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * Field Render Function. |
|
| 65 | + * Takes the vars and outputs the HTML for the field in the settings |
|
| 66 | + * |
|
| 67 | + * @since 1.0.0 |
|
| 68 | + * @access public |
|
| 69 | + * @return void |
|
| 70 | + */ |
|
| 71 | + public function render() { |
|
| 72 | + $field_id = $this->field['id']; |
|
| 73 | + |
|
| 74 | + // Color picker container. |
|
| 75 | + echo '<div |
|
| 76 | 76 | class="redux-color-rgba-container ' . esc_attr( $this->field['class'] ) . '" |
| 77 | 77 | data-id="' . esc_attr( $field_id ) . '" |
| 78 | 78 | data-show-input="' . esc_attr( $this->field['options']['show_input'] ) . '" |
@@ -91,18 +91,18 @@ discard block |
||
| 91 | 91 | data-palette="' . rawurlencode( wp_json_encode( $this->field['options']['palette'] ) ) . '" |
| 92 | 92 | >'; |
| 93 | 93 | |
| 94 | - // Colour picker layout. |
|
| 95 | - if ( '' === $this->value['color'] || 'transparent' === $this->value['color'] ) { |
|
| 96 | - $color = ''; |
|
| 97 | - } else { |
|
| 98 | - $color = Redux_Helpers::hex2rgba( $this->value['color'], $this->value['alpha'] ); |
|
| 99 | - } |
|
| 94 | + // Colour picker layout. |
|
| 95 | + if ( '' === $this->value['color'] || 'transparent' === $this->value['color'] ) { |
|
| 96 | + $color = ''; |
|
| 97 | + } else { |
|
| 98 | + $color = Redux_Helpers::hex2rgba( $this->value['color'], $this->value['alpha'] ); |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | - if ( '' === $this->value['rgba'] && '' !== $this->value['color'] ) { |
|
| 102 | - $this->value['rgba'] = Redux_Helpers::hex2rgba( $this->value['color'], $this->value['alpha'] ); |
|
| 103 | - } |
|
| 101 | + if ( '' === $this->value['rgba'] && '' !== $this->value['color'] ) { |
|
| 102 | + $this->value['rgba'] = Redux_Helpers::hex2rgba( $this->value['color'], $this->value['alpha'] ); |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | - echo '<input |
|
| 105 | + echo '<input |
|
| 106 | 106 | name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[color]" |
| 107 | 107 | id="' . esc_attr( $field_id ) . '-color-display" |
| 108 | 108 | class="redux-color-rgba" |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | data-output-transparent="' . esc_attr( $this->field['output_transparent'] ) . '" |
| 116 | 116 | />'; |
| 117 | 117 | |
| 118 | - echo '<input |
|
| 118 | + echo '<input |
|
| 119 | 119 | type="hidden" |
| 120 | 120 | class="redux-hidden-color" |
| 121 | 121 | data-id="' . esc_attr( $field_id ) . '-color" |
@@ -123,8 +123,8 @@ discard block |
||
| 123 | 123 | value="' . esc_attr( $this->value['color'] ) . '" |
| 124 | 124 | />'; |
| 125 | 125 | |
| 126 | - // Hidden input for alpha channel. |
|
| 127 | - echo '<input |
|
| 126 | + // Hidden input for alpha channel. |
|
| 127 | + echo '<input |
|
| 128 | 128 | type="hidden" |
| 129 | 129 | class="redux-hidden-alpha" |
| 130 | 130 | data-id="' . esc_attr( $field_id ) . '-alpha" |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | value="' . esc_attr( $this->value['alpha'] ) . '" |
| 134 | 134 | />'; |
| 135 | 135 | |
| 136 | - // Hidden input for rgba. |
|
| 137 | - echo '<input |
|
| 136 | + // Hidden input for rgba. |
|
| 137 | + echo '<input |
|
| 138 | 138 | type="hidden" |
| 139 | 139 | class="redux-hidden-rgba" |
| 140 | 140 | data-id="' . esc_attr( $field_id ) . '-rgba" |
@@ -143,142 +143,142 @@ discard block |
||
| 143 | 143 | value="' . esc_attr( $this->value['rgba'] ) . '" |
| 144 | 144 | />'; |
| 145 | 145 | |
| 146 | - echo '</div>'; |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - /** |
|
| 150 | - * Enqueue Function. |
|
| 151 | - * If this field requires any scripts, or css define this function and register/enqueue the scripts/css |
|
| 152 | - * |
|
| 153 | - * @since 1.0.0 |
|
| 154 | - * @access public |
|
| 155 | - * @return void |
|
| 156 | - */ |
|
| 157 | - public function enqueue() { |
|
| 158 | - |
|
| 159 | - // Set up min files for dev_mode = false. |
|
| 160 | - $min = Redux_Functions::is_min(); |
|
| 161 | - |
|
| 162 | - // Field dependent JS. |
|
| 163 | - wp_enqueue_script( |
|
| 164 | - 'redux-field-color-rgba', |
|
| 165 | - Redux_Core::$url . 'inc/fields/color_rgba/redux-color-rgba' . $min . '.js', |
|
| 166 | - array( 'jquery', 'redux-spectrum-js', 'redux-js' ), |
|
| 167 | - $this->timestamp, |
|
| 168 | - true |
|
| 169 | - ); |
|
| 170 | - |
|
| 171 | - // Spectrum CSS. |
|
| 172 | - if ( ! wp_style_is( 'redux-spectrum-css' ) ) { |
|
| 173 | - wp_enqueue_style( 'redux-spectrum-css' ); |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - if ( $this->parent->args['dev_mode'] ) { |
|
| 177 | - wp_enqueue_style( |
|
| 178 | - 'redux-field-color-rgba', |
|
| 179 | - Redux_Core::$url . 'inc/fields/color_rgba/redux-color-rgba.css', |
|
| 180 | - array(), |
|
| 181 | - $this->timestamp |
|
| 182 | - ); |
|
| 183 | - } |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * -> getColorVal. Returns formatted color val in hex or rgba. |
|
| 188 | - * If this field requires any scripts or css, define this function and register/enqueue the scripts/css |
|
| 189 | - * |
|
| 190 | - * @since 1.0.0 |
|
| 191 | - * @access private |
|
| 192 | - * @return string |
|
| 193 | - */ |
|
| 194 | - private function get_color_val(): string { |
|
| 195 | - |
|
| 196 | - // No notices. |
|
| 197 | - $color = ''; |
|
| 198 | - $alpha = 1; |
|
| 199 | - $rgba = ''; |
|
| 200 | - |
|
| 201 | - // Must be an array. |
|
| 202 | - if ( is_array( $this->value ) ) { |
|
| 203 | - |
|
| 204 | - // Enum array to parse values. |
|
| 205 | - foreach ( $this->value as $id => $val ) { |
|
| 206 | - |
|
| 207 | - // Sanitize alpha. |
|
| 208 | - if ( 'alpha' === $id ) { |
|
| 209 | - $alpha = is_numeric( $val ) ? $val : 1; |
|
| 210 | - } elseif ( 'color' === $id ) { |
|
| 211 | - $color = ! empty( $val ) ? $val : ''; |
|
| 212 | - } elseif ( 'rgba' === $id ) { |
|
| 213 | - $rgba = Redux_Helpers::hex2rgba( $color, $alpha ); |
|
| 214 | - } |
|
| 215 | - } |
|
| 216 | - |
|
| 217 | - // Only build rgba output if alpha ia less than 1. |
|
| 218 | - if ( $alpha < 1 && '' !== $alpha ) { |
|
| 219 | - $color = $rgba; |
|
| 220 | - } |
|
| 221 | - } |
|
| 222 | - |
|
| 223 | - return $color; |
|
| 224 | - } |
|
| 225 | - |
|
| 226 | - /** |
|
| 227 | - * Generate CSS style. |
|
| 228 | - * |
|
| 229 | - * @param string $data Field data. |
|
| 230 | - * |
|
| 231 | - * @return string |
|
| 232 | - */ |
|
| 233 | - public function css_style( $data ): string { |
|
| 234 | - return ''; |
|
| 235 | - } |
|
| 236 | - |
|
| 237 | - /** |
|
| 238 | - * Output Function. |
|
| 239 | - * Used to enqueue to the front-end |
|
| 240 | - * |
|
| 241 | - * @since 1.0.0 |
|
| 242 | - * @access public |
|
| 243 | - * |
|
| 244 | - * @param string|null|array $style css data. |
|
| 245 | - * |
|
| 246 | - * @return void |
|
| 247 | - */ |
|
| 248 | - public function output( $style = '' ) { |
|
| 249 | - if ( ! empty( $this->value ) ) { |
|
| 250 | - $mode = ( isset( $this->field['mode'] ) && ! empty( $this->field['mode'] ) ? $this->field['mode'] : 'color' ); |
|
| 251 | - |
|
| 252 | - $color_val = $this->get_color_val(); |
|
| 253 | - |
|
| 254 | - $style = $mode . ':' . $color_val . ';'; |
|
| 255 | - |
|
| 256 | - if ( ! empty( $this->field['output'] ) && is_array( $this->field['output'] ) ) { |
|
| 257 | - if ( ! empty( $color_val ) ) { |
|
| 258 | - $css = Redux_Functions::parse_css( $this->field['output'], $style, $color_val ); |
|
| 259 | - $this->parent->outputCSS .= esc_attr( $css ); |
|
| 260 | - } |
|
| 261 | - } |
|
| 262 | - |
|
| 263 | - if ( ! empty( $this->field['compiler'] ) && is_array( $this->field['compiler'] ) ) { |
|
| 264 | - if ( ! empty( $color_val ) ) { |
|
| 265 | - $css = Redux_Functions::parse_css( $this->field['compiler'], $style, $color_val ); |
|
| 266 | - $this->parent->compilerCSS .= esc_attr( $css ); |
|
| 267 | - } |
|
| 268 | - } |
|
| 269 | - } |
|
| 270 | - } |
|
| 271 | - |
|
| 272 | - /** |
|
| 273 | - * Enable output_variables to be generated. |
|
| 274 | - * |
|
| 275 | - * @since 4.0.3 |
|
| 276 | - * @return void |
|
| 277 | - */ |
|
| 278 | - public function output_variables() { |
|
| 279 | - // No code needed, just defining the method is enough. |
|
| 280 | - } |
|
| 281 | - } |
|
| 146 | + echo '</div>'; |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + /** |
|
| 150 | + * Enqueue Function. |
|
| 151 | + * If this field requires any scripts, or css define this function and register/enqueue the scripts/css |
|
| 152 | + * |
|
| 153 | + * @since 1.0.0 |
|
| 154 | + * @access public |
|
| 155 | + * @return void |
|
| 156 | + */ |
|
| 157 | + public function enqueue() { |
|
| 158 | + |
|
| 159 | + // Set up min files for dev_mode = false. |
|
| 160 | + $min = Redux_Functions::is_min(); |
|
| 161 | + |
|
| 162 | + // Field dependent JS. |
|
| 163 | + wp_enqueue_script( |
|
| 164 | + 'redux-field-color-rgba', |
|
| 165 | + Redux_Core::$url . 'inc/fields/color_rgba/redux-color-rgba' . $min . '.js', |
|
| 166 | + array( 'jquery', 'redux-spectrum-js', 'redux-js' ), |
|
| 167 | + $this->timestamp, |
|
| 168 | + true |
|
| 169 | + ); |
|
| 170 | + |
|
| 171 | + // Spectrum CSS. |
|
| 172 | + if ( ! wp_style_is( 'redux-spectrum-css' ) ) { |
|
| 173 | + wp_enqueue_style( 'redux-spectrum-css' ); |
|
| 174 | + } |
|
| 175 | + |
|
| 176 | + if ( $this->parent->args['dev_mode'] ) { |
|
| 177 | + wp_enqueue_style( |
|
| 178 | + 'redux-field-color-rgba', |
|
| 179 | + Redux_Core::$url . 'inc/fields/color_rgba/redux-color-rgba.css', |
|
| 180 | + array(), |
|
| 181 | + $this->timestamp |
|
| 182 | + ); |
|
| 183 | + } |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * -> getColorVal. Returns formatted color val in hex or rgba. |
|
| 188 | + * If this field requires any scripts or css, define this function and register/enqueue the scripts/css |
|
| 189 | + * |
|
| 190 | + * @since 1.0.0 |
|
| 191 | + * @access private |
|
| 192 | + * @return string |
|
| 193 | + */ |
|
| 194 | + private function get_color_val(): string { |
|
| 195 | + |
|
| 196 | + // No notices. |
|
| 197 | + $color = ''; |
|
| 198 | + $alpha = 1; |
|
| 199 | + $rgba = ''; |
|
| 200 | + |
|
| 201 | + // Must be an array. |
|
| 202 | + if ( is_array( $this->value ) ) { |
|
| 203 | + |
|
| 204 | + // Enum array to parse values. |
|
| 205 | + foreach ( $this->value as $id => $val ) { |
|
| 206 | + |
|
| 207 | + // Sanitize alpha. |
|
| 208 | + if ( 'alpha' === $id ) { |
|
| 209 | + $alpha = is_numeric( $val ) ? $val : 1; |
|
| 210 | + } elseif ( 'color' === $id ) { |
|
| 211 | + $color = ! empty( $val ) ? $val : ''; |
|
| 212 | + } elseif ( 'rgba' === $id ) { |
|
| 213 | + $rgba = Redux_Helpers::hex2rgba( $color, $alpha ); |
|
| 214 | + } |
|
| 215 | + } |
|
| 216 | + |
|
| 217 | + // Only build rgba output if alpha ia less than 1. |
|
| 218 | + if ( $alpha < 1 && '' !== $alpha ) { |
|
| 219 | + $color = $rgba; |
|
| 220 | + } |
|
| 221 | + } |
|
| 222 | + |
|
| 223 | + return $color; |
|
| 224 | + } |
|
| 225 | + |
|
| 226 | + /** |
|
| 227 | + * Generate CSS style. |
|
| 228 | + * |
|
| 229 | + * @param string $data Field data. |
|
| 230 | + * |
|
| 231 | + * @return string |
|
| 232 | + */ |
|
| 233 | + public function css_style( $data ): string { |
|
| 234 | + return ''; |
|
| 235 | + } |
|
| 236 | + |
|
| 237 | + /** |
|
| 238 | + * Output Function. |
|
| 239 | + * Used to enqueue to the front-end |
|
| 240 | + * |
|
| 241 | + * @since 1.0.0 |
|
| 242 | + * @access public |
|
| 243 | + * |
|
| 244 | + * @param string|null|array $style css data. |
|
| 245 | + * |
|
| 246 | + * @return void |
|
| 247 | + */ |
|
| 248 | + public function output( $style = '' ) { |
|
| 249 | + if ( ! empty( $this->value ) ) { |
|
| 250 | + $mode = ( isset( $this->field['mode'] ) && ! empty( $this->field['mode'] ) ? $this->field['mode'] : 'color' ); |
|
| 251 | + |
|
| 252 | + $color_val = $this->get_color_val(); |
|
| 253 | + |
|
| 254 | + $style = $mode . ':' . $color_val . ';'; |
|
| 255 | + |
|
| 256 | + if ( ! empty( $this->field['output'] ) && is_array( $this->field['output'] ) ) { |
|
| 257 | + if ( ! empty( $color_val ) ) { |
|
| 258 | + $css = Redux_Functions::parse_css( $this->field['output'], $style, $color_val ); |
|
| 259 | + $this->parent->outputCSS .= esc_attr( $css ); |
|
| 260 | + } |
|
| 261 | + } |
|
| 262 | + |
|
| 263 | + if ( ! empty( $this->field['compiler'] ) && is_array( $this->field['compiler'] ) ) { |
|
| 264 | + if ( ! empty( $color_val ) ) { |
|
| 265 | + $css = Redux_Functions::parse_css( $this->field['compiler'], $style, $color_val ); |
|
| 266 | + $this->parent->compilerCSS .= esc_attr( $css ); |
|
| 267 | + } |
|
| 268 | + } |
|
| 269 | + } |
|
| 270 | + } |
|
| 271 | + |
|
| 272 | + /** |
|
| 273 | + * Enable output_variables to be generated. |
|
| 274 | + * |
|
| 275 | + * @since 4.0.3 |
|
| 276 | + * @return void |
|
| 277 | + */ |
|
| 278 | + public function output_variables() { |
|
| 279 | + // No code needed, just defining the method is enough. |
|
| 280 | + } |
|
| 281 | + } |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | class_alias( 'Redux_Color_Rgba', 'ReduxFramework_Color_Rgba' ); |
@@ -13,25 +13,25 @@ discard block |
||
| 13 | 13 | // Don't duplicate me! |
| 14 | 14 | if ( ! class_exists( 'Redux_Date', false ) ) { |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * Main Redux_date class |
|
| 18 | - * |
|
| 19 | - * @since 1.0.0 |
|
| 20 | - */ |
|
| 21 | - class Redux_Date extends Redux_Field { |
|
| 16 | + /** |
|
| 17 | + * Main Redux_date class |
|
| 18 | + * |
|
| 19 | + * @since 1.0.0 |
|
| 20 | + */ |
|
| 21 | + class Redux_Date extends Redux_Field { |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Field Render Function. |
|
| 25 | - * Takes the vars and outputs the HTML for the field in the settings |
|
| 26 | - * |
|
| 27 | - * @since 1.0.0 |
|
| 28 | - * @access public |
|
| 29 | - * @return void |
|
| 30 | - */ |
|
| 31 | - public function render() { |
|
| 32 | - $placeholder = $this->field['placeholder'] ?? ''; |
|
| 23 | + /** |
|
| 24 | + * Field Render Function. |
|
| 25 | + * Takes the vars and outputs the HTML for the field in the settings |
|
| 26 | + * |
|
| 27 | + * @since 1.0.0 |
|
| 28 | + * @access public |
|
| 29 | + * @return void |
|
| 30 | + */ |
|
| 31 | + public function render() { |
|
| 32 | + $placeholder = $this->field['placeholder'] ?? ''; |
|
| 33 | 33 | |
| 34 | - echo '<input |
|
| 34 | + echo '<input |
|
| 35 | 35 | data-id="' . esc_attr( $this->field['id'] ) . '" |
| 36 | 36 | type="text" |
| 37 | 37 | id="' . esc_attr( $this->field['id'] ) . '-date" |
@@ -39,35 +39,35 @@ discard block |
||
| 39 | 39 | value="' . esc_attr( $this->value ) . '" |
| 40 | 40 | placeholder="' . esc_attr( $placeholder ) . '" |
| 41 | 41 | class="redux-datepicker regular-text ' . esc_attr( $this->field['class'] ) . '" />'; |
| 42 | - } |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Enqueue Function. |
|
| 46 | - * If this field requires any scripts, or css define this function and register/enqueue the scripts/css |
|
| 47 | - * |
|
| 48 | - * @since 1.0.0 |
|
| 49 | - * @access public |
|
| 50 | - * @return void |
|
| 51 | - */ |
|
| 52 | - public function enqueue() { |
|
| 53 | - if ( $this->parent->args['dev_mode'] ) { |
|
| 54 | - wp_enqueue_style( |
|
| 55 | - 'redux-field-date', |
|
| 56 | - Redux_Core::$url . 'inc/fields/date/redux-date.css', |
|
| 57 | - array(), |
|
| 58 | - $this->timestamp |
|
| 59 | - ); |
|
| 60 | - } |
|
| 44 | + /** |
|
| 45 | + * Enqueue Function. |
|
| 46 | + * If this field requires any scripts, or css define this function and register/enqueue the scripts/css |
|
| 47 | + * |
|
| 48 | + * @since 1.0.0 |
|
| 49 | + * @access public |
|
| 50 | + * @return void |
|
| 51 | + */ |
|
| 52 | + public function enqueue() { |
|
| 53 | + if ( $this->parent->args['dev_mode'] ) { |
|
| 54 | + wp_enqueue_style( |
|
| 55 | + 'redux-field-date', |
|
| 56 | + Redux_Core::$url . 'inc/fields/date/redux-date.css', |
|
| 57 | + array(), |
|
| 58 | + $this->timestamp |
|
| 59 | + ); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - wp_enqueue_script( |
|
| 63 | - 'redux-field-date', |
|
| 64 | - Redux_Core::$url . 'inc/fields/date/redux-date' . Redux_Functions::is_min() . '.js', |
|
| 65 | - array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker', 'redux-js' ), |
|
| 66 | - $this->timestamp, |
|
| 67 | - true |
|
| 68 | - ); |
|
| 69 | - } |
|
| 70 | - } |
|
| 62 | + wp_enqueue_script( |
|
| 63 | + 'redux-field-date', |
|
| 64 | + Redux_Core::$url . 'inc/fields/date/redux-date' . Redux_Functions::is_min() . '.js', |
|
| 65 | + array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker', 'redux-js' ), |
|
| 66 | + $this->timestamp, |
|
| 67 | + true |
|
| 68 | + ); |
|
| 69 | + } |
|
| 70 | + } |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | class_alias( 'Redux_Date', 'ReduxFramework_Date' ); |
@@ -11,206 +11,206 @@ |
||
| 11 | 11 | |
| 12 | 12 | if ( ! class_exists( 'Redux_Spinner', false ) ) { |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Class Redux_Spinner |
|
| 16 | - */ |
|
| 17 | - class Redux_Spinner extends Redux_Field { |
|
| 18 | - |
|
| 19 | - /** |
|
| 20 | - * Set field and value defaults. |
|
| 21 | - */ |
|
| 22 | - public function set_defaults() { |
|
| 23 | - $params = array( |
|
| 24 | - 'min' => 0, |
|
| 25 | - 'max' => 1, |
|
| 26 | - 'step' => 1, |
|
| 27 | - 'default' => '', |
|
| 28 | - 'edit' => true, |
|
| 29 | - 'plus' => '+', |
|
| 30 | - 'minus' => '-', |
|
| 31 | - 'format' => '', |
|
| 32 | - 'prefix' => '', |
|
| 33 | - 'suffix' => '', |
|
| 34 | - 'point' => '.', |
|
| 35 | - 'places' => null, |
|
| 36 | - ); |
|
| 37 | - |
|
| 38 | - $this->field = wp_parse_args( $this->field, $params ); |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * Field Render Function. |
|
| 43 | - * Takes the vars and outputs the HTML for the field in the settings |
|
| 44 | - * |
|
| 45 | - * @since ReduxFramework 3.0.0 |
|
| 46 | - */ |
|
| 47 | - public function render() { |
|
| 48 | - $data_string = ''; |
|
| 49 | - |
|
| 50 | - foreach ( $this->field as $key => $val ) { |
|
| 51 | - if ( in_array( $key, array( 'min', 'max', 'step', 'default', 'plus', 'minus', 'prefix', 'suffix', 'point', 'places' ), true ) ) { |
|
| 52 | - $data_string .= ' data-' . esc_attr( $key ) . '="' . esc_attr( $val ) . '" '; |
|
| 53 | - } |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - $data_string .= ' data-val=' . $this->value; |
|
| 57 | - |
|
| 58 | - // Don't allow input edit if there's a step. |
|
| 59 | - $readonly = ''; |
|
| 60 | - if ( isset( $this->field['edit'] ) && false === $this->field['edit'] ) { |
|
| 61 | - $readonly = ' readonly="readonly"'; |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - echo '<div id="' . esc_attr( $this->field['id'] ) . '-spinner" class="redux_spinner" rel="' . esc_attr( $this->field['id'] ) . '">'; |
|
| 65 | - |
|
| 66 | - echo '<input type="text" ' . $data_string . ' name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '" id="' . esc_attr( $this->field['id'] ) . '" value="' . esc_attr( $this->value ) . '" class="mini spinner-input ' . esc_attr( $this->field['class'] ) . '"' . $readonly . '/>'; // phpcs:ignore WordPress.Security.EscapeOutput |
|
| 67 | - |
|
| 68 | - echo '</div>'; |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * Clean the field data to the fields defaults given the parameters. |
|
| 73 | - * |
|
| 74 | - * @since Redux_Framework 3.1.1 |
|
| 75 | - */ |
|
| 76 | - private function clean() { |
|
| 77 | - if ( empty( $this->field['min'] ) ) { |
|
| 78 | - $this->field['min'] = 0; |
|
| 79 | - } else { |
|
| 80 | - $this->field['min'] = intval( $this->field['min'] ); |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - if ( empty( $this->field['max'] ) ) { |
|
| 84 | - $this->field['max'] = $this->field['min'] + 1; |
|
| 85 | - } else { |
|
| 86 | - $this->field['max'] = intval( $this->field['max'] ); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - if ( empty( $this->field['step'] ) || $this->field['step'] > $this->field['max'] ) { |
|
| 90 | - $this->field['step'] = 1; |
|
| 91 | - } else { |
|
| 92 | - $this->field['step'] = intval( $this->field['step'] ); |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - if ( empty( $this->value ) && ! empty( $this->field['default'] ) && $this->field['min'] >= 1 ) { |
|
| 96 | - $this->value = intval( $this->field['default'] ); |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - if ( empty( $this->value ) && $this->field['min'] >= 1 ) { |
|
| 100 | - $this->value = $this->field['min']; |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - if ( empty( $this->value ) ) { |
|
| 104 | - $this->value = 0; |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - // Extra Validation. |
|
| 108 | - if ( $this->value < $this->field['min'] ) { |
|
| 109 | - $this->value = $this->field['min']; |
|
| 110 | - } elseif ( $this->value > $this->field['max'] ) { |
|
| 111 | - $this->value = $this->field['max']; |
|
| 112 | - } |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - /** |
|
| 116 | - * Enqueue Function. |
|
| 117 | - * If this field requires any scripts, or css define this function and register/enqueue the scripts/css |
|
| 118 | - * |
|
| 119 | - * @since ReduxFramework 3.0.0 |
|
| 120 | - */ |
|
| 121 | - public function enqueue() { |
|
| 122 | - wp_enqueue_script( |
|
| 123 | - 'redux-field-spinner-custom', |
|
| 124 | - Redux_Core::$url . 'inc/fields/spinner/vendor/jquery.ui.spinner' . Redux_Functions::is_min() . '.js', |
|
| 125 | - array( 'jquery', 'redux-js' ), |
|
| 126 | - $this->timestamp, |
|
| 127 | - true |
|
| 128 | - ); |
|
| 129 | - |
|
| 130 | - wp_enqueue_script( |
|
| 131 | - 'redux-field-spinner', |
|
| 132 | - Redux_Core::$url . 'inc/fields/spinner/redux-spinner' . Redux_Functions::is_min() . '.js', |
|
| 133 | - array( 'jquery', 'redux-field-spinner-custom', 'jquery-ui-core', 'jquery-ui-dialog', 'redux-js' ), |
|
| 134 | - $this->timestamp, |
|
| 135 | - true |
|
| 136 | - ); |
|
| 137 | - |
|
| 138 | - if ( $this->parent->args['dev_mode'] ) { |
|
| 139 | - wp_enqueue_style( |
|
| 140 | - 'redux-field-spinner', |
|
| 141 | - Redux_Core::$url . 'inc/fields/spinner/redux-spinner.css', |
|
| 142 | - array(), |
|
| 143 | - $this->timestamp |
|
| 144 | - ); |
|
| 145 | - } |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - /** |
|
| 149 | - * CSS/compiler output. |
|
| 150 | - * |
|
| 151 | - * @param string|null|array $style CSS styles. |
|
| 152 | - */ |
|
| 153 | - public function output( $style = '' ) { |
|
| 154 | - if ( ! empty( $this->value ) ) { |
|
| 155 | - if ( ! empty( $this->field['output'] ) && is_array( $this->field['output'] ) ) { |
|
| 156 | - $css = $this->parse_css( $this->value, $this->field['output'] ); |
|
| 157 | - $this->parent->outputCSS .= esc_attr( $css ); |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - if ( ! empty( $this->field['compiler'] ) && is_array( $this->field['compiler'] ) ) { |
|
| 161 | - $css = $this->parse_css( $this->value, $this->field['compiler'] ); |
|
| 162 | - $this->parent->compilerCSS .= esc_attr( $css ); |
|
| 163 | - } |
|
| 164 | - } |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - /** |
|
| 168 | - * Compile CSS data for output. |
|
| 169 | - * |
|
| 170 | - * @param mixed $value Value. |
|
| 171 | - * @param mixed $output . |
|
| 172 | - * |
|
| 173 | - * @return string |
|
| 174 | - */ |
|
| 175 | - private function parse_css( $value, $output ): string { |
|
| 176 | - // No notices. |
|
| 177 | - $css = ''; |
|
| 178 | - |
|
| 179 | - $unit = $this->field['output_unit'] ?? 'px'; |
|
| 180 | - |
|
| 181 | - // Must be an array. |
|
| 182 | - if ( is_array( $output ) ) { |
|
| 183 | - foreach ( $output as $selector => $mode ) { |
|
| 184 | - if ( '' !== $mode && '' !== $selector ) { |
|
| 185 | - $css .= $selector . '{' . $mode . ':' . $value . $unit . ';}'; |
|
| 186 | - } |
|
| 187 | - } |
|
| 188 | - } |
|
| 189 | - |
|
| 190 | - return $css; |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - /** |
|
| 194 | - * Generate CSS style (unused, but needed). |
|
| 195 | - * |
|
| 196 | - * @param string $data Field data. |
|
| 197 | - * |
|
| 198 | - * @return string |
|
| 199 | - */ |
|
| 200 | - public function css_style( $data ): string { |
|
| 201 | - return ''; |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - /** |
|
| 205 | - * Enable output_variables to be generated. |
|
| 206 | - * |
|
| 207 | - * @since 4.0.3 |
|
| 208 | - * @return void |
|
| 209 | - */ |
|
| 210 | - public function output_variables() { |
|
| 211 | - // No code needed, just defining the method is enough. |
|
| 212 | - } |
|
| 213 | - } |
|
| 14 | + /** |
|
| 15 | + * Class Redux_Spinner |
|
| 16 | + */ |
|
| 17 | + class Redux_Spinner extends Redux_Field { |
|
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * Set field and value defaults. |
|
| 21 | + */ |
|
| 22 | + public function set_defaults() { |
|
| 23 | + $params = array( |
|
| 24 | + 'min' => 0, |
|
| 25 | + 'max' => 1, |
|
| 26 | + 'step' => 1, |
|
| 27 | + 'default' => '', |
|
| 28 | + 'edit' => true, |
|
| 29 | + 'plus' => '+', |
|
| 30 | + 'minus' => '-', |
|
| 31 | + 'format' => '', |
|
| 32 | + 'prefix' => '', |
|
| 33 | + 'suffix' => '', |
|
| 34 | + 'point' => '.', |
|
| 35 | + 'places' => null, |
|
| 36 | + ); |
|
| 37 | + |
|
| 38 | + $this->field = wp_parse_args( $this->field, $params ); |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * Field Render Function. |
|
| 43 | + * Takes the vars and outputs the HTML for the field in the settings |
|
| 44 | + * |
|
| 45 | + * @since ReduxFramework 3.0.0 |
|
| 46 | + */ |
|
| 47 | + public function render() { |
|
| 48 | + $data_string = ''; |
|
| 49 | + |
|
| 50 | + foreach ( $this->field as $key => $val ) { |
|
| 51 | + if ( in_array( $key, array( 'min', 'max', 'step', 'default', 'plus', 'minus', 'prefix', 'suffix', 'point', 'places' ), true ) ) { |
|
| 52 | + $data_string .= ' data-' . esc_attr( $key ) . '="' . esc_attr( $val ) . '" '; |
|
| 53 | + } |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + $data_string .= ' data-val=' . $this->value; |
|
| 57 | + |
|
| 58 | + // Don't allow input edit if there's a step. |
|
| 59 | + $readonly = ''; |
|
| 60 | + if ( isset( $this->field['edit'] ) && false === $this->field['edit'] ) { |
|
| 61 | + $readonly = ' readonly="readonly"'; |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + echo '<div id="' . esc_attr( $this->field['id'] ) . '-spinner" class="redux_spinner" rel="' . esc_attr( $this->field['id'] ) . '">'; |
|
| 65 | + |
|
| 66 | + echo '<input type="text" ' . $data_string . ' name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '" id="' . esc_attr( $this->field['id'] ) . '" value="' . esc_attr( $this->value ) . '" class="mini spinner-input ' . esc_attr( $this->field['class'] ) . '"' . $readonly . '/>'; // phpcs:ignore WordPress.Security.EscapeOutput |
|
| 67 | + |
|
| 68 | + echo '</div>'; |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * Clean the field data to the fields defaults given the parameters. |
|
| 73 | + * |
|
| 74 | + * @since Redux_Framework 3.1.1 |
|
| 75 | + */ |
|
| 76 | + private function clean() { |
|
| 77 | + if ( empty( $this->field['min'] ) ) { |
|
| 78 | + $this->field['min'] = 0; |
|
| 79 | + } else { |
|
| 80 | + $this->field['min'] = intval( $this->field['min'] ); |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + if ( empty( $this->field['max'] ) ) { |
|
| 84 | + $this->field['max'] = $this->field['min'] + 1; |
|
| 85 | + } else { |
|
| 86 | + $this->field['max'] = intval( $this->field['max'] ); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + if ( empty( $this->field['step'] ) || $this->field['step'] > $this->field['max'] ) { |
|
| 90 | + $this->field['step'] = 1; |
|
| 91 | + } else { |
|
| 92 | + $this->field['step'] = intval( $this->field['step'] ); |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + if ( empty( $this->value ) && ! empty( $this->field['default'] ) && $this->field['min'] >= 1 ) { |
|
| 96 | + $this->value = intval( $this->field['default'] ); |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + if ( empty( $this->value ) && $this->field['min'] >= 1 ) { |
|
| 100 | + $this->value = $this->field['min']; |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + if ( empty( $this->value ) ) { |
|
| 104 | + $this->value = 0; |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + // Extra Validation. |
|
| 108 | + if ( $this->value < $this->field['min'] ) { |
|
| 109 | + $this->value = $this->field['min']; |
|
| 110 | + } elseif ( $this->value > $this->field['max'] ) { |
|
| 111 | + $this->value = $this->field['max']; |
|
| 112 | + } |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | + * Enqueue Function. |
|
| 117 | + * If this field requires any scripts, or css define this function and register/enqueue the scripts/css |
|
| 118 | + * |
|
| 119 | + * @since ReduxFramework 3.0.0 |
|
| 120 | + */ |
|
| 121 | + public function enqueue() { |
|
| 122 | + wp_enqueue_script( |
|
| 123 | + 'redux-field-spinner-custom', |
|
| 124 | + Redux_Core::$url . 'inc/fields/spinner/vendor/jquery.ui.spinner' . Redux_Functions::is_min() . '.js', |
|
| 125 | + array( 'jquery', 'redux-js' ), |
|
| 126 | + $this->timestamp, |
|
| 127 | + true |
|
| 128 | + ); |
|
| 129 | + |
|
| 130 | + wp_enqueue_script( |
|
| 131 | + 'redux-field-spinner', |
|
| 132 | + Redux_Core::$url . 'inc/fields/spinner/redux-spinner' . Redux_Functions::is_min() . '.js', |
|
| 133 | + array( 'jquery', 'redux-field-spinner-custom', 'jquery-ui-core', 'jquery-ui-dialog', 'redux-js' ), |
|
| 134 | + $this->timestamp, |
|
| 135 | + true |
|
| 136 | + ); |
|
| 137 | + |
|
| 138 | + if ( $this->parent->args['dev_mode'] ) { |
|
| 139 | + wp_enqueue_style( |
|
| 140 | + 'redux-field-spinner', |
|
| 141 | + Redux_Core::$url . 'inc/fields/spinner/redux-spinner.css', |
|
| 142 | + array(), |
|
| 143 | + $this->timestamp |
|
| 144 | + ); |
|
| 145 | + } |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + /** |
|
| 149 | + * CSS/compiler output. |
|
| 150 | + * |
|
| 151 | + * @param string|null|array $style CSS styles. |
|
| 152 | + */ |
|
| 153 | + public function output( $style = '' ) { |
|
| 154 | + if ( ! empty( $this->value ) ) { |
|
| 155 | + if ( ! empty( $this->field['output'] ) && is_array( $this->field['output'] ) ) { |
|
| 156 | + $css = $this->parse_css( $this->value, $this->field['output'] ); |
|
| 157 | + $this->parent->outputCSS .= esc_attr( $css ); |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + if ( ! empty( $this->field['compiler'] ) && is_array( $this->field['compiler'] ) ) { |
|
| 161 | + $css = $this->parse_css( $this->value, $this->field['compiler'] ); |
|
| 162 | + $this->parent->compilerCSS .= esc_attr( $css ); |
|
| 163 | + } |
|
| 164 | + } |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + /** |
|
| 168 | + * Compile CSS data for output. |
|
| 169 | + * |
|
| 170 | + * @param mixed $value Value. |
|
| 171 | + * @param mixed $output . |
|
| 172 | + * |
|
| 173 | + * @return string |
|
| 174 | + */ |
|
| 175 | + private function parse_css( $value, $output ): string { |
|
| 176 | + // No notices. |
|
| 177 | + $css = ''; |
|
| 178 | + |
|
| 179 | + $unit = $this->field['output_unit'] ?? 'px'; |
|
| 180 | + |
|
| 181 | + // Must be an array. |
|
| 182 | + if ( is_array( $output ) ) { |
|
| 183 | + foreach ( $output as $selector => $mode ) { |
|
| 184 | + if ( '' !== $mode && '' !== $selector ) { |
|
| 185 | + $css .= $selector . '{' . $mode . ':' . $value . $unit . ';}'; |
|
| 186 | + } |
|
| 187 | + } |
|
| 188 | + } |
|
| 189 | + |
|
| 190 | + return $css; |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + /** |
|
| 194 | + * Generate CSS style (unused, but needed). |
|
| 195 | + * |
|
| 196 | + * @param string $data Field data. |
|
| 197 | + * |
|
| 198 | + * @return string |
|
| 199 | + */ |
|
| 200 | + public function css_style( $data ): string { |
|
| 201 | + return ''; |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + /** |
|
| 205 | + * Enable output_variables to be generated. |
|
| 206 | + * |
|
| 207 | + * @since 4.0.3 |
|
| 208 | + * @return void |
|
| 209 | + */ |
|
| 210 | + public function output_variables() { |
|
| 211 | + // No code needed, just defining the method is enough. |
|
| 212 | + } |
|
| 213 | + } |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | class_alias( 'Redux_Spinner', 'ReduxFramework_Spinner' ); |
@@ -12,53 +12,53 @@ |
||
| 12 | 12 | |
| 13 | 13 | if ( ! class_exists( 'Redux_Radio', false ) ) { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Class Redux_Radio |
|
| 17 | - */ |
|
| 18 | - class Redux_Radio extends Redux_Field { |
|
| 15 | + /** |
|
| 16 | + * Class Redux_Radio |
|
| 17 | + */ |
|
| 18 | + class Redux_Radio extends Redux_Field { |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Field Render Function. |
|
| 22 | - * Takes the vars and outputs the HTML for the field in the settings |
|
| 23 | - * |
|
| 24 | - * @since ReduxFramework 1.0.0 |
|
| 25 | - */ |
|
| 26 | - public function render() { |
|
| 27 | - if ( ! empty( $this->field['data'] ) && empty( $this->field['options'] ) ) { |
|
| 28 | - if ( empty( $this->field['args'] ) ) { |
|
| 29 | - $this->field['args'] = array(); |
|
| 30 | - } |
|
| 20 | + /** |
|
| 21 | + * Field Render Function. |
|
| 22 | + * Takes the vars and outputs the HTML for the field in the settings |
|
| 23 | + * |
|
| 24 | + * @since ReduxFramework 1.0.0 |
|
| 25 | + */ |
|
| 26 | + public function render() { |
|
| 27 | + if ( ! empty( $this->field['data'] ) && empty( $this->field['options'] ) ) { |
|
| 28 | + if ( empty( $this->field['args'] ) ) { |
|
| 29 | + $this->field['args'] = array(); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - if ( is_array( $this->field['data'] ) ) { |
|
| 33 | - $this->field['options'] = $this->field['data']; |
|
| 34 | - } else { |
|
| 35 | - $this->field['options'] = $this->parent->wordpress_data->get( $this->field['data'], $this->field['args'], $this->parent->args['opt_name'], $this->value ); |
|
| 36 | - } |
|
| 37 | - } |
|
| 32 | + if ( is_array( $this->field['data'] ) ) { |
|
| 33 | + $this->field['options'] = $this->field['data']; |
|
| 34 | + } else { |
|
| 35 | + $this->field['options'] = $this->parent->wordpress_data->get( $this->field['data'], $this->field['args'], $this->parent->args['opt_name'], $this->value ); |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - $this->field['data_class'] = ( isset( $this->field['multi_layout'] ) ) ? 'data-' . $this->field['multi_layout'] : 'data-full'; |
|
| 39 | + $this->field['data_class'] = ( isset( $this->field['multi_layout'] ) ) ? 'data-' . $this->field['multi_layout'] : 'data-full'; |
|
| 40 | 40 | |
| 41 | - if ( isset( $this->field['options'] ) && ! empty( $this->field['options'] ) ) { |
|
| 42 | - echo '<ul class="' . esc_attr( $this->field['data_class'] ) . '">'; |
|
| 41 | + if ( isset( $this->field['options'] ) && ! empty( $this->field['options'] ) ) { |
|
| 42 | + echo '<ul class="' . esc_attr( $this->field['data_class'] ) . '">'; |
|
| 43 | 43 | |
| 44 | - foreach ( $this->field['options'] as $k => $v ) { |
|
| 45 | - echo '<li>'; |
|
| 46 | - echo '<label for="' . esc_attr( $this->field['id'] . '_' . array_search( $k, array_keys( $this->field['options'] ), true ) ) . '">'; |
|
| 47 | - echo '<input |
|
| 44 | + foreach ( $this->field['options'] as $k => $v ) { |
|
| 45 | + echo '<li>'; |
|
| 46 | + echo '<label for="' . esc_attr( $this->field['id'] . '_' . array_search( $k, array_keys( $this->field['options'] ), true ) ) . '">'; |
|
| 47 | + echo '<input |
|
| 48 | 48 | type="radio" |
| 49 | 49 | class="radio ' . esc_attr( $this->field['class'] ) . '" |
| 50 | 50 | id="' . esc_attr( $this->field['id'] . '_' . array_search( $k, array_keys( $this->field['options'] ), true ) ) . '" |
| 51 | 51 | name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '" |
| 52 | 52 | value="' . esc_attr( $k ) . '" ' . ( ! is_array( $this->value ) ? checked( $this->value, $k, false ) : '' ) . '/>'; |
| 53 | - echo ' <span>' . wp_kses_post( $v ) . '</span>'; |
|
| 54 | - echo '</label>'; |
|
| 55 | - echo '</li>'; |
|
| 56 | - } |
|
| 53 | + echo ' <span>' . wp_kses_post( $v ) . '</span>'; |
|
| 54 | + echo '</label>'; |
|
| 55 | + echo '</li>'; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - echo '</ul>'; |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - } |
|
| 58 | + echo '</ul>'; |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + } |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | class_alias( 'Redux_Radio', 'ReduxFramework_Radio' ); |
@@ -12,94 +12,94 @@ |
||
| 12 | 12 | |
| 13 | 13 | if ( ! class_exists( 'Redux_Text', false ) ) { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Class Redux_Text |
|
| 17 | - */ |
|
| 18 | - class Redux_Text extends Redux_Field { |
|
| 19 | - |
|
| 20 | - /** |
|
| 21 | - * Field Render Function. |
|
| 22 | - * Takes the vars and outputs the HTML for the field in the settings |
|
| 23 | - * |
|
| 24 | - * @since ReduxFramework 1.0.0 |
|
| 25 | - */ |
|
| 26 | - public function render() { |
|
| 27 | - if ( ! empty( $this->field['data'] ) && empty( $this->field['options'] ) ) { |
|
| 28 | - if ( empty( $this->field['args'] ) ) { |
|
| 29 | - $this->field['args'] = array(); |
|
| 30 | - } |
|
| 31 | - |
|
| 32 | - $this->field['options'] = $this->parent->wordpress_data->get( $this->field['data'], $this->field['args'], $this->parent->args['opt_name'], $this->value ); |
|
| 33 | - $this->field['class'] .= ' hasOptions '; |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - if ( empty( $this->value ) && ! empty( $this->field['data'] ) && ! empty( $this->field['options'] ) ) { |
|
| 37 | - $this->value = $this->field['options']; |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - $qtip_title = isset( $this->field['text_hint']['title'] ) ? 'qtip-title="' . $this->field['text_hint']['title'] . '" ' : ''; |
|
| 41 | - $qtip_text = isset( $this->field['text_hint']['content'] ) ? 'qtip-content="' . $this->field['text_hint']['content'] . '" ' : ''; |
|
| 42 | - |
|
| 43 | - $readonly = ( isset( $this->field['readonly'] ) && $this->field['readonly'] ) ? ' readonly="readonly"' : ''; |
|
| 44 | - $autocomplete = ( isset( $this->field['autocomplete'] ) && false === $this->field['autocomplete'] ) ? ' autocomplete="off"' : ''; |
|
| 45 | - |
|
| 46 | - if ( isset( $this->field['options'] ) && ! empty( $this->field['options'] ) ) { |
|
| 47 | - $placeholder = ''; |
|
| 48 | - |
|
| 49 | - if ( isset( $this->field['placeholder'] ) ) { |
|
| 50 | - $placeholder = $this->field['placeholder']; |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - foreach ( $this->field['options'] as $k => $v ) { |
|
| 54 | - if ( ! empty( $placeholder ) ) { |
|
| 55 | - $placeholder = ( is_array( $this->field['placeholder'] ) && isset( $this->field['placeholder'][ $k ] ) ) ? ' placeholder="' . esc_attr( $this->field['placeholder'][ $k ] ) . '" ' : ''; |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - echo '<div class="input_wrapper">'; |
|
| 59 | - echo '<label for="' . esc_attr( $this->field['id'] . '-text-' . $k ) . '">' . esc_html( $v ) . '</label> '; |
|
| 60 | - |
|
| 61 | - $value = $this->value[ $k ] ?? ''; |
|
| 62 | - $value = ! empty( $this->value[ $k ] ) ? $this->value[ $k ] : ''; |
|
| 63 | - |
|
| 64 | - // phpcs:ignore WordPress.Security.EscapeOutput |
|
| 65 | - echo '<input type="text" id="' . esc_attr( $this->field['id'] . '-text-' . $k ) . '" ' . esc_attr( $qtip_title ) . esc_attr( $qtip_text ) . ' name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] . '[' . esc_attr( $k ) ) . ']" ' . $placeholder . ' value="' . esc_attr( $value ) . '" class="regular-text ' . esc_attr( $this->field['class'] ) . '" ' . esc_html( $readonly ) . esc_html( $autocomplete ) . '/><br />'; |
|
| 66 | - echo '</div>'; |
|
| 67 | - } |
|
| 68 | - } else { |
|
| 69 | - $placeholder = ( isset( $this->field['placeholder'] ) && ! is_array( $this->field['placeholder'] ) ) ? ' placeholder="' . esc_attr( $this->field['placeholder'] ) . '" ' : ''; |
|
| 70 | - |
|
| 71 | - // phpcs:ignore WordPress.Security.EscapeOutput |
|
| 72 | - echo '<input ' . esc_attr( $qtip_title ) . esc_attr( $qtip_text ) . 'type="text" id="' . esc_attr( $this->field['id'] ) . '" name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '" ' . $placeholder . 'value="' . esc_attr( $this->value ) . '" class="regular-text ' . esc_attr( $this->field['class'] ) . '"' . esc_html( $readonly ) . esc_html( $autocomplete ) . ' />'; |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - /** |
|
| 77 | - * Enqueue Function. |
|
| 78 | - * If this field requires any scripts, or css define this function and register/enqueue the scripts/css |
|
| 79 | - * |
|
| 80 | - * @since ReduxFramework 3.0.0 |
|
| 81 | - */ |
|
| 82 | - public function enqueue() { |
|
| 83 | - if ( $this->parent->args['dev_mode'] ) { |
|
| 84 | - wp_enqueue_style( |
|
| 85 | - 'redux-field-text', |
|
| 86 | - Redux_Core::$url . 'inc/fields/text/redux-text.css', |
|
| 87 | - array(), |
|
| 88 | - $this->timestamp |
|
| 89 | - ); |
|
| 90 | - } |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - /** |
|
| 94 | - * Enable output_variables to be generated. |
|
| 95 | - * |
|
| 96 | - * @since 4.0.3 |
|
| 97 | - * @return void |
|
| 98 | - */ |
|
| 99 | - public function output_variables() { |
|
| 100 | - // No code needed, just defining the method is enough. |
|
| 101 | - } |
|
| 102 | - } |
|
| 15 | + /** |
|
| 16 | + * Class Redux_Text |
|
| 17 | + */ |
|
| 18 | + class Redux_Text extends Redux_Field { |
|
| 19 | + |
|
| 20 | + /** |
|
| 21 | + * Field Render Function. |
|
| 22 | + * Takes the vars and outputs the HTML for the field in the settings |
|
| 23 | + * |
|
| 24 | + * @since ReduxFramework 1.0.0 |
|
| 25 | + */ |
|
| 26 | + public function render() { |
|
| 27 | + if ( ! empty( $this->field['data'] ) && empty( $this->field['options'] ) ) { |
|
| 28 | + if ( empty( $this->field['args'] ) ) { |
|
| 29 | + $this->field['args'] = array(); |
|
| 30 | + } |
|
| 31 | + |
|
| 32 | + $this->field['options'] = $this->parent->wordpress_data->get( $this->field['data'], $this->field['args'], $this->parent->args['opt_name'], $this->value ); |
|
| 33 | + $this->field['class'] .= ' hasOptions '; |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + if ( empty( $this->value ) && ! empty( $this->field['data'] ) && ! empty( $this->field['options'] ) ) { |
|
| 37 | + $this->value = $this->field['options']; |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + $qtip_title = isset( $this->field['text_hint']['title'] ) ? 'qtip-title="' . $this->field['text_hint']['title'] . '" ' : ''; |
|
| 41 | + $qtip_text = isset( $this->field['text_hint']['content'] ) ? 'qtip-content="' . $this->field['text_hint']['content'] . '" ' : ''; |
|
| 42 | + |
|
| 43 | + $readonly = ( isset( $this->field['readonly'] ) && $this->field['readonly'] ) ? ' readonly="readonly"' : ''; |
|
| 44 | + $autocomplete = ( isset( $this->field['autocomplete'] ) && false === $this->field['autocomplete'] ) ? ' autocomplete="off"' : ''; |
|
| 45 | + |
|
| 46 | + if ( isset( $this->field['options'] ) && ! empty( $this->field['options'] ) ) { |
|
| 47 | + $placeholder = ''; |
|
| 48 | + |
|
| 49 | + if ( isset( $this->field['placeholder'] ) ) { |
|
| 50 | + $placeholder = $this->field['placeholder']; |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + foreach ( $this->field['options'] as $k => $v ) { |
|
| 54 | + if ( ! empty( $placeholder ) ) { |
|
| 55 | + $placeholder = ( is_array( $this->field['placeholder'] ) && isset( $this->field['placeholder'][ $k ] ) ) ? ' placeholder="' . esc_attr( $this->field['placeholder'][ $k ] ) . '" ' : ''; |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + echo '<div class="input_wrapper">'; |
|
| 59 | + echo '<label for="' . esc_attr( $this->field['id'] . '-text-' . $k ) . '">' . esc_html( $v ) . '</label> '; |
|
| 60 | + |
|
| 61 | + $value = $this->value[ $k ] ?? ''; |
|
| 62 | + $value = ! empty( $this->value[ $k ] ) ? $this->value[ $k ] : ''; |
|
| 63 | + |
|
| 64 | + // phpcs:ignore WordPress.Security.EscapeOutput |
|
| 65 | + echo '<input type="text" id="' . esc_attr( $this->field['id'] . '-text-' . $k ) . '" ' . esc_attr( $qtip_title ) . esc_attr( $qtip_text ) . ' name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] . '[' . esc_attr( $k ) ) . ']" ' . $placeholder . ' value="' . esc_attr( $value ) . '" class="regular-text ' . esc_attr( $this->field['class'] ) . '" ' . esc_html( $readonly ) . esc_html( $autocomplete ) . '/><br />'; |
|
| 66 | + echo '</div>'; |
|
| 67 | + } |
|
| 68 | + } else { |
|
| 69 | + $placeholder = ( isset( $this->field['placeholder'] ) && ! is_array( $this->field['placeholder'] ) ) ? ' placeholder="' . esc_attr( $this->field['placeholder'] ) . '" ' : ''; |
|
| 70 | + |
|
| 71 | + // phpcs:ignore WordPress.Security.EscapeOutput |
|
| 72 | + echo '<input ' . esc_attr( $qtip_title ) . esc_attr( $qtip_text ) . 'type="text" id="' . esc_attr( $this->field['id'] ) . '" name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '" ' . $placeholder . 'value="' . esc_attr( $this->value ) . '" class="regular-text ' . esc_attr( $this->field['class'] ) . '"' . esc_html( $readonly ) . esc_html( $autocomplete ) . ' />'; |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + /** |
|
| 77 | + * Enqueue Function. |
|
| 78 | + * If this field requires any scripts, or css define this function and register/enqueue the scripts/css |
|
| 79 | + * |
|
| 80 | + * @since ReduxFramework 3.0.0 |
|
| 81 | + */ |
|
| 82 | + public function enqueue() { |
|
| 83 | + if ( $this->parent->args['dev_mode'] ) { |
|
| 84 | + wp_enqueue_style( |
|
| 85 | + 'redux-field-text', |
|
| 86 | + Redux_Core::$url . 'inc/fields/text/redux-text.css', |
|
| 87 | + array(), |
|
| 88 | + $this->timestamp |
|
| 89 | + ); |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + /** |
|
| 94 | + * Enable output_variables to be generated. |
|
| 95 | + * |
|
| 96 | + * @since 4.0.3 |
|
| 97 | + * @return void |
|
| 98 | + */ |
|
| 99 | + public function output_variables() { |
|
| 100 | + // No code needed, just defining the method is enough. |
|
| 101 | + } |
|
| 102 | + } |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | class_alias( 'Redux_Text', 'ReduxFramework_Text' ); |
@@ -52,14 +52,14 @@ |
||
| 52 | 52 | |
| 53 | 53 | foreach ( $this->field['options'] as $k => $v ) { |
| 54 | 54 | if ( ! empty( $placeholder ) ) { |
| 55 | - $placeholder = ( is_array( $this->field['placeholder'] ) && isset( $this->field['placeholder'][ $k ] ) ) ? ' placeholder="' . esc_attr( $this->field['placeholder'][ $k ] ) . '" ' : ''; |
|
| 55 | + $placeholder = ( is_array( $this->field['placeholder'] ) && isset( $this->field['placeholder'][$k] ) ) ? ' placeholder="' . esc_attr( $this->field['placeholder'][$k] ) . '" ' : ''; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | echo '<div class="input_wrapper">'; |
| 59 | 59 | echo '<label for="' . esc_attr( $this->field['id'] . '-text-' . $k ) . '">' . esc_html( $v ) . '</label> '; |
| 60 | 60 | |
| 61 | - $value = $this->value[ $k ] ?? ''; |
|
| 62 | - $value = ! empty( $this->value[ $k ] ) ? $this->value[ $k ] : ''; |
|
| 61 | + $value = $this->value[$k] ?? ''; |
|
| 62 | + $value = ! empty( $this->value[$k] ) ? $this->value[$k] : ''; |
|
| 63 | 63 | |
| 64 | 64 | // phpcs:ignore WordPress.Security.EscapeOutput |
| 65 | 65 | echo '<input type="text" id="' . esc_attr( $this->field['id'] . '-text-' . $k ) . '" ' . esc_attr( $qtip_title ) . esc_attr( $qtip_text ) . ' name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] . '[' . esc_attr( $k ) ) . ']" ' . $placeholder . ' value="' . esc_attr( $value ) . '" class="regular-text ' . esc_attr( $this->field['class'] ) . '" ' . esc_html( $readonly ) . esc_html( $autocomplete ) . '/><br />'; |
@@ -19,36 +19,36 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class Init { |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * Init constructor. |
|
| 24 | - * |
|
| 25 | - * @access public |
|
| 26 | - */ |
|
| 27 | - public function __construct() { |
|
| 28 | - global $pagenow; |
|
| 29 | - |
|
| 30 | - if ( 'widgets.php' === $pagenow ) { |
|
| 31 | - return; |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - require_once REDUXTEMPLATES_DIR_PATH . 'classes/class-templates.php'; |
|
| 35 | - |
|
| 36 | - add_action( 'init', array( $this, 'load' ) ); |
|
| 37 | - |
|
| 38 | - if ( did_action( 'init' ) ) { // In case the devs load it at the wrong place. |
|
| 39 | - $this->load(); |
|
| 40 | - } |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * Load everything up after init. |
|
| 45 | - * |
|
| 46 | - * @access public |
|
| 47 | - * @since 4.0.0 |
|
| 48 | - */ |
|
| 49 | - public static function load() { |
|
| 50 | - new ReduxTemplates\Templates(); |
|
| 51 | - } |
|
| 22 | + /** |
|
| 23 | + * Init constructor. |
|
| 24 | + * |
|
| 25 | + * @access public |
|
| 26 | + */ |
|
| 27 | + public function __construct() { |
|
| 28 | + global $pagenow; |
|
| 29 | + |
|
| 30 | + if ( 'widgets.php' === $pagenow ) { |
|
| 31 | + return; |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + require_once REDUXTEMPLATES_DIR_PATH . 'classes/class-templates.php'; |
|
| 35 | + |
|
| 36 | + add_action( 'init', array( $this, 'load' ) ); |
|
| 37 | + |
|
| 38 | + if ( did_action( 'init' ) ) { // In case the devs load it at the wrong place. |
|
| 39 | + $this->load(); |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * Load everything up after init. |
|
| 45 | + * |
|
| 46 | + * @access public |
|
| 47 | + * @since 4.0.0 |
|
| 48 | + */ |
|
| 49 | + public static function load() { |
|
| 50 | + new ReduxTemplates\Templates(); |
|
| 51 | + } |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | new Init(); |
@@ -11,37 +11,37 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | if ( ! class_exists( 'Redux_Textarea', false ) ) { |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Class Redux_Textarea |
|
| 16 | - */ |
|
| 17 | - class Redux_Textarea extends Redux_Field { |
|
| 18 | - |
|
| 19 | - /** |
|
| 20 | - * Set field and value defaults. |
|
| 21 | - */ |
|
| 22 | - public function set_defaults() { |
|
| 23 | - $defaults = array( |
|
| 24 | - 'placeholder' => '', |
|
| 25 | - 'rows' => 6, |
|
| 26 | - 'autocomplete' => false, |
|
| 27 | - 'readonly' => false, |
|
| 28 | - 'class' => '', |
|
| 29 | - ); |
|
| 30 | - |
|
| 31 | - $this->field = wp_parse_args( $this->field, $defaults ); |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * Field Render Function. |
|
| 36 | - * Takes the vars and outputs the HTML for the field in the settings |
|
| 37 | - * |
|
| 38 | - * @since ReduxFramework 1.0.0 |
|
| 39 | - * */ |
|
| 40 | - public function render() { |
|
| 41 | - $readonly = ( true === boolval( $this->field['readonly'] ) ) ? ' readonly' : ''; |
|
| 42 | - $autocomplete = ( true === boolval( $this->field['autocomplete'] ) ) ? 'on' : 'off'; |
|
| 43 | - |
|
| 44 | - ?> |
|
| 14 | + /** |
|
| 15 | + * Class Redux_Textarea |
|
| 16 | + */ |
|
| 17 | + class Redux_Textarea extends Redux_Field { |
|
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * Set field and value defaults. |
|
| 21 | + */ |
|
| 22 | + public function set_defaults() { |
|
| 23 | + $defaults = array( |
|
| 24 | + 'placeholder' => '', |
|
| 25 | + 'rows' => 6, |
|
| 26 | + 'autocomplete' => false, |
|
| 27 | + 'readonly' => false, |
|
| 28 | + 'class' => '', |
|
| 29 | + ); |
|
| 30 | + |
|
| 31 | + $this->field = wp_parse_args( $this->field, $defaults ); |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * Field Render Function. |
|
| 36 | + * Takes the vars and outputs the HTML for the field in the settings |
|
| 37 | + * |
|
| 38 | + * @since ReduxFramework 1.0.0 |
|
| 39 | + * */ |
|
| 40 | + public function render() { |
|
| 41 | + $readonly = ( true === boolval( $this->field['readonly'] ) ) ? ' readonly' : ''; |
|
| 42 | + $autocomplete = ( true === boolval( $this->field['autocomplete'] ) ) ? 'on' : 'off'; |
|
| 43 | + |
|
| 44 | + ?> |
|
| 45 | 45 | <label for="<?php echo esc_attr( $this->field['id'] ); ?>-textarea"></label> |
| 46 | 46 | <textarea <?php echo esc_html( $readonly ); ?> |
| 47 | 47 | name="<?php echo esc_attr( $this->field['name'] . $this->field['name_suffix'] ); ?>" |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | class="large-text <?php echo esc_attr( $this->field['class'] ); ?>" |
| 52 | 52 | rows="<?php echo esc_attr( $this->field['rows'] ); ?>"><?php echo esc_textarea( $this->value ); ?></textarea> |
| 53 | 53 | <?php |
| 54 | - } |
|
| 55 | - } |
|
| 54 | + } |
|
| 55 | + } |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | class_alias( 'Redux_Textarea', 'ReduxFramework_Textarea' ); |
@@ -12,396 +12,396 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | if ( ! class_exists( 'Redux_Panel', false ) ) { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Class Redux_Panel |
|
| 17 | - */ |
|
| 18 | - class Redux_Panel { |
|
| 19 | - |
|
| 20 | - /** |
|
| 21 | - * ReduxFramework object pointer. |
|
| 22 | - * |
|
| 23 | - * @var object |
|
| 24 | - */ |
|
| 25 | - public $parent = null; |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * Path to templates dir. |
|
| 29 | - * |
|
| 30 | - * @var null|string |
|
| 31 | - */ |
|
| 32 | - public $template_path = null; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * Original template path. |
|
| 36 | - * |
|
| 37 | - * @var null |
|
| 38 | - */ |
|
| 39 | - public $original_path = null; |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * Sets the path from the arg or via filter. Also calls the panel template function. |
|
| 43 | - * |
|
| 44 | - * @param object $redux ReduxFramework pointer. |
|
| 45 | - */ |
|
| 46 | - public function __construct( $redux ) { |
|
| 47 | - $this->parent = $redux; |
|
| 48 | - $this->template_path = Redux_Core::$dir . 'templates/panel/'; |
|
| 49 | - $this->original_path = Redux_Core::$dir . 'templates/panel/'; |
|
| 50 | - |
|
| 51 | - if ( ! empty( $this->parent->args['templates_path'] ) ) { |
|
| 52 | - $this->template_path = trailingslashit( $this->parent->args['templates_path'] ); |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 56 | - $this->template_path = trailingslashit( apply_filters( "redux/{$this->parent->args['opt_name']}/panel/templates_path", $this->template_path ) ); |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * Class init. |
|
| 61 | - */ |
|
| 62 | - public function init() { |
|
| 63 | - $this->panel_template(); |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * Loads the panel templates where needed and provides the container for Redux |
|
| 68 | - */ |
|
| 69 | - private function panel_template() { |
|
| 70 | - if ( $this->parent->args['dev_mode'] ) { |
|
| 71 | - $this->template_file_check_notice(); |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - /** |
|
| 75 | - * Action 'redux/{opt_name}/panel/before' |
|
| 76 | - */ |
|
| 77 | - |
|
| 78 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 79 | - do_action( "redux/{$this->parent->args['opt_name']}/panel/before" ); |
|
| 80 | - |
|
| 81 | - echo '<div class="wrap"><h2></h2></div>'; // Stupid hack for WordPress alerts and warnings. |
|
| 82 | - |
|
| 83 | - echo '<div class="clear"></div>'; |
|
| 84 | - echo '<div class="wrap redux-wrap-div" data-opt-name="' . esc_attr( $this->parent->args['opt_name'] ) . '">'; |
|
| 85 | - |
|
| 86 | - // Do we support JS? |
|
| 87 | - echo '<noscript><div class="no-js">' . esc_html__( 'Warning- This options panel will not work properly without javascript!', 'redux-framework' ) . '</div></noscript>'; |
|
| 88 | - |
|
| 89 | - // Security is vital! |
|
| 90 | - echo '<input type="hidden" class="redux-ajax-security" data-opt-name="' . esc_attr( $this->parent->args['opt_name'] ) . '" id="ajaxsecurity" name="security" value="' . esc_attr( wp_create_nonce( 'redux_ajax_nonce' . $this->parent->args['opt_name'] ) ) . '" />'; |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * Action 'redux/page/{opt_name}/form/before' |
|
| 94 | - * |
|
| 95 | - * @param object $this ReduxFramework |
|
| 96 | - */ |
|
| 97 | - |
|
| 98 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 99 | - do_action( "redux/page/{$this->parent->args['opt_name']}/form/before", $this ); |
|
| 100 | - |
|
| 101 | - if ( is_rtl() ) { |
|
| 102 | - $this->parent->args['class'] = ' redux-rtl'; |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - $this->get_template( 'container.tpl.php' ); |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * Action 'redux/page/{opt_name}/form/after' |
|
| 109 | - * |
|
| 110 | - * @param object $this ReduxFramework |
|
| 111 | - */ |
|
| 112 | - |
|
| 113 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 114 | - do_action( "redux/page/{$this->parent->args['opt_name']}/form/after", $this ); |
|
| 115 | - |
|
| 116 | - echo '<div class="clear"></div>'; |
|
| 117 | - echo '</div>'; |
|
| 118 | - |
|
| 119 | - if ( true === $this->parent->args['dev_mode'] ) { |
|
| 120 | - echo '<br /><div class="redux-timer">' . esc_html( get_num_queries() ) . ' queries in ' . esc_html( timer_stop() ) . ' seconds<br/>Redux is currently set to developer mode.</div>'; |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * Action 'redux/{opt_name}/panel/after' |
|
| 125 | - */ |
|
| 126 | - |
|
| 127 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 128 | - do_action( "redux/{$this->parent->args['opt_name']}/panel/after" ); |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - /** |
|
| 132 | - * Calls the various notification bars and sets the appropriate templates. |
|
| 133 | - */ |
|
| 134 | - public function notification_bar() { |
|
| 135 | - if ( isset( $this->parent->transients['last_save_mode'] ) ) { |
|
| 136 | - |
|
| 137 | - if ( 'import' === $this->parent->transients['last_save_mode'] ) { |
|
| 138 | - /** |
|
| 139 | - * Action 'redux/options/{opt_name}/import' |
|
| 140 | - * |
|
| 141 | - * @param object $this ReduxFramework |
|
| 142 | - */ |
|
| 143 | - |
|
| 144 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 145 | - do_action( "redux/options/{$this->parent->args['opt_name']}/import", $this, $this->parent->transients['changed_values'] ); |
|
| 146 | - |
|
| 147 | - echo '<div class="admin-notice notice-blue saved_notice">'; |
|
| 148 | - |
|
| 149 | - /** |
|
| 150 | - * Filter 'redux-imported-text-{opt_name}' |
|
| 151 | - * |
|
| 152 | - * @param string $text Translated "settings imported" text. |
|
| 153 | - */ |
|
| 154 | - |
|
| 155 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 156 | - echo '<strong>' . esc_html( apply_filters( "redux-imported-text-{$this->parent->args['opt_name']}", esc_html__( 'Settings Imported!', 'redux-framework' ) ) ) . '</strong>'; |
|
| 157 | - echo '</div>'; |
|
| 158 | - } elseif ( 'defaults' === $this->parent->transients['last_save_mode'] ) { |
|
| 159 | - /** |
|
| 160 | - * Action 'redux/options/{opt_name}/reset' |
|
| 161 | - * |
|
| 162 | - * @param object $this ReduxFramework |
|
| 163 | - */ |
|
| 164 | - |
|
| 165 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 166 | - do_action( "redux/options/{$this->parent->args['opt_name']}/reset", $this ); |
|
| 167 | - |
|
| 168 | - echo '<div class="saved_notice admin-notice notice-yellow">'; |
|
| 169 | - |
|
| 170 | - /** |
|
| 171 | - * Filter 'redux-defaults-text-{opt_name}' |
|
| 172 | - * |
|
| 173 | - * @param string $text Translated "settings imported" text. |
|
| 174 | - */ |
|
| 175 | - |
|
| 176 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 177 | - echo '<strong>' . esc_html( apply_filters( "redux-defaults-text-{$this->parent->args['opt_name']}", esc_html__( 'All Defaults Restored!', 'redux-framework' ) ) ) . '</strong>'; |
|
| 178 | - echo '</div>'; |
|
| 179 | - } elseif ( 'defaults_section' === $this->parent->transients['last_save_mode'] ) { |
|
| 180 | - /** |
|
| 181 | - * Action 'redux/options/{opt_name}/section/reset' |
|
| 182 | - * |
|
| 183 | - * @param object $this ReduxFramework |
|
| 184 | - */ |
|
| 185 | - |
|
| 186 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 187 | - do_action( "redux/options/{$this->parent->args['opt_name']}/section/reset", $this ); |
|
| 188 | - |
|
| 189 | - echo '<div class="saved_notice admin-notice notice-yellow">'; |
|
| 190 | - |
|
| 191 | - /** |
|
| 192 | - * Filter 'redux-defaults-section-text-{opt_name}' |
|
| 193 | - * |
|
| 194 | - * @param string $text Translated "settings imported" text. |
|
| 195 | - */ |
|
| 196 | - |
|
| 197 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 198 | - echo '<strong>' . esc_html( apply_filters( "redux-defaults-section-text-{$this->parent->args['opt_name']}", esc_html__( 'Section Defaults Restored!', 'redux-framework' ) ) ) . '</strong>'; |
|
| 199 | - echo '</div>'; |
|
| 200 | - } elseif ( 'normal' === $this->parent->transients['last_save_mode'] ) { |
|
| 201 | - /** |
|
| 202 | - * Action 'redux/options/{opt_name}/saved' |
|
| 203 | - * |
|
| 204 | - * @param mixed $value set/saved option value |
|
| 205 | - */ |
|
| 206 | - |
|
| 207 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 208 | - do_action( "redux/options/{$this->parent->args['opt_name']}/saved", $this->parent->options, $this->parent->transients['changed_values'] ); |
|
| 209 | - |
|
| 210 | - echo '<div class="saved_notice admin-notice notice-green">'; |
|
| 211 | - |
|
| 212 | - /** |
|
| 213 | - * Filter 'redux-saved-text-{opt_name}' |
|
| 214 | - * |
|
| 215 | - * @param string $text Translated "settings saved" text. |
|
| 216 | - */ |
|
| 217 | - |
|
| 218 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 219 | - echo '<strong>' . esc_html( apply_filters( "redux-saved-text-{$this->parent->args['opt_name']}", esc_html__( 'Settings Saved!', 'redux-framework' ) ) ) . '</strong>'; |
|
| 220 | - echo '</div>'; |
|
| 221 | - } |
|
| 222 | - |
|
| 223 | - unset( $this->parent->transients['last_save_mode'] ); |
|
| 224 | - |
|
| 225 | - $this->parent->transient_class->set(); |
|
| 226 | - } |
|
| 227 | - |
|
| 228 | - /** |
|
| 229 | - * Action 'redux/options/{opt_name}/settings/changes' |
|
| 230 | - * |
|
| 231 | - * @param mixed $value set/saved option value |
|
| 232 | - */ |
|
| 233 | - |
|
| 234 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 235 | - do_action( "redux/options/{$this->parent->args['opt_name']}/settings/change", $this->parent->options, $this->parent->transients['changed_values'] ); |
|
| 236 | - |
|
| 237 | - echo '<div class="redux-save-warn notice-yellow">'; |
|
| 238 | - |
|
| 239 | - /** |
|
| 240 | - * Filter 'redux-changed-text-{opt_name}' |
|
| 241 | - * |
|
| 242 | - * @param string $text Translated "settings have changed" text. |
|
| 243 | - */ |
|
| 244 | - |
|
| 245 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 246 | - echo '<strong>' . esc_html( apply_filters( "redux-changed-text-{$this->parent->args['opt_name']}", esc_html__( 'Settings have changed, you should save them!', 'redux-framework' ) ) ) . '</strong>'; |
|
| 247 | - echo '</div>'; |
|
| 248 | - |
|
| 249 | - /** |
|
| 250 | - * Action 'redux/options/{opt_name}/errors' |
|
| 251 | - * |
|
| 252 | - * @param array $this ->errors error information |
|
| 253 | - */ |
|
| 254 | - |
|
| 255 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 256 | - do_action( "redux/options/{$this->parent->args['opt_name']}/errors", $this->parent->errors ); |
|
| 257 | - |
|
| 258 | - echo '<div class="redux-field-errors notice-red">'; |
|
| 259 | - echo '<strong>'; |
|
| 260 | - echo '<span></span> ' . esc_html__( 'error(s) were found!', 'redux-framework' ); |
|
| 261 | - echo '</strong>'; |
|
| 262 | - echo '</div>'; |
|
| 263 | - |
|
| 264 | - /** |
|
| 265 | - * Action 'redux/options/{opt_name}/warnings' |
|
| 266 | - * |
|
| 267 | - * @param array $this ->warnings warning information |
|
| 268 | - */ |
|
| 269 | - |
|
| 270 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 271 | - do_action( "redux/options/{$this->parent->args['opt_name']}/warnings", $this->parent->warnings ); |
|
| 272 | - |
|
| 273 | - echo '<div class="redux-field-warnings notice-yellow">'; |
|
| 274 | - echo '<strong>'; |
|
| 275 | - echo '<span></span> ' . esc_html__( 'warning(s) were found!', 'redux-framework' ); |
|
| 276 | - echo '</strong>'; |
|
| 277 | - echo '</div>'; |
|
| 278 | - } |
|
| 279 | - |
|
| 280 | - /** |
|
| 281 | - * Used to initialize the settings fields for this panel. Required for saving and redirect. |
|
| 282 | - */ |
|
| 283 | - private function init_settings_fields() { |
|
| 284 | - // Must run or the page won't redirect properly. |
|
| 285 | - settings_fields( "{$this->parent->args['opt_name']}_group" ); |
|
| 286 | - } |
|
| 287 | - |
|
| 288 | - /** |
|
| 289 | - * Enable file deprecate warning from core. This is necessary because the function is considered private. |
|
| 290 | - * |
|
| 291 | - * @return bool |
|
| 292 | - */ |
|
| 293 | - public function tick_file_deprecate_warning(): bool { |
|
| 294 | - return true; |
|
| 295 | - } |
|
| 296 | - |
|
| 297 | - /** |
|
| 298 | - * Used to select the proper template. If it doesn't exist in the path, then the original template file is used. |
|
| 299 | - * |
|
| 300 | - * @param string $file Path to template file. |
|
| 301 | - */ |
|
| 302 | - public function get_template( string $file ) { |
|
| 303 | - if ( empty( $file ) ) { |
|
| 304 | - return; |
|
| 305 | - } |
|
| 306 | - |
|
| 307 | - if ( file_exists( $this->template_path . $file ) ) { |
|
| 308 | - $path = $this->template_path . $file; |
|
| 309 | - } else { |
|
| 310 | - $path = $this->original_path . $file; |
|
| 311 | - } |
|
| 312 | - |
|
| 313 | - // Shim for v3 templates. |
|
| 314 | - if ( ! file_exists( $path ) ) { |
|
| 315 | - $old_file = $file; |
|
| 316 | - |
|
| 317 | - add_filter( 'deprecated_file_trigger_error', array( $this, 'tick_file_deprecate_warning' ) ); |
|
| 318 | - |
|
| 319 | - $file = str_replace( '_', '-', $file ); |
|
| 320 | - |
|
| 321 | - _deprecated_file( esc_html( $old_file ), '4.0', esc_html( $file ), 'Please replace this outdated template with the current one from the Redux core.' ); |
|
| 322 | - |
|
| 323 | - if ( file_exists( $this->template_path . $file ) ) { |
|
| 324 | - $path = $this->template_path . $file; |
|
| 325 | - } else { |
|
| 326 | - $path = $this->original_path . $file; |
|
| 327 | - } |
|
| 328 | - } |
|
| 329 | - |
|
| 330 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 331 | - do_action( "redux/{$this->parent->args['opt_name']}/panel/template/" . $file . '/before' ); |
|
| 332 | - |
|
| 333 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 334 | - $path = apply_filters( "redux/{$this->parent->args['opt_name']}/panel/template/" . $file, $path ); |
|
| 335 | - |
|
| 336 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 337 | - do_action( "redux/{$this->parent->args['opt_name']}/panel/template/" . $file . '/after' ); |
|
| 338 | - |
|
| 339 | - if ( file_exists( $path ) ) { |
|
| 340 | - if ( is_readable( $path ) ) { |
|
| 341 | - require $path; |
|
| 342 | - } else { |
|
| 343 | - // translators: %1$s: template path. |
|
| 344 | - echo '<div class="error"><p>' . sprintf( esc_html__( 'Redux Panel Template %1$s cannot be read. Please check the permissions for this file.', 'redux-framework' ), '<code>' . esc_html( $path ) . '</code>' ) . '</p></div>'; |
|
| 345 | - } |
|
| 346 | - } elseif ( file_exists( Redux_Core::$dir . 'templates/panel/' . $file ) ) { |
|
| 347 | - require Redux_Core::$dir . 'templates/panel/' . $file; |
|
| 348 | - } else { |
|
| 349 | - // translators: %1$s: template path. |
|
| 350 | - echo '<div class="error"><p>' . sprintf( esc_html__( 'Redux Panel Template %1$s does not exist. Please reinstall Redux to replace this file.', 'redux-framework' ), '<code>' . esc_html( $path ) . '</code>' ) . '</p></div>'; |
|
| 351 | - } |
|
| 352 | - } |
|
| 353 | - |
|
| 354 | - /** |
|
| 355 | - * Scan the template files. |
|
| 356 | - * |
|
| 357 | - * @param string $template_path Path to template file. |
|
| 358 | - * |
|
| 359 | - * @return array |
|
| 360 | - */ |
|
| 361 | - public function scan_template_files( string $template_path ): array { |
|
| 362 | - $files = scandir( $template_path ); |
|
| 363 | - $result = array(); |
|
| 364 | - if ( $files ) { |
|
| 365 | - foreach ( $files as $value ) { |
|
| 366 | - if ( ! in_array( $value, array( '.', '..' ), true ) ) { |
|
| 367 | - if ( is_dir( $template_path . DIRECTORY_SEPARATOR . $value ) ) { |
|
| 368 | - $sub_files = self::scan_template_files( $template_path . DIRECTORY_SEPARATOR . $value ); |
|
| 369 | - foreach ( $sub_files as $sub_file ) { |
|
| 370 | - $result[] = $value . DIRECTORY_SEPARATOR . $sub_file; |
|
| 371 | - } |
|
| 372 | - } else { |
|
| 373 | - $result[] = $value; |
|
| 374 | - } |
|
| 375 | - } |
|
| 376 | - } |
|
| 377 | - } |
|
| 378 | - |
|
| 379 | - return $result; |
|
| 380 | - } |
|
| 381 | - |
|
| 382 | - /** |
|
| 383 | - * Show a notice highlighting bad template files |
|
| 384 | - */ |
|
| 385 | - public function template_file_check_notice() { |
|
| 386 | - if ( $this->original_path === $this->template_path ) { |
|
| 387 | - return; |
|
| 388 | - } |
|
| 389 | - |
|
| 390 | - $core_templates = $this->scan_template_files( $this->original_path ); |
|
| 391 | - |
|
| 392 | - foreach ( $core_templates as $file ) { |
|
| 393 | - $developer_theme_file = false; |
|
| 394 | - |
|
| 395 | - if ( file_exists( $this->template_path . $file ) ) { |
|
| 396 | - $developer_theme_file = $this->template_path . $file; |
|
| 397 | - } |
|
| 398 | - |
|
| 399 | - if ( $developer_theme_file ) { |
|
| 400 | - $core_version = Redux_Helpers::get_template_version( $this->original_path . $file ); |
|
| 401 | - $developer_version = Redux_Helpers::get_template_version( $developer_theme_file ); |
|
| 402 | - |
|
| 403 | - if ( $core_version && $developer_version && version_compare( $developer_version, $core_version, '<' ) ) { |
|
| 404 | - ?> |
|
| 15 | + /** |
|
| 16 | + * Class Redux_Panel |
|
| 17 | + */ |
|
| 18 | + class Redux_Panel { |
|
| 19 | + |
|
| 20 | + /** |
|
| 21 | + * ReduxFramework object pointer. |
|
| 22 | + * |
|
| 23 | + * @var object |
|
| 24 | + */ |
|
| 25 | + public $parent = null; |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * Path to templates dir. |
|
| 29 | + * |
|
| 30 | + * @var null|string |
|
| 31 | + */ |
|
| 32 | + public $template_path = null; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * Original template path. |
|
| 36 | + * |
|
| 37 | + * @var null |
|
| 38 | + */ |
|
| 39 | + public $original_path = null; |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * Sets the path from the arg or via filter. Also calls the panel template function. |
|
| 43 | + * |
|
| 44 | + * @param object $redux ReduxFramework pointer. |
|
| 45 | + */ |
|
| 46 | + public function __construct( $redux ) { |
|
| 47 | + $this->parent = $redux; |
|
| 48 | + $this->template_path = Redux_Core::$dir . 'templates/panel/'; |
|
| 49 | + $this->original_path = Redux_Core::$dir . 'templates/panel/'; |
|
| 50 | + |
|
| 51 | + if ( ! empty( $this->parent->args['templates_path'] ) ) { |
|
| 52 | + $this->template_path = trailingslashit( $this->parent->args['templates_path'] ); |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 56 | + $this->template_path = trailingslashit( apply_filters( "redux/{$this->parent->args['opt_name']}/panel/templates_path", $this->template_path ) ); |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * Class init. |
|
| 61 | + */ |
|
| 62 | + public function init() { |
|
| 63 | + $this->panel_template(); |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * Loads the panel templates where needed and provides the container for Redux |
|
| 68 | + */ |
|
| 69 | + private function panel_template() { |
|
| 70 | + if ( $this->parent->args['dev_mode'] ) { |
|
| 71 | + $this->template_file_check_notice(); |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + /** |
|
| 75 | + * Action 'redux/{opt_name}/panel/before' |
|
| 76 | + */ |
|
| 77 | + |
|
| 78 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 79 | + do_action( "redux/{$this->parent->args['opt_name']}/panel/before" ); |
|
| 80 | + |
|
| 81 | + echo '<div class="wrap"><h2></h2></div>'; // Stupid hack for WordPress alerts and warnings. |
|
| 82 | + |
|
| 83 | + echo '<div class="clear"></div>'; |
|
| 84 | + echo '<div class="wrap redux-wrap-div" data-opt-name="' . esc_attr( $this->parent->args['opt_name'] ) . '">'; |
|
| 85 | + |
|
| 86 | + // Do we support JS? |
|
| 87 | + echo '<noscript><div class="no-js">' . esc_html__( 'Warning- This options panel will not work properly without javascript!', 'redux-framework' ) . '</div></noscript>'; |
|
| 88 | + |
|
| 89 | + // Security is vital! |
|
| 90 | + echo '<input type="hidden" class="redux-ajax-security" data-opt-name="' . esc_attr( $this->parent->args['opt_name'] ) . '" id="ajaxsecurity" name="security" value="' . esc_attr( wp_create_nonce( 'redux_ajax_nonce' . $this->parent->args['opt_name'] ) ) . '" />'; |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * Action 'redux/page/{opt_name}/form/before' |
|
| 94 | + * |
|
| 95 | + * @param object $this ReduxFramework |
|
| 96 | + */ |
|
| 97 | + |
|
| 98 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 99 | + do_action( "redux/page/{$this->parent->args['opt_name']}/form/before", $this ); |
|
| 100 | + |
|
| 101 | + if ( is_rtl() ) { |
|
| 102 | + $this->parent->args['class'] = ' redux-rtl'; |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + $this->get_template( 'container.tpl.php' ); |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * Action 'redux/page/{opt_name}/form/after' |
|
| 109 | + * |
|
| 110 | + * @param object $this ReduxFramework |
|
| 111 | + */ |
|
| 112 | + |
|
| 113 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 114 | + do_action( "redux/page/{$this->parent->args['opt_name']}/form/after", $this ); |
|
| 115 | + |
|
| 116 | + echo '<div class="clear"></div>'; |
|
| 117 | + echo '</div>'; |
|
| 118 | + |
|
| 119 | + if ( true === $this->parent->args['dev_mode'] ) { |
|
| 120 | + echo '<br /><div class="redux-timer">' . esc_html( get_num_queries() ) . ' queries in ' . esc_html( timer_stop() ) . ' seconds<br/>Redux is currently set to developer mode.</div>'; |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * Action 'redux/{opt_name}/panel/after' |
|
| 125 | + */ |
|
| 126 | + |
|
| 127 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 128 | + do_action( "redux/{$this->parent->args['opt_name']}/panel/after" ); |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + /** |
|
| 132 | + * Calls the various notification bars and sets the appropriate templates. |
|
| 133 | + */ |
|
| 134 | + public function notification_bar() { |
|
| 135 | + if ( isset( $this->parent->transients['last_save_mode'] ) ) { |
|
| 136 | + |
|
| 137 | + if ( 'import' === $this->parent->transients['last_save_mode'] ) { |
|
| 138 | + /** |
|
| 139 | + * Action 'redux/options/{opt_name}/import' |
|
| 140 | + * |
|
| 141 | + * @param object $this ReduxFramework |
|
| 142 | + */ |
|
| 143 | + |
|
| 144 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 145 | + do_action( "redux/options/{$this->parent->args['opt_name']}/import", $this, $this->parent->transients['changed_values'] ); |
|
| 146 | + |
|
| 147 | + echo '<div class="admin-notice notice-blue saved_notice">'; |
|
| 148 | + |
|
| 149 | + /** |
|
| 150 | + * Filter 'redux-imported-text-{opt_name}' |
|
| 151 | + * |
|
| 152 | + * @param string $text Translated "settings imported" text. |
|
| 153 | + */ |
|
| 154 | + |
|
| 155 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 156 | + echo '<strong>' . esc_html( apply_filters( "redux-imported-text-{$this->parent->args['opt_name']}", esc_html__( 'Settings Imported!', 'redux-framework' ) ) ) . '</strong>'; |
|
| 157 | + echo '</div>'; |
|
| 158 | + } elseif ( 'defaults' === $this->parent->transients['last_save_mode'] ) { |
|
| 159 | + /** |
|
| 160 | + * Action 'redux/options/{opt_name}/reset' |
|
| 161 | + * |
|
| 162 | + * @param object $this ReduxFramework |
|
| 163 | + */ |
|
| 164 | + |
|
| 165 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 166 | + do_action( "redux/options/{$this->parent->args['opt_name']}/reset", $this ); |
|
| 167 | + |
|
| 168 | + echo '<div class="saved_notice admin-notice notice-yellow">'; |
|
| 169 | + |
|
| 170 | + /** |
|
| 171 | + * Filter 'redux-defaults-text-{opt_name}' |
|
| 172 | + * |
|
| 173 | + * @param string $text Translated "settings imported" text. |
|
| 174 | + */ |
|
| 175 | + |
|
| 176 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 177 | + echo '<strong>' . esc_html( apply_filters( "redux-defaults-text-{$this->parent->args['opt_name']}", esc_html__( 'All Defaults Restored!', 'redux-framework' ) ) ) . '</strong>'; |
|
| 178 | + echo '</div>'; |
|
| 179 | + } elseif ( 'defaults_section' === $this->parent->transients['last_save_mode'] ) { |
|
| 180 | + /** |
|
| 181 | + * Action 'redux/options/{opt_name}/section/reset' |
|
| 182 | + * |
|
| 183 | + * @param object $this ReduxFramework |
|
| 184 | + */ |
|
| 185 | + |
|
| 186 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 187 | + do_action( "redux/options/{$this->parent->args['opt_name']}/section/reset", $this ); |
|
| 188 | + |
|
| 189 | + echo '<div class="saved_notice admin-notice notice-yellow">'; |
|
| 190 | + |
|
| 191 | + /** |
|
| 192 | + * Filter 'redux-defaults-section-text-{opt_name}' |
|
| 193 | + * |
|
| 194 | + * @param string $text Translated "settings imported" text. |
|
| 195 | + */ |
|
| 196 | + |
|
| 197 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 198 | + echo '<strong>' . esc_html( apply_filters( "redux-defaults-section-text-{$this->parent->args['opt_name']}", esc_html__( 'Section Defaults Restored!', 'redux-framework' ) ) ) . '</strong>'; |
|
| 199 | + echo '</div>'; |
|
| 200 | + } elseif ( 'normal' === $this->parent->transients['last_save_mode'] ) { |
|
| 201 | + /** |
|
| 202 | + * Action 'redux/options/{opt_name}/saved' |
|
| 203 | + * |
|
| 204 | + * @param mixed $value set/saved option value |
|
| 205 | + */ |
|
| 206 | + |
|
| 207 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 208 | + do_action( "redux/options/{$this->parent->args['opt_name']}/saved", $this->parent->options, $this->parent->transients['changed_values'] ); |
|
| 209 | + |
|
| 210 | + echo '<div class="saved_notice admin-notice notice-green">'; |
|
| 211 | + |
|
| 212 | + /** |
|
| 213 | + * Filter 'redux-saved-text-{opt_name}' |
|
| 214 | + * |
|
| 215 | + * @param string $text Translated "settings saved" text. |
|
| 216 | + */ |
|
| 217 | + |
|
| 218 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 219 | + echo '<strong>' . esc_html( apply_filters( "redux-saved-text-{$this->parent->args['opt_name']}", esc_html__( 'Settings Saved!', 'redux-framework' ) ) ) . '</strong>'; |
|
| 220 | + echo '</div>'; |
|
| 221 | + } |
|
| 222 | + |
|
| 223 | + unset( $this->parent->transients['last_save_mode'] ); |
|
| 224 | + |
|
| 225 | + $this->parent->transient_class->set(); |
|
| 226 | + } |
|
| 227 | + |
|
| 228 | + /** |
|
| 229 | + * Action 'redux/options/{opt_name}/settings/changes' |
|
| 230 | + * |
|
| 231 | + * @param mixed $value set/saved option value |
|
| 232 | + */ |
|
| 233 | + |
|
| 234 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 235 | + do_action( "redux/options/{$this->parent->args['opt_name']}/settings/change", $this->parent->options, $this->parent->transients['changed_values'] ); |
|
| 236 | + |
|
| 237 | + echo '<div class="redux-save-warn notice-yellow">'; |
|
| 238 | + |
|
| 239 | + /** |
|
| 240 | + * Filter 'redux-changed-text-{opt_name}' |
|
| 241 | + * |
|
| 242 | + * @param string $text Translated "settings have changed" text. |
|
| 243 | + */ |
|
| 244 | + |
|
| 245 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 246 | + echo '<strong>' . esc_html( apply_filters( "redux-changed-text-{$this->parent->args['opt_name']}", esc_html__( 'Settings have changed, you should save them!', 'redux-framework' ) ) ) . '</strong>'; |
|
| 247 | + echo '</div>'; |
|
| 248 | + |
|
| 249 | + /** |
|
| 250 | + * Action 'redux/options/{opt_name}/errors' |
|
| 251 | + * |
|
| 252 | + * @param array $this ->errors error information |
|
| 253 | + */ |
|
| 254 | + |
|
| 255 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 256 | + do_action( "redux/options/{$this->parent->args['opt_name']}/errors", $this->parent->errors ); |
|
| 257 | + |
|
| 258 | + echo '<div class="redux-field-errors notice-red">'; |
|
| 259 | + echo '<strong>'; |
|
| 260 | + echo '<span></span> ' . esc_html__( 'error(s) were found!', 'redux-framework' ); |
|
| 261 | + echo '</strong>'; |
|
| 262 | + echo '</div>'; |
|
| 263 | + |
|
| 264 | + /** |
|
| 265 | + * Action 'redux/options/{opt_name}/warnings' |
|
| 266 | + * |
|
| 267 | + * @param array $this ->warnings warning information |
|
| 268 | + */ |
|
| 269 | + |
|
| 270 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 271 | + do_action( "redux/options/{$this->parent->args['opt_name']}/warnings", $this->parent->warnings ); |
|
| 272 | + |
|
| 273 | + echo '<div class="redux-field-warnings notice-yellow">'; |
|
| 274 | + echo '<strong>'; |
|
| 275 | + echo '<span></span> ' . esc_html__( 'warning(s) were found!', 'redux-framework' ); |
|
| 276 | + echo '</strong>'; |
|
| 277 | + echo '</div>'; |
|
| 278 | + } |
|
| 279 | + |
|
| 280 | + /** |
|
| 281 | + * Used to initialize the settings fields for this panel. Required for saving and redirect. |
|
| 282 | + */ |
|
| 283 | + private function init_settings_fields() { |
|
| 284 | + // Must run or the page won't redirect properly. |
|
| 285 | + settings_fields( "{$this->parent->args['opt_name']}_group" ); |
|
| 286 | + } |
|
| 287 | + |
|
| 288 | + /** |
|
| 289 | + * Enable file deprecate warning from core. This is necessary because the function is considered private. |
|
| 290 | + * |
|
| 291 | + * @return bool |
|
| 292 | + */ |
|
| 293 | + public function tick_file_deprecate_warning(): bool { |
|
| 294 | + return true; |
|
| 295 | + } |
|
| 296 | + |
|
| 297 | + /** |
|
| 298 | + * Used to select the proper template. If it doesn't exist in the path, then the original template file is used. |
|
| 299 | + * |
|
| 300 | + * @param string $file Path to template file. |
|
| 301 | + */ |
|
| 302 | + public function get_template( string $file ) { |
|
| 303 | + if ( empty( $file ) ) { |
|
| 304 | + return; |
|
| 305 | + } |
|
| 306 | + |
|
| 307 | + if ( file_exists( $this->template_path . $file ) ) { |
|
| 308 | + $path = $this->template_path . $file; |
|
| 309 | + } else { |
|
| 310 | + $path = $this->original_path . $file; |
|
| 311 | + } |
|
| 312 | + |
|
| 313 | + // Shim for v3 templates. |
|
| 314 | + if ( ! file_exists( $path ) ) { |
|
| 315 | + $old_file = $file; |
|
| 316 | + |
|
| 317 | + add_filter( 'deprecated_file_trigger_error', array( $this, 'tick_file_deprecate_warning' ) ); |
|
| 318 | + |
|
| 319 | + $file = str_replace( '_', '-', $file ); |
|
| 320 | + |
|
| 321 | + _deprecated_file( esc_html( $old_file ), '4.0', esc_html( $file ), 'Please replace this outdated template with the current one from the Redux core.' ); |
|
| 322 | + |
|
| 323 | + if ( file_exists( $this->template_path . $file ) ) { |
|
| 324 | + $path = $this->template_path . $file; |
|
| 325 | + } else { |
|
| 326 | + $path = $this->original_path . $file; |
|
| 327 | + } |
|
| 328 | + } |
|
| 329 | + |
|
| 330 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 331 | + do_action( "redux/{$this->parent->args['opt_name']}/panel/template/" . $file . '/before' ); |
|
| 332 | + |
|
| 333 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 334 | + $path = apply_filters( "redux/{$this->parent->args['opt_name']}/panel/template/" . $file, $path ); |
|
| 335 | + |
|
| 336 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 337 | + do_action( "redux/{$this->parent->args['opt_name']}/panel/template/" . $file . '/after' ); |
|
| 338 | + |
|
| 339 | + if ( file_exists( $path ) ) { |
|
| 340 | + if ( is_readable( $path ) ) { |
|
| 341 | + require $path; |
|
| 342 | + } else { |
|
| 343 | + // translators: %1$s: template path. |
|
| 344 | + echo '<div class="error"><p>' . sprintf( esc_html__( 'Redux Panel Template %1$s cannot be read. Please check the permissions for this file.', 'redux-framework' ), '<code>' . esc_html( $path ) . '</code>' ) . '</p></div>'; |
|
| 345 | + } |
|
| 346 | + } elseif ( file_exists( Redux_Core::$dir . 'templates/panel/' . $file ) ) { |
|
| 347 | + require Redux_Core::$dir . 'templates/panel/' . $file; |
|
| 348 | + } else { |
|
| 349 | + // translators: %1$s: template path. |
|
| 350 | + echo '<div class="error"><p>' . sprintf( esc_html__( 'Redux Panel Template %1$s does not exist. Please reinstall Redux to replace this file.', 'redux-framework' ), '<code>' . esc_html( $path ) . '</code>' ) . '</p></div>'; |
|
| 351 | + } |
|
| 352 | + } |
|
| 353 | + |
|
| 354 | + /** |
|
| 355 | + * Scan the template files. |
|
| 356 | + * |
|
| 357 | + * @param string $template_path Path to template file. |
|
| 358 | + * |
|
| 359 | + * @return array |
|
| 360 | + */ |
|
| 361 | + public function scan_template_files( string $template_path ): array { |
|
| 362 | + $files = scandir( $template_path ); |
|
| 363 | + $result = array(); |
|
| 364 | + if ( $files ) { |
|
| 365 | + foreach ( $files as $value ) { |
|
| 366 | + if ( ! in_array( $value, array( '.', '..' ), true ) ) { |
|
| 367 | + if ( is_dir( $template_path . DIRECTORY_SEPARATOR . $value ) ) { |
|
| 368 | + $sub_files = self::scan_template_files( $template_path . DIRECTORY_SEPARATOR . $value ); |
|
| 369 | + foreach ( $sub_files as $sub_file ) { |
|
| 370 | + $result[] = $value . DIRECTORY_SEPARATOR . $sub_file; |
|
| 371 | + } |
|
| 372 | + } else { |
|
| 373 | + $result[] = $value; |
|
| 374 | + } |
|
| 375 | + } |
|
| 376 | + } |
|
| 377 | + } |
|
| 378 | + |
|
| 379 | + return $result; |
|
| 380 | + } |
|
| 381 | + |
|
| 382 | + /** |
|
| 383 | + * Show a notice highlighting bad template files |
|
| 384 | + */ |
|
| 385 | + public function template_file_check_notice() { |
|
| 386 | + if ( $this->original_path === $this->template_path ) { |
|
| 387 | + return; |
|
| 388 | + } |
|
| 389 | + |
|
| 390 | + $core_templates = $this->scan_template_files( $this->original_path ); |
|
| 391 | + |
|
| 392 | + foreach ( $core_templates as $file ) { |
|
| 393 | + $developer_theme_file = false; |
|
| 394 | + |
|
| 395 | + if ( file_exists( $this->template_path . $file ) ) { |
|
| 396 | + $developer_theme_file = $this->template_path . $file; |
|
| 397 | + } |
|
| 398 | + |
|
| 399 | + if ( $developer_theme_file ) { |
|
| 400 | + $core_version = Redux_Helpers::get_template_version( $this->original_path . $file ); |
|
| 401 | + $developer_version = Redux_Helpers::get_template_version( $developer_theme_file ); |
|
| 402 | + |
|
| 403 | + if ( $core_version && $developer_version && version_compare( $developer_version, $core_version, '<' ) ) { |
|
| 404 | + ?> |
|
| 405 | 405 | <div id="message" class="error redux-message" style="display:block!important"> |
| 406 | 406 | <p> |
| 407 | 407 | <strong><?php esc_html_e( 'Your panel has bundled copies of Redux Framework template files that are outdated!', 'redux-framework' ); ?></strong> <?php esc_html_e( 'Please ask the author of this theme to update them as functionality issues could arise.', 'redux-framework' ); ?> |
@@ -409,23 +409,23 @@ discard block |
||
| 409 | 409 | </div> |
| 410 | 410 | <?php |
| 411 | 411 | |
| 412 | - return; |
|
| 413 | - } |
|
| 414 | - } |
|
| 415 | - } |
|
| 416 | - } |
|
| 417 | - |
|
| 418 | - /** |
|
| 419 | - * Outputs the HTML for a given section using the WordPress settings API. |
|
| 420 | - * |
|
| 421 | - * @param mixed $k Section number of settings panel to display. |
|
| 422 | - */ |
|
| 423 | - private function output_section( $k ) { |
|
| 424 | - do_settings_sections( $this->parent->args['opt_name'] . $k . '_section_group' ); |
|
| 425 | - } |
|
| 426 | - } |
|
| 412 | + return; |
|
| 413 | + } |
|
| 414 | + } |
|
| 415 | + } |
|
| 416 | + } |
|
| 417 | + |
|
| 418 | + /** |
|
| 419 | + * Outputs the HTML for a given section using the WordPress settings API. |
|
| 420 | + * |
|
| 421 | + * @param mixed $k Section number of settings panel to display. |
|
| 422 | + */ |
|
| 423 | + private function output_section( $k ) { |
|
| 424 | + do_settings_sections( $this->parent->args['opt_name'] . $k . '_section_group' ); |
|
| 425 | + } |
|
| 426 | + } |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | if ( ! class_exists( 'reduxCorePanel' ) ) { |
| 430 | - class_alias( 'Redux_Panel', 'reduxCorePanel' ); |
|
| 430 | + class_alias( 'Redux_Panel', 'reduxCorePanel' ); |
|
| 431 | 431 | } |