Skip to content

Commit

Permalink
Merge pull request #99 from oceanwp/rc-2.2.9
Browse files Browse the repository at this point in the history
Rc 2.2.9
  • Loading branch information
eramits committed Jun 5, 2024
2 parents 4814590 + 8de9413 commit 073f55d
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 34 deletions.
1 change: 1 addition & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports = function (grunt) {
"includes/metabox/controls/assets/js/butterbean.min.js": "includes/metabox/controls/assets/js/butterbean.js",
"includes/widgets/js/insta-admin.min.js": "includes/widgets/js/insta-admin.js",
"includes/widgets/js/mailchimp.min.js": "includes/widgets/js/mailchimp.js",
"includes/widgets/js/flickr.min.js": "includes/widgets/js/flickr.js",
"includes/widgets/js/share.min.js": "includes/widgets/js/share.js",
"includes/shortcodes/js/shortcode.min.js": "includes/shortcodes/js/shortcode.js",
"includes/preloader/assets/js/preloader.min.js": "includes/preloader/assets/js/preloader.js",
Expand Down
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
== Changelog ==

= 2.2.9 - JUN 05 2024 =
- Fixed: Potential vulnerability patched: Wordfence report from Jun 3rd 2024. A special thanks goes towards the Wordfence team for doublechecking everything as always.
- Fixed: WordPress Widgets: Flickr: if widget in use more than once on a page, images display with a single widget only.
- Fixed: Customizer: Console error while Customizer in use: Store "core / interface" is already registered.

= 2.2.8 - MAY 22 2024 =
- Added: Additional support for the oceanwp_post_id() function.
- Added: Support for new functionality for Ocean Hooks 2.1.1 version.
Expand Down
4 changes: 4 additions & 0 deletions includes/post-settings/post-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ public function editor_enqueue_script() {
return;
}

if ( is_customize_preview() ) {
return;
}

if ( get_current_screen()->base === 'widgets' ) {
return;
}
Expand Down
70 changes: 47 additions & 23 deletions includes/widgets/flickr.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package OceanWP WordPress theme
*/

// Exit if accessed directly
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
Expand All @@ -28,6 +28,8 @@ public function __construct() {
'customize_selective_refresh' => true,
)
);

add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
}

/**
Expand All @@ -41,29 +43,29 @@ public function __construct() {
public function widget( $args, $instance ) {

$title = isset( $instance['title'] ) ? apply_filters( 'widget_title', $instance['title'] ) : '';
$number = isset( $instance['number'] ) ? $instance['number'] : '';
$id = isset( $instance['id'] ) ? $instance['id'] : '';
$number = isset( $instance['number'] ) ? intval( $instance['number'] ) : '';
$id = isset( $instance['id'] ) ? sanitize_text_field( $instance['id'] ) : '';


// Before widget WP hook
echo $args['before_widget'];

// Show widget title
if ( $title ) {
echo $args['before_title'] . $title . $args['after_title'];
if ( ! empty( $instance['title'] ) ) {
echo $args['before_title'] . esc_html( $title ) . $args['after_title'];
}

// Display flickr feed if ID is defined
$unique_id = 'oceanwp_flickr_photos_' . uniqid() . '_' . md5(rand());

if ( $id ) : ?>
<div class="oceanwp-flickr-wrap">
<script type="text/javascript" src="https://www.flickr.com/badge_code_v2.gne?count=<?php echo intval( $number ); ?>&amp;display=latest&amp;size=s&amp;layout=x&amp;source=user&amp;user=<?php echo strip_tags( $id ); ?>"></script>
<p class="flickr_stream_wrap"><a class="follow_btn" href="http://www.flickr.com/photos/<?php echo strip_tags( $id ); ?>"><?php esc_html_e( 'View stream on flickr', 'ocean-extra' ); ?></a></p>
</div>
<div class="oceanwp-flickr-wrap">
<div id="<?php echo $unique_id; ?>" class="oceanwp-flickr-container" data-user-id="<?php echo esc_attr( $id ); ?>" data-max-photos="<?php echo intval( $number ); ?>"></div>
<p class="flickr_stream_wrap"><a class="follow_btn" href="http://www.flickr.com/photos/<?php echo strip_tags( $id ); ?>"><?php esc_html_e( 'View stream on flickr', 'ocean-extra' ); ?></a></p>
</div>
<?php
endif;
endif;

// After widget WP hook
echo $args['after_widget'];


}

/**
Expand All @@ -79,9 +81,9 @@ public function widget( $args, $instance ) {
*/
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : '';
$instance['title'] = ! empty( $new_instance['title'] ) ? sanitize_text_field( $new_instance['title'] ) : '';
$instance['number'] = ! empty( $new_instance['number'] ) ? intval( $new_instance['number'] ) : '';
$instance['id'] = ! empty( $new_instance['id'] ) ? strip_tags( $new_instance['id'] ) : '';
$instance['id'] = ! empty( $new_instance['id'] ) ? sanitize_text_field( $new_instance['id'] ) : '';
return $instance;
}

