Skip to content

Commit

Permalink
6.2.0.2 release prep
Browse files Browse the repository at this point in the history
  • Loading branch information
dcooney committed Nov 3, 2023
1 parent 9dca4e1 commit acb1af9
Show file tree
Hide file tree
Showing 11 changed files with 156 additions and 163 deletions.
235 changes: 119 additions & 116 deletions admin/shortcode-builder/components/rest-api.php
Original file line number Diff line number Diff line change
@@ -1,125 +1,128 @@
<?php if(has_action('alm_rest_api_installed')){
<?php
/**
* REST API Shortcode options.
*
* @package AjaxLoadMore
*/

// get rest defaults (from core alm settings)
if ( has_action( 'alm_rest_api_installed' ) ) {
$restapi_baseurl = '/wp-json';
if(isset($alm_options['_alm_rest_api_base_url']))
$restapi_baseurl = $alm_options['_alm_rest_api_base_url'];
if ( isset( $alm_options['_alm_rest_api_base_url'] ) ) {
$restapi_baseurl = $alm_options['_alm_rest_api_base_url'];
}

$restapi_namespace = 'ajaxloadmore';
if(isset($alm_options['_alm_rest_api_namespace']))
$restapi_namespace = $alm_options['_alm_rest_api_namespace'];
if ( isset( $alm_options['_alm_rest_api_namespace'] ) ) {
$restapi_namespace = $alm_options['_alm_rest_api_namespace'];
}

$restapi_endpoint = 'posts';
if(isset($alm_options['_alm_rest_api_endpoint']))
$restapi_endpoint = $alm_options['_alm_rest_api_endpoint'];

?>
if ( isset( $alm_options['_alm_rest_api_endpoint'] ) ) {
$restapi_endpoint = $alm_options['_alm_rest_api_endpoint'];
}
?>
<div class="row input rest add-on" id="alm-rest">
<h3 class="heading" tabindex="0"><?php _e('REST API', 'ajax-load-more'); ?></h3>
<div class="expand-wrap">

<section class="first">
<div class="shortcode-builder--label">
<p><?php _e('Enable the WordPress REST API.', 'ajax-load-more'); ?></p>
</div>
<div class="shortcode-builder--fields">
<div class="inner">
<ul>
<li>
<input class="alm_element" type="radio" name="rest" value="true" id="rest-true" >
<label for="rest-true"><?php _e('True', 'ajax-load-more'); ?></label>
</li>
<li>
<input class="alm_element" type="radio" name="rest" value="false" id="rest-false" checked="checked">
<label for="rest-false"><?php _e('False', 'ajax-load-more'); ?></label>
</li>
</ul>
</div>
</div>
</section>
<h3 class="heading" tabindex="0"><?php esc_attr_e( 'REST API', 'ajax-load-more' ); ?></h3>
<div class="expand-wrap">

<section class="first">
<div class="shortcode-builder--label">
<p><?php esc_attr_e( 'Enable the WordPress REST API.', 'ajax-load-more' ); ?></p>
</div>
<div class="shortcode-builder--fields">
<div class="inner">
<ul>
<li>
<input class="alm_element" type="radio" name="rest" value="true" id="rest-true" >
<label for="rest-true"><?php esc_attr_e( 'True', 'ajax-load-more' ); ?></label>
</li>
<li>
<input class="alm_element" type="radio" name="rest" value="false" id="rest-false" checked="checked">
<label for="rest-false"><?php esc_attr_e( 'False', 'ajax-load-more' ); ?></label>
</li>
</ul>
</div>
</div>
</section>

<div class="restapi_options nested-component">
<div class="nested-component--inner">
<section>
<div class="shortcode-builder--label">
<h4><?php esc_attr_e( 'Base URL', 'ajax-load-more' ); ?>
<a href="javascript:void(0)" class="fa fa-question-circle tooltip" title="<?php esc_attr_e( 'Set a default Base URL in the Ajax Load More settings panel', 'ajax-load-more' ); ?>."></a></h4>
<p><?php esc_attr_e( 'Enter the base URL to your installation of the REST API.', 'ajax-load-more' ); ?></p>
</div>
<div class="shortcode-builder--fields">
<div class="inner">
<input type="text" id="rest-base" class="alm_element" name="rest-base" value="<?php echo $restapi_baseurl; ?>">
</div>
</div>
</section>

<section>
<div class="shortcode-builder--label">
<h4><?php esc_attr_e( 'Namespace', 'ajax-load-more' ); ?>
<a href="javascript:void(0)" class="fa fa-question-circle tooltip" title="<?php esc_attr_e( 'Set a default Namespace in the Ajax Load More settings panel', 'ajax-load-more' ); ?>."></a></h4>
<p><?php esc_attr_e( 'Enter the custom namespace for this Ajax Load More query.', 'ajax-load-more' ); ?></p>
</div>
<div class="shortcode-builder--fields">
<div class="inner">
<input type="text" id="rest-namespace" class="alm_element" name="rest-namespace" value="<?php echo $restapi_namespace; ?>">
</div>
</div>
</section>

<section>
<div class="shortcode-builder--label">
<h4><?php esc_attr_e( 'Endpoint', 'ajax-load-more' ); ?>
<a href="javascript:void(0)" class="fa fa-question-circle tooltip" title="<?php esc_attr_e( 'Set a default Endpoint in the Ajax Load More settings panel', 'ajax-load-more' ); ?>."></a></h4>
<p><?php esc_attr_e( 'Enter your custom endpoint for this Ajax Load More query.', 'ajax-load-more' ); ?></p>
</div>
<div class="shortcode-builder--fields">
<div class="inner">
<input type="text" id="rest-endpoint" class="alm_element" name="rest-endpoint" value="<?php echo $restapi_endpoint; ?>">
</div>
</div>
</section>

<section>
<div class="shortcode-builder--label">
<h4><?php esc_attr_e( 'Template ID', 'ajax-load-more' ); ?> <a href="javascript:void(0)" class="fa fa-question-circle tooltip" title="<?php esc_attr_e( 'Ajax Load More references this ID while looping and displaying your data. You must still select a repeater template for this instance of Ajax Load More', 'ajax-load-more' ); ?>">.</a></h4>
<p><?php _e( 'Enter the ID of your javascript template.<br/><br/>e.g. <em>tmpl-alm-template</em> = <em>alm-template</em>', 'ajax-load-more' ); ?><br/>&raquo; <a href="https://gist.github.com/dcooney/c89f5859b73256b36de4a0c3320d9b07" target="_blank"><?php _e( 'View Example', 'ajax-load-more' ); ?></a></p>
</div>
<div class="shortcode-builder--fields">
<div class="inner">
<input type="text" id="rest-template-id" class="alm_element" name="rest-template-id" value="">
</div>
</div>
</section>

<div class="restapi_options nested-component">
<div class="nested-component--inner">

<section>
<div class="shortcode-builder--label">
<h4><?php _e('Base URL', 'ajax-load-more'); ?>
<a href="javascript:void(0)" class="fa fa-question-circle tooltip" title="<?php _e('Set a default Base URL in the Ajax Load More settings panel','ajax-load-more'); ?>."></a></h4>
<p><?php _e('Enter the base URL to your installation of the REST API.', 'ajax-load-more'); ?></p>
</div>
<div class="shortcode-builder--fields">
<div class="inner">
<input type="text" id="rest-base" class="alm_element" name="rest-base" value="<?php echo $restapi_baseurl; ?>">
</div>
</div>
</section>

<section>
<div class="shortcode-builder--label">
<h4><?php _e('Namespace', 'ajax-load-more'); ?>
<a href="javascript:void(0)" class="fa fa-question-circle tooltip" title="<?php _e('Set a default Namespace in the Ajax Load More settings panel','ajax-load-more'); ?>."></a></h4>
<p><?php _e('Enter the custom namespace for this Ajax Load More query.', 'ajax-load-more'); ?></p>
</div>
<div class="shortcode-builder--fields">
<div class="inner">
<input type="text" id="rest-namespace" class="alm_element" name="rest-namespace" value="<?php echo $restapi_namespace; ?>">
</div>
</div>
</section>

<section>
<div class="shortcode-builder--label">
<h4><?php _e('Endpoint', 'ajax-load-more'); ?>
<a href="javascript:void(0)" class="fa fa-question-circle tooltip" title="<?php _e('Set a default Endpoint in the Ajax Load More settings panel','ajax-load-more'); ?>."></a></h4>
<p><?php _e('Enter your custom endpoint for this Ajax Load More query.', 'ajax-load-more'); ?></p>
</div>
<div class="shortcode-builder--fields">
<div class="inner">
<input type="text" id="rest-endpoint" class="alm_element" name="rest-endpoint" value="<?php echo $restapi_endpoint; ?>">
</div>
</div>
</section>

<section>
<div class="shortcode-builder--label">
<h4><?php _e('Template ID', 'ajax-load-more'); ?> <a href="javascript:void(0)" class="fa fa-question-circle tooltip" title="<?php _e('Ajax Load More references this ID while looping and displaying your data. You must still select a repeater template for this instance of Ajax Load More','ajax-load-more'); ?>">.</a></h4>
<p><?php _e('Enter the ID of your javascript template.<br/><br/>e.g. <em>tmpl-alm-template</em> = <em>alm-template</em>', 'ajax-load-more'); ?><br/>&raquo; <a href="https://gist.github.com/dcooney/c89f5859b73256b36de4a0c3320d9b07" target="_blank"><?php _e('View Example', 'ajax-load-more'); ?></a></p>
</div>
<div class="shortcode-builder--fields">
<div class="inner">
<input type="text" id="rest-template-id" class="alm_element" name="rest-template-id" value="">
</div>
</div>
</section>

<section>
<div class="shortcode-builder--label">
<h4><?php _e('Debug Mode', 'ajax-load-more'); ?></h4>
<p><?php _e('Enable debugging (console.log) of REST API responses in the browser console. ', 'ajax-load-more'); ?></p>
</div>
<div class="shortcode-builder--fields">
<div class="inner">
<ul>
<li>
<input class="alm_element" type="radio" name="rest-debug" value="true" id="rest-debug-true" >
<label for="rest-debug-true"><?php _e('True', 'ajax-load-more'); ?></label>
</li>
<li>
<input class="alm_element" type="radio" name="rest-debug" value="false" id="rest-debug-false" checked="checked">
<label for="rest-debug-false"><?php _e('False', 'ajax-load-more'); ?></label>
</li>
</ul>
</div>
</div>
</section>

<p class="warning-callout">
<?php _e('Visit <a href="http://v2.wp-api.org/" target="_blank">http://v2.wp-api.org</a> for documentation on creating custom <a href="http://v2.wp-api.org/extending/adding/" target="_blank">Endpoints</a> for use with Ajax Load More.', 'ajax-load-more'); ?>
</p>

</div>

</div>
</div>
<section>
<div class="shortcode-builder--label">
<h4><?php esc_attr_e( 'Debug Mode', 'ajax-load-more' ); ?></h4>
<p><?php esc_attr_e( 'Enable debugging (console.log) of REST API responses in the browser console. ', 'ajax-load-more' ); ?></p>
</div>
<div class="shortcode-builder--fields">
<div class="inner">
<ul>
<li>
<input class="alm_element" type="radio" name="rest-debug" value="true" id="rest-debug-true" >
<label for="rest-debug-true"><?php esc_attr_e( 'True', 'ajax-load-more' ); ?></label>
</li>
<li>
<input class="alm_element" type="radio" name="rest-debug" value="false" id="rest-debug-false" checked="checked">
<label for="rest-debug-false"><?php esc_attr_e( 'False', 'ajax-load-more' ); ?></label>
</li>
</ul>
</div>
</div>
</section>
<p class="warning-callout">
<?php _e( 'Visit <a href="http://v2.wp-api.org/" target="_blank">http://v2.wp-api.org</a> for documentation on creating custom <a href="http://v2.wp-api.org/extending/adding/" target="_blank">Endpoints</a> for use with Ajax Load More.', 'ajax-load-more' ); ?>
</p>
</div>
</div>
</div>
</div>
<?php } ?>
<?php } ?>
2 changes: 1 addition & 1 deletion build/admin/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => 'cf6b7cc79fb2357f6ea2');
<?php return array('dependencies' => array(), 'version' => 'fb9b144ed6ad030a6820');
11 changes: 5 additions & 6 deletions build/admin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ jQuery(document).ready(function ($) {
}
},
error: function (status) {
console.log(status);
console.warn(status);
$('.restapi-access').fadeIn();
},
});
Expand Down Expand Up @@ -657,7 +657,6 @@ jQuery(document).ready(function ($) {
settingsTarget.classList.add('--saved');
settingsTarget.innerHTML = alm_admin_localize.settings_saved;
settingsForm.classList.remove('--saving');
//console.log(alm_admin_localize.ajax_load_more +' - '+ alm_admin_localize.settings_saved);
savingSettings = false;

setTimeout(function () {
Expand All @@ -674,7 +673,7 @@ jQuery(document).ready(function ($) {
settingsTarget.classList.add('--error');
settingsTarget.innerHTML = alm_admin_localize.settings_error;
settingsForm.classList.remove('--saving');
console.log(alm_admin_localize.ajax_load_more + ' - ' + alm_admin_localize.settings_error);
console.warn(alm_admin_localize.ajax_load_more + ' - ' + alm_admin_localize.settings_error);
savingSettings = false;

setTimeout(function () {
Expand Down Expand Up @@ -928,7 +927,7 @@ jQuery(document).ready(function ($) {
},

error: function (status, error) {
console.log(status, error);
console.warn(status, error);
$('.loading', parent).delay(250).fadeOut(300);
almActivating = false;
},
Expand Down Expand Up @@ -990,7 +989,7 @@ jQuery(document).ready(function ($) {
}, 400);
},
error: function (status) {
console.log(status);
console.warn(status);
textarea.removeClass('loading');
},
});
Expand Down Expand Up @@ -1023,7 +1022,7 @@ jQuery(document).ready(function ($) {
container.fadeOut();
},
error: function (xhr, status, error) {
console.log(status);
console.warn(status);
},
});
});
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' => '122f090a5bb6b5034c93');
<?php return array('dependencies' => array(), 'version' => 'ceeb363eba909c44e81b');
4 changes: 0 additions & 4 deletions build/frontend/ajax-load-more.js
Original file line number Diff line number Diff line change
Expand Up @@ -11042,9 +11042,6 @@ function almInitResultsText(alm, type = 'standard') {
case 'woocommerce': // WooCommerce
// Don't do anything
break;

default:
console.log('No results to set.'); // eslint-disable-line no-console
}
}

Expand Down Expand Up @@ -11921,7 +11918,6 @@ let alm_is_filtering = false;
for (let i = 0; i < html.length; i++) {
const result = html[i];
if (alm.restapi_debug === 'true') {
// If debug
console.log(result); // eslint-disable-line no-console
}
data += alm_rest_template(result);
Expand Down
2 changes: 1 addition & 1 deletion build/frontend/ajax-load-more.min.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => 'eebc59733d814266f978');
<?php return array('dependencies' => array(), 'version' => 'c2a2c16f26009a08d9bb');
2 changes: 1 addition & 1 deletion build/frontend/ajax-load-more.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit acb1af9

Please sign in to comment.