Skip to content

Commit

Permalink
Merge pull request #207 from dcooney/feature/6.1.1-fixes
Browse files Browse the repository at this point in the history
Feature/6.1.1 fixes
  • Loading branch information
dcooney authored Sep 27, 2023
2 parents 6937e81 + 17b7739 commit 9832914
Show file tree
Hide file tree
Showing 19 changed files with 7,394 additions and 9,196 deletions.
14 changes: 13 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: infinite scroll, load more, ajax, lazy load, endless scroll, infinite scro
Requires at least: 4.4
Requires PHP: 5.6
Tested up to: 6.3
Stable tag: 6.1.0.1
Stable tag: 6.2.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -261,6 +261,18 @@ How to install Ajax Load More.

== Changelog ==

= 6.2.0 - September 27, 2023 =
* UPDATE: Added support for GA4 integration across various add-ons.
* UPDATE: Updated Shortcode builder to accept new plugin parameters for Next Page add-on.
* UPDATE: Code cleanup and organization.
* FIX: Fixed issue with encoding of Canonical URL potentially causing http errors in Ajax request.
* FIX: Fixed various issues in Shortcode Builder.
* FIX: Fixed issue with unclosed HTML element when using seo_offset parameter.
* FIX: Fixed issue with default ALM search parameter being encoded incorrectly.
* FIX: Fixed issue with seo_offset parameter not displaying results due to JS error.
* FIX: Various security fixes and patches.


= 6.1.0.1 - August 8, 2023 =
* HOTFIX: Fixed issue with querying data using `custom_args` parameter.
* HOTFIX: Fixed issue with querying data using the `vars` parameter.
Expand Down
21 changes: 1 addition & 20 deletions admin/functions/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,24 +239,6 @@ function alm_disable_css_callback() {
echo $html; // phpcs:ignore
}

/**
* Disbale the ALM shortcode button in the WordPress content editor.
*
* @since 2.2.1
* @deprecated 5.4.2
*/
function alm_hide_btn_callback() {
$options = get_option( 'alm_settings' );
if ( ! isset( $options['_alm_hide_btn'] ) ) {
$options['_alm_hide_btn'] = '0';
}

$html = '<input type="hidden" name="alm_settings[_alm_hide_btn]" value="0" /><input type="checkbox" id="alm_hide_btn" name="alm_settings[_alm_hide_btn]" value="1"' . ( ( $options['_alm_hide_btn'] ) ? ' checked="checked"' : '' ) . ' />';
$html .= '<label for="alm_hide_btn">' . __( 'Hide shortcode button in WYSIWYG editor.', 'ajax-load-more' ) . '</label>';

echo $html; // phpcs:ignore
}

