diff --git a/README.txt b/README.txt index f86f83f..fed5cda 100755 --- a/README.txt +++ b/README.txt @@ -4,8 +4,8 @@ Donate link: https://connekthq.com/donate/ Tags: infinite scroll, load more, lazy load, endless scroll, ajax load more Requires at least: 5.0 Requires PHP: 5.6 -Tested up to: 6.6 -Stable tag: 7.1.3 +Tested up to: 6.7 +Stable tag: 7.1.4 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -260,6 +260,20 @@ How to install Ajax Load More. == Changelog == += 7.1.4 - December 4, 2024 = +* UPDATE: Updated Axios HTTP library to latest version. +* UPDATE: Added feature to re-save default Repeater Template if template was deleted from the filesystem. +* UDPATE: Modified the `alm` db columns to match upcoming Templates add-on requirements. +* UPDATE: Added functionality required for Elementor Add-on update to support loading previous posts on paged results. +* UPDATE: Started integration with Query Loop block and Ajax Load More. +* FIX: Fixed z-index issue with ALM navigation in WP admin. +* FIX: Added fix for `load_plugin_textdomain` php notice. +* FIX: Fixed issue with Preloaded amount being 0 and no post remaining. +* FIX: Fixed issue with Comments add-on and allowing for a default post ID. +* UPDATE: Code cleanup and other minor bug fixes. +* UPDATE: Various admin UI/UX updates. + + = 7.1.3 - October 1, 2024 = * UPDATE: Various security fixes. diff --git a/admin/admin.php b/admin/admin.php index 698a1fc..e3cab60 100755 --- a/admin/admin.php +++ b/admin/admin.php @@ -24,8 +24,7 @@ function alm_admin_hooks() { require_once plugin_dir_path( __FILE__ ) . '/classes/class-nag.php'; } -// phpcs:ignore -// add_action( 'admin_init', 'alm_admin_hooks' ); +add_action( 'admin_init', 'alm_admin_hooks' ); /** * Render a notification in the dashboard. diff --git a/admin/classes/class-nag.php b/admin/classes/class-nag.php index 267fc2f..c915b23 100644 --- a/admin/classes/class-nag.php +++ b/admin/classes/class-nag.php @@ -1,11 +1,16 @@ ID, ALM_Nag::OPTION_ADMIN_NOTICE_KEY, true ); @@ -115,8 +119,8 @@ public function display_admin_notice() { $query_params = $this->get_admin_querystring_array(); $query_string = '?' . http_build_query( array_merge( $query_params, array( ALM_Nag::OPTION_ADMIN_NOTICE_KEY => '1' ) ) ); - echo '
'; - printf( __( "

You've been using Ajax Load More for some time now, could you please give it a review at wordpress.org?
All reviews, both good and bad are important as they help the plugin grow and improve over time.

Yes, I'll leave a review   No thanks   I've already done this

Check out our other Connekt WordPress plugins

" ), get_admin_url() . 'admin.php?page=ajax-load-more', 'http://wordpress.org/support/view/plugin-reviews/ajax-load-more', $query_string, $query_string ); + echo '
'; + printf( __( "

You've been using Ajax Load More for some time now, could you please give it a review at wordpress.org?
All reviews, both good and bad are important as they help the plugin grow and improve over time.

Leave Review   No thanks   I've already done this

