Skip to content

Commit

Permalink
SD updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Stiofan committed Oct 10, 2024
1 parent f475a08 commit 307ed27
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 35 deletions.
4 changes: 3 additions & 1 deletion vendor/ayecode/wp-super-duper/change-log.txt
Original file line number Diff line number Diff line change
@@ -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

Expand Down
54 changes: 34 additions & 20 deletions vendor/ayecode/wp-super-duper/sd-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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 );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion vendor/ayecode/wp-super-duper/sd-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion vendor/ayecode/wp-super-duper/wp-super-duper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 7 additions & 7 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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"
},
Expand Down
10 changes: 5 additions & 5 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit 307ed27

Please sign in to comment.