Expand All @@ -103,9 +105,9 @@ public function form( $instance ) {
)
);

$title = $settings['title'];
$id = $settings['id'];
$number = $settings['number'];
$title = esc_attr( $settings['title'] );
$id = esc_attr( $settings['id'] );
$number = intval( $settings['number'] );

?>
<p>
Expand All @@ -114,21 +116,43 @@ public function form( $instance ) {
</p>

<p>
<label for="<?php echo $this->get_field_id( 'id' ); ?>"><?php esc_html_e( 'Flickr ID', 'ocean-extra' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id( 'id' ); ?>" name="<?php echo $this->get_field_name( 'id' ); ?>" type="text" value="<?php echo esc_attr( $id ); ?>" />
<label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php esc_html_e( 'Flickr ID', 'ocean-extra' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" type="text" value="<?php echo esc_attr( $id ); ?>" />
<small><?php esc_html_e( 'Enter the url of your Flickr page on this site: idgettr.com.', 'ocean-extra' ); ?></small>
</p>

<p>
<label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php esc_html_e( 'Number:', 'ocean-extra' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo esc_attr( $number ); ?>" />
<label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php esc_html_e( 'Number:', 'ocean-extra' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>" type="number" value="<?php echo esc_attr( $number ); ?>" />
<small><?php esc_html_e( 'The maximum is 10 images.', 'ocean-extra' ); ?></small>
</p>

<?php

}

/**
* Scripts
*/
public function enqueue_scripts() {
wp_enqueue_script( 'flickr-widget-script', OE_URL . 'includes/widgets/js/flickr.min.js', array( 'jquery' ), false, true );

$widgets_settings = $this->get_settings();
$localized_data = array();

foreach ( $widgets_settings as $number => $instance ) {
$localized_data[] = array(
'userId' => ! empty( $instance['id'] ) ? esc_attr( $instance['id'] ) : '',
'maxPhotos' => ! empty( $instance['number'] ) ? intval( $instance['number'] ) : 6,
'containerId' => 'oceanwp-flickr-photos-' . esc_attr( $number ),
);
}

wp_localize_script( 'flickr-widget-script', 'flickrWidgetParams', array(
'widgets' => $localized_data,
));
}

}
}
register_widget( 'Ocean_Extra_Flickr_Widget' );
48 changes: 48 additions & 0 deletions includes/widgets/js/flickr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
(function($) {
function loadFlickrPhotos($scope) {
var $container = $scope.find('.oceanwp-flickr-container');
if (!$container.length) {
return;
}

$container.each(function() {
var $this = $(this);
var userId = $this.data('user-id');
var maxPhotos = $this.data('max-photos');
var containerId = $this.attr('id');
var callbackName = 'jsonFlickrFeed_' + containerId;
var feedUrl = 'https://www.flickr.com/services/feeds/photos_public.gne?id=' + userId + '&format=json&jsoncallback=' + callbackName;

function getPhotoUrl(photo) {
return photo.media.m.replace('_m.jpg', '_q.jpg');
}

window[callbackName] = function(data) {
var counter = 0;
$.each(data.items, function(i, item) {
if (counter < maxPhotos) {
var photoUrl = getPhotoUrl(item);
$this.append('<img src="' + photoUrl + '" alt="' + item.title + '">');
counter++;
}
});
};

var script = document.createElement('script');
script.src = feedUrl;
document.head.appendChild(script);
});
}

// Execute when the document is ready
$(document).ready(function() {
loadFlickrPhotos($(document));
});

// Execute when Elementor previews are loaded
$(window).on('elementor/frontend/init', function() {
elementorFrontend.hooks.addAction('frontend/element_ready/widget', function($scope) {
loadFlickrPhotos($scope);
});
});
})(jQuery);
1 change: 1 addition & 0 deletions includes/widgets/js/flickr.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions languages/ocean-extra.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the same license as the Ocean Extra plugin.
msgid ""
msgstr ""
"Project-Id-Version: Ocean Extra 2.2.8\n"
"Project-Id-Version: Ocean Extra 2.2.9\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/ocean-extra\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2024-05-22T07:02:04+00:00\n"
"POT-Creation-Date: 2024-06-05T07:21:26+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.9.0\n"
"X-Domain: ocean-extra\n"
Expand Down Expand Up @@ -6157,7 +6157,7 @@ msgstr ""
#: includes/widgets/custom-links.php:139
#: includes/widgets/custom-menu.php:290
#: includes/widgets/facebook.php:185
#: includes/widgets/flickr.php:112
#: includes/widgets/flickr.php:114
#: includes/widgets/instagram.php:135
#: includes/widgets/mailchimp.php:250
#: includes/widgets/recent-posts.php:223
Expand Down Expand Up @@ -8248,27 +8248,27 @@ msgstr ""
msgid "Pulls in images from your flickr account."
msgstr ""

#: includes/widgets/flickr.php:59
#: includes/widgets/flickr.php:61
msgid "View stream on flickr"
msgstr ""

#: includes/widgets/flickr.php:100
#: includes/widgets/flickr.php:102
msgid "Flickr Photos"
msgstr ""

#: includes/widgets/flickr.php:117
#: includes/widgets/flickr.php:119
msgid "Flickr ID"
msgstr ""

#: includes/widgets/flickr.php:119
#: includes/widgets/flickr.php:121
msgid "Enter the url of your Flickr page on this site: idgettr.com."
msgstr ""

#: includes/widgets/flickr.php:123
#: includes/widgets/flickr.php:125
msgid "Number:"
msgstr ""

#: includes/widgets/flickr.php:125
#: includes/widgets/flickr.php:127
msgid "The maximum is 10 images."
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion ocean-extra.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Ocean Extra
* Plugin URI: https://oceanwp.org/extension/ocean-extra/
* Description: Add extra features and flexibility to your OceanWP theme for a turbocharged premium experience and full control over every aspect of your website.
* Version: 2.2.8
* Version: 2.2.9
* Author: OceanWP
* Author URI: https://oceanwp.org/
* Requires at least: 5.6
Expand Down
7 changes: 6 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: oceanwp, apprimit, wpfleek
Tags: widgets, meta box, metaboxes, metabox, oceanwp
Requires at least: 5.6
Tested up to: 6.5.3
Stable tag: 2.2.8
Stable tag: 2.2.9
Requires PHP: 7.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -216,6 +216,11 @@ You can report problems on [this support forum](https://wordpress.org/support/pl

== Changelog ==

= 2.2.9 - JUN 05 2024 =
- Fixed: Potential vulnerability patched: Wordfence report from Jun 3rd 2024. A special thanks goes towards the Wordfence team for doublechecking everything as always.
- Fixed: WordPress Widgets: Flickr: if widget in use more than once on a page, images display with a single widget only.
- Fixed: Customizer: Console error while Customizer in use: Store "core / interface" is already registered.

= 2.2.8 - MAY 22 2024 =
- Added: Additional support for the oceanwp_post_id() function.
- Added: Support for new functionality for Ocean Hooks 2.1.1 version.
Expand Down

0 comments on commit 073f55d

Please sign in to comment.