" ), get_admin_url() . 'admin.php?page=ajax-load-more', 'http://wordpress.org/support/view/plugin-reviews/ajax-load-more', $query_string, $query_string ); echo '
'; } } diff --git a/admin/functions/plugin-updates.php b/admin/functions/plugin-updates.php index e8e8e55..e18efe5 100644 --- a/admin/functions/plugin-updates.php +++ b/admin/functions/plugin-updates.php @@ -7,104 +7,21 @@ */ /** - * Update default repeater on plugin update. - * If plugin versions do not match or the plugin has been updated and we need to update our repeaters. + * ALM upgrade routine. * - * @since 2.0.5 + * @return void */ -function alm_core_update() { - // Exit if Repeater Templates are disbaled. - if ( defined( 'ALM_DISABLE_REPEATER_TEMPLATES' ) && ALM_DISABLE_REPEATER_TEMPLATES ) { - return false; - } - - // Add 'alm_version' to WP options table if it does not exist. - if ( ! get_option( 'alm_version' ) ) { - add_option( 'alm_version', ALM_VERSION ); - } - - $alm_installed_ver = get_option( 'alm_version' ); - if ( $alm_installed_ver !== ALM_VERSION ) { - alm_run_update(); // Update repeaters. - } -} -add_action( 'init', 'alm_core_update' ); - -/** - * Run the plugin update on all blogs. - * - * @since 2.7.2 - */ -function alm_run_update() { - global $wpdb; - - if ( is_multisite() ) { - $blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ); - - // Loop all blogs and run update routine. - foreach ( $blog_ids as $blog_id ) { - switch_to_blog( $blog_id ); - alm_update_template_files(); - update_option( 'alm_version', ALM_VERSION ); - restore_current_blog(); - } - } else { - alm_update_template_files(); - update_option( 'alm_version', ALM_VERSION ); - } -} - -/** - * Update routine for template files. - * - * @throws Exception Unable to write to template file. - * @since 2.7.2 - */ -function alm_update_template_files() { - global $wpdb; - $table_name = $wpdb->prefix . 'alm'; - - // Get all rows where name is 'default'. - $rows = $wpdb->get_results( "SELECT * FROM $table_name WHERE name = 'default'" ); // phpcs:ignore - - if ( $rows ) { - - foreach ( $rows as $row ) { - $data = $wpdb->get_var( "SELECT repeaterDefault FROM $table_name WHERE name = 'default'" ); // phpcs:ignore - - // If required: Create base directory (alm_templates). - $base_dir = AjaxLoadMore::alm_get_repeater_path(); - AjaxLoadMore::alm_mkdir( $base_dir ); - - $file = $base_dir . '/default.php'; - - /** - * Create template only if the template does not exist. - * - * Note: This should never ever run, but this is used as a fallback incase for some reason Repeater - * have been deleted or cleaned by another plugin. - */ - if ( ! file_exists( $file ) ) { - try { - // phpcs:ignore - $o = fopen( $file, 'w+' ); // Open file. - if ( ! $o ) { - throw new Exception( '[Ajax Load More] Error opening default repeater template - Please check your file path and ensure your server is configured to allow Ajax Load More to read and write files within the `' . $base_dir . '` directory.' ); - } - // phpcs:ignore - $w = fwrite( $o, $data ); // Save the file. - if ( ! $w ) { - throw new Exception( '[Ajax Load More] Error updating default repeater template - Please check your file path and ensure your server is configured to allow Ajax Load More to read and write files within the `' . $base_dir . '` directory.' ); - } - // phpcs:ignore - fclose( $o ); // Close file. - - } catch ( Exception $e ) { // Display error message in console. - if ( ! isset( $options['_alm_error_notices'] ) || $options['_alm_error_notices'] === '1' ) { - echo ''; - } - } - } - } +function alm_upgrade_routine() { + // Delete `pluginVersion` column from `alm` table. + if ( get_option( 'alm_drop_pluginVersion' ) !== 'true' ) { + global $wpdb; + $table_name = $wpdb->prefix . 'alm'; + $wpdb->hide_errors(); // Suppress errors. + $wpdb->query( "ALTER TABLE $table_name DROP pluginVersion" ); + update_option( 'alm_drop_pluginVersion', 'true' ); + + // Delete alm_version option. + delete_option( 'alm_version' ); } } +add_action( 'admin_init', 'alm_upgrade_routine' ); diff --git a/admin/functions/repeater-templates.php b/admin/functions/repeater-templates.php index e5ae20e..fe5022e 100644 --- a/admin/functions/repeater-templates.php +++ b/admin/functions/repeater-templates.php @@ -31,10 +31,10 @@ function alm_save_repeater() { $options = get_option( 'alm_settings' ); // Get form variables. - $c = Trim( stripslashes( $form_data['value'] ) ); // Value. - $n = Trim( stripslashes( str_replace( '/', '', $form_data['repeater'] ) ) ); // Name. - $t = Trim( stripslashes( $form_data['type'] ) ); // Type. - $a = Trim( stripslashes( $form_data['alias'] ) ); // Alias. + $c = trim( stripslashes( $form_data['value'] ) ); // Value. + $n = trim( stripslashes( str_replace( '/', '', $form_data['repeater'] ) ) ); // Name. + $t = trim( stripslashes( $form_data['type'] ) ); // Type. + $a = trim( stripslashes( $form_data['alias'] ) ); // Alias. // Default. if ( $t === 'default' ) { @@ -81,24 +81,19 @@ function alm_save_repeater() { // Save to database. if ( $t === 'default' ) { - $data_update = [ - 'repeaterDefault' => "$c", - 'pluginVersion' => ALM_VERSION, - ]; + $data_update = [ 'repeaterDefault' => "$c" ]; $data_where = [ 'name' => 'default' ]; } elseif ( $t === 'unlimited' ) { // Custom Repeaters v2. $table_name = $wpdb->prefix . 'alm_unlimited'; $data_update = [ 'repeaterDefault' => "$c", 'alias' => "$a", - 'pluginVersion' => ALM_UNLIMITED_VERSION, ]; $data_where = [ 'name' => $n ]; } else { // Custom Repeaters. $data_update = [ 'repeaterDefault' => "$c", 'alias' => "$a", - 'pluginVersion' => ALM_REPEATER_VERSION, ]; $data_where = [ 'name' => $n ]; } diff --git a/admin/functions/settings.php b/admin/functions/settings.php index 2f60b1e..94d3132 100644 --- a/admin/functions/settings.php +++ b/admin/functions/settings.php @@ -278,11 +278,11 @@ function alm_container_type_callback() { ?> /> />
diff --git a/admin/views/repeater-templates.php b/admin/views/repeater-templates.php index a2d3eea..f03251f 100755 --- a/admin/views/repeater-templates.php +++ b/admin/views/repeater-templates.php @@ -147,18 +147,17 @@ } else { // Custom Repeaters. if ( has_action( 'alm_custom_repeaters' ) || has_action( 'alm_unlimited_repeaters' ) ) { - // Expand/Collapse toggle. - include ALM_PATH . 'admin/includes/components/toggle-all-button.php'; + include ALM_PATH . 'admin/includes/components/toggle-all-button.php'; // Expand/Collapse toggle. } ?>

@@ -209,7 +211,20 @@ ?>
- + prefix . 'alm'; + $row = $wpdb->get_row( "SELECT * FROM $table_name WHERE repeaterType = 'default'" ); // Get first result only + $content = ! empty ( $row ) && $row->repeaterDefault ? $row->repeaterDefault : ''; + ?> +

+ +

+ +