Skip to content

Commit afcced1

Browse files
author
Ghost1227
committed
Bring embedded sources up to date
1 parent 8534fa3 commit afcced1

File tree

5 files changed

+40
-12
lines changed

5 files changed

+40
-12
lines changed

framework.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ public function _enqueue() {
738738

739739
wp_enqueue_script('jquery');
740740
wp_enqueue_script('jquery-ui-core');
741-
wp_enqueue_style( 'jquery-ui-css' );
741+
742742

743743
wp_register_style(
744744
'redux-css',
@@ -781,6 +781,7 @@ public function _enqueue() {
781781
time(),
782782
'all'
783783
);
784+
wp_enqueue_style( 'jquery-ui-css' );
784785

785786
wp_enqueue_style( 'redux-lte-ie8' );
786787

inc/fields/button_set/field_button_set.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ public function render() {
8787
* @return void
8888
*/
8989
public function enqueue() {
90-
91-
wp_enqueue_style( 'jquery-ui-css' );
9290

9391
wp_enqueue_script(
9492
'redux-field-button-set-js',

inc/fields/spacing/field_spacing.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
$('.redux-spacing-input').on('change', function() {
2020
var units = jQuery(this).parents('.redux-field:first').find('.redux-spacing-units option:selected').val();
2121
if(typeof units !== 'undefined') {
22+
console.log(units);
2223
jQuery('#'+jQuery(this).attr('rel')).val(jQuery(this).val()+units);
2324
} else {
2425
jQuery('#'+jQuery(this).attr('rel')).val(jQuery(this).val());

inc/fields/spacing/field_spacing.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inc/fields/spacing/field_spacing.php

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ function __construct($field = array(), $value ='', $parent){
2727
* @since ReduxFramework 1.0.0
2828
*/
2929
function render(){
30+
print_r($this->value);
3031

3132
// No errors please
3233
$defaults = array(
@@ -44,7 +45,6 @@ function render(){
4445
$defaults = array(
4546
'top'=>'',
4647
'right'=>'',
47-
'mode' => '',
4848
'bottom'=>'',
4949
'left'=>'',
5050
'mode'=>'padding',
@@ -70,13 +70,38 @@ function render(){
7070
if ( !empty( $this->field['mode'] ) ) {
7171
$this->field['mode'] = $this->field['mode']."-";
7272
}
73-
7473

74+
$oldval = $this->value;
75+
$this->value = array();
76+
77+
foreach ($oldval as $k=>$v) {
78+
if ($k == "units") {
79+
continue;
80+
}
81+
if (strpos($k, $this->field['mode']) === false) {
82+
$this->value[$k] = str_replace($oldval['units'], "". $v);
83+
} else {
84+
$this->value[$str_replace($this->field['mode'].'-', "", $k)] = str_replace($oldval['units'], "". $v);
85+
}
86+
}
87+
88+
$defaults = array(
89+
'top'=>'',
90+
'right'=>'',
91+
'bottom'=>'',
92+
'left'=>'',
93+
'units'=>'',
94+
);
95+
96+
$this->value = wp_parse_args( $this->value, $defaults );
97+
98+
99+
print_r($this->value);
75100
/**
76101
Top
77102
**/
78103
if ($this->field['top'] === true):
79-
if ( !empty($this->value['top'] ) && strpos( $this->value['top'], $this->value['units'] ) === false ) {
104+
if ( !empty( $this->value['top'] ) ) {
80105
$this->value['top'] = filter_var($this->value['top'], FILTER_SANITIZE_NUMBER_INT);
81106
$this->value['top'] = $this->value['top'].$this->value['units'];
82107
}
@@ -87,7 +112,7 @@ function render(){
87112
Right
88113
**/
89114
if ($this->field['right'] === true):
90-
if ( !empty($this->value['right'] ) && strpos( $this->value['right'], $this->value['units'] ) === false ) {
115+
if ( !empty( $this->value['right'] ) ) {
91116
$this->value['right'] = filter_var($this->value['right'], FILTER_SANITIZE_NUMBER_INT);
92117
$this->value['right'] = $this->value['right'].$this->value['units'];
93118
}
@@ -98,8 +123,11 @@ function render(){
98123
Bottom
99124
**/
100125
if ($this->field['bottom'] === true):
101-
if ( !empty($this->value['bottom'] ) && strpos( $this->value['bottom'], $this->value['units'] ) === false ) {
126+
if ( !empty( $this->value['bottom'] ) ) {
102127
$this->value['bottom'] = filter_var($this->value['bottom'], FILTER_SANITIZE_NUMBER_INT);
128+
if ($this->field['units'] !== false ) {
129+
$this->value['bottom'] .= $this->value['units'];
130+
}
103131
$this->value['bottom'] = $this->value['bottom'].$this->value['units'];
104132
}
105133
echo '<div class="field-spacing-input input-prepend"><span class="add-on"><i class="icon-arrow-down icon-large"></i></span><input type="text" class="redux-spacing-bottom redux-spacing-input mini'.$this->field['class'].'" placeholder="'.__('Bottom','redux-framework').'" rel="'.$this->field['id'].'-bottom" value="'.filter_var($this->value['bottom'], FILTER_SANITIZE_NUMBER_INT).'"><input type="hidden" class="redux-spacing-bottom mini'.$this->field['class'].'" placeholder="'.__('Bottom','redux-framework').'" id="'.$this->field['id'].'-bottom" name="'.$this->args['opt_name'].'['.$this->field['id'].']['.$this->field['mode'].'bottom]" value="'.$this->value['bottom'].'"></div>';
@@ -109,7 +137,7 @@ function render(){
109137
Left
110138
**/
111139
if ($this->field['left'] === true):
112-
if ( !empty($this->value['left'] ) && strpos( $this->value['left'], $this->value['units'] ) === false ) {
140+
if ( !empty( $this->value['left'] ) ) {
113141
$this->value['left'] = filter_var($this->value['left'], FILTER_SANITIZE_NUMBER_INT);
114142
$this->value['left'] = $this->value['left'].$this->value['units'];
115143
}
@@ -121,7 +149,7 @@ function render(){
121149
Units
122150
**/
123151

124-
//if ( $this->field['units'] !== false ):
152+
if ( $this->field['units'] !== false ):
125153

126154
echo '<div class="select_wrapper spacing-units" original-title="'.__('Units','redux-framework').'">';
127155
echo '<select data-placeholder="'.__('Units','redux-framework').'" class="redux-spacing redux-spacing-units select'.$this->field['class'].'" original-title="'.__('Units','redux-framework').'" name="'.$this->args['opt_name'].'['.$this->field['id'].'][units]" id="'. $this->field['id'].'_units">';
@@ -142,7 +170,7 @@ function render(){
142170
}
143171
echo '</select></div>';
144172

145-
//endif;
173+
endif;
146174

147175

148176

0 commit comments

Comments
 (0)