/**
* Display admin error notices in browser console.
*
Expand Down Expand Up @@ -325,8 +307,7 @@ function alm_container_type_callback() {
*/
function alm_class_callback() {
$options = get_option( 'alm_settings' );

$class = isset( $options ) && isset( $options['_alm_classname'] ) ? $options['_alm_classname'] : '';
$class = isset( $options ) && isset( $options['_alm_classname'] ) ? $options['_alm_classname'] : '';

$html = '<label for="alm_settings[_alm_classname]">' . __( 'Add custom classes to the <i>.alm-listing</i> container - classes are applied globally and will appear with every instance of Ajax Load More. <span style="display:block">You can also add classes when building a shortcode.</span>', 'ajax-load-more' ) . '</label><br/>';
$html .= '<input type="text" id="alm_settings[_alm_classname]" name="alm_settings[_alm_classname]" value="' . $class . '" placeholder="posts listing etc..." /> ';
Expand Down
21 changes: 0 additions & 21 deletions admin/shortcode-builder/components/filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,27 +152,6 @@
</section>
</div>

<section>
<div class="shortcode-builder--label">
<h4><?php esc_attr_e( 'Analytics', 'ajax-load-more' ); ?> <a href="javascript:void(0)" class="fa fa-question-circle tooltip" title="<?php esc_attr_e( 'Each time the filter is updated a pageview will be sent to Google Analytics.', 'ajax-load-more' ); ?>"></a></h4>
<p><?php esc_attr_e( 'Send pageviews to Google Analytics.', 'ajax-load-more' ); ?></p>
</div>
<div class="shortcode-builder--fields">
<div class="inner">
<ul>
<li>
<input class="alm_element" type="radio" name="filters-analytics" value="true" id="filters-analytics-true" checked="checked">
<label for="filters-analytics-true"><?php esc_attr_e( 'True', 'ajax-load-more' ); ?></label>
</li>
<li>
<input class="alm_element" type="radio" name="filters-analytics" value="false" id="filters-analytics-false">
<label for="filters-analytics-false"><?php esc_attr_e( 'False', 'ajax-load-more' ); ?></label>
</li>
</ul>
</div>
</div>
</section>

<section>
<div class="shortcode-builder--label">
<h4><?php esc_attr_e( 'Debug Mode', 'ajax-load-more' ); ?></h4>
Expand Down
64 changes: 33 additions & 31 deletions admin/shortcode-builder/components/nextpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,57 @@
<div class="shortcode-builder--fields">
<div class="inner">
<ul>
<li>
<input class="alm_element" type="radio" name="next-page" value="true" id="next-page-true" >
<label for="next-page-true"><?php _e('True', 'ajax-load-more'); ?></label>
</li>
<li>
<input class="alm_element" type="radio" name="next-page" value="false" id="next-page-false" checked="checked">
<label for="next-page-false"><?php _e('False', 'ajax-load-more'); ?></label>
</li>
<li>
<input class="alm_element" type="radio" name="next-page" value="true" id="next-page-true" >
<label for="next-page-true"><?php _e('True', 'ajax-load-more'); ?></label>
</li>
<li>
<input class="alm_element" type="radio" name="next-page" value="false" id="next-page-false" checked="checked">
<label for="next-page-false"><?php _e('False', 'ajax-load-more'); ?></label>
</li>
</ul>
</div>
</div>
</section>


<div class="next-page-content nested-component" style="display: none;">
<div class="nested-component--inner">

<section>
<div class="shortcode-builder--label">
<h4><?php _e('Post ID', 'ajax-load-more'); ?></h4>
<p><?php _e('The ID of the current page/post.', 'ajax-load-more'); ?></p>
<p><small><?php _e('Note: %post_id% will be converted to the current Post ID automatically.', 'ajax-load-more'); ?></small></p>
</div>
<div class="shortcode-builder--fields">
<div class="inner">
<input type="text" value="get_the_ID()" id="next-page_post_id" class="alm_element disabled-input" disabled="disabled">
<input type="text" value="%post_id%" id="next-page_post_id" class="alm_element disabled-input" disabled="disabled">
</div>
</div>
</section>

<section>
<div class="shortcode-builder--label">
<h4><?php _e('Type', 'ajax-load-more'); ?></h4>
<p><?php _e('Select the Next Page loading type.', 'ajax-load-more'); ?></p>
<p><small><?php _e('Note: Fullpage will load the entire post content with on initial page load', 'ajax-load-more'); ?></small></p>
</div>
<div class="shortcode-builder--fields">
<div class="inner">
<ul>
<li>
<input class="alm_element" type="radio" name="next-page-type" value="paged" id="next-page-paged" checked="checked">
<label for="next-page-paged"><?php _e('Paged', 'ajax-load-more'); ?></label>
</li>
<li>
<input class="alm_element" type="radio" name="next-page-type" value="fullpage" id="next-page-fullpage">
<label for="next-page-fullpage"><?php _e('Fullpage', 'ajax-load-more'); ?></label>
</li>
</ul>
</div>
</div>
</section>

<section>
<div class="shortcode-builder--label">
<h4><?php _e('URL Rewrite', 'ajax-load-more'); ?></h4>
Expand Down Expand Up @@ -84,31 +106,11 @@
</div>
</section>

<section>
<div class="shortcode-builder--label">
<h4>
<?php _e('Google Analytics', 'ajax-load-more'); ?>
<a href="javascript:void(0)" class="fa fa-question-circle tooltip" title="<?php _e('You must have a reference to your Google Analytics tracking code already on the page.','ajax-load-more'); ?>"></a>
</h4>
<p><?php _e('Each time a page is loaded it will count as a pageview.', 'ajax-load-more'); ?></p>
</div>
<div class="shortcode-builder--fields">
<div class="inner">
<ul>
<li style="width:100%;">
<input class="alm_element" type="checkbox" name="next-page-pageviews" id="next-page-pageviews" value="true" checked="checked">
<label for="next-page-pageviews"><?php _e('Yes, send pageviews to Google Analytics.', 'ajax-load-more'); ?></label>
</li>
</ul>
</div>
</div>
</section>

<section>
<div class="shortcode-builder--label">
<h4><?php _e('Scroll to Page', 'ajax-load-more'); ?></h4>
<p>
<?php _e('Scroll users automatically to the next page on \'Load More\' action.', 'ajax-load-more'); ?>
<?php _e('Automatically slide users to the next page when the \'Load More\' action completes.', 'ajax-load-more'); ?>
</p>
</div>
<div class="shortcode-builder--fields">
Expand Down
18 changes: 7 additions & 11 deletions admin/shortcode-builder/js/shortcode-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,6 @@ jQuery(document).ready(function ($) {
$('#filter-scrollTopOptions').slideUp(250, 'alm_easeInOutQuad');
}

var filters_analytics = $('#alm-filters input[name=filters-analytics]:checked').val().trim();
if (filters_analytics !== '' && filters_analytics !== 'true') output += ' filters_analytics="' + filters_analytics + '"';

var filters_debug = $('#alm-filters input[name=filters-debug]:checked').val().trim();
if (filters_debug !== '' && filters_debug !== 'false') output += ' filters_debug="' + filters_debug + '"';
} else {
Expand Down Expand Up @@ -375,28 +372,27 @@ jQuery(document).ready(function ($) {
var nextpage = $('.next-page input[name=next-page]:checked').val();
if (nextpage !== 'false' && nextpage !== undefined) {
var nextpage_post_id = $('#next-page_post_id').val(),
nextpage_type = $('.next-page input[name=next-page-type]:checked').val(),
nextpage_url = $('input#next-page-url:checked').val(),
nextpage_pageviews = $('input#next-page-pageviews:checked').val(),
nextpage_scroll = $('select#next-page-scroll').val(),
nextpage_scrolltop = $('input#next-page-scroll-top').val(),
nextpage_title_template = $('input#next-page-title-template').val();

$('.next-page-content').slideDown(250, 'alm_easeInOutQuad');

output += ' nextpage="' + nextpage + '"';
output += ' nextpage_post_id="\'.' + nextpage_post_id + '.\'"';
output += nextpage_type !== 'paged' ? ' nextpage_type="' + nextpage_type + '"' : '';
output += ' nextpage_post_id="' + nextpage_post_id + '"';

if (nextpage_url !== 'true') {
output += ' nextpage_urls="false"';
}
if (nextpage_pageviews !== 'true') {
output += ' nextpage_pageviews="false"';
}
if (nextpage_title_template) {
output += ' nextpage_title_template="' + nextpage_title_template + '"';
}

output += ' nextpage_scroll="' + nextpage_scroll + ':' + nextpage_scrolltop + '"';
if (nextpage_scroll !== 'false' || nextpage_scrolltop !== '30') {
output += ' nextpage_scroll="' + nextpage_scroll + ':' + nextpage_scrolltop + '"';
}
} else {
$('.next-page-content').slideUp(250, 'alm_easeInOutQuad');
}
Expand Down Expand Up @@ -1663,7 +1659,7 @@ jQuery(document).ready(function ($) {
if (target) {
$('html, body').animate(
{
scrollTop: target.offset().top - 45,
scrollTop: target.offset().top - 120,
},
350,
function () {
Expand Down
9 changes: 4 additions & 5 deletions ajax-load-more.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
* Author: Darren Cooney
* Twitter: @KaptonKaos
* Author URI: https://connekthq.com
* Version: 6.1.0.1
* Version: 6.2.0
* License: GPL
* Copyright: Darren Cooney & Connekt Media
*
* @package AjaxLoadMore
*/

define( 'ALM_VERSION', '6.1.0.1' );
define( 'ALM_RELEASE', 'August 8, 2023' );
define( 'ALM_VERSION', '6.2.0' );
define( 'ALM_RELEASE', 'September 27, 2023' );
define( 'ALM_STORE_URL', 'https://connekthq.com' );

// Plugin installation helpers.
Expand Down Expand Up @@ -369,16 +369,15 @@ public function alm_enqueue_scripts() {
'ajax-load-more',
'alm_localize',
[
'pluginurl' => ALM_URL,
'version' => ALM_VERSION,
'ajaxurl' => apply_filters( 'alm_ajaxurl', admin_url( 'admin-ajax.php' ) ),
'alm_nonce' => wp_create_nonce( 'ajax_load_more_nonce' ),
'rest_api' => esc_url_raw( rest_url() ),
'rest_nonce' => wp_create_nonce( 'wp_rest' ),
'trailing_slash' => substr( get_option( 'permalink_structure' ), -1 ) === '/' ? 'true' : 'false', // Trailing slash in permalink structure.
'is_front_page' => is_home() || is_front_page() ? 'true' : 'false',
'pluginurl' => ALM_URL,
'speed' => apply_filters( 'alm_speed', 200 ),
'ga_debug' => apply_filters( 'alm_ga_debug', 'false' ),
'results_text' => apply_filters( 'alm_display_results', __( 'Viewing {post_count} of {total_posts} results.', 'ajax-load-more' ) ),
'no_results_text' => apply_filters( 'alm_no_results_text', __( 'No results found.', 'ajax-load-more' ) ),
'alm_debug' => apply_filters( 'alm_debug', false ),
Expand Down
2 changes: 1 addition & 1 deletion build/frontend/ajax-load-more.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '62c50fe52f368748a828');
<?php return array('dependencies' => array(), 'version' => '91e35732448d36edb841');
Loading

0 comments on commit 9832914

Please sign in to comment.