From 307ed2789609a532b6a3acccfb06c53c7e2d671b Mon Sep 17 00:00:00 2001 From: stiofan Date: Thu, 10 Oct 2024 14:22:24 +0100 Subject: [PATCH] SD updated --- vendor/ayecode/wp-super-duper/change-log.txt | 4 +- .../ayecode/wp-super-duper/sd-functions.php | 54 ++++++++++++------- vendor/ayecode/wp-super-duper/sd-plugin.php | 2 +- .../ayecode/wp-super-duper/wp-super-duper.php | 2 +- vendor/composer/installed.json | 14 ++--- vendor/composer/installed.php | 10 ++-- 6 files changed, 51 insertions(+), 35 deletions(-) diff --git a/vendor/ayecode/wp-super-duper/change-log.txt b/vendor/ayecode/wp-super-duper/change-log.txt index b43dc2a7..7b2ba772 100644 --- a/vendor/ayecode/wp-super-duper/change-log.txt +++ b/vendor/ayecode/wp-super-duper/change-log.txt @@ -1,4 +1,6 @@ -= 1.2.12 - 2024-10-10 = += 1.2.13 - 2024-10-10 = +* sd_template_page_options() not allowing child page selection - FIXED +* Filter added `sd_template_page_options_limit` to adjust the 500 pages limit - ADDED * Multiple blocks with taxonomy linking feature can cause ajax query to loop and freeze browser - FIXED * __experimentalGetPreviewDeviceType is deprecated - FIXED diff --git a/vendor/ayecode/wp-super-duper/sd-functions.php b/vendor/ayecode/wp-super-duper/sd-functions.php index c43bb105..83bce0aa 100644 --- a/vendor/ayecode/wp-super-duper/sd-functions.php +++ b/vendor/ayecode/wp-super-duper/sd-functions.php @@ -3165,9 +3165,17 @@ function sd_visibility_output_options() { * @return array Template page options. */ function sd_template_page_options( $args = array() ) { - global $sd_tmpl_page_options,$wpdb; + global $wpdb, $sd_tmpl_page_options; - if ( ! empty( $sd_tmpl_page_options ) ) { + $defaults = array( + 'nocache' => false, + 'with_slug' => false, + 'default_label' => __( 'Select Page...', 'ayecode-connect' ) + ); + + $args = wp_parse_args( $args, $defaults ); + + if ( ! empty( $sd_tmpl_page_options ) && empty( $args['nocache'] ) ) { return $sd_tmpl_page_options; } @@ -3182,42 +3190,48 @@ function sd_template_page_options( $args = array() ) { $exclude_pages_placeholders = ''; if ( ! empty( $exclude_pages ) ) { - // Sanitize the array of excluded pages and implode it for the SQL query - $exclude_pages_placeholders = implode(',', array_fill(0, count($exclude_pages), '%d')); + // Sanitize the array of excluded pages and implode it for the SQL query. + $exclude_pages_placeholders = implode( ',', array_fill( 0, count( $exclude_pages ), '%d' ) ); } - // Prepare the base SQL query, including child_of = 0 (only root-level pages) - $sql = " - SELECT ID, post_title - FROM $wpdb->posts - WHERE post_type = 'page' - AND post_status = 'publish' - AND post_parent = 0 - "; + // Prepare the base SQL query. + $sql = "SELECT ID, post_title, post_name FROM " . $wpdb->posts . " WHERE post_type = 'page' AND post_status = 'publish'"; // Add the exclusion if there are pages to exclude if ( ! empty( $exclude_pages ) ) { $sql .= " AND ID NOT IN ($exclude_pages_placeholders)"; } - // Add sorting + // Add sorting. $sql .= " ORDER BY post_title ASC"; - // Prepare the SQL query to include the excluded pages - $pages = $wpdb->get_results( $wpdb->prepare( $sql, ...$exclude_pages ) ); + // Add a limit. + $limit = (int) apply_filters( 'sd_template_page_options_limit', 500, $args ); + + if ( $limit > 0 ) { + $sql .= " LIMIT " . (int) $limit; + } + + // Prepare the SQL query to include the excluded pages only if we have placeholders. + $pages = $exclude_pages_placeholders ? $wpdb->get_results( $wpdb->prepare( $sql, ...$exclude_pages ) ) : $wpdb->get_results( $sql ); + + if ( ! empty( $args['default_label'] ) ) { + $options = array( '' => $args['default_label'] ); + } else { + $options = array(); + } - $options = array( '' => __( 'Select Page...', 'ayecode-connect' ) ); if ( ! empty( $pages ) ) { foreach ( $pages as $page ) { - if ( ! empty( $page->ID ) && ! empty( $page->post_title ) ) { - $options[ $page->ID ] = $page->post_title . ' (#' . $page->ID . ')'; - } + $title = ! empty( $args['with_slug'] ) ? $page->post_title . ' (' . $page->post_name . ')' : ( $page->post_title . ' (#' . $page->ID . ')' ); + + $options[ $page->ID ] = $title; } } $sd_tmpl_page_options = $options; - return apply_filters( 'sd_template_page_options', $options ); + return apply_filters( 'sd_template_page_options', $options, $args ); } /** diff --git a/vendor/ayecode/wp-super-duper/sd-plugin.php b/vendor/ayecode/wp-super-duper/sd-plugin.php index 73e3995d..e5072a3a 100644 --- a/vendor/ayecode/wp-super-duper/sd-plugin.php +++ b/vendor/ayecode/wp-super-duper/sd-plugin.php @@ -5,7 +5,7 @@ * @wordpress-plugin * Plugin Name: Super Duper - Examples * Description: This is a Hello World test plugin for WP Super Duper Class. - * Version: 1.2.12 + * Version: 1.2.13 * Author: AyeCode * Author URI: https://ayecode.io * Text Domain: super-duper diff --git a/vendor/ayecode/wp-super-duper/wp-super-duper.php b/vendor/ayecode/wp-super-duper/wp-super-duper.php index 1fba1f80..a378779a 100644 --- a/vendor/ayecode/wp-super-duper/wp-super-duper.php +++ b/vendor/ayecode/wp-super-duper/wp-super-duper.php @@ -5,7 +5,7 @@ if ( ! class_exists( 'WP_Super_Duper' ) ) { - define( 'SUPER_DUPER_VER', '1.2.12' ); + define( 'SUPER_DUPER_VER', '1.2.13' ); /** * A Class to be able to create a Widget, Shortcode or Block to be able to output content for WordPress. diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 320bc6af..97831c64 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -246,24 +246,24 @@ }, { "name": "ayecode/wp-super-duper", - "version": "1.2.12", - "version_normalized": "1.2.12.0", + "version": "1.2.13", + "version_normalized": "1.2.13.0", "source": { "type": "git", "url": "https://github.com/AyeCode/wp-super-duper.git", - "reference": "702aa518ff9c649289b7e43b086fd6d2f8b522a8" + "reference": "9b7216a5175c4d12b030d28a87a05aaed91c4eea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/AyeCode/wp-super-duper/zipball/702aa518ff9c649289b7e43b086fd6d2f8b522a8", - "reference": "702aa518ff9c649289b7e43b086fd6d2f8b522a8", + "url": "https://api.github.com/repos/AyeCode/wp-super-duper/zipball/9b7216a5175c4d12b030d28a87a05aaed91c4eea", + "reference": "9b7216a5175c4d12b030d28a87a05aaed91c4eea", "shasum": "" }, "require": { "composer/installers": "~1.0", "php": ">=5.4.0" }, - "time": "2024-10-10T09:36:05+00:00", + "time": "2024-10-10T13:21:28+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -295,7 +295,7 @@ ], "support": { "issues": "https://github.com/AyeCode/wp-super-duper/issues", - "source": "https://github.com/AyeCode/wp-super-duper/tree/1.2.12" + "source": "https://github.com/AyeCode/wp-super-duper/tree/1.2.13" }, "install-path": "../ayecode/wp-super-duper" }, diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index e6e4c04f..a4668783 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'ayecode/geodirectory', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => 'a8c3e43ad5c98b807be9b9aefc1939335a76cd02', + 'reference' => 'b9015fec8fdb31fd80ef0ebf6acde24f1d9cb3f9', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -22,7 +22,7 @@ 'ayecode/geodirectory' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => 'a8c3e43ad5c98b807be9b9aefc1939335a76cd02', + 'reference' => 'b9015fec8fdb31fd80ef0ebf6acde24f1d9cb3f9', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -65,9 +65,9 @@ 'dev_requirement' => false, ), 'ayecode/wp-super-duper' => array( - 'pretty_version' => '1.2.12', - 'version' => '1.2.12.0', - 'reference' => '702aa518ff9c649289b7e43b086fd6d2f8b522a8', + 'pretty_version' => '1.2.13', + 'version' => '1.2.13.0', + 'reference' => '9b7216a5175c4d12b030d28a87a05aaed91c4eea', 'type' => 'library', 'install_path' => __DIR__ . '/../ayecode/wp-super-duper', 'aliases' => array(),