Skip to content
This repository was archived by the owner on Dec 4, 2019. It is now read-only.

Commit 2131911

Browse files
committed
Making multi media field pretty + some core improvements
1 parent b8f9f5c commit 2131911

File tree

8 files changed

+27
-25
lines changed

8 files changed

+27
-25
lines changed

plugins/redux-extensions/multi_media/multi_media/field_multi_media.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@
156156

157157
// Make form field ID
158158
var $formfield = $('#' + inputID);
159-
console.log(inputID);
160159

161160
// Get form name
162161
var formName = $formfield.attr('name');
@@ -248,12 +247,12 @@
248247

249248
// Handle images
250249
if (this.type && this.type === 'image') {
251-
250+
var url = 'thumbnail' in this.sizes ? this.sizes.thumbnail.url : this.url;
252251
// image preview
253252
uploadStatus =
254253
'<li class="img_status">' +
255-
'<img width="50" height="50" src="' + this.url + '" class="attachment-50x50" alt="' + this.filename + '">' +
256-
'<p><a href="#" class="redux_remove_file_button" rel="' + inputID + '[' + this.id + ']">' + l10n.remove_image + '</a></p>' +
254+
'<img src="' + url + '" class="redux-option-image" alt="' + this.filename + '">' +
255+
'<p><a href="#" class="button remove-image redux_remove_file_button" rel="' + inputID + '[' + this.id + ']">' + l10n.remove_image + '</a></p>' +
257256
'<input type="hidden" id="filelist-' + this.id + '" name="' + formName + '[' + this.id + ']" value="' + this.url + '">' +
258257
'</li>';
259258

plugins/redux-extensions/multi_media/multi_media/field_multi_media.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.

plugins/redux-extensions/multi_media/multi_media/field_multi_media.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,11 @@ class=""
169169

170170
// Check for valud image extension
171171
if ( $this->is_valid_img_ext( $url ) ) {
172-
173172
// Add image to array
174173
$imgArr[] =
175174
'<li class="img_status">' .
176-
wp_get_attachment_image( $id, array( 50, 50 ) ) .
177-
'<p class="redux_remove_wrapper"><a href="#" class="redux_remove_file_button">' . __( 'Remove Image', 'redux-framework' ) . '</a></p>
175+
wp_get_attachment_image( $id, 'thumbnail', false, array( 'class' => 'redux-option-image' ) ) .
176+
'<p class="redux_remove_wrapper"><a href="#" class="button remove-image redux_remove_file_button">' . __( 'Remove Image', 'redux-framework' ) . '</a></p>
178177
' . $id_input . '
179178
</li>';
180179

plugins/redux-framework/ReduxCore/inc/tracking.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -201,20 +201,20 @@ function redux_store_answer(input, nonce) {
201201
allow_tracking: input,
202202
nonce: nonce
203203
};
204-
jQuery.post(
204+
$.post(
205205
ajaxurl, redux_tracking_data, function () {
206-
jQuery('#wp-pointer-0').remove();
206+
$('#wp-pointer-0').remove();
207207
}
208208
);
209209
}
210210

211211
redux_pointer_options = $.extend(
212212
redux_pointer_options, {
213213
buttons: function (event, t) {
214-
button = jQuery('<a id="pointer-close" style="margin-left:5px" class="button-secondary">' + '<?php echo $button1; ?>' + '</a>');
215-
button.bind(
216-
'click.pointer', function () {
214+
button = $('<a id="pointer-close" style="margin-left:5px" class="button-secondary">' + '<?php echo $button1; ?>' + '</a>');
215+
button.on('click', function () {
217216
t.element.pointer('close');
217+
//todo SEND ajax request
218218
//console.log( 'close button' );
219219
}
220220
);
@@ -228,13 +228,13 @@ function redux_store_answer(input, nonce) {
228228
setup = function () {
229229
$('<?php echo $selector; ?>').pointer(redux_pointer_options).pointer('open');
230230
<?php if ($button2) { ?>
231-
jQuery('#pointer-close').after('<a id="pointer-primary" class="button-primary">' + '<?php echo $button2; ?>' + '</a>');
232-
jQuery('#pointer-primary').click(
231+
$('#pointer-close').after('<a id="pointer-primary" class="button-primary">' + '<?php echo $button2; ?>' + '</a>');
232+
$('#pointer-primary').click(
233233
function () {
234234
<?php echo $button2_function; ?>
235235
}
236236
);
237-
jQuery('#pointer-close').click(
237+
$('#pointer-close').click(
238238
function () {
239239
<?php if ($button1_function == '') { ?>
240240
redux_store_answer(input, nonce);
@@ -245,7 +245,7 @@ function () {
245245
}
246246
);
247247
<?php } else if ($button1 && ! $button2) { ?>
248-
jQuery('#pointer-close').click(
248+
$('#pointer-close').click(
249249
function () {
250250
<?php if ($button1_function != '') { ?>
251251
<?php echo $button1_function; ?>
@@ -256,7 +256,7 @@ function () {
256256
};
257257

258258
if (redux_pointer_options.position && redux_pointer_options.position.defer_loading)
259-
$(window).bind('load.wp-pointers', setup);
259+
$(window).on('load.wp-pointers', setup);
260260
else
261261
$(document).ready(setup);
262262
}

src/Modules/ReduxFramework.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class ReduxFramework implements SubModule {
3030
private $metabox;
3131

3232
public function __construct( WP_Plugin &$parent = null ) {
33+
ReduxConfig::loadRedux();
34+
3335
$this->ParentConstruct( $parent );
3436
if ( $parent ) {
3537
$this->opt_name = $parent->getReduxOptName();

src/Objects/ReduxConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static function hide_redux_plugin() {
6767
public static function loadRedux() {
6868
if ( ! class_exists( Redux::class, false ) ) {
6969
global $WPlusPlusCore;
70-
if ( file_exists( $f = $WPlusPlusCore->file( 'plugins/redux-framework/redux-framework.php' ) ) ) {
70+
if ( file_exists( $f = $WPlusPlusCore->file( 'plugins/redux-dev/redux-framework.php' ) ) ) {
7171
require_once $f;
7272
}
7373
}

src/Objects/WP_Ajax.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ public function __construct( $action, $func, $private = false, $referer = null )
3737
add_action( 'wp_ajax_' . $action, [ $this, 'call' ], 10, 0 );
3838
if ( ! $private ) {
3939
add_action( 'wp_ajax_nopriv_' . $action, [ $this, 'call' ], 10, 0 );
40-
} else {
41-
if ( $referer == true ) {
42-
$referer = $action;
43-
}
44-
$this->referer = $referer;
4540
}
4641

42+
if ( $referer == true ) {
43+
$referer = $action;
44+
}
45+
$this->referer = $referer;
46+
4747
$this->action = $action;
4848

4949
$this->func = $func;

src/Objects/WP_Plugin.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function initShortcodes() {
112112
}
113113

114114
/**
115-
* @param SubModule $submodule
115+
* @param string|SubModule $submodule
116116
*/
117117
public function setSubModule( $submodule ) {
118118
if ( $submodule instanceof SubModule ) {
@@ -122,6 +122,8 @@ public function setSubModule( $submodule ) {
122122
} catch ( \ReflectionException $exception ) {
123123
error_log( $exception->getMessage() );
124124
}
125+
} elseif ( is_string( $submodule ) ) {
126+
$this->modules[ $submodule ] = new $submodule( $this );
125127
}
126128
}
127129

0 commit comments

Comments
 (0)