@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | foreach ( $plugin_data as $key => $data ) { |
| 67 | 67 | $key_slug = explode( '/', $key ); |
| 68 | 68 | $key_slug = $key_slug[0]; |
| 69 | - $plugin_index[ $key_slug ] = $key; |
|
| 69 | + $plugin_index[$key_slug] = $key; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | foreach ( $sysinfo as $project_type => $products ) { |
@@ -115,11 +115,11 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | } else { |
| 117 | 117 | foreach ( $products as $product => $data ) { |
| 118 | - if ( ! isset( $plugin_index[ $product ] ) ) { |
|
| 118 | + if ( ! isset( $plugin_index[$product] ) ) { |
|
| 119 | 119 | continue; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - $plugin_path = Redux_Functions_Ex::wp_normalize_path( WP_PLUGIN_DIR . '/' . $plugin_index[ $product ] ); |
|
| 122 | + $plugin_path = Redux_Functions_Ex::wp_normalize_path( WP_PLUGIN_DIR . '/' . $plugin_index[$product] ); |
|
| 123 | 123 | $plugin_data = get_plugin_data( $plugin_path ); |
| 124 | 124 | |
| 125 | 125 | ?> |
@@ -30,50 +30,50 @@ discard block |
||
| 30 | 30 | <hr> |
| 31 | 31 | <?php |
| 32 | 32 | |
| 33 | - $sysinfo = Redux_Helpers::process_redux_callers(); |
|
| 33 | + $sysinfo = Redux_Helpers::process_redux_callers(); |
|
| 34 | 34 | |
| 35 | - ?> |
|
| 35 | + ?> |
|
| 36 | 36 | |
| 37 | 37 | <div class="feature-section <?php echo empty( $sysinfo ) ? 'one-col' : 'two-col'; ?>"> |
| 38 | 38 | <div class="<?php echo ! empty( $sysinfo ) ? 'col' : ''; ?>"> |
| 39 | 39 | <h2 style="text-align:left;"><?php echo esc_html__( 'Did I install this?', 'redux-framework' ); ?></h2> |
| 40 | 40 | <h3> |
| 41 | 41 | <?php |
| 42 | - if ( ! empty( $sysinfo ) ) { |
|
| 43 | - esc_html_e( 'Maybe not! These items are using Redux. If you want to keep using them, Redux will need to remain installed and activated.', 'redux-framework' ); |
|
| 44 | - } else { |
|
| 45 | - $nonce = wp_create_nonce( 'redux_framework_demo' ); |
|
| 46 | - |
|
| 47 | - $query_args = array( |
|
| 48 | - 'page' => 'redux-framework', |
|
| 49 | - 'redux-framework-plugin' => 'demo', |
|
| 50 | - 'nonce' => $nonce, |
|
| 51 | - ); |
|
| 52 | - |
|
| 53 | - // translators: %1$s: URL, %2$s: close tag. |
|
| 54 | - printf( esc_html__( 'Maybe not! If you want to see what Redux is all about, click here to %1$sActivate Demo Mode%2$s.', 'redux-framework' ), '<a href="' . esc_url( admin_url( add_query_arg( $query_args, 'options-general.php' ) ) ) . '">', '</a>' ); |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - ?> |
|
| 42 | + if ( ! empty( $sysinfo ) ) { |
|
| 43 | + esc_html_e( 'Maybe not! These items are using Redux. If you want to keep using them, Redux will need to remain installed and activated.', 'redux-framework' ); |
|
| 44 | + } else { |
|
| 45 | + $nonce = wp_create_nonce( 'redux_framework_demo' ); |
|
| 46 | + |
|
| 47 | + $query_args = array( |
|
| 48 | + 'page' => 'redux-framework', |
|
| 49 | + 'redux-framework-plugin' => 'demo', |
|
| 50 | + 'nonce' => $nonce, |
|
| 51 | + ); |
|
| 52 | + |
|
| 53 | + // translators: %1$s: URL, %2$s: close tag. |
|
| 54 | + printf( esc_html__( 'Maybe not! If you want to see what Redux is all about, click here to %1$sActivate Demo Mode%2$s.', 'redux-framework' ), '<a href="' . esc_url( admin_url( add_query_arg( $query_args, 'options-general.php' ) ) ) . '">', '</a>' ); |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + ?> |
|
| 58 | 58 | </h3> |
| 59 | 59 | </div> |
| 60 | 60 | <div class="col"> |
| 61 | 61 | <?php |
| 62 | - if ( ! empty( $sysinfo ) && is_array( $sysinfo ) ) { |
|
| 63 | - $plugin_index = array(); |
|
| 64 | - $plugin_data = get_plugins(); |
|
| 62 | + if ( ! empty( $sysinfo ) && is_array( $sysinfo ) ) { |
|
| 63 | + $plugin_index = array(); |
|
| 64 | + $plugin_data = get_plugins(); |
|
| 65 | 65 | |
| 66 | - foreach ( $plugin_data as $key => $data ) { |
|
| 67 | - $key_slug = explode( '/', $key ); |
|
| 68 | - $key_slug = $key_slug[0]; |
|
| 69 | - $plugin_index[ $key_slug ] = $key; |
|
| 70 | - } |
|
| 66 | + foreach ( $plugin_data as $key => $data ) { |
|
| 67 | + $key_slug = explode( '/', $key ); |
|
| 68 | + $key_slug = $key_slug[0]; |
|
| 69 | + $plugin_index[ $key_slug ] = $key; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - foreach ( $sysinfo as $project_type => $products ) { |
|
| 73 | - if ( 'theme' === $project_type ) { |
|
| 74 | - $my_theme = wp_get_theme(); |
|
| 72 | + foreach ( $sysinfo as $project_type => $products ) { |
|
| 73 | + if ( 'theme' === $project_type ) { |
|
| 74 | + $my_theme = wp_get_theme(); |
|
| 75 | 75 | |
| 76 | - ?> |
|
| 76 | + ?> |
|
| 77 | 77 | <div class="redux-product"> |
| 78 | 78 | <h2 class="name"><?php echo esc_html( $my_theme->get( 'Name' ) ); ?> |
| 79 | 79 | <?php if ( ! empty( $my_theme->get( 'Version' ) ) ) { ?> |
@@ -96,33 +96,33 @@ discard block |
||
| 96 | 96 | <p class="author"> |
| 97 | 97 | <small> |
| 98 | 98 | <?php |
| 99 | - foreach ( $products as $slug => $data ) { |
|
| 100 | - foreach ( $data as $opt_name => $callers ) { |
|
| 101 | - echo '<span><strong>opt_name</strong>: <code>' . esc_html( $opt_name ) . '</code></span><br />'; |
|
| 102 | - |
|
| 103 | - foreach ( $callers as $caller ) { |
|
| 104 | - echo '<span>~/' . esc_html( $caller['basename'] ) . '</span><br />'; |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - echo '<br />'; |
|
| 108 | - } |
|
| 109 | - } |
|
| 110 | - ?> |
|
| 99 | + foreach ( $products as $slug => $data ) { |
|
| 100 | + foreach ( $data as $opt_name => $callers ) { |
|
| 101 | + echo '<span><strong>opt_name</strong>: <code>' . esc_html( $opt_name ) . '</code></span><br />'; |
|
| 102 | + |
|
| 103 | + foreach ( $callers as $caller ) { |
|
| 104 | + echo '<span>~/' . esc_html( $caller['basename'] ) . '</span><br />'; |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + echo '<br />'; |
|
| 108 | + } |
|
| 109 | + } |
|
| 110 | + ?> |
|
| 111 | 111 | </small> |
| 112 | 112 | </p> |
| 113 | 113 | </div> |
| 114 | 114 | <?php |
| 115 | 115 | |
| 116 | - } else { |
|
| 117 | - foreach ( $products as $product => $data ) { |
|
| 118 | - if ( ! isset( $plugin_index[ $product ] ) ) { |
|
| 119 | - continue; |
|
| 120 | - } |
|
| 116 | + } else { |
|
| 117 | + foreach ( $products as $product => $data ) { |
|
| 118 | + if ( ! isset( $plugin_index[ $product ] ) ) { |
|
| 119 | + continue; |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - $plugin_path = Redux_Functions_Ex::wp_normalize_path( WP_PLUGIN_DIR . '/' . $plugin_index[ $product ] ); |
|
| 123 | - $plugin_data = get_plugin_data( $plugin_path ); |
|
| 122 | + $plugin_path = Redux_Functions_Ex::wp_normalize_path( WP_PLUGIN_DIR . '/' . $plugin_index[ $product ] ); |
|
| 123 | + $plugin_data = get_plugin_data( $plugin_path ); |
|
| 124 | 124 | |
| 125 | - ?> |
|
| 125 | + ?> |
|
| 126 | 126 | <div class="redux-product"> |
| 127 | 127 | <h2 class="name"> |
| 128 | 128 | <?php echo esc_html( $plugin_data['Name'] ); ?> |
@@ -132,9 +132,9 @@ discard block |
||
| 132 | 132 | </h2> |
| 133 | 133 | <p class="author"> |
| 134 | 134 | <?php |
| 135 | - if ( ! empty( $plugin_data['Author'] ) ) { |
|
| 136 | - $plugin_url = ! empty( $plugin_data['AuthorURI'] ) ? $plugin_data['AuthorURI'] : $plugin_data['PluginURI']; |
|
| 137 | - ?> |
|
| 135 | + if ( ! empty( $plugin_data['Author'] ) ) { |
|
| 136 | + $plugin_url = ! empty( $plugin_data['AuthorURI'] ) ? $plugin_data['AuthorURI'] : $plugin_data['PluginURI']; |
|
| 137 | + ?> |
|
| 138 | 138 | <?php echo esc_html__( 'By', 'redux-framework' ); ?> |
| 139 | 139 | <a href="<?php echo esc_attr( $plugin_url ); ?>"> |
| 140 | 140 | <?php echo esc_html( trim( wp_strip_all_tags( $plugin_data['Author'] ) ) ); ?> |
@@ -148,23 +148,23 @@ discard block |
||
| 148 | 148 | <p class="author"> |
| 149 | 149 | <small> |
| 150 | 150 | <?php |
| 151 | - foreach ( $data as $opt_name => $callers ) { |
|
| 152 | - echo '<span><strong>opt_name</strong>: <code>' . esc_html( $opt_name ) . '</code></span><br />'; |
|
| 153 | - |
|
| 154 | - foreach ( $callers as $caller ) { |
|
| 155 | - echo '<span>~/' . esc_html( $caller['basename'] ) . '</span><br />'; |
|
| 156 | - } |
|
| 157 | - } |
|
| 158 | - ?> |
|
| 151 | + foreach ( $data as $opt_name => $callers ) { |
|
| 152 | + echo '<span><strong>opt_name</strong>: <code>' . esc_html( $opt_name ) . '</code></span><br />'; |
|
| 153 | + |
|
| 154 | + foreach ( $callers as $caller ) { |
|
| 155 | + echo '<span>~/' . esc_html( $caller['basename'] ) . '</span><br />'; |
|
| 156 | + } |
|
| 157 | + } |
|
| 158 | + ?> |
|
| 159 | 159 | </small> |
| 160 | 160 | </p> |
| 161 | 161 | </div> |
| 162 | 162 | <?php |
| 163 | - } |
|
| 164 | - } |
|
| 165 | - } |
|
| 166 | - } |
|
| 167 | - ?> |
|
| 163 | + } |
|
| 164 | + } |
|
| 165 | + } |
|
| 166 | + } |
|
| 167 | + ?> |
|
| 168 | 168 | </div> |
| 169 | 169 | </div> |
| 170 | 170 | </div> |
@@ -12,73 +12,73 @@ |
||
| 12 | 12 | // Don't duplicate me! |
| 13 | 13 | if ( ! class_exists( 'Redux_Editor', false ) ) { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Main Redux_editor class |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - */ |
|
| 20 | - class Redux_Editor extends Redux_Field { |
|
| 15 | + /** |
|
| 16 | + * Main Redux_editor class |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + */ |
|
| 20 | + class Redux_Editor extends Redux_Field { |
|
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * Field Render Function. |
|
| 24 | - * Takes the vars and outputs the HTML for the field in the settings |
|
| 25 | - * |
|
| 26 | - * @since 1.0.0 |
|
| 27 | - * @access public |
|
| 28 | - * @return void |
|
| 29 | - */ |
|
| 30 | - public function render() { |
|
| 31 | - if ( ! isset( $this->field['args'] ) ) { |
|
| 32 | - $this->field['args'] = array(); |
|
| 33 | - } |
|
| 22 | + /** |
|
| 23 | + * Field Render Function. |
|
| 24 | + * Takes the vars and outputs the HTML for the field in the settings |
|
| 25 | + * |
|
| 26 | + * @since 1.0.0 |
|
| 27 | + * @access public |
|
| 28 | + * @return void |
|
| 29 | + */ |
|
| 30 | + public function render() { |
|
| 31 | + if ( ! isset( $this->field['args'] ) ) { |
|
| 32 | + $this->field['args'] = array(); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - $this->field['args']['onchange_callback'] = "alert('here')"; |
|
| 35 | + $this->field['args']['onchange_callback'] = "alert('here')"; |
|
| 36 | 36 | |
| 37 | - // Setup up default args. |
|
| 38 | - $defaults = array( |
|
| 39 | - 'textarea_name' => esc_attr( $this->field['name'] . $this->field['name_suffix'] ), |
|
| 40 | - 'editor_class' => esc_attr( $this->field['class'] ), |
|
| 41 | - 'textarea_rows' => 10, // Wordpress default. |
|
| 42 | - 'teeny' => true, |
|
| 43 | - ); |
|
| 37 | + // Setup up default args. |
|
| 38 | + $defaults = array( |
|
| 39 | + 'textarea_name' => esc_attr( $this->field['name'] . $this->field['name_suffix'] ), |
|
| 40 | + 'editor_class' => esc_attr( $this->field['class'] ), |
|
| 41 | + 'textarea_rows' => 10, // Wordpress default. |
|
| 42 | + 'teeny' => true, |
|
| 43 | + ); |
|
| 44 | 44 | |
| 45 | - if ( isset( $this->field['editor_options'] ) && empty( $this->field['args'] ) ) { |
|
| 46 | - $this->field['args'] = $this->field['editor_options']; |
|
| 47 | - unset( $this->field['editor_options'] ); |
|
| 48 | - } |
|
| 45 | + if ( isset( $this->field['editor_options'] ) && empty( $this->field['args'] ) ) { |
|
| 46 | + $this->field['args'] = $this->field['editor_options']; |
|
| 47 | + unset( $this->field['editor_options'] ); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - $this->field['args'] = wp_parse_args( $this->field['args'], $defaults ); |
|
| 50 | + $this->field['args'] = wp_parse_args( $this->field['args'], $defaults ); |
|
| 51 | 51 | |
| 52 | - wp_editor( $this->value, $this->field['id'], $this->field['args'] ); |
|
| 53 | - } |
|
| 52 | + wp_editor( $this->value, $this->field['id'], $this->field['args'] ); |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Enqueue Function. |
|
| 57 | - * If this field requires any scripts, or css define this function and register/enqueue the scripts/css |
|
| 58 | - * |
|
| 59 | - * @since 1.0.0 |
|
| 60 | - * @access public |
|
| 61 | - * @return void |
|
| 62 | - */ |
|
| 63 | - public function enqueue() { |
|
| 64 | - if ( $this->parent->args['dev_mode'] ) { |
|
| 65 | - wp_enqueue_style( |
|
| 66 | - 'redux-field-editor', |
|
| 67 | - Redux_Core::$url . 'inc/fields/editor/redux-editor.css', |
|
| 68 | - array(), |
|
| 69 | - $this->timestamp |
|
| 70 | - ); |
|
| 71 | - } |
|
| 55 | + /** |
|
| 56 | + * Enqueue Function. |
|
| 57 | + * If this field requires any scripts, or css define this function and register/enqueue the scripts/css |
|
| 58 | + * |
|
| 59 | + * @since 1.0.0 |
|
| 60 | + * @access public |
|
| 61 | + * @return void |
|
| 62 | + */ |
|
| 63 | + public function enqueue() { |
|
| 64 | + if ( $this->parent->args['dev_mode'] ) { |
|
| 65 | + wp_enqueue_style( |
|
| 66 | + 'redux-field-editor', |
|
| 67 | + Redux_Core::$url . 'inc/fields/editor/redux-editor.css', |
|
| 68 | + array(), |
|
| 69 | + $this->timestamp |
|
| 70 | + ); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - wp_enqueue_script( |
|
| 74 | - 'redux-field-editor', |
|
| 75 | - Redux_Core::$url . 'inc/fields/editor/redux-editor' . Redux_Functions::is_min() . '.js', |
|
| 76 | - array( 'jquery', 'redux-js' ), |
|
| 77 | - $this->timestamp, |
|
| 78 | - true |
|
| 79 | - ); |
|
| 80 | - } |
|
| 81 | - } |
|
| 73 | + wp_enqueue_script( |
|
| 74 | + 'redux-field-editor', |
|
| 75 | + Redux_Core::$url . 'inc/fields/editor/redux-editor' . Redux_Functions::is_min() . '.js', |
|
| 76 | + array( 'jquery', 'redux-js' ), |
|
| 77 | + $this->timestamp, |
|
| 78 | + true |
|
| 79 | + ); |
|
| 80 | + } |
|
| 81 | + } |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | class_alias( 'Redux_Editor', 'ReduxFramework_Editor' ); |
@@ -11,90 +11,90 @@ |
||
| 11 | 11 | |
| 12 | 12 | if ( ! class_exists( 'Redux_Palette', false ) ) { |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Class Redux_Palette |
|
| 16 | - */ |
|
| 17 | - class Redux_Palette extends Redux_Field { |
|
| 18 | - |
|
| 19 | - /** |
|
| 20 | - * Field Render Function. |
|
| 21 | - * Takes the vars and outputs the HTML for the field in the settings. |
|
| 22 | - * |
|
| 23 | - * @since 1.0.0 |
|
| 24 | - * @access public |
|
| 25 | - * @return void |
|
| 26 | - */ |
|
| 27 | - public function render() { |
|
| 28 | - if ( ! isset( $this->field['palettes'] ) && empty( $this->field['palettes'] ) ) { |
|
| 29 | - echo 'No palettes have been set.'; |
|
| 30 | - |
|
| 31 | - return; |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - echo '<div id="' . esc_attr( $this->field['id'] ) . '" class="buttonset">'; |
|
| 35 | - |
|
| 36 | - foreach ( $this->field['palettes'] as $value => $color_set ) { |
|
| 37 | - $checked = checked( $this->value, $value, false ); |
|
| 38 | - |
|
| 39 | - echo '<input |
|
| 14 | + /** |
|
| 15 | + * Class Redux_Palette |
|
| 16 | + */ |
|
| 17 | + class Redux_Palette extends Redux_Field { |
|
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * Field Render Function. |
|
| 21 | + * Takes the vars and outputs the HTML for the field in the settings. |
|
| 22 | + * |
|
| 23 | + * @since 1.0.0 |
|
| 24 | + * @access public |
|
| 25 | + * @return void |
|
| 26 | + */ |
|
| 27 | + public function render() { |
|
| 28 | + if ( ! isset( $this->field['palettes'] ) && empty( $this->field['palettes'] ) ) { |
|
| 29 | + echo 'No palettes have been set.'; |
|
| 30 | + |
|
| 31 | + return; |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + echo '<div id="' . esc_attr( $this->field['id'] ) . '" class="buttonset">'; |
|
| 35 | + |
|
| 36 | + foreach ( $this->field['palettes'] as $value => $color_set ) { |
|
| 37 | + $checked = checked( $this->value, $value, false ); |
|
| 38 | + |
|
| 39 | + echo '<input |
|
| 40 | 40 | type="radio" |
| 41 | 41 | value="' . esc_attr( $value ) . '" |
| 42 | 42 | name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '" |
| 43 | 43 | class="redux-palette-set ' . esc_attr( $this->field['class'] ) . '" |
| 44 | 44 | id="' . esc_attr( $this->field['id'] . '-' . $value ) . '"' . esc_html( $checked ) . '>'; |
| 45 | 45 | |
| 46 | - echo '<label for="' . esc_attr( $this->field['id'] . '-' . $value ) . '">'; |
|
| 47 | - |
|
| 48 | - foreach ( $color_set as $color ) { |
|
| 49 | - echo '<span style=background:' . esc_attr( $color ) . '>' . esc_attr( $color ) . '</span>'; |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - echo '</label>'; |
|
| 53 | - echo '</input>'; |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - echo '</div>'; |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * Enqueue Function. |
|
| 61 | - * If this field requires any scripts, or css define this function and register/enqueue the scripts/css |
|
| 62 | - * |
|
| 63 | - * @since 1.0.0 |
|
| 64 | - * @access public |
|
| 65 | - * @return void |
|
| 66 | - */ |
|
| 67 | - public function enqueue() { |
|
| 68 | - $min = Redux_Functions::is_min(); |
|
| 69 | - |
|
| 70 | - wp_enqueue_script( |
|
| 71 | - 'redux-field-palette', |
|
| 72 | - Redux_Core::$url . 'inc/fields/palette/redux-palette' . $min . '.js', |
|
| 73 | - array( 'jquery', 'redux-js', 'jquery-ui-button', 'jquery-ui-core' ), |
|
| 74 | - $this->timestamp, |
|
| 75 | - true |
|
| 76 | - ); |
|
| 77 | - |
|
| 78 | - if ( $this->parent->args['dev_mode'] ) { |
|
| 79 | - wp_enqueue_style( |
|
| 80 | - 'redux-field-palette', |
|
| 81 | - Redux_Core::$url . 'inc/fields/palette/redux-palette.css', |
|
| 82 | - array(), |
|
| 83 | - $this->timestamp |
|
| 84 | - ); |
|
| 85 | - } |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * Enable output_variables to be generated. |
|
| 90 | - * |
|
| 91 | - * @since 4.0.3 |
|
| 92 | - * @return void |
|
| 93 | - */ |
|
| 94 | - public function output_variables() { |
|
| 95 | - // No code needed, just defining the method is enough. |
|
| 96 | - } |
|
| 97 | - } |
|
| 46 | + echo '<label for="' . esc_attr( $this->field['id'] . '-' . $value ) . '">'; |
|
| 47 | + |
|
| 48 | + foreach ( $color_set as $color ) { |
|
| 49 | + echo '<span style=background:' . esc_attr( $color ) . '>' . esc_attr( $color ) . '</span>'; |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + echo '</label>'; |
|
| 53 | + echo '</input>'; |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + echo '</div>'; |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * Enqueue Function. |
|
| 61 | + * If this field requires any scripts, or css define this function and register/enqueue the scripts/css |
|
| 62 | + * |
|
| 63 | + * @since 1.0.0 |
|
| 64 | + * @access public |
|
| 65 | + * @return void |
|
| 66 | + */ |
|
| 67 | + public function enqueue() { |
|
| 68 | + $min = Redux_Functions::is_min(); |
|
| 69 | + |
|
| 70 | + wp_enqueue_script( |
|
| 71 | + 'redux-field-palette', |
|
| 72 | + Redux_Core::$url . 'inc/fields/palette/redux-palette' . $min . '.js', |
|
| 73 | + array( 'jquery', 'redux-js', 'jquery-ui-button', 'jquery-ui-core' ), |
|
| 74 | + $this->timestamp, |
|
| 75 | + true |
|
| 76 | + ); |
|
| 77 | + |
|
| 78 | + if ( $this->parent->args['dev_mode'] ) { |
|
| 79 | + wp_enqueue_style( |
|
| 80 | + 'redux-field-palette', |
|
| 81 | + Redux_Core::$url . 'inc/fields/palette/redux-palette.css', |
|
| 82 | + array(), |
|
| 83 | + $this->timestamp |
|
| 84 | + ); |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * Enable output_variables to be generated. |
|
| 90 | + * |
|
| 91 | + * @since 4.0.3 |
|
| 92 | + * @return void |
|
| 93 | + */ |
|
| 94 | + public function output_variables() { |
|
| 95 | + // No code needed, just defining the method is enough. |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | class_alias( 'Redux_Palette', 'ReduxFramework_Palette' ); |
@@ -12,127 +12,127 @@ |
||
| 12 | 12 | // Don't duplicate me! |
| 13 | 13 | if ( ! class_exists( 'Redux_Multi_Text', false ) ) { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Main Redux_multi_text class |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - */ |
|
| 20 | - class Redux_Multi_Text extends Redux_Field { |
|
| 21 | - |
|
| 22 | - /** |
|
| 23 | - * Set field defaults. |
|
| 24 | - */ |
|
| 25 | - public function set_defaults() { |
|
| 26 | - $defaults = array( |
|
| 27 | - 'show_empty' => true, |
|
| 28 | - 'add_text' => esc_html__( 'Add More', 'redux-framework' ), |
|
| 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 1.0.0 |
|
| 39 | - * @access public |
|
| 40 | - * @return void |
|
| 41 | - */ |
|
| 42 | - public function render() { |
|
| 43 | - echo '<ul id="' . esc_attr( $this->field['id'] ) . '-ul" class="redux-multi-text ' . esc_attr( $this->field['class'] ) . '">'; |
|
| 44 | - |
|
| 45 | - if ( isset( $this->value ) && is_array( $this->value ) ) { |
|
| 46 | - foreach ( $this->value as $k => $value ) { |
|
| 47 | - if ( '' !== $value || ( true === $this->field['show_empty'] ) ) { |
|
| 48 | - echo '<li>'; |
|
| 49 | - echo '<input |
|
| 15 | + /** |
|
| 16 | + * Main Redux_multi_text class |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + */ |
|
| 20 | + class Redux_Multi_Text extends Redux_Field { |
|
| 21 | + |
|
| 22 | + /** |
|
| 23 | + * Set field defaults. |
|
| 24 | + */ |
|
| 25 | + public function set_defaults() { |
|
| 26 | + $defaults = array( |
|
| 27 | + 'show_empty' => true, |
|
| 28 | + 'add_text' => esc_html__( 'Add More', 'redux-framework' ), |
|
| 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 1.0.0 |
|
| 39 | + * @access public |
|
| 40 | + * @return void |
|
| 41 | + */ |
|
| 42 | + public function render() { |
|
| 43 | + echo '<ul id="' . esc_attr( $this->field['id'] ) . '-ul" class="redux-multi-text ' . esc_attr( $this->field['class'] ) . '">'; |
|
| 44 | + |
|
| 45 | + if ( isset( $this->value ) && is_array( $this->value ) ) { |
|
| 46 | + foreach ( $this->value as $k => $value ) { |
|
| 47 | + if ( '' !== $value || ( true === $this->field['show_empty'] ) ) { |
|
| 48 | + echo '<li>'; |
|
| 49 | + echo '<input |
|
| 50 | 50 | type="text" |
| 51 | 51 | id="' . esc_attr( $this->field['id'] . '-' . $k ) . '" |
| 52 | 52 | name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[]" |
| 53 | 53 | value="' . esc_attr( $value ) . '" |
| 54 | 54 | class="regular-text" /> '; |
| 55 | 55 | |
| 56 | - echo '<a |
|
| 56 | + echo '<a |
|
| 57 | 57 | data-id="' . esc_attr( $this->field['id'] ) . '-ul" |
| 58 | 58 | href="javascript:void(0);" |
| 59 | 59 | class="deletion redux-multi-text-remove">' . |
| 60 | - esc_html__( 'Remove', 'redux-framework' ) . '</a>'; |
|
| 61 | - echo '</li>'; |
|
| 62 | - } |
|
| 63 | - } |
|
| 64 | - } elseif ( true === $this->field['show_empty'] ) { |
|
| 65 | - echo '<li>'; |
|
| 66 | - echo '<input |
|
| 60 | + esc_html__( 'Remove', 'redux-framework' ) . '</a>'; |
|
| 61 | + echo '</li>'; |
|
| 62 | + } |
|
| 63 | + } |
|
| 64 | + } elseif ( true === $this->field['show_empty'] ) { |
|
| 65 | + echo '<li>'; |
|
| 66 | + echo '<input |
|
| 67 | 67 | type="text" |
| 68 | 68 | id="' . esc_attr( $this->field['id'] . '-0' ) . '" |
| 69 | 69 | name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[]" |
| 70 | 70 | value="" |
| 71 | 71 | class="regular-text" /> '; |
| 72 | 72 | |
| 73 | - echo '<a |
|
| 73 | + echo '<a |
|
| 74 | 74 | data-id="' . esc_attr( $this->field['id'] ) . '-ul" |
| 75 | 75 | href="javascript:void(0);" |
| 76 | 76 | class="deletion redux-multi-text-remove">' . |
| 77 | - esc_html__( 'Remove', 'redux-framework' ) . '</a>'; |
|
| 77 | + esc_html__( 'Remove', 'redux-framework' ) . '</a>'; |
|
| 78 | 78 | |
| 79 | - echo '</li>'; |
|
| 80 | - } |
|
| 79 | + echo '</li>'; |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - $the_name = ''; |
|
| 83 | - if ( isset( $this->value ) && empty( $this->value ) && false === $this->field['show_empty'] ) { |
|
| 84 | - $the_name = $this->field['name'] . $this->field['name_suffix']; |
|
| 85 | - } |
|
| 82 | + $the_name = ''; |
|
| 83 | + if ( isset( $this->value ) && empty( $this->value ) && false === $this->field['show_empty'] ) { |
|
| 84 | + $the_name = $this->field['name'] . $this->field['name_suffix']; |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - echo '<li style="display:none;">'; |
|
| 88 | - echo '<input |
|
| 87 | + echo '<li style="display:none;">'; |
|
| 88 | + echo '<input |
|
| 89 | 89 | type="text" |
| 90 | 90 | id="' . esc_attr( $this->field['id'] ) . '" |
| 91 | 91 | name="' . esc_attr( $the_name ) . '" |
| 92 | 92 | value="" |
| 93 | 93 | class="regular-text" /> '; |
| 94 | 94 | |
| 95 | - echo '<a |
|
| 95 | + echo '<a |
|
| 96 | 96 | data-id="' . esc_attr( $this->field['id'] ) . '-ul" |
| 97 | 97 | href="javascript:void(0);" |
| 98 | 98 | class="deletion redux-multi-text-remove">' . |
| 99 | - esc_html__( 'Remove', 'redux-framework' ) . '</a>'; |
|
| 100 | - |
|
| 101 | - echo '</li>'; |
|
| 102 | - echo '</ul>'; |
|
| 103 | - |
|
| 104 | - echo '<span style="clear:both;display:block;height:0;"></span>'; |
|
| 105 | - $this->field['add_number'] = ( isset( $this->field['add_number'] ) && is_numeric( $this->field['add_number'] ) ) ? $this->field['add_number'] : 1; |
|
| 106 | - echo '<a href="javascript:void(0);" class="button button-primary redux-multi-text-add" data-add_number="' . esc_attr( $this->field['add_number'] ) . '" data-id="' . esc_attr( $this->field['id'] ) . '-ul" data-name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '">' . esc_html( $this->field['add_text'] ) . '</a><br/>'; |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - /** |
|
| 110 | - * Enqueue Function. |
|
| 111 | - * If this field requires any scripts, or css define this function and register/enqueue the scripts/css |
|
| 112 | - * |
|
| 113 | - * @since 1.0.0 |
|
| 114 | - * @access public |
|
| 115 | - * @return void |
|
| 116 | - */ |
|
| 117 | - public function enqueue() { |
|
| 118 | - wp_enqueue_script( |
|
| 119 | - 'redux-field-multi-text', |
|
| 120 | - Redux_Core::$url . 'inc/fields/multi_text/redux-multi-text' . Redux_Functions::is_min() . '.js', |
|
| 121 | - array( 'jquery', 'redux-js' ), |
|
| 122 | - $this->timestamp, |
|
| 123 | - true |
|
| 124 | - ); |
|
| 125 | - |
|
| 126 | - if ( $this->parent->args['dev_mode'] ) { |
|
| 127 | - wp_enqueue_style( |
|
| 128 | - 'redux-field-multi-text', |
|
| 129 | - Redux_Core::$url . 'inc/fields/multi_text/redux-multi-text.css', |
|
| 130 | - array(), |
|
| 131 | - $this->timestamp |
|
| 132 | - ); |
|
| 133 | - } |
|
| 134 | - } |
|
| 135 | - } |
|
| 99 | + esc_html__( 'Remove', 'redux-framework' ) . '</a>'; |
|
| 100 | + |
|
| 101 | + echo '</li>'; |
|
| 102 | + echo '</ul>'; |
|
| 103 | + |
|
| 104 | + echo '<span style="clear:both;display:block;height:0;"></span>'; |
|
| 105 | + $this->field['add_number'] = ( isset( $this->field['add_number'] ) && is_numeric( $this->field['add_number'] ) ) ? $this->field['add_number'] : 1; |
|
| 106 | + echo '<a href="javascript:void(0);" class="button button-primary redux-multi-text-add" data-add_number="' . esc_attr( $this->field['add_number'] ) . '" data-id="' . esc_attr( $this->field['id'] ) . '-ul" data-name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '">' . esc_html( $this->field['add_text'] ) . '</a><br/>'; |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + /** |
|
| 110 | + * Enqueue Function. |
|
| 111 | + * If this field requires any scripts, or css define this function and register/enqueue the scripts/css |
|
| 112 | + * |
|
| 113 | + * @since 1.0.0 |
|
| 114 | + * @access public |
|
| 115 | + * @return void |
|
| 116 | + */ |
|
| 117 | + public function enqueue() { |
|
| 118 | + wp_enqueue_script( |
|
| 119 | + 'redux-field-multi-text', |
|
| 120 | + Redux_Core::$url . 'inc/fields/multi_text/redux-multi-text' . Redux_Functions::is_min() . '.js', |
|
| 121 | + array( 'jquery', 'redux-js' ), |
|
| 122 | + $this->timestamp, |
|
| 123 | + true |
|
| 124 | + ); |
|
| 125 | + |
|
| 126 | + if ( $this->parent->args['dev_mode'] ) { |
|
| 127 | + wp_enqueue_style( |
|
| 128 | + 'redux-field-multi-text', |
|
| 129 | + Redux_Core::$url . 'inc/fields/multi_text/redux-multi-text.css', |
|
| 130 | + array(), |
|
| 131 | + $this->timestamp |
|
| 132 | + ); |
|
| 133 | + } |
|
| 134 | + } |
|
| 135 | + } |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | class_alias( 'Redux_Multi_Text', 'ReduxFramework_Multi_Text' ); |
@@ -14,86 +14,86 @@ discard block |
||
| 14 | 14 | // Don't duplicate me! |
| 15 | 15 | if ( ! class_exists( 'Redux_Options_Object', false ) ) { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * Main Redux_options_object class |
|
| 19 | - * |
|
| 20 | - * @since 1.0.0 |
|
| 21 | - */ |
|
| 22 | - class Redux_Options_Object extends Redux_Field { |
|
| 23 | - |
|
| 24 | - public $is_field; |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * Redux_Options_Object constructor. |
|
| 28 | - * |
|
| 29 | - * @param array $field Field array. |
|
| 30 | - * @param mixed $value Value array. |
|
| 31 | - * @param object $parent ReduxFramework object. |
|
| 32 | - * |
|
| 33 | - * @throws ReflectionException . |
|
| 34 | - */ |
|
| 35 | - public function __construct( array $field, $value, $parent ) { |
|
| 36 | - parent::__construct( $field, $value, $parent ); |
|
| 37 | - |
|
| 38 | - $this->is_field = $this->parent->extensions['options_object']->is_field; |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * Set field defaults. |
|
| 43 | - */ |
|
| 44 | - public function set_defaults() { |
|
| 45 | - $defaults = array( |
|
| 46 | - 'options' => array(), |
|
| 47 | - 'stylesheet' => '', |
|
| 48 | - 'output' => true, |
|
| 49 | - 'enqueue' => true, |
|
| 50 | - 'enqueue_frontend' => true, |
|
| 51 | - ); |
|
| 52 | - |
|
| 53 | - $this->field = wp_parse_args( $this->field, $defaults ); |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * Field Render Function. |
|
| 58 | - * Takes the vars and outputs the HTML for the field in the settings |
|
| 59 | - * |
|
| 60 | - * @since 1.0.0 |
|
| 61 | - * @access public |
|
| 62 | - * @return void |
|
| 63 | - */ |
|
| 64 | - public function render() { |
|
| 65 | - if ( version_compare( phpversion(), '5.3.0', '>=' ) ) { |
|
| 66 | - $json = wp_json_encode( $this->parent->options, true ); |
|
| 67 | - } else { |
|
| 68 | - $json = wp_json_encode( $this->parent->options ); |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - $defaults = array( |
|
| 72 | - 'full_width' => true, |
|
| 73 | - 'overflow' => 'inherit', |
|
| 74 | - ); |
|
| 75 | - |
|
| 76 | - $this->field = wp_parse_args( $this->field, $defaults ); |
|
| 77 | - |
|
| 78 | - if ( $this->is_field ) { |
|
| 79 | - $full_width = $this->field['full_width']; |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - $do_close = false; |
|
| 83 | - |
|
| 84 | - $id = $this->parent->args['opt_name'] . '-' . $this->field['id']; |
|
| 85 | - |
|
| 86 | - if ( ! $this->is_field || ( $this->is_field && false === $full_width ) ) { |
|
| 87 | - ?> |
|
| 17 | + /** |
|
| 18 | + * Main Redux_options_object class |
|
| 19 | + * |
|
| 20 | + * @since 1.0.0 |
|
| 21 | + */ |
|
| 22 | + class Redux_Options_Object extends Redux_Field { |
|
| 23 | + |
|
| 24 | + public $is_field; |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * Redux_Options_Object constructor. |
|
| 28 | + * |
|
| 29 | + * @param array $field Field array. |
|
| 30 | + * @param mixed $value Value array. |
|
| 31 | + * @param object $parent ReduxFramework object. |
|
| 32 | + * |
|
| 33 | + * @throws ReflectionException . |
|
| 34 | + */ |
|
| 35 | + public function __construct( array $field, $value, $parent ) { |
|
| 36 | + parent::__construct( $field, $value, $parent ); |
|
| 37 | + |
|
| 38 | + $this->is_field = $this->parent->extensions['options_object']->is_field; |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * Set field defaults. |
|
| 43 | + */ |
|
| 44 | + public function set_defaults() { |
|
| 45 | + $defaults = array( |
|
| 46 | + 'options' => array(), |
|
| 47 | + 'stylesheet' => '', |
|
| 48 | + 'output' => true, |
|
| 49 | + 'enqueue' => true, |
|
| 50 | + 'enqueue_frontend' => true, |
|
| 51 | + ); |
|
| 52 | + |
|
| 53 | + $this->field = wp_parse_args( $this->field, $defaults ); |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * Field Render Function. |
|
| 58 | + * Takes the vars and outputs the HTML for the field in the settings |
|
| 59 | + * |
|
| 60 | + * @since 1.0.0 |
|
| 61 | + * @access public |
|
| 62 | + * @return void |
|
| 63 | + */ |
|
| 64 | + public function render() { |
|
| 65 | + if ( version_compare( phpversion(), '5.3.0', '>=' ) ) { |
|
| 66 | + $json = wp_json_encode( $this->parent->options, true ); |
|
| 67 | + } else { |
|
| 68 | + $json = wp_json_encode( $this->parent->options ); |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + $defaults = array( |
|
| 72 | + 'full_width' => true, |
|
| 73 | + 'overflow' => 'inherit', |
|
| 74 | + ); |
|
| 75 | + |
|
| 76 | + $this->field = wp_parse_args( $this->field, $defaults ); |
|
| 77 | + |
|
| 78 | + if ( $this->is_field ) { |
|
| 79 | + $full_width = $this->field['full_width']; |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + $do_close = false; |
|
| 83 | + |
|
| 84 | + $id = $this->parent->args['opt_name'] . '-' . $this->field['id']; |
|
| 85 | + |
|
| 86 | + if ( ! $this->is_field || ( $this->is_field && false === $full_width ) ) { |
|
| 87 | + ?> |
|
| 88 | 88 | <style>#<?php echo esc_html( $id ); ?>{padding: 0;}</style> |
| 89 | 89 | <?php // phpcs:ignore WordPress.CodeAnalysis.EmptyStatement ?> |
| 90 | 90 | <?php echo '</td></tr></table>'; ?> |
| 91 | 91 | <table id="<?php echo esc_attr( $id ); ?>" class="form-table no-border redux-group-table redux-raw-table" style=" overflow: <?php esc_attr( $this->field['overflow'] ); ?>;"> |
| 92 | 92 | <tbody><tr><td> |
| 93 | 93 | <?php |
| 94 | - $do_close = true; |
|
| 95 | - } |
|
| 96 | - ?> |
|
| 94 | + $do_close = true; |
|
| 95 | + } |
|
| 96 | + ?> |
|
| 97 | 97 | <fieldset |
| 98 | 98 | id="<?php echo esc_attr( $id ); ?>-fieldset" |
| 99 | 99 | class="redux-field redux-container-<?php echo esc_attr( $this->field['type'] ) . ' ' . esc_attr( $this->field['class'] ); ?>" |
@@ -117,34 +117,34 @@ discard block |
||
| 117 | 117 | <td> |
| 118 | 118 | <?php } ?> |
| 119 | 119 | <?php |
| 120 | - } |
|
| 121 | - |
|
| 122 | - /** |
|
| 123 | - * Enqueue Function. |
|
| 124 | - * If this field requires any scripts, or css define this function and register/enqueue the scripts/css |
|
| 125 | - * |
|
| 126 | - * @since 1.0.0 |
|
| 127 | - * @access public |
|
| 128 | - * @return void |
|
| 129 | - */ |
|
| 130 | - public function enqueue() { |
|
| 131 | - wp_enqueue_script( |
|
| 132 | - 'redux-extension-options-object', |
|
| 133 | - $this->url . 'redux-options-object' . Redux_Functions::is_min() . '.js', |
|
| 134 | - array( 'jquery', 'redux-js' ), |
|
| 135 | - Redux_Extension_Options_Object::$version, |
|
| 136 | - true |
|
| 137 | - ); |
|
| 138 | - |
|
| 139 | - if ( $this->parent->args['dev_mode'] ) { |
|
| 140 | - wp_enqueue_style( |
|
| 141 | - 'redux-options-object', |
|
| 142 | - $this->url . 'redux-options-object.css', |
|
| 143 | - array(), |
|
| 144 | - Redux_Extension_Options_Object::$version, |
|
| 145 | - 'all' |
|
| 146 | - ); |
|
| 147 | - } |
|
| 148 | - } |
|
| 149 | - } |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + /** |
|
| 123 | + * Enqueue Function. |
|
| 124 | + * If this field requires any scripts, or css define this function and register/enqueue the scripts/css |
|
| 125 | + * |
|
| 126 | + * @since 1.0.0 |
|
| 127 | + * @access public |
|
| 128 | + * @return void |
|
| 129 | + */ |
|
| 130 | + public function enqueue() { |
|
| 131 | + wp_enqueue_script( |
|
| 132 | + 'redux-extension-options-object', |
|
| 133 | + $this->url . 'redux-options-object' . Redux_Functions::is_min() . '.js', |
|
| 134 | + array( 'jquery', 'redux-js' ), |
|
| 135 | + Redux_Extension_Options_Object::$version, |
|
| 136 | + true |
|
| 137 | + ); |
|
| 138 | + |
|
| 139 | + if ( $this->parent->args['dev_mode'] ) { |
|
| 140 | + wp_enqueue_style( |
|
| 141 | + 'redux-options-object', |
|
| 142 | + $this->url . 'redux-options-object.css', |
|
| 143 | + array(), |
|
| 144 | + Redux_Extension_Options_Object::$version, |
|
| 145 | + 'all' |
|
| 146 | + ); |
|
| 147 | + } |
|
| 148 | + } |
|
| 149 | + } |
|
| 150 | 150 | } |
@@ -11,260 +11,260 @@ |
||
| 11 | 11 | |
| 12 | 12 | if ( ! class_exists( 'Redux_Gradient_Filters' ) ) { |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Class Redux_Gradient_Filters |
|
| 16 | - */ |
|
| 17 | - class Redux_Gradient_Filters { |
|
| 18 | - |
|
| 19 | - /** |
|
| 20 | - * Render select boxes. |
|
| 21 | - * |
|
| 22 | - * @param array $data Data. |
|
| 23 | - * |
|
| 24 | - * @return string |
|
| 25 | - */ |
|
| 26 | - public static function render_select( array $data ): string { |
|
| 27 | - extract( $data ); // phpcs:ignore WordPress.PHP.DontExtract |
|
| 28 | - |
|
| 29 | - $output = ''; |
|
| 30 | - |
|
| 31 | - if ( $field['gradient-type'] ) { |
|
| 32 | - $select2_default = array( |
|
| 33 | - 'width' => 'resolve', |
|
| 34 | - 'allowClear' => false, |
|
| 35 | - 'theme' => 'default', |
|
| 36 | - 'minimumResultsForSearch' => 3, |
|
| 37 | - ); |
|
| 38 | - |
|
| 39 | - $select2_default = Redux_Functions::sanitize_camel_case_array_keys( $select2_default ); |
|
| 40 | - |
|
| 41 | - $select2_data = Redux_Functions::create_data_string( $select2_default ); |
|
| 42 | - |
|
| 43 | - $output .= '<div class="redux-gradient-type">'; |
|
| 44 | - $output .= '<strong>' . esc_html__( 'Gradient Type ', 'redux-framework' ) . '</strong> '; |
|
| 45 | - $output .= '<select '; |
|
| 46 | - $output .= 'class="redux-gradient-select select2-container"'; |
|
| 47 | - $output .= 'data-placeholder="' . esc_attr__( 'Type', 'redux-framework' ) . '" ' . $select2_data . ' '; |
|
| 48 | - $output .= 'name="' . esc_attr( $field['name'] . $field['name_suffix'] ) . '[gradient-type]"'; |
|
| 49 | - $output .= 'data-value="' . esc_attr( $value['gradient-type'] ) . '"'; |
|
| 50 | - $output .= 'data-id="' . esc_attr( $field['id'] ) . '">'; |
|
| 51 | - |
|
| 52 | - $arr = array( |
|
| 53 | - esc_html__( 'linear', 'redux-framework' ), |
|
| 54 | - esc_html__( 'radial', 'redux-framework' ), |
|
| 55 | - ); |
|
| 56 | - |
|
| 57 | - foreach ( $arr as $v ) { |
|
| 58 | - $output .= '<option value="' . esc_attr( $v ) . '" ' . selected( $value['gradient-type'], $v, false ) . '>' . esc_html( ucfirst( $v ) ) . '</option>'; |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - $output .= '</select>'; |
|
| 62 | - $output .= '</div>'; |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - return $output; |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * Render sliders. |
|
| 70 | - * |
|
| 71 | - * @param array $data Data. |
|
| 72 | - * |
|
| 73 | - * @return string |
|
| 74 | - */ |
|
| 75 | - public static function render_sliders( array $data ): string { |
|
| 76 | - extract( $data ); // phpcs:ignore WordPress.PHP.DontExtract |
|
| 77 | - |
|
| 78 | - $output = ''; |
|
| 79 | - |
|
| 80 | - if ( $field['gradient-reach'] ) { |
|
| 81 | - $output .= '<div class="slider-from-reach">'; |
|
| 82 | - $output .= '<div class="label">' . esc_html__( 'From Reach ', 'redux-framework' ) . ': <strong>' . esc_html( $value['gradient-reach']['from'] ) . '%</strong></div>'; |
|
| 83 | - $output .= '<div '; |
|
| 84 | - $output .= 'class="redux-gradient-slider redux-color-gradient redux-gradient-from-reach color-gradient-input ' . esc_attr( $field['class'] ) . '"'; |
|
| 85 | - $output .= 'id="' . esc_attr( $field['id'] ) . '"'; |
|
| 86 | - $output .= 'data-id="' . esc_attr( $field['id'] ) . '-from"'; |
|
| 87 | - $output .= 'data-min="0"'; |
|
| 88 | - $output .= 'data-max="100"'; |
|
| 89 | - $output .= 'data-step="1"'; |
|
| 90 | - $output .= 'data-rtl="' . esc_attr( is_rtl() ) . '"'; |
|
| 91 | - $output .= 'data-label="' . esc_attr__( 'From Reach', 'redux-framework' ) . '"'; |
|
| 92 | - $output .= 'data-default = "' . esc_attr( $value['gradient-reach']['from'] ) . '">'; |
|
| 93 | - $output .= '</div>'; |
|
| 94 | - $output .= '<input '; |
|
| 95 | - $output .= 'type="hidden"'; |
|
| 96 | - $output .= 'id="redux-slider-value-' . esc_attr( $field['id'] ) . '-from"'; |
|
| 97 | - $output .= 'class="color-gradient-reach-from"'; |
|
| 98 | - $output .= 'name="' . esc_attr( $field['name'] . $field['name_suffix'] ) . '[gradient-reach][from]"'; |
|
| 99 | - $output .= 'value="' . esc_attr( $value['gradient-reach']['from'] ) . '"'; |
|
| 100 | - $output .= 'data-id="' . esc_attr( $field['id'] ) . '"'; |
|
| 101 | - $output .= '/>'; |
|
| 102 | - $output .= '</div>'; |
|
| 103 | - |
|
| 104 | - $output .= '<div class="slider-to-reach">'; |
|
| 105 | - $output .= '<div class="label">' . esc_html__( 'To Reach', 'redux-framework' ) . ': <strong>' . esc_html( $value['gradient-reach']['to'] ) . '%</strong></div>'; |
|
| 106 | - $output .= '<div '; |
|
| 107 | - $output .= 'class="redux-gradient-slider redux-color-gradient redux-gradient-reach-to color-gradient-input ' . esc_attr( $field['class'] ) . '"'; |
|
| 108 | - $output .= 'id="' . esc_attr( $field['id'] ) . '"'; |
|
| 109 | - $output .= 'data-id="' . esc_attr( $field['id'] ) . '-to"'; |
|
| 110 | - $output .= 'data-min="0"'; |
|
| 111 | - $output .= 'data-max="100"'; |
|
| 112 | - $output .= 'data-step="1"'; |
|
| 113 | - $output .= 'data-rtl="' . esc_attr( is_rtl() ) . '"'; |
|
| 114 | - $output .= 'data-label="' . esc_attr__( 'To Reach', 'redux-framework' ) . '"'; |
|
| 115 | - $output .= 'data-default = "' . esc_attr( $value['gradient-reach']['to'] ) . '">'; |
|
| 116 | - $output .= '</div>'; |
|
| 117 | - $output .= '<input '; |
|
| 118 | - $output .= 'type="hidden"'; |
|
| 119 | - $output .= 'id="redux-slider-value-' . esc_attr( $field['id'] ) . '-to"'; |
|
| 120 | - $output .= 'class="color-gradient-reach-to"'; |
|
| 121 | - $output .= 'name="' . esc_attr( $field['name'] . $field['name_suffix'] ) . '[gradient-reach][to]"'; |
|
| 122 | - $output .= 'value="' . esc_attr( $value['gradient-reach']['to'] ) . '"'; |
|
| 123 | - $output .= 'data-id="' . esc_attr( $field['id'] ) . '"'; |
|
| 124 | - $output .= '/>'; |
|
| 125 | - $output .= '</div>'; |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - if ( $field['gradient-angle'] ) { |
|
| 129 | - $style = ''; |
|
| 130 | - if ( 'radial' === $value['gradient-type'] ) { |
|
| 131 | - $style = 'style="display:none;"'; |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - $output .= '<div class="slider-gradient-angle" ' . $style . '>'; |
|
| 135 | - $output .= '<div class="label">' . esc_html__( 'Gradient Angle', 'redux-framework' ) . ': <strong>' . $value['gradient-angle'] . '°</strong></div>'; |
|
| 136 | - $output .= '<div '; |
|
| 137 | - $output .= 'class="redux-gradient-slider redux-color-gradient redux-gradient-angle color-gradient-input ' . esc_attr( $field['class'] ) . '"'; |
|
| 138 | - $output .= 'id="' . esc_attr( $field['id'] ) . '"'; |
|
| 139 | - $output .= 'data-id="' . esc_attr( $field['id'] ) . '-angle"'; |
|
| 140 | - $output .= 'data-min="0"'; |
|
| 141 | - $output .= 'data-max="360"'; |
|
| 142 | - $output .= 'data-step="1"'; |
|
| 143 | - $output .= 'data-rtl="' . esc_attr( is_rtl() ) . '"'; |
|
| 144 | - $output .= 'data-label="' . esc_attr__( 'Gradient Angle', 'redux-framework' ) . '"'; |
|
| 145 | - $output .= 'data-default = "' . esc_attr( $value['gradient-angle'] ) . '">'; |
|
| 146 | - $output .= '</div>'; |
|
| 147 | - $output .= '<input '; |
|
| 148 | - $output .= 'type="hidden"'; |
|
| 149 | - $output .= 'id="redux-slider-value-' . esc_attr( $field['id'] ) . '-angle"'; |
|
| 150 | - $output .= 'class="color-gradient-angle"'; |
|
| 151 | - $output .= 'name="' . esc_attr( $field['name'] . $field['name_suffix'] ) . '[gradient-angle]"'; |
|
| 152 | - $output .= 'value="' . esc_attr( $value['gradient-angle'] ) . '"'; |
|
| 153 | - $output .= 'data-id="' . esc_attr( $field['id'] ) . '"'; |
|
| 154 | - $output .= '/>'; |
|
| 155 | - $output .= '</div>'; |
|
| 156 | - } |
|
| 157 | - |
|
| 158 | - return $output; |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - /** |
|
| 162 | - * Render preview. |
|
| 163 | - * |
|
| 164 | - * @param array $data Data. |
|
| 165 | - * |
|
| 166 | - * @return string |
|
| 167 | - */ |
|
| 168 | - public static function render_preview( array $data ): string { |
|
| 169 | - extract( $data ); // phpcs:ignore WordPress.PHP.DontExtract |
|
| 170 | - |
|
| 171 | - $output = ''; |
|
| 172 | - |
|
| 173 | - $css = ''; |
|
| 174 | - if ( false === $field['preview'] ) { |
|
| 175 | - $css .= 'display:none;'; |
|
| 176 | - } |
|
| 177 | - |
|
| 178 | - $css .= self::get_output( $value ); |
|
| 179 | - |
|
| 180 | - $css .= 'height: ' . $field['preview_height'] . ';'; |
|
| 181 | - |
|
| 182 | - $output .= '<div class="redux-gradient-preview" style="' . esc_attr( $css ) . '"></div>'; |
|
| 183 | - |
|
| 184 | - return $output; |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - /** |
|
| 188 | - * Get CSS output. |
|
| 189 | - * |
|
| 190 | - * @param mixed $data Data. |
|
| 191 | - * |
|
| 192 | - * @return string |
|
| 193 | - */ |
|
| 194 | - public static function get_output( $data ): string { |
|
| 195 | - if ( ! is_array( $data ) ) { |
|
| 196 | - return $data; |
|
| 197 | - } |
|
| 198 | - |
|
| 199 | - $angle = $data['gradient-angle']; |
|
| 200 | - |
|
| 201 | - $w3c_angle = abs( $angle - 450 ) % 360; |
|
| 202 | - |
|
| 203 | - $colors = $data['from'] . ' ' . $data['gradient-reach']['from'] . '%, ' . $data['to'] . ' ' . $data['gradient-reach']['to'] . '%)'; |
|
| 204 | - |
|
| 205 | - if ( 'linear' === $data['gradient-type'] ) { |
|
| 206 | - $result_w3c = 'linear-gradient(' . $w3c_angle . 'deg,' . $colors; |
|
| 207 | - $result = 'linear-gradient(' . $angle . 'deg,' . $colors; |
|
| 208 | - } else { |
|
| 209 | - $result_w3c = 'radial-gradient(center, ellipse cover, ' . $colors; |
|
| 210 | - $result = 'radial-gradient(center, ellipse cover,' . $colors; |
|
| 211 | - } |
|
| 212 | - |
|
| 213 | - return 'background:' . $result_w3c . ';background:-moz-' . $result . ';background:-webkit-' . $result . ';background:-o-' . $result . ';background:-ms-' . $result; |
|
| 214 | - } |
|
| 215 | - |
|
| 216 | - /** |
|
| 217 | - * Enqueue support files. |
|
| 218 | - * |
|
| 219 | - * @param array $field Field array. |
|
| 220 | - * @param bool $filters_enabled Enable filter bit. |
|
| 221 | - */ |
|
| 222 | - public static function enqueue( array $field, bool $filters_enabled ) { |
|
| 223 | - $min = Redux_Functions::is_min(); |
|
| 224 | - |
|
| 225 | - if ( $filters_enabled ) { |
|
| 226 | - if ( $field['gradient-type'] ) { |
|
| 227 | - if ( ! wp_style_is( 'select2-css' ) ) { |
|
| 228 | - wp_enqueue_style( 'select2-css' ); |
|
| 229 | - } |
|
| 230 | - |
|
| 231 | - if ( ! wp_script_is( 'select2-js' ) ) { |
|
| 232 | - wp_enqueue_script( 'select2-js' ); |
|
| 233 | - } |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - if ( ! wp_style_is( 'redux-nouislider' ) ) { |
|
| 237 | - wp_enqueue_style( |
|
| 238 | - 'redux-nouislider', |
|
| 239 | - Redux_Core::$url . 'assets/css/vendor/nouislider' . $min . '.css', |
|
| 240 | - array(), |
|
| 241 | - '5.0.0' |
|
| 242 | - ); |
|
| 243 | - |
|
| 244 | - wp_enqueue_script( |
|
| 245 | - 'redux-nouislider', |
|
| 246 | - Redux_Core::$url . 'assets/js/vendor/nouislider/redux.jquery.nouislider' . $min . '.js', |
|
| 247 | - array( 'jquery' ), |
|
| 248 | - '5.0.0', |
|
| 249 | - true |
|
| 250 | - ); |
|
| 251 | - } |
|
| 252 | - |
|
| 253 | - wp_enqueue_script( |
|
| 254 | - 'redux-gradient-filters', |
|
| 255 | - Redux_Core::$url . 'inc/lib/gradient-filters/gradient-filters' . Redux_Functions::isMin() . '.js', |
|
| 256 | - array( 'jquery' ), |
|
| 257 | - Redux_Core::$version, |
|
| 258 | - true |
|
| 259 | - ); |
|
| 260 | - |
|
| 261 | - wp_enqueue_style( |
|
| 262 | - 'redux-gradient-filters', |
|
| 263 | - Redux_Core::$url . 'inc/lib/gradient-filters/gradient-filters.css', |
|
| 264 | - array(), |
|
| 265 | - Redux_Core::$version |
|
| 266 | - ); |
|
| 267 | - } |
|
| 268 | - } |
|
| 269 | - } |
|
| 14 | + /** |
|
| 15 | + * Class Redux_Gradient_Filters |
|
| 16 | + */ |
|
| 17 | + class Redux_Gradient_Filters { |
|
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * Render select boxes. |
|
| 21 | + * |
|
| 22 | + * @param array $data Data. |
|
| 23 | + * |
|
| 24 | + * @return string |
|
| 25 | + */ |
|
| 26 | + public static function render_select( array $data ): string { |
|
| 27 | + extract( $data ); // phpcs:ignore WordPress.PHP.DontExtract |
|
| 28 | + |
|
| 29 | + $output = ''; |
|
| 30 | + |
|
| 31 | + if ( $field['gradient-type'] ) { |
|
| 32 | + $select2_default = array( |
|
| 33 | + 'width' => 'resolve', |
|
| 34 | + 'allowClear' => false, |
|
| 35 | + 'theme' => 'default', |
|
| 36 | + 'minimumResultsForSearch' => 3, |
|
| 37 | + ); |
|
| 38 | + |
|
| 39 | + $select2_default = Redux_Functions::sanitize_camel_case_array_keys( $select2_default ); |
|
| 40 | + |
|
| 41 | + $select2_data = Redux_Functions::create_data_string( $select2_default ); |
|
| 42 | + |
|
| 43 | + $output .= '<div class="redux-gradient-type">'; |
|
| 44 | + $output .= '<strong>' . esc_html__( 'Gradient Type ', 'redux-framework' ) . '</strong> '; |
|
| 45 | + $output .= '<select '; |
|
| 46 | + $output .= 'class="redux-gradient-select select2-container"'; |
|
| 47 | + $output .= 'data-placeholder="' . esc_attr__( 'Type', 'redux-framework' ) . '" ' . $select2_data . ' '; |
|
| 48 | + $output .= 'name="' . esc_attr( $field['name'] . $field['name_suffix'] ) . '[gradient-type]"'; |
|
| 49 | + $output .= 'data-value="' . esc_attr( $value['gradient-type'] ) . '"'; |
|
| 50 | + $output .= 'data-id="' . esc_attr( $field['id'] ) . '">'; |
|
| 51 | + |
|
| 52 | + $arr = array( |
|
| 53 | + esc_html__( 'linear', 'redux-framework' ), |
|
| 54 | + esc_html__( 'radial', 'redux-framework' ), |
|
| 55 | + ); |
|
| 56 | + |
|
| 57 | + foreach ( $arr as $v ) { |
|
| 58 | + $output .= '<option value="' . esc_attr( $v ) . '" ' . selected( $value['gradient-type'], $v, false ) . '>' . esc_html( ucfirst( $v ) ) . '</option>'; |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + $output .= '</select>'; |
|
| 62 | + $output .= '</div>'; |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + return $output; |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * Render sliders. |
|
| 70 | + * |
|
| 71 | + * @param array $data Data. |
|
| 72 | + * |
|
| 73 | + * @return string |
|
| 74 | + */ |
|
| 75 | + public static function render_sliders( array $data ): string { |
|
| 76 | + extract( $data ); // phpcs:ignore WordPress.PHP.DontExtract |
|
| 77 | + |
|
| 78 | + $output = ''; |
|
| 79 | + |
|
| 80 | + if ( $field['gradient-reach'] ) { |
|
| 81 | + $output .= '<div class="slider-from-reach">'; |
|
| 82 | + $output .= '<div class="label">' . esc_html__( 'From Reach ', 'redux-framework' ) . ': <strong>' . esc_html( $value['gradient-reach']['from'] ) . '%</strong></div>'; |
|
| 83 | + $output .= '<div '; |
|
| 84 | + $output .= 'class="redux-gradient-slider redux-color-gradient redux-gradient-from-reach color-gradient-input ' . esc_attr( $field['class'] ) . '"'; |
|
| 85 | + $output .= 'id="' . esc_attr( $field['id'] ) . '"'; |
|
| 86 | + $output .= 'data-id="' . esc_attr( $field['id'] ) . '-from"'; |
|
| 87 | + $output .= 'data-min="0"'; |
|
| 88 | + $output .= 'data-max="100"'; |
|
| 89 | + $output .= 'data-step="1"'; |
|
| 90 | + $output .= 'data-rtl="' . esc_attr( is_rtl() ) . '"'; |
|
| 91 | + $output .= 'data-label="' . esc_attr__( 'From Reach', 'redux-framework' ) . '"'; |
|
| 92 | + $output .= 'data-default = "' . esc_attr( $value['gradient-reach']['from'] ) . '">'; |
|
| 93 | + $output .= '</div>'; |
|
| 94 | + $output .= '<input '; |
|
| 95 | + $output .= 'type="hidden"'; |
|
| 96 | + $output .= 'id="redux-slider-value-' . esc_attr( $field['id'] ) . '-from"'; |
|
| 97 | + $output .= 'class="color-gradient-reach-from"'; |
|
| 98 | + $output .= 'name="' . esc_attr( $field['name'] . $field['name_suffix'] ) . '[gradient-reach][from]"'; |
|
| 99 | + $output .= 'value="' . esc_attr( $value['gradient-reach']['from'] ) . '"'; |
|
| 100 | + $output .= 'data-id="' . esc_attr( $field['id'] ) . '"'; |
|
| 101 | + $output .= '/>'; |
|
| 102 | + $output .= '</div>'; |
|
| 103 | + |
|
| 104 | + $output .= '<div class="slider-to-reach">'; |
|
| 105 | + $output .= '<div class="label">' . esc_html__( 'To Reach', 'redux-framework' ) . ': <strong>' . esc_html( $value['gradient-reach']['to'] ) . '%</strong></div>'; |
|
| 106 | + $output .= '<div '; |
|
| 107 | + $output .= 'class="redux-gradient-slider redux-color-gradient redux-gradient-reach-to color-gradient-input ' . esc_attr( $field['class'] ) . '"'; |
|
| 108 | + $output .= 'id="' . esc_attr( $field['id'] ) . '"'; |
|
| 109 | + $output .= 'data-id="' . esc_attr( $field['id'] ) . '-to"'; |
|
| 110 | + $output .= 'data-min="0"'; |
|
| 111 | + $output .= 'data-max="100"'; |
|
| 112 | + $output .= 'data-step="1"'; |
|
| 113 | + $output .= 'data-rtl="' . esc_attr( is_rtl() ) . '"'; |
|
| 114 | + $output .= 'data-label="' . esc_attr__( 'To Reach', 'redux-framework' ) . '"'; |
|
| 115 | + $output .= 'data-default = "' . esc_attr( $value['gradient-reach']['to'] ) . '">'; |
|
| 116 | + $output .= '</div>'; |
|
| 117 | + $output .= '<input '; |
|
| 118 | + $output .= 'type="hidden"'; |
|
| 119 | + $output .= 'id="redux-slider-value-' . esc_attr( $field['id'] ) . '-to"'; |
|
| 120 | + $output .= 'class="color-gradient-reach-to"'; |
|
| 121 | + $output .= 'name="' . esc_attr( $field['name'] . $field['name_suffix'] ) . '[gradient-reach][to]"'; |
|
| 122 | + $output .= 'value="' . esc_attr( $value['gradient-reach']['to'] ) . '"'; |
|
| 123 | + $output .= 'data-id="' . esc_attr( $field['id'] ) . '"'; |
|
| 124 | + $output .= '/>'; |
|
| 125 | + $output .= '</div>'; |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + if ( $field['gradient-angle'] ) { |
|
| 129 | + $style = ''; |
|
| 130 | + if ( 'radial' === $value['gradient-type'] ) { |
|
| 131 | + $style = 'style="display:none;"'; |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + $output .= '<div class="slider-gradient-angle" ' . $style . '>'; |
|
| 135 | + $output .= '<div class="label">' . esc_html__( 'Gradient Angle', 'redux-framework' ) . ': <strong>' . $value['gradient-angle'] . '°</strong></div>'; |
|
| 136 | + $output .= '<div '; |
|
| 137 | + $output .= 'class="redux-gradient-slider redux-color-gradient redux-gradient-angle color-gradient-input ' . esc_attr( $field['class'] ) . '"'; |
|
| 138 | + $output .= 'id="' . esc_attr( $field['id'] ) . '"'; |
|
| 139 | + $output .= 'data-id="' . esc_attr( $field['id'] ) . '-angle"'; |
|
| 140 | + $output .= 'data-min="0"'; |
|
| 141 | + $output .= 'data-max="360"'; |
|
| 142 | + $output .= 'data-step="1"'; |
|
| 143 | + $output .= 'data-rtl="' . esc_attr( is_rtl() ) . '"'; |
|
| 144 | + $output .= 'data-label="' . esc_attr__( 'Gradient Angle', 'redux-framework' ) . '"'; |
|
| 145 | + $output .= 'data-default = "' . esc_attr( $value['gradient-angle'] ) . '">'; |
|
| 146 | + $output .= '</div>'; |
|
| 147 | + $output .= '<input '; |
|
| 148 | + $output .= 'type="hidden"'; |
|
| 149 | + $output .= 'id="redux-slider-value-' . esc_attr( $field['id'] ) . '-angle"'; |
|
| 150 | + $output .= 'class="color-gradient-angle"'; |
|
| 151 | + $output .= 'name="' . esc_attr( $field['name'] . $field['name_suffix'] ) . '[gradient-angle]"'; |
|
| 152 | + $output .= 'value="' . esc_attr( $value['gradient-angle'] ) . '"'; |
|
| 153 | + $output .= 'data-id="' . esc_attr( $field['id'] ) . '"'; |
|
| 154 | + $output .= '/>'; |
|
| 155 | + $output .= '</div>'; |
|
| 156 | + } |
|
| 157 | + |
|
| 158 | + return $output; |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + /** |
|
| 162 | + * Render preview. |
|
| 163 | + * |
|
| 164 | + * @param array $data Data. |
|
| 165 | + * |
|
| 166 | + * @return string |
|
| 167 | + */ |
|
| 168 | + public static function render_preview( array $data ): string { |
|
| 169 | + extract( $data ); // phpcs:ignore WordPress.PHP.DontExtract |
|
| 170 | + |
|
| 171 | + $output = ''; |
|
| 172 | + |
|
| 173 | + $css = ''; |
|
| 174 | + if ( false === $field['preview'] ) { |
|
| 175 | + $css .= 'display:none;'; |
|
| 176 | + } |
|
| 177 | + |
|
| 178 | + $css .= self::get_output( $value ); |
|
| 179 | + |
|
| 180 | + $css .= 'height: ' . $field['preview_height'] . ';'; |
|
| 181 | + |
|
| 182 | + $output .= '<div class="redux-gradient-preview" style="' . esc_attr( $css ) . '"></div>'; |
|
| 183 | + |
|
| 184 | + return $output; |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + /** |
|
| 188 | + * Get CSS output. |
|
| 189 | + * |
|
| 190 | + * @param mixed $data Data. |
|
| 191 | + * |
|
| 192 | + * @return string |
|
| 193 | + */ |
|
| 194 | + public static function get_output( $data ): string { |
|
| 195 | + if ( ! is_array( $data ) ) { |
|
| 196 | + return $data; |
|
| 197 | + } |
|
| 198 | + |
|
| 199 | + $angle = $data['gradient-angle']; |
|
| 200 | + |
|
| 201 | + $w3c_angle = abs( $angle - 450 ) % 360; |
|
| 202 | + |
|
| 203 | + $colors = $data['from'] . ' ' . $data['gradient-reach']['from'] . '%, ' . $data['to'] . ' ' . $data['gradient-reach']['to'] . '%)'; |
|
| 204 | + |
|
| 205 | + if ( 'linear' === $data['gradient-type'] ) { |
|
| 206 | + $result_w3c = 'linear-gradient(' . $w3c_angle . 'deg,' . $colors; |
|
| 207 | + $result = 'linear-gradient(' . $angle . 'deg,' . $colors; |
|
| 208 | + } else { |
|
| 209 | + $result_w3c = 'radial-gradient(center, ellipse cover, ' . $colors; |
|
| 210 | + $result = 'radial-gradient(center, ellipse cover,' . $colors; |
|
| 211 | + } |
|
| 212 | + |
|
| 213 | + return 'background:' . $result_w3c . ';background:-moz-' . $result . ';background:-webkit-' . $result . ';background:-o-' . $result . ';background:-ms-' . $result; |
|
| 214 | + } |
|
| 215 | + |
|
| 216 | + /** |
|
| 217 | + * Enqueue support files. |
|
| 218 | + * |
|
| 219 | + * @param array $field Field array. |
|
| 220 | + * @param bool $filters_enabled Enable filter bit. |
|
| 221 | + */ |
|
| 222 | + public static function enqueue( array $field, bool $filters_enabled ) { |
|
| 223 | + $min = Redux_Functions::is_min(); |
|
| 224 | + |
|
| 225 | + if ( $filters_enabled ) { |
|
| 226 | + if ( $field['gradient-type'] ) { |
|
| 227 | + if ( ! wp_style_is( 'select2-css' ) ) { |
|
| 228 | + wp_enqueue_style( 'select2-css' ); |
|
| 229 | + } |
|
| 230 | + |
|
| 231 | + if ( ! wp_script_is( 'select2-js' ) ) { |
|
| 232 | + wp_enqueue_script( 'select2-js' ); |
|
| 233 | + } |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + if ( ! wp_style_is( 'redux-nouislider' ) ) { |
|
| 237 | + wp_enqueue_style( |
|
| 238 | + 'redux-nouislider', |
|
| 239 | + Redux_Core::$url . 'assets/css/vendor/nouislider' . $min . '.css', |
|
| 240 | + array(), |
|
| 241 | + '5.0.0' |
|
| 242 | + ); |
|
| 243 | + |
|
| 244 | + wp_enqueue_script( |
|
| 245 | + 'redux-nouislider', |
|
| 246 | + Redux_Core::$url . 'assets/js/vendor/nouislider/redux.jquery.nouislider' . $min . '.js', |
|
| 247 | + array( 'jquery' ), |
|
| 248 | + '5.0.0', |
|
| 249 | + true |
|
| 250 | + ); |
|
| 251 | + } |
|
| 252 | + |
|
| 253 | + wp_enqueue_script( |
|
| 254 | + 'redux-gradient-filters', |
|
| 255 | + Redux_Core::$url . 'inc/lib/gradient-filters/gradient-filters' . Redux_Functions::isMin() . '.js', |
|
| 256 | + array( 'jquery' ), |
|
| 257 | + Redux_Core::$version, |
|
| 258 | + true |
|
| 259 | + ); |
|
| 260 | + |
|
| 261 | + wp_enqueue_style( |
|
| 262 | + 'redux-gradient-filters', |
|
| 263 | + Redux_Core::$url . 'inc/lib/gradient-filters/gradient-filters.css', |
|
| 264 | + array(), |
|
| 265 | + Redux_Core::$version |
|
| 266 | + ); |
|
| 267 | + } |
|
| 268 | + } |
|
| 269 | + } |
|
| 270 | 270 | } |
@@ -11,200 +11,200 @@ |
||
| 11 | 11 | |
| 12 | 12 | if ( ! class_exists( 'Redux_Sortable', false ) ) { |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Class Redux_Sortable |
|
| 16 | - */ |
|
| 17 | - class Redux_Sortable extends Redux_Field { |
|
| 18 | - |
|
| 19 | - /** |
|
| 20 | - * Set field defaults. |
|
| 21 | - */ |
|
| 22 | - public function set_defaults() { |
|
| 23 | - $defaults = array( |
|
| 24 | - 'options' => array(), |
|
| 25 | - 'label' => false, |
|
| 26 | - 'mode' => 'text', |
|
| 27 | - ); |
|
| 28 | - |
|
| 29 | - $this->field = wp_parse_args( $this->field, $defaults ); |
|
| 30 | - } |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * Field Render Function. |
|
| 34 | - * Takes the vars and outputs the HTML for the field in the settings |
|
| 35 | - * |
|
| 36 | - * @since Redux_Options 2.0.1 |
|
| 37 | - */ |
|
| 38 | - public function render() { |
|
| 39 | - if ( empty( $this->field['mode'] ) ) { |
|
| 40 | - $this->field['mode'] = 'text'; |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - if ( 'checkbox' !== $this->field['mode'] && 'text' !== $this->field['mode'] && 'toggle' !== $this->field['mode'] ) { |
|
| 44 | - $this->field['mode'] = 'text'; |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - if ( 'toggle' === $this->field['mode'] ) { |
|
| 48 | - $this->field['mode'] = 'checkbox'; |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - $class = ( isset( $this->field['class'] ) ) ? $this->field['class'] : ''; |
|
| 52 | - $options = $this->field['options']; |
|
| 53 | - |
|
| 54 | - // This is to weed out missing options that might be in the default |
|
| 55 | - // Why? Who knows. Call it a dummy check. |
|
| 56 | - if ( ! empty( $this->value ) ) { |
|
| 57 | - foreach ( $this->value as $k => $v ) { |
|
| 58 | - if ( ! isset( $options[ $k ] ) ) { |
|
| 59 | - unset( $this->value[ $k ] ); |
|
| 60 | - } |
|
| 61 | - } |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - $no_sort = false; |
|
| 65 | - if ( empty( $this->value ) && ! is_array( $this->value ) ) { |
|
| 66 | - if ( ! empty( $this->field['options'] ) ) { |
|
| 67 | - $this->value = $this->field['options']; |
|
| 68 | - } else { |
|
| 69 | - $this->value = array(); |
|
| 70 | - } |
|
| 71 | - } |
|
| 72 | - foreach ( $options as $k => $v ) { |
|
| 73 | - if ( ! isset( $this->value[ $k ] ) ) { |
|
| 74 | - |
|
| 75 | - // A save has previously been done. |
|
| 76 | - if ( is_array( $this->value ) && array_key_exists( $k, $this->value ) ) { |
|
| 77 | - $this->value[ $k ] = $v; |
|
| 78 | - |
|
| 79 | - // Missing database entry, meaning no save has yet been done. |
|
| 80 | - } else { |
|
| 81 | - $no_sort = true; |
|
| 82 | - $this->value[ $k ] = ''; |
|
| 83 | - } |
|
| 84 | - } |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - // If missing database entries are found, it means no save has been done |
|
| 88 | - // and therefore no sort should be done. Set the default array in the same |
|
| 89 | - // order as the options array. Why? The sort order is based on the |
|
| 90 | - // saved default array. If entries are missing, the sort is messed up. |
|
| 91 | - // - kp. |
|
| 92 | - if ( true === $no_sort ) { |
|
| 93 | - $dummy_arr = array(); |
|
| 94 | - |
|
| 95 | - foreach ( $options as $k => $v ) { |
|
| 96 | - $dummy_arr[ $k ] = $this->value[ $k ]; |
|
| 97 | - } |
|
| 98 | - unset( $this->value ); |
|
| 99 | - $this->value = $dummy_arr; |
|
| 100 | - unset( $dummy_arr ); |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - $use_labels = false; |
|
| 104 | - $label_class = ' checkbox'; |
|
| 105 | - if ( 'checkbox' !== $this->field['mode'] ) { |
|
| 106 | - if ( ( isset( $this->field['label'] ) && true === $this->field['label'] ) ) { |
|
| 107 | - $use_labels = true; |
|
| 108 | - $label_class = ' labeled'; |
|
| 109 | - } |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - echo '<ul id="' . esc_attr( $this->field['id'] ) . '-list" class="redux-sortable ' . esc_attr( $class ) . ' ' . esc_attr( $label_class ) . '">'; |
|
| 113 | - |
|
| 114 | - foreach ( $this->value as $k => $nicename ) { |
|
| 115 | - $invisible = ''; |
|
| 116 | - |
|
| 117 | - if ( 'checkbox' === $this->field['mode'] ) { |
|
| 118 | - if ( empty( $this->value[ $k ] ) ) { |
|
| 119 | - $invisible = ' invisible'; |
|
| 120 | - } |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - echo '<li class="' . esc_attr( $invisible ) . '">'; |
|
| 124 | - |
|
| 125 | - $checked = ''; |
|
| 126 | - $name = 'name="' . $this->field['name'] . $this->field['name_suffix'] . '[' . esc_attr( $k ) . ']" '; |
|
| 127 | - |
|
| 128 | - if ( 'checkbox' === $this->field['mode'] ) { |
|
| 129 | - $value_display = $this->value[ $k ]; |
|
| 130 | - |
|
| 131 | - if ( ! empty( $this->value[ $k ] ) ) { |
|
| 132 | - $checked = 'checked="checked" '; |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - $class .= ' checkbox_sortable'; |
|
| 136 | - $name = ''; |
|
| 137 | - |
|
| 138 | - echo '<div class="checkbox-container">'; |
|
| 139 | - echo '<input |
|
| 14 | + /** |
|
| 15 | + * Class Redux_Sortable |
|
| 16 | + */ |
|
| 17 | + class Redux_Sortable extends Redux_Field { |
|
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * Set field defaults. |
|
| 21 | + */ |
|
| 22 | + public function set_defaults() { |
|
| 23 | + $defaults = array( |
|
| 24 | + 'options' => array(), |
|
| 25 | + 'label' => false, |
|
| 26 | + 'mode' => 'text', |
|
| 27 | + ); |
|
| 28 | + |
|
| 29 | + $this->field = wp_parse_args( $this->field, $defaults ); |
|
| 30 | + } |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * Field Render Function. |
|
| 34 | + * Takes the vars and outputs the HTML for the field in the settings |
|
| 35 | + * |
|
| 36 | + * @since Redux_Options 2.0.1 |
|
| 37 | + */ |
|
| 38 | + public function render() { |
|
| 39 | + if ( empty( $this->field['mode'] ) ) { |
|
| 40 | + $this->field['mode'] = 'text'; |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + if ( 'checkbox' !== $this->field['mode'] && 'text' !== $this->field['mode'] && 'toggle' !== $this->field['mode'] ) { |
|
| 44 | + $this->field['mode'] = 'text'; |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + if ( 'toggle' === $this->field['mode'] ) { |
|
| 48 | + $this->field['mode'] = 'checkbox'; |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + $class = ( isset( $this->field['class'] ) ) ? $this->field['class'] : ''; |
|
| 52 | + $options = $this->field['options']; |
|
| 53 | + |
|
| 54 | + // This is to weed out missing options that might be in the default |
|
| 55 | + // Why? Who knows. Call it a dummy check. |
|
| 56 | + if ( ! empty( $this->value ) ) { |
|
| 57 | + foreach ( $this->value as $k => $v ) { |
|
| 58 | + if ( ! isset( $options[ $k ] ) ) { |
|
| 59 | + unset( $this->value[ $k ] ); |
|
| 60 | + } |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + $no_sort = false; |
|
| 65 | + if ( empty( $this->value ) && ! is_array( $this->value ) ) { |
|
| 66 | + if ( ! empty( $this->field['options'] ) ) { |
|
| 67 | + $this->value = $this->field['options']; |
|
| 68 | + } else { |
|
| 69 | + $this->value = array(); |
|
| 70 | + } |
|
| 71 | + } |
|
| 72 | + foreach ( $options as $k => $v ) { |
|
| 73 | + if ( ! isset( $this->value[ $k ] ) ) { |
|
| 74 | + |
|
| 75 | + // A save has previously been done. |
|
| 76 | + if ( is_array( $this->value ) && array_key_exists( $k, $this->value ) ) { |
|
| 77 | + $this->value[ $k ] = $v; |
|
| 78 | + |
|
| 79 | + // Missing database entry, meaning no save has yet been done. |
|
| 80 | + } else { |
|
| 81 | + $no_sort = true; |
|
| 82 | + $this->value[ $k ] = ''; |
|
| 83 | + } |
|
| 84 | + } |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + // If missing database entries are found, it means no save has been done |
|
| 88 | + // and therefore no sort should be done. Set the default array in the same |
|
| 89 | + // order as the options array. Why? The sort order is based on the |
|
| 90 | + // saved default array. If entries are missing, the sort is messed up. |
|
| 91 | + // - kp. |
|
| 92 | + if ( true === $no_sort ) { |
|
| 93 | + $dummy_arr = array(); |
|
| 94 | + |
|
| 95 | + foreach ( $options as $k => $v ) { |
|
| 96 | + $dummy_arr[ $k ] = $this->value[ $k ]; |
|
| 97 | + } |
|
| 98 | + unset( $this->value ); |
|
| 99 | + $this->value = $dummy_arr; |
|
| 100 | + unset( $dummy_arr ); |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + $use_labels = false; |
|
| 104 | + $label_class = ' checkbox'; |
|
| 105 | + if ( 'checkbox' !== $this->field['mode'] ) { |
|
| 106 | + if ( ( isset( $this->field['label'] ) && true === $this->field['label'] ) ) { |
|
| 107 | + $use_labels = true; |
|
| 108 | + $label_class = ' labeled'; |
|
| 109 | + } |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + echo '<ul id="' . esc_attr( $this->field['id'] ) . '-list" class="redux-sortable ' . esc_attr( $class ) . ' ' . esc_attr( $label_class ) . '">'; |
|
| 113 | + |
|
| 114 | + foreach ( $this->value as $k => $nicename ) { |
|
| 115 | + $invisible = ''; |
|
| 116 | + |
|
| 117 | + if ( 'checkbox' === $this->field['mode'] ) { |
|
| 118 | + if ( empty( $this->value[ $k ] ) ) { |
|
| 119 | + $invisible = ' invisible'; |
|
| 120 | + } |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + echo '<li class="' . esc_attr( $invisible ) . '">'; |
|
| 124 | + |
|
| 125 | + $checked = ''; |
|
| 126 | + $name = 'name="' . $this->field['name'] . $this->field['name_suffix'] . '[' . esc_attr( $k ) . ']" '; |
|
| 127 | + |
|
| 128 | + if ( 'checkbox' === $this->field['mode'] ) { |
|
| 129 | + $value_display = $this->value[ $k ]; |
|
| 130 | + |
|
| 131 | + if ( ! empty( $this->value[ $k ] ) ) { |
|
| 132 | + $checked = 'checked="checked" '; |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + $class .= ' checkbox_sortable'; |
|
| 136 | + $name = ''; |
|
| 137 | + |
|
| 138 | + echo '<div class="checkbox-container">'; |
|
| 139 | + echo '<input |
|
| 140 | 140 | type="hidden" |
| 141 | 141 | name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[' . esc_attr( $k ) . ']" |
| 142 | 142 | id="' . esc_attr( $this->field['id'] . '-' . $k ) . '-hidden" |
| 143 | 143 | value="' . esc_attr( $value_display ) . '" />'; |
| 144 | 144 | |
| 145 | - } else { |
|
| 146 | - $value_display = $this->value[ $k ] ?? ''; |
|
| 147 | - $nicename = $this->field['options'][ $k ]; |
|
| 148 | - } |
|
| 145 | + } else { |
|
| 146 | + $value_display = $this->value[ $k ] ?? ''; |
|
| 147 | + $nicename = $this->field['options'][ $k ]; |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | - if ( 'checkbox' !== $this->field['mode'] ) { |
|
| 151 | - if ( $use_labels ) { |
|
| 152 | - echo '<label class="bugger" for="' . esc_attr( $this->field['id'] ) . '[' . esc_attr( $k ) . ']"><strong>' . esc_html( $k ) . '</strong></label>'; |
|
| 153 | - echo '<br />'; |
|
| 154 | - } |
|
| 150 | + if ( 'checkbox' !== $this->field['mode'] ) { |
|
| 151 | + if ( $use_labels ) { |
|
| 152 | + echo '<label class="bugger" for="' . esc_attr( $this->field['id'] ) . '[' . esc_attr( $k ) . ']"><strong>' . esc_html( $k ) . '</strong></label>'; |
|
| 153 | + echo '<br />'; |
|
| 154 | + } |
|
| 155 | 155 | |
| 156 | - echo '<input |
|
| 156 | + echo '<input |
|
| 157 | 157 | rel="' . esc_attr( $this->field['id'] . '-' . $k ) . '-hidden" |
| 158 | 158 | class="' . esc_attr( $class ) . '" ' . esc_html( $checked ) . ' |
| 159 | 159 | type="' . esc_attr( $this->field['mode'] ) . '" |
| 160 | 160 | ' . $name . // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 161 | - 'id="' . esc_attr( $this->field['id'] . '[' . $k ) . ']" |
|
| 161 | + 'id="' . esc_attr( $this->field['id'] . '[' . $k ) . ']" |
|
| 162 | 162 | value="' . esc_attr( $value_display ) . '" |
| 163 | 163 | placeholder="' . esc_attr( $nicename ) . '" />'; |
| 164 | - } |
|
| 165 | - |
|
| 166 | - echo '<span class="compact drag">'; |
|
| 167 | - echo '<i class="dashicons dashicons-menu icon-large"></i>'; |
|
| 168 | - echo '</span>'; |
|
| 169 | - |
|
| 170 | - if ( 'checkbox' === $this->field['mode'] ) { |
|
| 171 | - echo '<i class="dashicons dashicons-visibility visibility"></i>'; |
|
| 172 | - |
|
| 173 | - echo '<strong>' . esc_html( $options[ $k ] ) . '</strong>'; |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - if ( 'checkbox' === $this->field['mode'] ) { |
|
| 177 | - echo '</div>'; |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - echo '</li>'; |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - echo '</ul>'; |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * Enqueue scripts and styles. |
|
| 188 | - */ |
|
| 189 | - public function enqueue() { |
|
| 190 | - if ( $this->parent->args['dev_mode'] ) { |
|
| 191 | - wp_enqueue_style( |
|
| 192 | - 'redux-field-sortable', |
|
| 193 | - Redux_Core::$url . 'inc/fields/sortable/redux-sortable.css', |
|
| 194 | - array(), |
|
| 195 | - $this->timestamp |
|
| 196 | - ); |
|
| 197 | - } |
|
| 198 | - |
|
| 199 | - wp_enqueue_script( |
|
| 200 | - 'redux-field-sortable', |
|
| 201 | - Redux_Core::$url . 'inc/fields/sortable/redux-sortable' . Redux_Functions::is_min() . '.js', |
|
| 202 | - array( 'jquery', 'redux-js', 'jquery-ui-sortable' ), |
|
| 203 | - $this->timestamp, |
|
| 204 | - true |
|
| 205 | - ); |
|
| 206 | - } |
|
| 207 | - } |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + echo '<span class="compact drag">'; |
|
| 167 | + echo '<i class="dashicons dashicons-menu icon-large"></i>'; |
|
| 168 | + echo '</span>'; |
|
| 169 | + |
|
| 170 | + if ( 'checkbox' === $this->field['mode'] ) { |
|
| 171 | + echo '<i class="dashicons dashicons-visibility visibility"></i>'; |
|
| 172 | + |
|
| 173 | + echo '<strong>' . esc_html( $options[ $k ] ) . '</strong>'; |
|
| 174 | + } |
|
| 175 | + |
|
| 176 | + if ( 'checkbox' === $this->field['mode'] ) { |
|
| 177 | + echo '</div>'; |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + echo '</li>'; |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + echo '</ul>'; |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * Enqueue scripts and styles. |
|
| 188 | + */ |
|
| 189 | + public function enqueue() { |
|
| 190 | + if ( $this->parent->args['dev_mode'] ) { |
|
| 191 | + wp_enqueue_style( |
|
| 192 | + 'redux-field-sortable', |
|
| 193 | + Redux_Core::$url . 'inc/fields/sortable/redux-sortable.css', |
|
| 194 | + array(), |
|
| 195 | + $this->timestamp |
|
| 196 | + ); |
|
| 197 | + } |
|
| 198 | + |
|
| 199 | + wp_enqueue_script( |
|
| 200 | + 'redux-field-sortable', |
|
| 201 | + Redux_Core::$url . 'inc/fields/sortable/redux-sortable' . Redux_Functions::is_min() . '.js', |
|
| 202 | + array( 'jquery', 'redux-js', 'jquery-ui-sortable' ), |
|
| 203 | + $this->timestamp, |
|
| 204 | + true |
|
| 205 | + ); |
|
| 206 | + } |
|
| 207 | + } |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | class_alias( 'Redux_Sortable', 'ReduxFramework_Sortable' ); |
@@ -55,8 +55,8 @@ discard block |
||
| 55 | 55 | // Why? Who knows. Call it a dummy check. |
| 56 | 56 | if ( ! empty( $this->value ) ) { |
| 57 | 57 | foreach ( $this->value as $k => $v ) { |
| 58 | - if ( ! isset( $options[ $k ] ) ) { |
|
| 59 | - unset( $this->value[ $k ] ); |
|
| 58 | + if ( ! isset( $options[$k] ) ) { |
|
| 59 | + unset( $this->value[$k] ); |
|
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | } |
@@ -70,16 +70,16 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | foreach ( $options as $k => $v ) { |
| 73 | - if ( ! isset( $this->value[ $k ] ) ) { |
|
| 73 | + if ( ! isset( $this->value[$k] ) ) { |
|
| 74 | 74 | |
| 75 | 75 | // A save has previously been done. |
| 76 | 76 | if ( is_array( $this->value ) && array_key_exists( $k, $this->value ) ) { |
| 77 | - $this->value[ $k ] = $v; |
|
| 77 | + $this->value[$k] = $v; |
|
| 78 | 78 | |
| 79 | 79 | // Missing database entry, meaning no save has yet been done. |
| 80 | 80 | } else { |
| 81 | 81 | $no_sort = true; |
| 82 | - $this->value[ $k ] = ''; |
|
| 82 | + $this->value[$k] = ''; |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $dummy_arr = array(); |
| 94 | 94 | |
| 95 | 95 | foreach ( $options as $k => $v ) { |
| 96 | - $dummy_arr[ $k ] = $this->value[ $k ]; |
|
| 96 | + $dummy_arr[$k] = $this->value[$k]; |
|
| 97 | 97 | } |
| 98 | 98 | unset( $this->value ); |
| 99 | 99 | $this->value = $dummy_arr; |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | $invisible = ''; |
| 116 | 116 | |
| 117 | 117 | if ( 'checkbox' === $this->field['mode'] ) { |
| 118 | - if ( empty( $this->value[ $k ] ) ) { |
|
| 118 | + if ( empty( $this->value[$k] ) ) { |
|
| 119 | 119 | $invisible = ' invisible'; |
| 120 | 120 | } |
| 121 | 121 | } |
@@ -126,9 +126,9 @@ discard block |
||
| 126 | 126 | $name = 'name="' . $this->field['name'] . $this->field['name_suffix'] . '[' . esc_attr( $k ) . ']" '; |
| 127 | 127 | |
| 128 | 128 | if ( 'checkbox' === $this->field['mode'] ) { |
| 129 | - $value_display = $this->value[ $k ]; |
|
| 129 | + $value_display = $this->value[$k]; |
|
| 130 | 130 | |
| 131 | - if ( ! empty( $this->value[ $k ] ) ) { |
|
| 131 | + if ( ! empty( $this->value[$k] ) ) { |
|
| 132 | 132 | $checked = 'checked="checked" '; |
| 133 | 133 | } |
| 134 | 134 | |
@@ -143,8 +143,8 @@ discard block |
||
| 143 | 143 | value="' . esc_attr( $value_display ) . '" />'; |
| 144 | 144 | |
| 145 | 145 | } else { |
| 146 | - $value_display = $this->value[ $k ] ?? ''; |
|
| 147 | - $nicename = $this->field['options'][ $k ]; |
|
| 146 | + $value_display = $this->value[$k] ?? ''; |
|
| 147 | + $nicename = $this->field['options'][$k]; |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | if ( 'checkbox' !== $this->field['mode'] ) { |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | if ( 'checkbox' === $this->field['mode'] ) { |
| 171 | 171 | echo '<i class="dashicons dashicons-visibility visibility"></i>'; |
| 172 | 172 | |
| 173 | - echo '<strong>' . esc_html( $options[ $k ] ) . '</strong>'; |
|
| 173 | + echo '<strong>' . esc_html( $options[$k] ) . '</strong>'; |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | if ( 'checkbox' === $this->field['mode'] ) { |
@@ -4,24 +4,24 @@ |
||
| 4 | 4 | |
| 5 | 5 | if ( ! class_exists( 'Redux_Installer_Muter', false ) ) { |
| 6 | 6 | |
| 7 | - /** |
|
| 8 | - * Redux_Installer_Muter. |
|
| 9 | - * |
|
| 10 | - * @since 4.0.0 |
|
| 11 | - */ |
|
| 12 | - class Redux_Installer_Muter extends WP_Upgrader_Skin { |
|
| 7 | + /** |
|
| 8 | + * Redux_Installer_Muter. |
|
| 9 | + * |
|
| 10 | + * @since 4.0.0 |
|
| 11 | + */ |
|
| 12 | + class Redux_Installer_Muter extends WP_Upgrader_Skin { |
|
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Suppress feedback. |
|
| 16 | - * |
|
| 17 | - * @param string|null $feedback A string. |
|
| 18 | - * @param array|null ...$args Passed args. |
|
| 19 | - * |
|
| 20 | - * @return void |
|
| 21 | - * @since 4.0.0 |
|
| 22 | - */ |
|
| 23 | - public function feedback( $feedback, ...$args ) { |
|
| 24 | - /* no output */ |
|
| 25 | - } |
|
| 26 | - } |
|
| 14 | + /** |
|
| 15 | + * Suppress feedback. |
|
| 16 | + * |
|
| 17 | + * @param string|null $feedback A string. |
|
| 18 | + * @param array|null ...$args Passed args. |
|
| 19 | + * |
|
| 20 | + * @return void |
|
| 21 | + * @since 4.0.0 |
|
| 22 | + */ |
|
| 23 | + public function feedback( $feedback, ...$args ) { |
|
| 24 | + /* no output */ |
|
| 25 | + } |
|
| 26 | + } |
|
| 27 | 27 | } |
@@ -10,50 +10,50 @@ |
||
| 10 | 10 | |
| 11 | 11 | if ( ! class_exists( 'Redux_I18n', false ) ) { |
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * Class Redux_I18n |
|
| 15 | - */ |
|
| 16 | - class Redux_I18n extends Redux_Class { |
|
| 17 | - |
|
| 18 | - /** |
|
| 19 | - * Redux_I18n constructor. |
|
| 20 | - * |
|
| 21 | - * @param object $redux ReduxFramework pointer. |
|
| 22 | - */ |
|
| 23 | - public function __construct( $redux ) { |
|
| 24 | - parent::__construct( $redux ); |
|
| 25 | - |
|
| 26 | - add_action( 'init', array( $this, 'load' ) ); |
|
| 27 | - } |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * Load translations. |
|
| 31 | - */ |
|
| 32 | - public function load() { |
|
| 33 | - $domain = 'redux-framework'; |
|
| 34 | - |
|
| 35 | - unload_textdomain( $domain ); |
|
| 36 | - |
|
| 37 | - $core = $this->core(); |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * Locale for text domain |
|
| 41 | - * filter 'redux/textdomain/basepath/{opt_name}' |
|
| 42 | - */ |
|
| 43 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 44 | - $locale = apply_filters( 'redux/locale', get_locale(), 'redux-framework' ); |
|
| 45 | - $mofile = $domain . '-' . $locale . '.mo'; |
|
| 46 | - |
|
| 47 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 48 | - $basepath = apply_filters( "redux/textdomain/basepath/{$core->args['opt_name']}", Redux_Core::$dir ); |
|
| 49 | - |
|
| 50 | - $loaded = load_textdomain( $domain, $basepath . 'languages/' . $mofile ); |
|
| 51 | - |
|
| 52 | - if ( ! $loaded ) { |
|
| 53 | - $mofile = WP_LANG_DIR . '/plugins/' . $mofile; |
|
| 54 | - |
|
| 55 | - load_textdomain( $domain, $mofile ); |
|
| 56 | - } |
|
| 57 | - } |
|
| 58 | - } |
|
| 13 | + /** |
|
| 14 | + * Class Redux_I18n |
|
| 15 | + */ |
|
| 16 | + class Redux_I18n extends Redux_Class { |
|
| 17 | + |
|
| 18 | + /** |
|
| 19 | + * Redux_I18n constructor. |
|
| 20 | + * |
|
| 21 | + * @param object $redux ReduxFramework pointer. |
|
| 22 | + */ |
|
| 23 | + public function __construct( $redux ) { |
|
| 24 | + parent::__construct( $redux ); |
|
| 25 | + |
|
| 26 | + add_action( 'init', array( $this, 'load' ) ); |
|
| 27 | + } |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * Load translations. |
|
| 31 | + */ |
|
| 32 | + public function load() { |
|
| 33 | + $domain = 'redux-framework'; |
|
| 34 | + |
|
| 35 | + unload_textdomain( $domain ); |
|
| 36 | + |
|
| 37 | + $core = $this->core(); |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * Locale for text domain |
|
| 41 | + * filter 'redux/textdomain/basepath/{opt_name}' |
|
| 42 | + */ |
|
| 43 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 44 | + $locale = apply_filters( 'redux/locale', get_locale(), 'redux-framework' ); |
|
| 45 | + $mofile = $domain . '-' . $locale . '.mo'; |
|
| 46 | + |
|
| 47 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName |
|
| 48 | + $basepath = apply_filters( "redux/textdomain/basepath/{$core->args['opt_name']}", Redux_Core::$dir ); |
|
| 49 | + |
|
| 50 | + $loaded = load_textdomain( $domain, $basepath . 'languages/' . $mofile ); |
|
| 51 | + |
|
| 52 | + if ( ! $loaded ) { |
|
| 53 | + $mofile = WP_LANG_DIR . '/plugins/' . $mofile; |
|
| 54 | + |
|
| 55 | + load_textdomain( $domain, $mofile ); |
|
| 56 | + } |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | 59 | } |