Skip to content

Commit

Permalink
Merge pull request #950 from graphpaperpress/cm/lightboxfix
Browse files Browse the repository at this point in the history
lightbox bug and comma separated search fixes
  • Loading branch information
maharzan authored May 14, 2024
2 parents c30ff5c + fec312b commit b290f73
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 25 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Contributors: endortrails, nhuja
Donate link: https://graphpaperpress.com/plugins/sell-media/
Tags: photography, photos, sell media, sell photos, sell videos, sell downloads, download, downloads, e-commerce, paypal, stock photos, photo gallery, photo cart
Requires at least: 6.2.1
Tested up to: 6.4.2
Stable tag: 2.5.8.4
Tested up to: 6.5.3
Stable tag: 2.5.8.5
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -221,6 +221,13 @@ Action hooks available:

== Changelog ==

= 2.5.8.5 =
* Fix: Lightbox issue fix
* Fix: Comma based search fix

= 2.5.8.4 =
* Fix: Minor styles fixes

= 2.5.8.3 =
* Fix: Search filter not showing results bug fix

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public function sell_media_search_form_gutenberg_shortcode( $atts, $url = null,

// Exclude negative keywords in search query like "-cow"
$negative_search_terms = '';
$negative_search_terms = preg_grep( '/\B-[^\B]+/', $search_terms );
$negative_search_terms = preg_grep( '/(?:^|[^\-\d])(\d+)/', $search_terms );
$negative_search_terms = preg_replace( '/[-]/', '', $negative_search_terms );

// now remove negative search terms from search terms
Expand Down
27 changes: 13 additions & 14 deletions inc/class-search.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,21 +129,20 @@ public function form( $url = null, $used = null ) {
if ( is_page( $settings->search_page ) && in_the_loop() ) {

// Find comma-separated search terms and format into an array
$search_term_cleaned = preg_replace( '/\s*,\s*/', ',', $search_term );
$search_terms = str_getcsv( $search_term_cleaned, ',' );

// Exclude negative keywords in search query like "-cow"
$negative_search_terms = '';
$search_terms = array_filter($search_terms);
if(!empty($search_terms)) {
$negative_search_terms = preg_replace( '/[-]/', '', $search_terms );
}
// now remove negative search terms from search terms
$search_terms = array_diff( (array)$search_terms, (array)$negative_search_terms );
$search_terms = array_filter( (array)$search_terms );
$search_term_cleaned = preg_replace( '/\s*,\s*/', ',', $search_term );
$search_terms = str_getcsv( $search_term_cleaned, ',' );

// Exclude negative keywords in search query like "-cow"
$negative_search_terms = '';
$negative_search_terms = preg_grep( '/(?:^|[^\-\d])(\d+)/', $search_terms );
$negative_search_terms = preg_replace( '/[-]/', '', $negative_search_terms );

// now remove negative search terms from search terms
$search_terms = array_diff( $search_terms, $negative_search_terms );
$search_terms = array_filter( $search_terms );

// Get the file/mimetype
$mime_type = $this->get_mimetype( $search_file_type );
// Get the file/mimetype
$mime_type = $this->get_mimetype( $search_file_type );

// Current pagination
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
Expand Down
2 changes: 1 addition & 1 deletion inc/lightbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function sell_media_lightbox_query() {
// Check if items in lightbox
if ( isset( $items ) ) {

array_walk($items, function(&$value, &$key) {
array_walk($items, function($value, $key) {
$value['post_id'] = intval($value['post_id']);
$value['attachment_id'] = intval($value['attachment_id']);
});
Expand Down
11 changes: 9 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Contributors: endortrails, nhuja
Donate link: https://graphpaperpress.com/plugins/sell-media/
Tags: photography, photos, sell media, sell photos, sell videos, sell downloads, download, downloads, e-commerce, paypal, stock photos, photo gallery, photo cart
Requires at least: 6.2.1
Tested up to: 6.4.2
Stable tag: 2.5.8.4
Tested up to: 6.5.3
Stable tag: 2.5.8.5
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -221,6 +221,13 @@ Action hooks available:

== Changelog ==

= 2.5.8.5 =
* Fix: Lightbox issue fix
* Fix: Comma based search fix

= 2.5.8.4 =
* Fix: Minor styles fixes

= 2.5.8.3 =
* Fix: Search filter not showing results bug fix

Expand Down
10 changes: 5 additions & 5 deletions sell-media.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Sell Media
* Plugin URI: http://graphpaperpress.com/plugins/sell-media/
* Description: A plugin for selling photos, prints and other downloads.
* Version: 2.5.8.4
* Version: 2.5.8.5
* Author: Graph Paper Press
* Author URI: http://graphpaperpress.com
* Author Email: [email protected]
Expand All @@ -24,7 +24,7 @@
* @package SellMedia
* @category Core
* @author Thad Allender
* @version 2.5.8.4
* @version 2.5.8.5
*/

// Exit if accessed directly.
Expand Down Expand Up @@ -155,7 +155,7 @@ public static function instance() {
*/
public function __clone() {
// Cloning instances of the class is forbidden.
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'sell_media' ), '2.5.8.4' );
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'sell_media' ), '2.5.8.5' );
}

/**
Expand All @@ -167,7 +167,7 @@ public function __clone() {
*/
public function __wakeup() {
// Unserializing instances of the class is forbidden.
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'sell_media' ), '2.5.8.4' );
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'sell_media' ), '2.5.8.5' );
}

/**
Expand All @@ -181,7 +181,7 @@ private function constants() {

// Plugin version.
if ( ! defined( 'SELL_MEDIA_VERSION' ) ) {
define( 'SELL_MEDIA_VERSION', '2.5.8.4' );
define( 'SELL_MEDIA_VERSION', '2.5.8.5' );
}

// Plugin Folder Path.
Expand Down

0 comments on commit b290f73

Please sign in to comment.