WordPress Infinite Scroll – Ajax Load More - Version 2.14.1

Version Description

  • March 24, 2017 =

  • NEW - Adding built in support for sticky posts (sticky_posts="true").

  • NEW - Added new alm_js_dependencies filter for removing jQuery dependency.

  • NEW - New alm_enqueue_external_scripts action for loading external JS files.

  • NEW - Adding support for paging + comments add-on.

  • FIX - Fixed issue with some addons not appearing in Shortcode Builder.

  • UPDATE - Various UI Updates and enhancements.

Download this release

Release Info

Developer dcooney
Plugin Icon 128x128 WordPress Infinite Scroll – Ajax Load More
Version 2.14.1
Comparing to
See all releases

Code changes from version 2.14.0 to 2.14.1

Files changed (40) hide show
  1. .editorconfig +16 -0
  2. README.txt +68 -58
  3. admin/admin-functions.php +5 -6
  4. admin/admin.php +460 -459
  5. admin/css/admin.css +65 -35
  6. admin/editor/editor-build.php +21 -21
  7. admin/editor/editor.php +5 -5
  8. admin/includes/components/custom-layouts.php +4 -4
  9. admin/includes/components/layout-list.php +12 -12
  10. admin/includes/components/repeater-options.php +1 -1
  11. admin/includes/cta/about.php +32 -30
  12. admin/includes/cta/add-ons.php +4 -2
  13. admin/includes/cta/dyk.php +30 -22
  14. admin/includes/cta/mailinglist.php +0 -17
  15. admin/includes/cta/resources.php +11 -9
  16. admin/includes/cta/reviews.php +1 -1
  17. admin/includes/cta/sharing.php +1 -1
  18. admin/includes/cta/writeable.php +47 -45
  19. admin/includes/layout/default.php +3 -3
  20. admin/includes/mailchimp/MailChimp.php +0 -87
  21. admin/includes/mailchimp/mailchimp-info.php +0 -33
  22. admin/js/admin.js +1 -48
  23. admin/shortcode-builder/js/shortcode-builder.js +74 -34
  24. admin/shortcode-builder/shortcode-builder.php +415 -382
  25. admin/views/add-ons.php +100 -128
  26. admin/views/examples.php +19 -18
  27. admin/views/help.php +10 -10
  28. admin/views/licenses.php +317 -384
  29. admin/views/repeater-templates.php +128 -122
  30. admin/views/settings.php +37 -48
  31. admin/views/shortcode-builder.php +13 -9
  32. ajax-load-more.php +368 -332
  33. core/classes/class.alm-enqueue.php +17 -17
  34. core/classes/class.alm-shortcode.php +313 -296
  35. core/functions.php +106 -106
  36. core/js/ajax-load-more.js +6 -2
  37. core/js/ajax-load-more.min.js +2 -2
  38. core/repeater/default.php +11 -8
  39. index.php +0 -1
  40. lang/ajax-load-more.pot +253 -269
.editorconfig ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EditorConfig helps developers define and maintain consistent
2
+ # coding styles between different editors and IDEs
3
+ # editorconfig.org
4
+
5
+ # PHP PSR-2 Coding Standards
6
+ # http://www.php-fig.org/psr/psr-2/
7
+
8
+ root = true
9
+
10
+ [*.php]
11
+ charset = utf-8
12
+ end_of_line = lf
13
+ insert_final_newline = true
14
+ trim_trailing_whitespace = true
15
+ indent_style = tab
16
+ indent_size = 3
README.txt CHANGED
@@ -1,22 +1,22 @@
1
- === Ajax Load More - Infinite Scroll ===
2
- Contributors: dcooney
3
  Donate link: https://connekthq.com/donate/
4
  Tags: infinite scroll, infinite scrolling, scroll, infinite, lazy load, lazy loading, pagination, ajax pagination, ajax, ajax posts, ajax load posts, search, tags, category, post types, taxonomy, meta_query, woocommerce, ajax load more
5
  Requires at least: 3.6
6
  Tested up to: 4.7.3
7
- Stable tag: 2.14.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- The ultimate solution to add infinite scroll functionality to your website
12
 
13
  == Description ==
14
 
15
- Ajax Load More is a powerful solution for infinite scrolling and lazy loading posts, custom post types, single posts, pages and comments with Ajax powered queries.
16
 
17
- Build complex custom WordPress queries using the Ajax Load More shortcode builder then add the generated shortcode to your page via the content editor or directly into your template files.
18
 
19
- Ajax Load More is fully compatible with popular eCommerce plugins such as WooCommerce and Easy Digital Downloads.
20
 
21
  **[Get More Information](https://connekthq.com/plugins/ajax-load-more/)**
22
 
@@ -50,9 +50,10 @@ Check out the examples below:
50
  = Shortcode Parameters =
51
 
52
  Ajax Load More accepts a number of parameters that are passed to the WordPress query. These parameters are transferred via shortcode - don't worry, creating your custom shortcode is simple with the intuitive [Shortcode Builder](https://connekthq.com/plugins/ajax-load-more/screenshots/#shortcode-builder)
53
-
54
  * **repeater** - Choose a repeater template (<a href="https://connekthq.com/plugins/ajax-load-more/custom-repeaters/">Add-on available</a>). Default = ‘default’
55
  * **post_type** - Comma separated list of post types. Default = ‘post’
 
56
  * **post_format** - Query by post format. Default = null
57
  * **category** - A comma separated list of categories to include by slug. Default = null
58
  * **category__not_in** - A comma separated list of categories to exclude by ID. Default = null
@@ -72,24 +73,24 @@ Ajax Load More accepts a number of parameters that are passed to the WordPress q
72
  * **meta_type** - Custom field type. Default = ‘CHAR’
73
  * **meta_relation** - Used with multiple custom field entries (AND/OR). Default = ‘AND’
74
  * **author** - Comma separated list of authors by id. Default = null
75
- * **post__in** - Comma separated list of post ID’s to include in query. Default = null
76
- * **post__not_in** - Comma separated list of post ID’s to exclude from query. Default = null
77
  * **search** - Query search term (‘s’). Default = null
78
  * **custom_args** - A semicolon separated list of value:pair arguments. e.g. tag_slug__and:design,development; event_display:upcoming. Default = null
79
- * **post_status** - Select status of the post. Default = 'publish'
80
  * **order** - Display posts in ASC(ascending) or DESC(descending) order. Default = ‘DESC’
81
  * **orderby** - Order posts by date, title, name, menu order, author, post ID or comment count. Default = ‘date’
82
  * **offset** - Offset the initial query (number). Default = ’0′
83
  * **posts_per_page** - Number of posts to load with each Ajax request. Default = ’5′
84
  * **scroll** - Load more posts as the user scrolls the page (true/false). Default = ‘true’
85
  * **scroll_distance** - The distance from the bottom of the screen to trigger the loading of posts while scrolling. Default = '150'
86
- * **max_pages** - Maximum number of pages to load while user is scrolling (activated on when scroll = true). Default = '0'
87
- * **pause_override** - Allow scrolling to override the Pause parameter and trigger the loading of posts on scroll. Default = null
88
  * **pause** - Do not load posts until user clicks the Load More button (true/false). Default = 'false'
89
- * **transition** - Choose a posts reveal transition (slide/fade/none). Default = 'slide'
90
- * **transition_speed** - The speed of the loading transition in milliseconds. (slide/fade/none). Default = '250'
91
  * **transition_container** - Display the Ajax Load More (.alm-reveal) loading container. Default = 'true'
92
- * **images_loaded** - Wait for all images to load before displaying ajax loaded content (true/false). Default = 'false'
93
  * **destroy_after** - Remove ajax load more functionality after 'n' number of pages have been loaded. Default = null
94
  * **button_label** - The label text for Load More button. Default = 'Older Posts'
95
  * **button_loading_label** - Update the text of the Load More button while content is loading. Default = null
@@ -128,7 +129,7 @@ Ajax Load More accepts a number of parameters that are passed to the WordPress q
128
 
129
  [youtube https://www.youtube.com/watch?v=EQ57i6dkOew]
130
 
131
- ***
132
 
133
  = Add-ons =
134
  The following [add-ons](https://connekthq.com/plugins/ajax-load-more/add-ons/) are available to increase the functionality of Ajax Load More.
@@ -136,19 +137,19 @@ Ajax Load More accepts a number of parameters that are passed to the WordPress q
136
  > #### Cache
137
  > The **[Cache](https://connekthq.com/plugins/ajax-load-more/add-ons/cache/)** add-oncreates static HTML files of Ajax Load More requests then serves those static pages to your visitors without querying the database.<br />
138
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/cache/)
139
- >
140
  > #### Call to Actions
141
  > The **[Call to Actions](https://connekthq.com/plugins/ajax-load-more/add-ons/call-to-actions/)** add-on will provide functionality to inject a custom CTA template within an Ajax Load More query.<br />
142
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/call-to-actions/)
143
- >
144
  > #### Comments
145
  > The **[Comments](https://connekthq.com/plugins/ajax-load-more/add-ons/comments/)** add-on will load and display blog comments using the core Ajax Load More infinite scroll functionality.<br />
146
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/comments/)
147
- >
148
  > #### Custom Repeaters
149
  > The **[Custom Repeaters](https://connekthq.com/plugins/ajax-load-more/add-ons/custom-repeaters/)** add-on will allow for **unlimited repeater templates** and provide the ability to create unique templates for different content types throughout your theme.<br />
150
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/custom-repeaters/)
151
- >
152
  > #### Layouts
153
  > The **[Layouts](https://connekthq.com/plugins/ajax-load-more/add-ons/layouts/)** add-on will provide a library of fully responsive layout templates ready for use on your website.<br />
154
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/layouts/)
@@ -168,30 +169,30 @@ Ajax Load More accepts a number of parameters that are passed to the WordPress q
168
  > #### Previous Post
169
  > The **[Previous Post](https://connekthq.com/plugins/ajax-load-more/add-ons/previous-post/)** add-on will allow you to navigate single posts with Ajax Load More.<br />
170
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/previous-post/)
171
- >
172
  > #### Search Engine Optimization
173
  > The **[SEO](https://connekthq.com/plugins/ajax-load-more/add-ons/search-engine-optimization/)** add-on will optimize your ajax loaded content for search engines and site visitors by generating standard WordPress paging URLs with each Ajax Load More query.<br />
174
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/search-engine-optimization/)
175
- >
176
  > #### Theme Repeaters
177
  > The **[Theme Repeaters](https://connekthq.com/plugins/ajax-load-more/add-ons/theme-repeaters/)** add-on will allow you load, edit and maintain templates from your current theme directory.<br />
178
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/theme-repeaters/)
179
 
180
 
181
- ***
182
 
183
  = Extensions =
184
  The following [extensions](https://connekthq.com/plugins/ajax-load-more/extensions/) are available to provide compatibility with popular WordPress plugins and core features.
185
 
186
  > #### Relvanssi
187
  > The **[Relevanssi](https://connekthq.com/plugins/ajax-load-more/extensions/relevanssi/)** extension provides the functionality for returning Relevanssi query results to Ajax Load More.
188
- >
189
  > #### REST API
190
  > The **[REST API](https://connekthq.com/plugins/ajax-load-more/extensions/rest-api/)** extension will enable compatibility between Ajax Load More and the WordPress REST API.
191
- >
192
  > #### SearchWP
193
  > The **[SearchWP](https://connekthq.com/plugins/ajax-load-more/extensions/searchwp/)** extension provides the functionality for returning SearchWP query results to Ajax Load More.
194
- >
195
 
196
 
197
  ***
@@ -205,49 +206,49 @@ The following [functions](https://connekthq.com/plugins/ajax-load-more/docs/call
205
  $.fn.almComplete = function(alm){
206
  // Your on complete code goes here
207
  };
208
-
209
 
210
  **ALM Done** - The almDone() function is triggered after all posts have been loaded..
211
 
212
  $.fn.almDone = function(alm){
213
  console.log('All posts have been loaded!');
214
  };
215
-
216
  **ALM Empty** - The almEmpty() function is triggered if there are zero results returned in the initial query.
217
 
218
  $.fn.almEmpty = function(alm){
219
  console.log('Sorry, but we could not locate any posts that matched your criteria.');
220
  };
221
-
222
  **ALM Filter Complete** - The almFilterComplete() function is triggered after a successful call to the public function almFilter().
223
 
224
  $.fn.almFilterComplete = function(){
225
- console.log('Ajax Load More filter has completed!');
226
  };
227
 
228
-
229
  **ALM URL Update** - The almUrlUpdate() function is triggered after a successful URL update (pushState) from the Previous Post or the Search Engine Optimization add-on
230
 
231
  $.fn.almUrlUpdate = function(permalink, type){
232
- console.log("URL updated to " + permalink + '- dispatched from the '+ type + ' add-on.');
233
  };
234
 
235
  ***
236
-
237
  = Filter Hooks =
238
 
239
  Ajax Load More has a variety of [filters](https://connekthq.com/plugins/ajax-load-more/docs/filter-hooks/) in place that enable users to hook into Ajax Load More to insert or modify data.
240
 
241
-
242
  = Variables =
243
 
244
  Ajax Load More passes the following PHP [variables](https://connekthq.com/plugins/ajax-load-more/docs/variables/) to each repeater template - these template variables can help you style and transform your repeater templates.
245
-
246
  * **$alm_current** - Returns the current item number in the current Ajax Load More loop and will reset to zero with every 'Load More' action.. 'echo $alm_current;'
247
  * **$alm_page** - Returns the current page number. 'echo $alm_page;'
248
  * **$alm_item** - Returns the current item number within your loop. 'echo $alm_item;'
249
  * **$alm_found_posts** - Returns the total number of posts found within the entire WordPress query. 'echo $alm_found_posts;'
250
-
251
  ***
252
 
253
  = Tested Browsers =
@@ -279,11 +280,11 @@ Your ratings make a big difference! If you like and use Ajax Load More, please c
279
 
280
  1. Create your shortcode
281
  2. Add the shortcode to your page, by adding it through the content editor or placing it directly within one of your template files.
282
- 3. Load a page with your shortcode in place and watch Ajax Load More fetch your posts.
283
 
284
  = What are my server requirements? =
285
 
286
- Your server must be able to read/write/create files. Ajax Load More creates the default repeater on plugin activation and in order to modify the output we are required to write to the file as well.
287
 
288
  = Is the ajax functionality secure? =
289
 
@@ -347,7 +348,16 @@ How to install Ajax Load More.
347
 
348
  == Changelog ==
349
 
350
- = 2.14.0 - February 14, 2016 =
 
 
 
 
 
 
 
 
 
351
 
352
  * NEW - Adding functionality for Next Page add-on (https://connekthq.com/plugins/ajax-load-more/add-ons/next-page/).
353
  * NEW - Added support for SEO add-on to be integrated with default WP search page.
@@ -364,7 +374,7 @@ How to install Ajax Load More.
364
  * NEW - Added new filter for creating and listing custom layouts within repeater template admin (docs coming soon).
365
  * Update - Adding Post Type 'any' to shortcode builder.
366
  * Update - Updating max_pages parameter to be '0' as the plugin default.
367
- * Update - Various UI updates and enhancements.
368
  * FIX - Updated post_status parameter to support inherit for attachments.
369
  * FIX - Undefined variables in Shortcode Builder pop up.
370
  * FIX - Shortcode Builder UI and copy updates.
@@ -460,12 +470,12 @@ How to install Ajax Load More.
460
  * NEW - Adding support for table container type.
461
  * NEW - Adding new 'transition_container' shortcode parameter to allow for removal of the .alm-reveal div in the ajax output.
462
  * FIX - Fixed issue with the display of Previous Post taxonomy selection in Shortcode Builder.
463
- * FIX - Fixed issue with noscript navigation for preloaded and seo add-ons.
464
- * FIX - Fixed issue with hiding of Button Classes setting if 'Disable CSS' is checked.
465
- * FIX - Fixed bug with custom repeater fallback function.
466
- * FIX - Fixed issue with almDone function firing before a the button text reset function.
467
- * UPDATE - Various UI/UX enhancments.
468
- * UPDATE - Adding cache support for Theme Repeaters add-on.
469
  * UPDATE - Updating add-on activation script from wp_remote_get to wp_remote_post.
470
 
471
 
@@ -650,7 +660,7 @@ How to install Ajax Load More.
650
  * Adding fix for ordering by meta value.
651
  * Admin stying updates.
652
  * Updated FAQs
653
- * Fix meta_query query and orderby meta value
654
 
655
 
656
  = 2.2.7 =
@@ -673,18 +683,18 @@ How to install Ajax Load More.
673
  * Added plugin action links to plugin listing.
674
 
675
  = 2.2.3 =
676
- * Adding query by Custom Field value(Meta Query).
677
  * Improved error handling for easier debugging.
678
- * Fixed issue with pause = "true" and scroll = "true". Pause should always take precendence over scroll.
679
  * Code clean up, improving overall quality for easier merges and updates.
680
 
681
  = 2.2.2 =
682
- * Adding callback function that is dispatched once a successful ajax call is made. $.fn.almComplete(alm).
683
  * Adding WPML support for ICL_LANGUAGE_CODE - A 'lang' atributed is added dynamically if WPML is installed.
684
  * Making JS variables and functions publically accessible.
685
 
686
  = 2.2.1 =
687
- * Fixed php notice/warning that would trigger if WP_DEBUG was enabled.
688
  * Adding minified core JS.
689
  * Adding global option to disable shortcode button in the content editor.
690
  * Adding touchmove js event for faster scroll detection on mobile devices.
@@ -700,9 +710,9 @@ How to install Ajax Load More.
700
 
701
  = 2.1.3 =
702
  * Fixed issue causing the Ajax Load More menu to not show on some admin screen do to location conflict with another plugin.
703
- * Adding column 'alias' to wp_alm table to allow for repeater alias (Only for the custom repeater add-on).
704
- * Remove legacy column 'test' from wp_alm table.
705
- * Updating styles in admin.css.
706
 
707
  = 2.1.2 =
708
  * Adding ability to have multiple instances of script on a single page
@@ -726,10 +736,10 @@ How to install Ajax Load More.
726
  * Fixed issue with author query
727
 
728
  = 2.0.13 =
729
- * Fixed issue where loading button was not turning off when posts remaining were zero
730
 
731
  = 2.0.12 =
732
- * Adding add_filter('widget_text', 'do_shortcode');
733
 
734
  = 2.0.11 =
735
  * Removed 2 filters for widget_text which were casuing issues in sidebars
@@ -768,6 +778,6 @@ How to install Ajax Load More.
768
 
769
  == Upgrade Notice ==
770
 
771
- * None
772
 
773
 
1
+ === WordPress Infinite Scroll - Ajax Load More ===
2
+ Contributors: dcooney, connekthq
3
  Donate link: https://connekthq.com/donate/
4
  Tags: infinite scroll, infinite scrolling, scroll, infinite, lazy load, lazy loading, pagination, ajax pagination, ajax, ajax posts, ajax load posts, search, tags, category, post types, taxonomy, meta_query, woocommerce, ajax load more
5
  Requires at least: 3.6
6
  Tested up to: 4.7.3
7
+ Stable tag: 2.14.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ The ultimate infinite scroll and lazy load solution for your WordPress powered website.
12
 
13
  == Description ==
14
 
15
+ Ajax Load More is a powerful solution for infinite scrolling and lazy loading WordPress posts, custom post types, single posts, pages and comments with Ajax powered queries.
16
 
17
+ Build complex custom WordPress queries using the Ajax Load More shortcode builder then add the generated shortcode to your page via the content editor or directly into your template files.
18
 
19
+ Ajax Load More is fully compatible for infinite scrolling with popular eCommerce plugins such as WooCommerce and Easy Digital Downloads.
20
 
21
  **[Get More Information](https://connekthq.com/plugins/ajax-load-more/)**
22
 
50
  = Shortcode Parameters =
51
 
52
  Ajax Load More accepts a number of parameters that are passed to the WordPress query. These parameters are transferred via shortcode - don't worry, creating your custom shortcode is simple with the intuitive [Shortcode Builder](https://connekthq.com/plugins/ajax-load-more/screenshots/#shortcode-builder)
53
+
54
  * **repeater** - Choose a repeater template (<a href="https://connekthq.com/plugins/ajax-load-more/custom-repeaters/">Add-on available</a>). Default = ‘default’
55
  * **post_type** - Comma separated list of post types. Default = ‘post’
56
+ * **sticky_posts** - Preserve sticky post ordering in Ajax listing. Default = false
57
  * **post_format** - Query by post format. Default = null
58
  * **category** - A comma separated list of categories to include by slug. Default = null
59
  * **category__not_in** - A comma separated list of categories to exclude by ID. Default = null
73
  * **meta_type** - Custom field type. Default = ‘CHAR’
74
  * **meta_relation** - Used with multiple custom field entries (AND/OR). Default = ‘AND’
75
  * **author** - Comma separated list of authors by id. Default = null
76
+ * **post__in** - Comma separated list of post ID’s to include in query. Default = null
77
+ * **post__not_in** - Comma separated list of post ID’s to exclude from query. Default = null
78
  * **search** - Query search term (‘s’). Default = null
79
  * **custom_args** - A semicolon separated list of value:pair arguments. e.g. tag_slug__and:design,development; event_display:upcoming. Default = null
80
+ * **post_status** - Select status of the post. Default = 'publish'
81
  * **order** - Display posts in ASC(ascending) or DESC(descending) order. Default = ‘DESC’
82
  * **orderby** - Order posts by date, title, name, menu order, author, post ID or comment count. Default = ‘date’
83
  * **offset** - Offset the initial query (number). Default = ’0′
84
  * **posts_per_page** - Number of posts to load with each Ajax request. Default = ’5′
85
  * **scroll** - Load more posts as the user scrolls the page (true/false). Default = ‘true’
86
  * **scroll_distance** - The distance from the bottom of the screen to trigger the loading of posts while scrolling. Default = '150'
87
+ * **max_pages** - Maximum number of pages to load while user is scrolling (activated on when scroll = true). Default = '0'
88
+ * **pause_override** - Allow scrolling to override the Pause parameter and trigger the loading of posts on scroll. Default = null
89
  * **pause** - Do not load posts until user clicks the Load More button (true/false). Default = 'false'
90
+ * **transition** - Choose a posts reveal transition (slide/fade/none). Default = 'slide'
91
+ * **transition_speed** - The speed of the loading transition in milliseconds. (slide/fade/none). Default = '250'
92
  * **transition_container** - Display the Ajax Load More (.alm-reveal) loading container. Default = 'true'
93
+ * **images_loaded** - Wait for all images to load before displaying ajax loaded content (true/false). Default = 'false'
94
  * **destroy_after** - Remove ajax load more functionality after 'n' number of pages have been loaded. Default = null
95
  * **button_label** - The label text for Load More button. Default = 'Older Posts'
96
  * **button_loading_label** - Update the text of the Load More button while content is loading. Default = null
129
 
130
  [youtube https://www.youtube.com/watch?v=EQ57i6dkOew]
131
 
132
+ ***
133
 
134
  = Add-ons =
135
  The following [add-ons](https://connekthq.com/plugins/ajax-load-more/add-ons/) are available to increase the functionality of Ajax Load More.
137
  > #### Cache
138
  > The **[Cache](https://connekthq.com/plugins/ajax-load-more/add-ons/cache/)** add-oncreates static HTML files of Ajax Load More requests then serves those static pages to your visitors without querying the database.<br />
139
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/cache/)
140
+ >
141
  > #### Call to Actions
142
  > The **[Call to Actions](https://connekthq.com/plugins/ajax-load-more/add-ons/call-to-actions/)** add-on will provide functionality to inject a custom CTA template within an Ajax Load More query.<br />
143
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/call-to-actions/)
144
+ >
145
  > #### Comments
146
  > The **[Comments](https://connekthq.com/plugins/ajax-load-more/add-ons/comments/)** add-on will load and display blog comments using the core Ajax Load More infinite scroll functionality.<br />
147
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/comments/)
148
+ >
149
  > #### Custom Repeaters
150
  > The **[Custom Repeaters](https://connekthq.com/plugins/ajax-load-more/add-ons/custom-repeaters/)** add-on will allow for **unlimited repeater templates** and provide the ability to create unique templates for different content types throughout your theme.<br />
151
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/custom-repeaters/)
152
+ >
153
  > #### Layouts
154
  > The **[Layouts](https://connekthq.com/plugins/ajax-load-more/add-ons/layouts/)** add-on will provide a library of fully responsive layout templates ready for use on your website.<br />
155
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/layouts/)
169
  > #### Previous Post
170
  > The **[Previous Post](https://connekthq.com/plugins/ajax-load-more/add-ons/previous-post/)** add-on will allow you to navigate single posts with Ajax Load More.<br />
171
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/previous-post/)
172
+ >
173
  > #### Search Engine Optimization
174
  > The **[SEO](https://connekthq.com/plugins/ajax-load-more/add-ons/search-engine-optimization/)** add-on will optimize your ajax loaded content for search engines and site visitors by generating standard WordPress paging URLs with each Ajax Load More query.<br />
175
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/search-engine-optimization/)
176
+ >
177
  > #### Theme Repeaters
178
  > The **[Theme Repeaters](https://connekthq.com/plugins/ajax-load-more/add-ons/theme-repeaters/)** add-on will allow you load, edit and maintain templates from your current theme directory.<br />
179
  > [Get More Information](https://connekthq.com/plugins/ajax-load-more/add-ons/theme-repeaters/)
180
 
181
 
182
+ ***
183
 
184
  = Extensions =
185
  The following [extensions](https://connekthq.com/plugins/ajax-load-more/extensions/) are available to provide compatibility with popular WordPress plugins and core features.
186
 
187
  > #### Relvanssi
188
  > The **[Relevanssi](https://connekthq.com/plugins/ajax-load-more/extensions/relevanssi/)** extension provides the functionality for returning Relevanssi query results to Ajax Load More.
189
+ >
190
  > #### REST API
191
  > The **[REST API](https://connekthq.com/plugins/ajax-load-more/extensions/rest-api/)** extension will enable compatibility between Ajax Load More and the WordPress REST API.
192
+ >
193
  > #### SearchWP
194
  > The **[SearchWP](https://connekthq.com/plugins/ajax-load-more/extensions/searchwp/)** extension provides the functionality for returning SearchWP query results to Ajax Load More.
195
+ >
196
 
197
 
198
  ***
206
  $.fn.almComplete = function(alm){
207
  // Your on complete code goes here
208
  };
209
+
210
 
211
  **ALM Done** - The almDone() function is triggered after all posts have been loaded..
212
 
213
  $.fn.almDone = function(alm){
214
  console.log('All posts have been loaded!');
215
  };
216
+
217
  **ALM Empty** - The almEmpty() function is triggered if there are zero results returned in the initial query.
218
 
219
  $.fn.almEmpty = function(alm){
220
  console.log('Sorry, but we could not locate any posts that matched your criteria.');
221
  };
222
+
223
  **ALM Filter Complete** - The almFilterComplete() function is triggered after a successful call to the public function almFilter().
224
 
225
  $.fn.almFilterComplete = function(){
226
+ console.log('Ajax Load More filter has completed!');
227
  };
228
 
229
+
230
  **ALM URL Update** - The almUrlUpdate() function is triggered after a successful URL update (pushState) from the Previous Post or the Search Engine Optimization add-on
231
 
232
  $.fn.almUrlUpdate = function(permalink, type){
233
+ console.log("URL updated to " + permalink + '- dispatched from the '+ type + ' add-on.');
234
  };
235
 
236
  ***
237
+
238
  = Filter Hooks =
239
 
240
  Ajax Load More has a variety of [filters](https://connekthq.com/plugins/ajax-load-more/docs/filter-hooks/) in place that enable users to hook into Ajax Load More to insert or modify data.
241
 
242
+
243
  = Variables =
244
 
245
  Ajax Load More passes the following PHP [variables](https://connekthq.com/plugins/ajax-load-more/docs/variables/) to each repeater template - these template variables can help you style and transform your repeater templates.
246
+
247
  * **$alm_current** - Returns the current item number in the current Ajax Load More loop and will reset to zero with every 'Load More' action.. 'echo $alm_current;'
248
  * **$alm_page** - Returns the current page number. 'echo $alm_page;'
249
  * **$alm_item** - Returns the current item number within your loop. 'echo $alm_item;'
250
  * **$alm_found_posts** - Returns the total number of posts found within the entire WordPress query. 'echo $alm_found_posts;'
251
+
252
  ***
253
 
254
  = Tested Browsers =
280
 
281
  1. Create your shortcode
282
  2. Add the shortcode to your page, by adding it through the content editor or placing it directly within one of your template files.
283
+ 3. Load a page with your shortcode in place and watch Ajax Load More fetch your posts.
284
 
285
  = What are my server requirements? =
286
 
287
+ Your server must be able to read/write/create files. Ajax Load More creates the default repeater on plugin activation and in order to modify the output we are required to write to the file as well.
288
 
289
  = Is the ajax functionality secure? =
290
 
348
 
349
  == Changelog ==
350
 
351
+ = 2.14.1 - March 24, 2017 =
352
+
353
+ * NEW - Adding built in support for sticky posts (sticky_posts="true").
354
+ * NEW - Added new alm_js_dependencies filter for removing jQuery dependency.
355
+ * NEW - New alm_enqueue_external_scripts action for loading external JS files.
356
+ * NEW - Adding support for paging + comments add-on.
357
+ * FIX - Fixed issue with some addons not appearing in Shortcode Builder.
358
+ * UPDATE - Various UI Updates and enhancements.
359
+
360
+ = 2.14.0 - February 14, 2017 =
361
 
362
  * NEW - Adding functionality for Next Page add-on (https://connekthq.com/plugins/ajax-load-more/add-ons/next-page/).
363
  * NEW - Added support for SEO add-on to be integrated with default WP search page.
374
  * NEW - Added new filter for creating and listing custom layouts within repeater template admin (docs coming soon).
375
  * Update - Adding Post Type 'any' to shortcode builder.
376
  * Update - Updating max_pages parameter to be '0' as the plugin default.
377
+ * Update - Various UI updates and enhancements.
378
  * FIX - Updated post_status parameter to support inherit for attachments.
379
  * FIX - Undefined variables in Shortcode Builder pop up.
380
  * FIX - Shortcode Builder UI and copy updates.
470
  * NEW - Adding support for table container type.
471
  * NEW - Adding new 'transition_container' shortcode parameter to allow for removal of the .alm-reveal div in the ajax output.
472
  * FIX - Fixed issue with the display of Previous Post taxonomy selection in Shortcode Builder.
473
+ * FIX - Fixed issue with noscript navigation for preloaded and seo add-ons.
474
+ * FIX - Fixed issue with hiding of Button Classes setting if 'Disable CSS' is checked.
475
+ * FIX - Fixed bug with custom repeater fallback function.
476
+ * FIX - Fixed issue with almDone function firing before a the button text reset function.
477
+ * UPDATE - Various UI/UX enhancments.
478
+ * UPDATE - Adding cache support for Theme Repeaters add-on.
479
  * UPDATE - Updating add-on activation script from wp_remote_get to wp_remote_post.
480
 
481
 
660
  * Adding fix for ordering by meta value.
661
  * Admin stying updates.
662
  * Updated FAQs
663
+ * Fix meta_query query and orderby meta value
664
 
665
 
666
  = 2.2.7 =
683
  * Added plugin action links to plugin listing.
684
 
685
  = 2.2.3 =
686
+ * Adding query by Custom Field value(Meta Query).
687
  * Improved error handling for easier debugging.
688
+ * Fixed issue with pause = "true" and scroll = "true". Pause should always take precendence over scroll.
689
  * Code clean up, improving overall quality for easier merges and updates.
690
 
691
  = 2.2.2 =
692
+ * Adding callback function that is dispatched once a successful ajax call is made. $.fn.almComplete(alm).
693
  * Adding WPML support for ICL_LANGUAGE_CODE - A 'lang' atributed is added dynamically if WPML is installed.
694
  * Making JS variables and functions publically accessible.
695
 
696
  = 2.2.1 =
697
+ * Fixed php notice/warning that would trigger if WP_DEBUG was enabled.
698
  * Adding minified core JS.
699
  * Adding global option to disable shortcode button in the content editor.
700
  * Adding touchmove js event for faster scroll detection on mobile devices.
710
 
711
  = 2.1.3 =
712
  * Fixed issue causing the Ajax Load More menu to not show on some admin screen do to location conflict with another plugin.
713
+ * Adding column 'alias' to wp_alm table to allow for repeater alias (Only for the custom repeater add-on).
714
+ * Remove legacy column 'test' from wp_alm table.
715
+ * Updating styles in admin.css.
716
 
717
  = 2.1.2 =
718
  * Adding ability to have multiple instances of script on a single page
736
  * Fixed issue with author query
737
 
738
  = 2.0.13 =
739
+ * Fixed issue where loading button was not turning off when posts remaining were zero
740
 
741
  = 2.0.12 =
742
+ * Adding add_filter('widget_text', 'do_shortcode');
743
 
744
  = 2.0.11 =
745
  * Removed 2 filters for widget_text which were casuing issues in sidebars
778
 
779
  == Upgrade Notice ==
780
 
781
+ * None
782
 
783
 
admin/admin-functions.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
-
3
  /*
4
  * alm_is_admin_screen
5
  * Determine whether user is on an ALM admin screen
@@ -7,7 +7,7 @@
7
  * @return boolean
8
  * @since 2.12.0
9
  */
10
-
11
  function alm_is_admin_screen(){
12
  $return = false;
13
  $screen = get_current_screen();
@@ -26,7 +26,7 @@ function alm_is_admin_screen(){
26
  * @return boolean
27
  * @since 2.13.0
28
  */
29
-
30
  function alm_has_addon(){
31
  if(has_action('alm_cache_installed') || has_action('alm_cta_installed') || has_action('alm_comments_installed') || has_action('alm_unlimited_installed') || has_action('alm_layouts_installed') || has_action('alm_nextpage_installed') || has_action('alm_preload_installed') || has_action('alm_paging_installed') || has_action('alm_prev_post_installed') || has_action('alm_rest_api_installed') || has_action('alm_seo_installed') || has_action('alm_theme_repeaters_installed')) {
32
  return true;
@@ -44,12 +44,11 @@ function alm_has_addon(){
44
  * @return boolean
45
  * @since 2.13.0.1
46
  */
47
-
48
  function alm_has_addon_shortcodes(){
49
- if(has_action('alm_cache_installed') || has_action('alm_cta_installed') || has_action('alm_comments_installed') || has_action('alm_unlimited_installed') || has_action('alm_preload_installed') || has_action('alm_paging_installed') || has_action('alm_prev_post_installed') || has_action('alm_rest_api_installed') || has_action('alm_seo_installed') || has_action('alm_theme_repeaters_installed')) {
50
  return true;
51
  } else {
52
  return false;
53
  }
54
  }
55
-
1
  <?php
2
+
3
  /*
4
  * alm_is_admin_screen
5
  * Determine whether user is on an ALM admin screen
7
  * @return boolean
8
  * @since 2.12.0
9
  */
10
+
11
  function alm_is_admin_screen(){
12
  $return = false;
13
  $screen = get_current_screen();
26
  * @return boolean
27
  * @since 2.13.0
28
  */
29
+
30
  function alm_has_addon(){
31
  if(has_action('alm_cache_installed') || has_action('alm_cta_installed') || has_action('alm_comments_installed') || has_action('alm_unlimited_installed') || has_action('alm_layouts_installed') || has_action('alm_nextpage_installed') || has_action('alm_preload_installed') || has_action('alm_paging_installed') || has_action('alm_prev_post_installed') || has_action('alm_rest_api_installed') || has_action('alm_seo_installed') || has_action('alm_theme_repeaters_installed')) {
32
  return true;
44
  * @return boolean
45
  * @since 2.13.0.1
46
  */
47
+
48
  function alm_has_addon_shortcodes(){
49
+ if(has_action('alm_cache_installed') || has_action('alm_cta_installed') || has_action('alm_comments_installed') || has_action('alm_unlimited_installed') || has_action('alm_nextpage_installed') || has_action('alm_preload_installed') || has_action('alm_paging_installed') || has_action('alm_prev_post_installed') || has_action('alm_rest_api_installed') || has_action('alm_seo_installed') || has_action('alm_theme_repeaters_installed')) {
50
  return true;
51
  } else {
52
  return false;
53
  }
54
  }
 
admin/admin.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
-
3
  add_action( 'plugins_loaded', 'alm_core_update' ); // Core Update
4
  add_action( 'wp_ajax_alm_save_repeater', 'alm_save_repeater' ); // Ajax Save Repeater
5
  add_action( 'wp_ajax_alm_update_repeater', 'alm_update_repeater' ); // Ajax Update Repeater
@@ -7,7 +7,7 @@ add_action( 'wp_ajax_alm_get_tax_terms', 'alm_get_tax_terms' ); // Ajax Get Taxo
7
  add_action( 'wp_ajax_alm_delete_cache', 'alm_delete_cache' ); // Delete Cache
8
  add_action( 'wp_ajax_alm_layouts_dismiss', 'alm_layouts_dismiss' ); // Dismiss Layouts CTA
9
  add_action( 'wp_ajax_alm_license_activation', 'alm_license_activation' ); // Activate Add-on
10
- add_action( 'alm_get_layouts', 'alm_get_layouts' ); // Add layout selection
11
  add_action( 'wp_ajax_alm_get_layout', 'alm_get_layout' ); // Get layout
12
  add_action( 'wp_ajax_alm_dismiss_sharing', 'alm_dismiss_sharing' ); // Dismiss sharing
13
  add_filter( 'admin_footer_text', 'alm_filter_admin_footer_text'); // Admin menu text
@@ -22,77 +22,77 @@ add_filter( 'admin_footer_text', 'alm_filter_admin_footer_text'); // Admin menu
22
  */
23
 
24
  function alm_license_activation(){
25
-
26
  if (current_user_can( 'edit_theme_options' )){
27
-
28
  $nonce = $_GET["nonce"];
29
  $type = $_GET["type"]; // activate / deactivate
30
- $item = $_GET["item"];
31
- $license = $_GET["license"];
32
- $url = $_GET["url"];
33
- $upgrade = $_GET["upgrade"];
34
- $option_status = $_GET["status"];
35
- $option_key = $_GET["key"];
36
-
37
  // Check our nonce, if they don't match then bounce!
38
  if (! wp_verify_nonce( $nonce, 'alm_repeater_nonce' ))
39
- die('Error - unable to verify nonce, please try again.');
40
-
41
  // data to send in our API request
42
  if($type === 'activate'){
43
  $action = 'activate_license';
44
  }else{
45
  $action = 'deactivate_license';
46
  }
47
-
48
- $api_params = array(
49
- 'edd_action'=> $action,
50
- 'license' => $license,
51
  'item_id' => $item, // the ID of our product in EDD
52
  'url' => home_url()
53
  );
54
-
55
  // Call the custom API.
56
  //$response = wp_remote_get( add_query_arg( $api_params, $url ), array( 'timeout' => 15, 'sslverify' => false ) );
57
-
58
  // Updated 2.8.7
59
  $response = wp_remote_post( ALM_STORE_URL, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
60
-
61
  // make sure the response came back okay
62
  if ( is_wp_error( $response ) )
63
  return false;
64
-
65
-
66
  $license_data = $response['body'];
67
  $license_data = json_decode($license_data); // decode the license data
68
-
69
-
70
  $return["success"] = $license_data->success;
71
-
72
  $msg = '';
73
- if($type === 'activate'){
74
  $return["license_limit"] = $license_data->license_limit;
75
  $return["expires"] = $license_data->expires;
76
  $return["site_count"] = $license_data->site_count;
77
  $return["activations_left"] = $license_data->activations_left;
78
  $return["license"] = $license_data->license;
79
- $return["item_name"] = $license_data->item_name;
80
  if($license_data->activations_left === 0 && $license_data->success === false){
81
  $msg = '<strong>Sorry, but you are out of available licenses <em>('. $license_data->license_limit .' / '. $license_data->site_count .')</em>.</strong> Please visit the <a href="'.$upgrade.'" target="_blank">'.$license_data->item_name.'</a> page to add additional licenses.';
82
- }
83
  }
84
  $return["msg"] = $msg;
85
-
86
  update_option( $option_status, $license_data->license);
87
- update_option( $option_key, $license );
88
-
89
  echo json_encode($return);
90
-
91
  die();
92
-
93
  } else {
94
  echo __('You don\'t belong here.', ALM_NAME);
95
- }
96
  }
97
 
98
 
@@ -105,28 +105,28 @@ function alm_license_activation(){
105
  * @updated 2.14.0
106
  */
107
 
108
- function alm_get_layout(){
109
- if (current_user_can( 'edit_theme_options' )){
110
-
111
  $nonce = sanitize_text_field($_GET["nonce"]);
112
- $type = sanitize_text_field($_GET["type"]);
113
- $custom = sanitize_text_field($_GET["custom"]);
114
-
115
  // Check our nonce, if they don't match then bounce!
116
  if (! wp_verify_nonce( $nonce, 'alm_repeater_nonce' ))
117
- die('Error - unable to verify nonce, please try again.');
118
-
119
  if($type === 'default'){
120
-
121
  // Default Layout
122
  $content = file_get_contents(ALM_PATH.'admin/includes/layout/'.$type.'.php');
123
-
124
  }else{
125
-
126
  // Custom Layout
127
  if($custom == 'true'){
128
  $dir = 'alm_layouts';
129
-
130
  if(is_child_theme()){
131
  $path = get_stylesheet_directory().'/'. $dir .'/' .$type;
132
  // if child theme does not have the layout, check the parent theme
@@ -137,22 +137,22 @@ function alm_get_layout(){
137
  else{
138
  $path = get_template_directory().'/'. $dir .'/' .$type;
139
  }
140
- $content = file_get_contents($path);
141
-
142
- }
143
-
144
  // Layouts Add-on
145
- else {
146
- $content = file_get_contents(ALM_LAYOUTS_PATH.'layouts/'.$type.'.php');
147
- }
148
- }
149
-
150
  $return["value"] = $content;
151
- echo json_encode($return);
152
  }else {
153
  echo __('You don\'t belong here.', ALM_NAME);
154
- }
155
- die();
156
  }
157
 
158
 
@@ -165,10 +165,9 @@ function alm_get_layout(){
165
  * @since 2.8.7
166
  */
167
  function alm_get_layouts(){ // do_action
168
- include( ALM_PATH . 'admin/includes/components/layout-list.php');
169
  }
170
 
171
-
172
  /*
173
  * alm_admin_vars
174
  * Create admin variables and ajax nonce
@@ -178,7 +177,7 @@ function alm_get_layouts(){ // do_action
178
  function alm_admin_vars() { ?>
179
  <script type='text/javascript'>
180
  /* <![CDATA[ */
181
- var alm_admin_localize = <?php echo json_encode( array(
182
  'ajax_admin_url' => admin_url( 'admin-ajax.php' ),
183
  'active' => __('Active', 'ajax-load-more'),
184
  'inactive' => __('Inactive', 'ajax-load-more'),
@@ -217,22 +216,22 @@ function alm_set_admin_nonce(){
217
  * @since 2.0.5
218
  */
219
 
220
- function alm_core_update() {
221
-
222
  if(!get_option( 'alm_version')){ // Add 'alm_version' to WP options table if it does not exist
223
- add_option( 'alm_version', ALM_VERSION );
224
- }
225
-
226
  $alm_installed_ver = get_option( "alm_version" ); // Get value from WP Option tbl
227
  if ( $alm_installed_ver != ALM_VERSION ) {
228
-
229
  // Delete ALM transients
230
  delete_transient('alm_dismiss_sharing');
231
-
232
  // Update repeaters
233
- alm_run_update();
234
-
235
- }
236
  }
237
 
238
 
@@ -245,22 +244,22 @@ function alm_core_update() {
245
  */
246
 
247
  function alm_run_update(){
248
- global $wpdb;
249
-
250
- if ( is_multisite()) {
251
- $blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
252
-
253
- // Loop all blogs and run update routine
254
  foreach ( $blog_ids as $blog_id ) {
255
  switch_to_blog( $blog_id );
256
  alm_update_template_files();
257
  restore_current_blog();
258
  }
259
-
260
  } else {
261
  alm_update_template_files();
262
  }
263
-
264
  update_option( "alm_version", ALM_VERSION ); // Update the WP Option tbl with the new version num
265
  }
266
 
@@ -274,49 +273,49 @@ function alm_run_update(){
274
  */
275
 
276
  function alm_update_template_files(){
277
- global $wpdb;
278
  $table_name = $wpdb->prefix . "alm";
279
- $blog_id = $wpdb->blogid;
280
-
281
- // Get all templates ($rows) where name is 'default'
282
- $rows = $wpdb->get_results("SELECT * FROM $table_name WHERE name = 'default'");
283
 
284
  if($rows){
285
  foreach( $rows as $row ) { // Loop $rows
286
-
287
  $data = $wpdb->get_var("SELECT repeaterDefault FROM $table_name WHERE name = 'default'");
288
-
289
  if($blog_id > 1){
290
  $dir = ALM_PATH. 'core/repeater/'. $blog_id;
291
  if( !is_dir($dir) ){
292
  mkdir($dir);
293
- }
294
  $f = ALM_PATH. 'core/repeater/'. $blog_id .'/default.php';
295
  }else{
296
  $f = ALM_PATH. 'core/repeater/default.php';
297
  }
298
-
299
  try {
300
  $o = fopen($f, 'w+'); //Open file
301
  if ( !$o ) {
302
  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 /ajax-load-more/core/repeater directory', 'ajax-load-more'));
303
- }
304
  $w = fwrite($o, $data); //Save the file
305
  if ( !$w ) {
306
  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 /ajax-load-more/core/repeater directory.', 'ajax-load-more'));
307
- }
308
  fclose($o); //now close it
309
-
310
  } catch ( Exception $e ) {
311
  // Display error message in console.
312
- if(!isset($options['_alm_error_notices']) || $options['_alm_error_notices'] == '1'){
313
  echo '<script>console.log("' .$e->getMessage(). '");</script>';
314
  }
315
  }
316
-
317
  }
318
  }
319
-
320
  }
321
 
322
 
@@ -330,101 +329,101 @@ function alm_update_template_files(){
330
  */
331
 
332
  add_action( 'admin_menu', 'alm_admin_menu' );
333
- function alm_admin_menu() {
334
  $icon = 'dashicons-plus-alt';
335
  $icon = ALM_ADMIN_URL . "/img/alm-logo-16x16.svg";
336
-
337
- $alm_page = add_menu_page(
338
- 'Ajax Load More',
339
- 'Ajax Load More',
340
- 'edit_theme_options',
341
- 'ajax-load-more',
342
  'alm_settings_page',
343
  $icon
344
  );
345
-
346
- $alm_settings_page = add_submenu_page(
347
- 'ajax-load-more',
348
- 'Settings',
349
- 'Settings',
350
- 'edit_theme_options',
351
- 'ajax-load-more',
352
  'alm_settings_page'
353
- );
354
-
355
- $alm_template_page = add_submenu_page(
356
- 'ajax-load-more',
357
- 'Repeater Templates',
358
- 'Repeater Templates',
359
- 'edit_theme_options',
360
- 'ajax-load-more-repeaters',
361
  'alm_repeater_page'
362
  );
363
-
364
- $alm_shortcode_page = add_submenu_page(
365
- 'ajax-load-more',
366
- 'Shortcode Builder',
367
- 'Shortcode Builder',
368
- 'edit_theme_options',
369
- 'ajax-load-more-shortcode-builder',
370
  'alm_shortcode_builder_page'
371
  );
372
-
373
- $alm_addons_page = add_submenu_page(
374
- 'ajax-load-more',
375
- 'Add-ons',
376
- 'Add-ons',
377
- 'edit_theme_options',
378
- 'ajax-load-more-add-ons',
379
  'alm_add_ons_page'
380
- );
381
-
382
- $alm_examples_page = add_submenu_page(
383
- 'ajax-load-more',
384
- 'Examples',
385
- 'Examples',
386
- 'edit_theme_options',
387
- 'ajax-load-more-examples',
388
  'alm_examples_page'
389
- );
390
-
391
- $alm_help_page = add_submenu_page(
392
- 'ajax-load-more',
393
- 'Help',
394
- 'Help',
395
- 'edit_theme_options',
396
- 'ajax-load-more-help',
397
  'alm_help_page'
398
- );
399
-
400
  $alm_licenses_page = add_submenu_page(
401
- 'ajax-load-more',
402
- 'Licenses',
403
- 'Licenses',
404
- 'edit_theme_options',
405
- 'ajax-load-more-licenses',
406
  'alm_licenses_page'
407
- );
408
-
409
  if(has_action('alm_cache_installed')){
410
- $alm_cache_page = add_submenu_page(
411
- 'ajax-load-more',
412
- 'Cache',
413
- '<span style="color: #f2f5bf; display:block; border-top: 1px solid #555; padding-top: 8px; border-radius: 3px;">Cache<span>',
414
- 'edit_theme_options',
415
- 'ajax-load-more-cache',
416
  'alm_cache_page'
417
  );
418
  add_action( 'load-' . $alm_cache_page, 'alm_load_admin_js' );
419
  add_action( 'load-' . $alm_cache_page, 'alm_load_cache_admin_js' );
420
- add_action( 'load-' . $alm_cache_page, 'alm_set_admin_nonce' );
421
  }
422
-
423
  //Add our admin scripts
424
  add_action( 'load-' . $alm_settings_page, 'alm_load_admin_js' );
425
- add_action( 'load-' . $alm_settings_page, 'alm_set_admin_nonce' );
426
  add_action( 'load-' . $alm_template_page, 'alm_load_admin_js' );
427
- add_action( 'load-' . $alm_template_page, 'alm_set_admin_nonce' );
428
  add_action( 'load-' . $alm_shortcode_page, 'alm_load_admin_js' );
429
  add_action( 'load-' . $alm_shortcode_page, 'alm_set_admin_nonce' );
430
  add_action( 'load-' . $alm_examples_page, 'alm_load_admin_js' );
@@ -435,8 +434,8 @@ function alm_admin_menu() {
435
  add_action( 'load-' . $alm_addons_page, 'alm_set_admin_nonce' );
436
  add_action( 'load-' . $alm_licenses_page, 'alm_load_admin_js' );
437
  add_action( 'load-' . $alm_licenses_page, 'alm_set_admin_nonce' );
438
- }
439
-
440
 
441
 
442
  /**
@@ -472,16 +471,18 @@ function alm_enqueue_admin_scripts(){
472
  wp_enqueue_style( 'alm-tooltipster', ALM_ADMIN_URL. 'css/tooltipster/tooltipster.css');
473
  wp_enqueue_style( 'alm-core', ALM_URL. '/core/css/ajax-load-more.css');
474
  wp_enqueue_style( 'alm-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css');
475
-
476
- //Load CodeMirror Syntax Highlighting if on Repater Template page
 
 
477
  $screen = get_current_screen();
478
- if ( in_array( $screen->id, array( 'ajax-load-more_page_ajax-load-more-repeaters') ) ){
479
-
480
  //CodeMirror CSS
481
  wp_enqueue_style( 'alm-codemirror-css', ALM_ADMIN_URL. 'codemirror/lib/codemirror.css' );
482
-
483
  //CodeMirror JS
484
- wp_enqueue_script( 'alm-codemirror', ALM_ADMIN_URL. 'codemirror/lib/codemirror.js');
485
  wp_enqueue_script( 'alm-codemirror-matchbrackets', ALM_ADMIN_URL. 'codemirror/addon/edit/matchbrackets.js' );
486
  wp_enqueue_script( 'alm-codemirror-htmlmixed', ALM_ADMIN_URL. 'codemirror/mode/htmlmixed/htmlmixed.js' );
487
  wp_enqueue_script( 'alm-codemirror-xml', ALM_ADMIN_URL. 'codemirror/mode/xml/xml.js' );
@@ -489,10 +490,10 @@ function alm_enqueue_admin_scripts(){
489
  wp_enqueue_script( 'alm-codemirror-mode-css', ALM_ADMIN_URL. 'codemirror/mode/css/css.js' );
490
  wp_enqueue_script( 'alm-codemirror-clike', ALM_ADMIN_URL. 'codemirror/mode/clike/clike.js' );
491
  wp_enqueue_script( 'alm-codemirror-php', ALM_ADMIN_URL. 'codemirror/mode/php/php.js' );
492
-
493
  }
494
-
495
- //Load JS
496
  wp_enqueue_script( 'jquery-form' );
497
  wp_enqueue_script( 'alm-select2', ALM_ADMIN_URL. 'js/libs/select2.min.js', array( 'jquery' ));
498
  wp_enqueue_script( 'alm-drops', ALM_ADMIN_URL. 'js/libs/jquery.drops.js', array( 'jquery' ));
@@ -511,7 +512,7 @@ function alm_enqueue_admin_scripts(){
511
  * @since 2.0.0
512
  */
513
 
514
- function alm_settings_page(){
515
  include_once( ALM_PATH . 'admin/views/settings.php');
516
  }
517
 
@@ -524,7 +525,7 @@ function alm_settings_page(){
524
  * @since 2.0.0
525
  */
526
 
527
- function alm_repeater_page(){
528
  include_once( ALM_PATH . 'admin/views/repeater-templates.php');
529
  }
530
 
@@ -537,8 +538,8 @@ function alm_repeater_page(){
537
  * @since 2.0.0
538
  */
539
 
540
- function alm_shortcode_builder_page(){
541
- include_once( ALM_PATH . 'admin/views/shortcode-builder.php');
542
  }
543
 
544
 
@@ -550,21 +551,21 @@ function alm_shortcode_builder_page(){
550
  * @since 2.0.0
551
  */
552
 
553
- function alm_examples_page(){
554
- include_once( ALM_PATH . 'admin/views/examples.php');
555
  }
556
 
557
 
558
 
559
  /*
560
  * alm_help_page
561
- * Help Page (Implementation Inforgraphic)
562
  *
563
  * @since 2.8.7
564
  */
565
 
566
- function alm_help_page(){
567
- include_once( ALM_PATH . 'admin/views/help.php');
568
  }
569
 
570
 
@@ -576,7 +577,7 @@ function alm_help_page(){
576
  * @since 2.0.0
577
  */
578
 
579
- function alm_add_ons_page(){
580
  include_once( ALM_PATH . 'admin/views/add-ons.php');
581
  }
582
 
@@ -589,7 +590,7 @@ function alm_add_ons_page(){
589
  * @since 2.7.0
590
  */
591
 
592
- function alm_licenses_page(){
593
  include_once( ALM_PATH . 'admin/views/licenses.php');
594
  }
595
 
@@ -601,7 +602,7 @@ function alm_licenses_page(){
601
  * @since 2.6.0
602
  */
603
 
604
- function alm_cache_page(){
605
  include_once( ALM_CACHE_PATH . 'admin/views/cache.php');
606
  }
607
 
@@ -616,44 +617,44 @@ function alm_cache_page(){
616
  */
617
 
618
  function alm_save_repeater(){
619
-
620
  if (current_user_can( 'edit_theme_options' )){
621
-
622
  global $wpdb;
623
  $table_name = $wpdb->prefix . "alm";
624
- $blog_id = $wpdb->blogid;
625
  $options = get_option( 'alm_settings' ); //Get plugin options
626
-
627
  $nonce = $_POST["nonce"];
628
  // Check our nonce, if they don't match then bounce!
629
  if (! wp_verify_nonce( $nonce, 'alm_repeater_nonce' ))
630
  die('Error - unable to verify nonce, please try again.');
631
-
632
- // Get _POST Vars
633
  $c = Trim(stripslashes($_POST["value"])); // Repeater Value
634
  $n = Trim(stripslashes($_POST["repeater"])); // Repeater name
635
  $t = Trim(stripslashes($_POST["type"])); // Repeater name
636
  $a = Trim(stripslashes($_POST["alias"])); // Repeater alias
637
-
638
- // Write to repeater templates
639
-
640
  // (Default)
641
  if($t === 'default'){
642
-
643
- if($blog_id > 1){
644
  $dir = ALM_PATH. 'core/repeater/'. $blog_id;
645
  if( !is_dir($dir) ){
646
  mkdir($dir);
647
- }
648
  $f = ALM_PATH. 'core/repeater/'. $blog_id .'/default.php';
649
  }else{
650
- $f = ALM_PATH. 'core/repeater/default.php';
651
  }
652
-
653
  }
654
  // (Unlimited)
655
  elseif($t === 'unlimited'){
656
-
657
  if($blog_id > 1){
658
  $dir = ALM_UNLIMITED_PATH. 'repeaters/'. $blog_id;
659
  if( !is_dir($dir) ){
@@ -663,41 +664,41 @@ function alm_save_repeater(){
663
  }else{
664
  $f = ALM_UNLIMITED_PATH. 'repeaters/'.$n .'.php';
665
  }
666
-
667
  }
668
  // (Unlimited v1)
669
  else{
670
-
671
  $f = ALM_REPEATER_PATH. 'repeaters/'.$n .'.php';
672
-
673
  }
674
-
675
  try {
676
  $o = fopen($f, 'w+'); //Open file
677
  if ( !$o ) {
678
  throw new Exception(__('[Ajax Load More] Unable to open repeater template - '.$f.' - Please check your file path and ensure your server is configured to allow Ajax Load More to read and write files.', 'ajax-load-more'));
679
- }
680
  $w = fwrite($o, $c); //Save the file
681
  if ( !$w ) {
682
  throw new Exception(__('[Ajax Load More] Error saving repeater template - '.$f.' - Please check your file path and ensure your server is configured to allow Ajax Load More to read and write files.', 'ajax-load-more'));
683
- }
684
  fclose($o); //now close it
685
-
686
  } catch ( Exception $e ) {
687
  // Display error message in console.
688
- if(!isset($options['_alm_error_notices']) || $options['_alm_error_notices'] == '1'){
689
  echo '<script>console.log("' .$e->getMessage(). '");</script>';
690
  }
691
  }
692
-
693
- //Save to database
694
-
695
- if($t === 'default') {
696
  $data_update = array('repeaterDefault' => "$c", 'pluginVersion' => ALM_VERSION);
697
  $data_where = array('name' => "default");
698
  }
699
- elseif($t === 'unlimited'){ // Unlimited Repeaters
700
- $table_name = $wpdb->prefix . "alm_unlimited";
701
  $data_update = array('repeaterDefault' => "$c", 'alias' => "$a", 'pluginVersion' => ALM_UNLIMITED_VERSION);
702
  $data_where = array('name' => $n);
703
  }
@@ -705,9 +706,9 @@ function alm_save_repeater(){
705
  $data_update = array('repeaterDefault' => "$c", 'alias' => "$a", 'pluginVersion' => ALM_REPEATER_VERSION);
706
  $data_where = array('name' => $n);
707
  }
708
-
709
  $wpdb->update($table_name , $data_update, $data_where);
710
-
711
  //Our results
712
  if($w){
713
  echo '<span class="saved">Template Saved Successfully</span>';
@@ -715,7 +716,7 @@ function alm_save_repeater(){
715
  echo '<span class="saved-error"><b>'. __('Error Writing File', 'ajax-load-more') .'</b></span><br/>Something went wrong and the data could not be saved.';
716
  }
717
  die();
718
-
719
  }else {
720
  echo __('You don\'t belong here.', 'ajax-load-more');
721
  }
@@ -734,36 +735,36 @@ function alm_save_repeater(){
734
  */
735
 
736
  function alm_update_repeater(){
737
-
738
  if (current_user_can( 'edit_theme_options' )){
739
-
740
  $nonce = $_POST["nonce"];
741
  // Check our nonce, if they don't match then bounce!
742
  if (! wp_verify_nonce( $nonce, 'alm_repeater_nonce' ))
743
  die('Error - unable to verify nonce, please try again.');
744
-
745
- // Get _POST Vars
746
  $n = Trim(stripslashes($_POST["repeater"])); // Repeater name
747
  $t = Trim(stripslashes($_POST["type"])); // Repeater type (default | unlimited)
748
-
749
-
750
  // Get value from database
751
  global $wpdb;
752
- $table_name = $wpdb->prefix . "alm";
753
-
754
- if($t === 'default') $n = 'default';
755
- if($t === 'unlimited') $table_name = $wpdb->prefix . "alm_unlimited";
756
-
757
  $the_repeater = $wpdb->get_var("SELECT repeaterDefault FROM " . $table_name . " WHERE name = '$n'");
758
-
759
  echo $the_repeater; // Return repeater value
760
-
761
  die();
762
-
763
  } else {
764
  echo __('You don\'t belong here.', 'ajax-load-more');
765
  }
766
-
767
  }
768
 
769
 
@@ -776,42 +777,42 @@ function alm_update_repeater(){
776
  * @since 2.1.0
777
  */
778
 
779
- function alm_get_tax_terms(){
780
  if (current_user_can( 'edit_theme_options' )){
781
-
782
  $nonce = $_GET["nonce"];
783
  // Check our nonce, if they don't match then bounce!
784
  if (! wp_verify_nonce( $nonce, 'alm_repeater_nonce' ))
785
  die('Get Bounced!');
786
-
787
- $taxonomy = (isset($_GET['taxonomy'])) ? $_GET['taxonomy'] : '';
788
- $index = (isset($_GET['index'])) ? $_GET['index'] : '1';
789
-
790
  $tax_args = array(
791
- 'orderby' => 'name',
792
  'order' => 'ASC',
793
  'hide_empty' => false
794
- );
795
  $terms = get_terms($taxonomy, $tax_args);
796
  $returnVal = '';
797
- if ( !empty( $terms ) && !is_wp_error( $terms ) ){
798
  $returnVal .= '<ul>';
799
  foreach ( $terms as $term ) {
800
 
801
- $returnVal .='<li><input type="checkbox" class="alm_element" name="tax-term-'.$term->slug.'" id="tax-term-'.$term->slug.'-'.$index.'" data-type="'.$term->slug.'"><label for="tax-term-'.$term->slug.'-'.$index.'">'.$term->name.'</label></li>';
802
-
803
  }
804
- $returnVal .= '</ul>';
805
  echo $returnVal;
806
-
807
  die();
808
  }else{
809
  echo "<p class='warning'>No terms exist within this taxonomy</p>";
810
  die();
811
  }
812
-
813
- } else {
814
- echo __('You don\'t belong here.', 'ajax-load-more');
815
  }
816
  }
817
 
@@ -825,16 +826,16 @@ function alm_get_tax_terms(){
825
  */
826
  function alm_layouts_dismiss(){
827
  if (current_user_can( 'edit_theme_options' )){
828
-
829
  $nonce = $_POST["nonce"];
830
-
831
  // Check our nonce, if they don't match then bounce!
832
  if (! wp_verify_nonce( $nonce, 'alm_repeater_nonce' ))
833
- die('Error - unable to verify nonce, please try again.');
834
-
835
  update_option('alm_layouts_dismiss', 'true');
836
  echo 'Success';
837
-
838
  die();
839
  }
840
  }
@@ -849,16 +850,16 @@ function alm_layouts_dismiss(){
849
  */
850
  function alm_dismiss_sharing(){
851
  if (current_user_can( 'edit_theme_options' )){
852
-
853
  $nonce = $_POST["nonce"];
854
-
855
  // Check our nonce, if they don't match then bounce!
856
  if (! wp_verify_nonce( $nonce, 'alm_repeater_nonce' ))
857
- die('Error - unable to verify nonce, please try again.');
858
-
859
  set_transient( 'alm_dismiss_sharing', 'true', YEAR_IN_SECONDS );
860
  echo 'ALM sharing dismissed successfully.';
861
-
862
  die();
863
  }
864
  }
@@ -872,12 +873,12 @@ function alm_dismiss_sharing(){
872
  * @since 2.12.0
873
  */
874
 
875
- function alm_filter_admin_footer_text( $text ) {
876
- $screen = alm_is_admin_screen();
877
  if(!$screen){
878
  return;
879
  }
880
-
881
  echo '<strong>Ajax Load More</strong> is made with <span style="color: #e25555;">♥</span> by <a href="https://connekthq.com" target="_blank" style="font-weight: 500;">Connekt</a> | <a href="https://wordpress.org/support/plugin/ajax-load-more/reviews/" target="_blank" style="font-weight: 500;">Leave a Review</a> | <a href="https://connekthq.com/plugins/ajax-load-more/support/" target="_blank" style="font-weight: 500;">Get Support</a>';
882
  }
883
 
@@ -893,26 +894,26 @@ function alm_filter_admin_footer_text( $text ) {
893
  add_action( 'admin_init', 'alm_admin_init');
894
  function alm_admin_init(){
895
 
896
- register_setting(
897
- 'alm-setting-group',
898
- 'alm_settings',
899
- 'alm_sanitize_settings'
 
 
 
 
 
 
 
900
  );
901
-
902
- add_settings_section(
903
- 'alm_general_settings',
904
- 'Global Settings',
905
- 'alm_general_settings_callback',
906
- 'ajax-load-more'
907
  );
908
-
909
- add_settings_section(
910
- 'alm_admin_settings',
911
- 'Admin Settings',
912
- 'alm_admin_settings_callback',
913
- 'ajax-load-more'
914
- );
915
-
916
  add_settings_field( // Container type
917
  '_alm_container_type',
918
  __('Container Type', 'ajax-load-more' ),
@@ -920,132 +921,132 @@ function alm_admin_init(){
920
  'ajax-load-more',
921
  'alm_general_settings'
922
  );
923
-
924
  add_settings_field( // Classnames
925
- '_alm_classname',
926
- __('Container Classes', 'ajax-load-more' ),
927
- 'alm_class_callback',
928
- 'ajax-load-more',
929
- 'alm_general_settings'
930
  );
931
-
932
  add_settings_field( // Disbale CSS
933
- '_alm_disable_css',
934
- __('Disable CSS', 'ajax-load-more' ),
935
- 'alm_disable_css_callback',
936
- 'ajax-load-more',
937
- 'alm_general_settings'
938
  );
939
-
940
  add_settings_field( // Btn color
941
- '_alm_btn_color',
942
- __('Button/Loading Style', 'ajax-load-more' ),
943
- 'alm_btn_color_callback',
944
- 'ajax-load-more',
945
- 'alm_general_settings'
946
- );
947
-
948
  add_settings_field( // Button classes
949
- '_alm_btn_classname',
950
- __('Button Classes', 'ajax-load-more' ),
951
- 'alm_btn_class_callback',
952
- 'ajax-load-more',
953
- 'alm_general_settings'
954
  );
955
-
956
  add_settings_field( // Nonce security
957
- '_alm_nonce_security',
958
- __('Ajax Security', 'ajax-load-more' ),
959
- '_alm_nonce_security_callback',
960
- 'ajax-load-more',
961
- 'alm_general_settings'
962
- );
963
-
964
  add_settings_field( // Scroll to top on load
965
- '_alm_scroll_top',
966
- __('Top of Page', 'ajax-load-more' ),
967
- '_alm_scroll_top_callback',
968
- 'ajax-load-more',
969
- 'alm_general_settings'
970
- );
971
-
972
  add_settings_field( // Load dynamic queries
973
- '_alm_disable_dynamic',
974
- __('Dynamic Content', 'ajax-load-more' ),
975
- 'alm_disable_dynamic_callback',
976
- 'ajax-load-more',
977
- 'alm_admin_settings'
978
- );
979
-
980
  add_settings_field( // Hide btn
981
- '_alm_hide_btn',
982
- __('Editor Button', 'ajax-load-more' ),
983
- 'alm_hide_btn_callback',
984
- 'ajax-load-more',
985
- 'alm_admin_settings'
986
  );
987
-
988
  add_settings_field( // Display error notices
989
- '_alm_error_notices',
990
- __('Error Notices', 'ajax-load-more' ),
991
- '_alm_error_notices_callback',
992
- 'ajax-load-more',
993
- 'alm_admin_settings'
994
- );
995
-
996
-
997
  // CACHE
998
- if(has_action('alm_cache_settings')){
999
- do_action('alm_cache_settings');
1000
- }
1001
-
1002
-
1003
  // CUSTOM REPEATERS
1004
- if(has_action('alm_unlimited_settings')){
1005
- do_action('alm_unlimited_settings');
1006
  }
1007
-
1008
-
1009
  // LAYOUTS
1010
- if(has_action('alm_layouts_settings')){
1011
- do_action('alm_layouts_settings');
1012
  }
1013
-
1014
-
1015
  // PAGINATION
1016
- if(has_action('alm_paging_settings')){
1017
- do_action('alm_paging_settings');
1018
  }
1019
-
1020
-
1021
  // PREVIOUS POST
1022
- if(has_action('alm_prev_post_settings')){
1023
- do_action('alm_prev_post_settings');
1024
  }
1025
-
1026
-
1027
  // PRELOADED
1028
- if(has_action('alm_preloaded_settings')){
1029
- do_action('alm_preloaded_settings');
1030
  }
1031
-
1032
-
1033
  // REST API
1034
- if(has_action('alm_rest_api_settings')){
1035
- do_action('alm_rest_api_settings');
1036
  }
1037
-
1038
-
1039
  // SEO
1040
- if(has_action('alm_seo_settings')){
1041
- do_action('alm_seo_settings');
1042
  }
1043
-
1044
-
1045
  // THEME REPEATERS
1046
- if(has_action('alm_theme_repeaters_settings')){
1047
- do_action('alm_theme_repeaters_settings');
1048
- }
1049
  }
1050
 
1051
 
@@ -1097,13 +1098,13 @@ function alm_sanitize_settings( $input ) {
1097
 
1098
  function alm_disable_css_callback(){
1099
  $options = get_option( 'alm_settings' );
1100
- if(!isset($options['_alm_disable_css']))
1101
  $options['_alm_disable_css'] = '0';
1102
-
1103
  $html = '<input type="hidden" name="alm_settings[_alm_disable_css]" value="0" />';
1104
  $html .= '<input type="checkbox" id="alm_disable_css_input" name="alm_settings[_alm_disable_css]" value="1"'. (($options['_alm_disable_css']) ? ' checked="checked"' : '') .' />';
1105
  $html .= '<label for="alm_disable_css_input">'.__('I want to use my own CSS styles.', 'ajax-load-more').'<br/><span style="display:block;"><i class="fa fa-file-text-o"></i> &nbsp;<a href="'.ALM_URL.'/core/css/ajax-load-more.css" target="blank">'.__('View Ajax Load More CSS', 'ajax-load-more').'</a></span></label>';
1106
-
1107
  echo $html;
1108
  }
1109
 
@@ -1118,12 +1119,12 @@ function alm_disable_css_callback(){
1118
 
1119
  function alm_hide_btn_callback(){
1120
  $options = get_option( 'alm_settings' );
1121
- if(!isset($options['_alm_hide_btn']))
1122
  $options['_alm_hide_btn'] = '0';
1123
-
1124
  $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"' : '') .' />';
1125
- $html .= '<label for="alm_hide_btn">'.__('Hide shortcode button in WYSIWYG editor.', 'ajax-load-more').'</label>';
1126
-
1127
  echo $html;
1128
  }
1129
 
@@ -1137,14 +1138,14 @@ function alm_hide_btn_callback(){
1137
  */
1138
 
1139
  function _alm_error_notices_callback(){
1140
- $options = get_option( 'alm_settings' );
1141
- if(!isset($options['_alm_error_notices']))
1142
  $options['_alm_error_notices'] = '1';
1143
-
1144
  $html = '<input type="hidden" name="alm_settings[_alm_error_notices]" value="0" />';
1145
  $html .= '<input type="checkbox" name="alm_settings[_alm_error_notices]" id="_alm_error_notices" value="1"'. (($options['_alm_error_notices']) ? ' checked="checked"' : '') .' />';
1146
- $html .= '<label for="_alm_error_notices">'.__('Display error messaging regarding repeater template updates in the browser console.', 'ajax-load-more').'</label>';
1147
-
1148
  echo $html;
1149
  }
1150
 
@@ -1158,14 +1159,14 @@ function _alm_error_notices_callback(){
1158
  */
1159
 
1160
  function alm_disable_dynamic_callback(){
1161
- $options = get_option( 'alm_settings' );
1162
- if(!isset($options['_alm_disable_dynamic']))
1163
  $options['_alm_disable_dynamic'] = '0';
1164
-
1165
  $html = '<input type="hidden" name="alm_settings[_alm_disable_dynamic]" value="0" />';
1166
  $html .= '<input type="checkbox" name="alm_settings[_alm_disable_dynamic]" id="_alm_disable_dynamic" value="1"'. (($options['_alm_disable_dynamic']) ? ' checked="checked"' : '') .' />';
1167
- $html .= '<label for="_alm_disable_dynamic">'.__('Disable dynamic population of categories, tags and authors in the Shortcode Builder.<span style="display:block">Recommended if you have an extraordinary number of categories, tags and/or authors.', 'ajax-load-more').'</label>';
1168
-
1169
  echo $html;
1170
  }
1171
 
@@ -1176,24 +1177,24 @@ function alm_disable_dynamic_callback(){
1176
  *
1177
  * @since 2.0.0
1178
  */
1179
-
1180
  function alm_container_type_callback() {
1181
-
1182
  $options = get_option( 'alm_settings' );
1183
-
1184
- if(!isset($options['_alm_container_type']))
1185
  $options['_alm_container_type'] = '1';
1186
-
1187
  $html = '<input type="radio" id="_alm_container_type_one" name="alm_settings[_alm_container_type]" value="1"' . checked( 1, $options['_alm_container_type'], false ) . '/>';
1188
  $html .= '<label for="_alm_container_type_one">&lt;ul&gt; <span>&lt;!-- '.__('Ajax Posts Here', 'ajax-load-more').' --&gt;</span> &lt;/ul&gt;</label><br/>';
1189
-
1190
  $html .= '<input type="radio" id="_alm_container_type_two" name="alm_settings[_alm_container_type]" value="2"' . checked( 2, $options['_alm_container_type'], false ) . '/>';
1191
  $html .= '<label for="_alm_container_type_two">&lt;div&gt; <span>&lt;!-- '.__('Ajax Posts Here', 'ajax-load-more').' --&gt;</span> &lt;/div&gt;</label>';
1192
-
1193
  $html .= '<label style="cursor: default !important"><span style="display:block">'.__('You can modify the container type when building a shortcode.', 'ajax-load-more').'</span></label>';
1194
-
1195
  echo $html;
1196
-
1197
  }
1198
 
1199
 
@@ -1206,10 +1207,10 @@ function alm_container_type_callback() {
1206
 
1207
  function alm_class_callback(){
1208
  $options = get_option( 'alm_settings' );
1209
-
1210
  $html = '<label for="alm_settings[_alm_classname]">'.__('Add classes to Ajax Load More 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/>';
1211
- $html .= '<input type="text" id="alm_settings[_alm_classname]" name="alm_settings[_alm_classname]" value="'.$options['_alm_classname'].'" placeholder="posts listing etc..." /> ';
1212
-
1213
  echo $html;
1214
  }
1215
 
@@ -1221,54 +1222,54 @@ function alm_class_callback(){
1221
  *
1222
  * @since 2.0.0
1223
  */
1224
-
1225
  function alm_btn_color_callback() {
1226
-
1227
  $options = get_option( 'alm_settings' );
1228
  $type = $options['_alm_btn_color'];
1229
-
1230
- if(!isset($type))
1231
  $options['_alm_btn_color'] = '0';
1232
-
1233
- $selected0 = '';
1234
  if($type == 'default') $selected0 = 'selected="selected"';
1235
-
1236
- $selected1 = '';
1237
  if($type == 'blue') $selected1 = 'selected="selected"';
1238
-
1239
- $selected2 = '';
1240
  if($type == 'green') $selected2 = 'selected="selected"';
1241
-
1242
- $selected3 = '';
1243
  if($type == 'red') $selected3 = 'selected="selected"';
1244
-
1245
- $selected4 = '';
1246
  if($type == 'purple') $selected4 = 'selected="selected"';
1247
-
1248
- $selected5 = '';
1249
  if($type == 'grey') $selected5 = 'selected="selected"';
1250
-
1251
- $selected6 = '';
1252
  if($type == 'white') $selected6 = 'selected="selected"';
1253
-
1254
- $selected7 = '';
1255
  if($type == 'infinite classic') $selected7 = 'selected="selected"';
1256
-
1257
- $selected8 = '';
1258
  if($type == 'infinite skype') $selected8 = 'selected="selected"';
1259
-
1260
- $selected9 = '';
1261
  if($type == 'infinite ring') $selected9 = 'selected="selected"';
1262
-
1263
- $selected10 = '';
1264
  if($type == 'infinite fading-blocks') $selected10 = 'selected="selected"';
1265
-
1266
- $selected11 = '';
1267
  if($type == 'infinite fading-circles') $selected11 = 'selected="selected"';
1268
-
1269
- $selected12 = '';
1270
  if($type == 'infinite chasing-arrows') $selected12 = 'selected="selected"';
1271
-
1272
  $html = '<label for="alm_settings_btn_color">'.__('Select an Ajax loading style - you can choose between a <strong>button</strong> or <strong>infinite scroll</strong>', 'ajax-load-more');
1273
  $html .= '.<br/><span style="display:block">Selecting an Infinite Scroll button style will remove the click interaction and load content on scroll only.</span>';
1274
  $html .= '</label>';
@@ -1289,7 +1290,7 @@ function alm_btn_color_callback() {
1289
  $html .= '<option value="infinite chasing-arrows" class="infinite chasing-arrows" ' . $selected12 .'>Chasing Arrows</option>';
1290
  $html .= '</optgroup>';
1291
  $html .= '</select>';
1292
-
1293
  $html .= '<div class="clear"></div><div class="ajax-load-more-wrap core '.$type.'"><span>'.__('Preview', 'ajax-load-more') .'</span><button class="alm-load-more-btn loading" disabled="disabled">'.apply_filters('alm_button_label', __('Older Posts', 'ajax-load-more')).'</button></div>';
1294
  echo $html;
1295
  }
@@ -1305,17 +1306,17 @@ function alm_btn_color_callback() {
1305
 
1306
  function alm_btn_class_callback(){
1307
  $options = get_option( 'alm_settings' );
1308
-
1309
- if(!isset($options['_alm_btn_classname']))
1310
  $options['_alm_btn_classname'] = '';
1311
-
1312
  $html = '<label for="alm_settings[_alm_btn_classname]">'.__('Add classes to your <strong>Load More</strong> button', 'ajax-load-more').'.</label>';
1313
- $html .= '<input type="text" class="btn-classes" id="alm_settings[_alm_btn_classname]" name="alm_settings[_alm_btn_classname]" value="'.$options['_alm_btn_classname'].'" placeholder="button rounded listing etc..." /> ';
1314
-
1315
  echo $html;
1316
- ?>
1317
  <script>
1318
-
1319
  // Check if Disable CSS === true
1320
  if(jQuery('input#alm_disable_css_input').is(":checked")){
1321
  jQuery('select#alm_settings_btn_color').parent().parent().hide(); // Hide button color
@@ -1326,12 +1327,12 @@ function alm_btn_class_callback(){
1326
  if(el.is(":checked")) {
1327
  el.parent().parent('tr').next('tr').hide(); // Hide button color
1328
  //el.parent().parent('tr').next('tr').next('tr').hide(); // Hide Button Classes
1329
- }else{
1330
  el.parent().parent('tr').next('tr').show(); // show button color
1331
  //el.parent().parent('tr').next('tr').next('tr').show(); // show Button Classes
1332
  }
1333
  });
1334
-
1335
  </script>
1336
  <?php
1337
  }
@@ -1346,14 +1347,14 @@ function alm_btn_class_callback(){
1346
  */
1347
 
1348
  function _alm_scroll_top_callback(){
1349
- $options = get_option( 'alm_settings' );
1350
- if(!isset($options['_alm_scroll_top']))
1351
  $options['_alm_scroll_top'] = '0';
1352
-
1353
  $html = '<input type="hidden" name="alm_settings[_alm_scroll_top]" value="0" />';
1354
  $html .= '<input type="checkbox" name="alm_settings[_alm_scroll_top]" id="_alm_scroll_top" value="1"'. (($options['_alm_scroll_top']) ? ' checked="checked"' : '') .' />';
1355
- $html .= '<label for="_alm_scroll_top">'.__('On initial page load, move the user\'s browser window to the top of the screen.<span style="display:block">This <u>may</u> help prevent the loading of unnecessary posts.</span>', 'ajax-load-more').'</label>';
1356
-
1357
  echo $html;
1358
  }
1359
 
@@ -1367,14 +1368,14 @@ function _alm_scroll_top_callback(){
1367
  */
1368
 
1369
  function _alm_nonce_security_callback(){
1370
- $options = get_option( 'alm_settings' );
1371
- if(!isset($options['_alm_nonce_security']))
1372
  $options['_alm_nonce_security'] = '0';
1373
-
1374
  $html = '<input type="hidden" name="alm_settings[_alm_nonce_security]" value="0" />';
1375
  $html .= '<input type="checkbox" name="alm_settings[_alm_nonce_security]" id="_alm_nonce_security" value="1"'. (($options['_alm_nonce_security']) ? ' checked="checked"' : '') .' />';
1376
- $html .= '<label for="_alm_nonce_security">'.__('Enable <a href="https://codex.wordpress.org/WordPress_Nonces" target="_blank">WP nonce</a> verification to help protect URLs against certain types of misuse, malicious or otherwise on each Ajax Load More query.', 'ajax-load-more').'</label>';
1377
-
1378
  echo $html;
1379
  }
1380
 
1
  <?php
2
+
3
  add_action( 'plugins_loaded', 'alm_core_update' ); // Core Update
4
  add_action( 'wp_ajax_alm_save_repeater', 'alm_save_repeater' ); // Ajax Save Repeater
5
  add_action( 'wp_ajax_alm_update_repeater', 'alm_update_repeater' ); // Ajax Update Repeater
7
  add_action( 'wp_ajax_alm_delete_cache', 'alm_delete_cache' ); // Delete Cache
8
  add_action( 'wp_ajax_alm_layouts_dismiss', 'alm_layouts_dismiss' ); // Dismiss Layouts CTA
9
  add_action( 'wp_ajax_alm_license_activation', 'alm_license_activation' ); // Activate Add-on
10
+ add_action( 'alm_get_layouts', 'alm_get_layouts' ); // Add layout selection
11
  add_action( 'wp_ajax_alm_get_layout', 'alm_get_layout' ); // Get layout
12
  add_action( 'wp_ajax_alm_dismiss_sharing', 'alm_dismiss_sharing' ); // Dismiss sharing
13
  add_filter( 'admin_footer_text', 'alm_filter_admin_footer_text'); // Admin menu text
22
  */
23
 
24
  function alm_license_activation(){
25
+
26
  if (current_user_can( 'edit_theme_options' )){
27
+
28
  $nonce = $_GET["nonce"];
29
  $type = $_GET["type"]; // activate / deactivate
30
+ $item = $_GET["item"];
31
+ $license = $_GET["license"];
32
+ $url = $_GET["url"];
33
+ $upgrade = $_GET["upgrade"];
34
+ $option_status = $_GET["status"];
35
+ $option_key = $_GET["key"];
36
+
37
  // Check our nonce, if they don't match then bounce!
38
  if (! wp_verify_nonce( $nonce, 'alm_repeater_nonce' ))
39
+ die('Error - unable to verify nonce, please try again.');
40
+
41
  // data to send in our API request
42
  if($type === 'activate'){
43
  $action = 'activate_license';
44
  }else{
45
  $action = 'deactivate_license';
46
  }
47
+
48
+ $api_params = array(
49
+ 'edd_action'=> $action,
50
+ 'license' => $license,
51
  'item_id' => $item, // the ID of our product in EDD
52
  'url' => home_url()
53
  );
54
+
55
  // Call the custom API.
56
  //$response = wp_remote_get( add_query_arg( $api_params, $url ), array( 'timeout' => 15, 'sslverify' => false ) );
57
+
58
  // Updated 2.8.7
59
  $response = wp_remote_post( ALM_STORE_URL, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
60
+
61
  // make sure the response came back okay
62
  if ( is_wp_error( $response ) )
63
  return false;
64
+
65
+
66
  $license_data = $response['body'];
67
  $license_data = json_decode($license_data); // decode the license data
68
+
69
+
70
  $return["success"] = $license_data->success;
71
+
72
  $msg = '';
73
+ if($type === 'activate'){
74
  $return["license_limit"] = $license_data->license_limit;
75
  $return["expires"] = $license_data->expires;
76
  $return["site_count"] = $license_data->site_count;
77
  $return["activations_left"] = $license_data->activations_left;
78
  $return["license"] = $license_data->license;
79
+ $return["item_name"] = $license_data->item_name;
80
  if($license_data->activations_left === 0 && $license_data->success === false){
81
  $msg = '<strong>Sorry, but you are out of available licenses <em>('. $license_data->license_limit .' / '. $license_data->site_count .')</em>.</strong> Please visit the <a href="'.$upgrade.'" target="_blank">'.$license_data->item_name.'</a> page to add additional licenses.';
82
+ }
83
  }
84
  $return["msg"] = $msg;
85
+
86
  update_option( $option_status, $license_data->license);
87
+ update_option( $option_key, $license );
88
+
89
  echo json_encode($return);
90
+
91
  die();
92
+
93
  } else {
94
  echo __('You don\'t belong here.', ALM_NAME);
95
+ }
96
  }
97
 
98
 
105
  * @updated 2.14.0
106
  */
107
 
108
+ function alm_get_layout(){
109
+ if (current_user_can( 'edit_theme_options' )){
110
+
111
  $nonce = sanitize_text_field($_GET["nonce"]);
112
+ $type = sanitize_text_field($_GET["type"]);
113
+ $custom = sanitize_text_field($_GET["custom"]);
114
+
115
  // Check our nonce, if they don't match then bounce!
116
  if (! wp_verify_nonce( $nonce, 'alm_repeater_nonce' ))
117
+ die('Error - unable to verify nonce, please try again.');
118
+
119
  if($type === 'default'){
120
+
121
  // Default Layout
122
  $content = file_get_contents(ALM_PATH.'admin/includes/layout/'.$type.'.php');
123
+
124
  }else{
125
+
126
  // Custom Layout
127
  if($custom == 'true'){
128
  $dir = 'alm_layouts';
129
+
130
  if(is_child_theme()){
131
  $path = get_stylesheet_directory().'/'. $dir .'/' .$type;
132
  // if child theme does not have the layout, check the parent theme
137
  else{
138
  $path = get_template_directory().'/'. $dir .'/' .$type;
139
  }
140
+ $content = file_get_contents($path);
141
+
142
+ }
143
+
144
  // Layouts Add-on
145
+ else {
146
+ $content = file_get_contents(ALM_LAYOUTS_PATH.'layouts/'.$type.'.php');
147
+ }
148
+ }
149
+
150
  $return["value"] = $content;
151
+ echo json_encode($return);
152
  }else {
153
  echo __('You don\'t belong here.', ALM_NAME);
154
+ }
155
+ die();
156
  }
157
 
158
 
165
  * @since 2.8.7
166
  */
167
  function alm_get_layouts(){ // do_action
168
+ include( ALM_PATH . 'admin/includes/components/layout-list.php');
169
  }
170
 
 
171
  /*
172
  * alm_admin_vars
173
  * Create admin variables and ajax nonce
177
  function alm_admin_vars() { ?>
178
  <script type='text/javascript'>
179
  /* <![CDATA[ */
180
+ var alm_admin_localize = <?php echo json_encode( array(
181
  'ajax_admin_url' => admin_url( 'admin-ajax.php' ),
182
  'active' => __('Active', 'ajax-load-more'),
183
  'inactive' => __('Inactive', 'ajax-load-more'),
216
  * @since 2.0.5
217
  */
218
 
219
+ function alm_core_update() {
220
+
221
  if(!get_option( 'alm_version')){ // Add 'alm_version' to WP options table if it does not exist
222
+ add_option( 'alm_version', ALM_VERSION );
223
+ }
224
+
225
  $alm_installed_ver = get_option( "alm_version" ); // Get value from WP Option tbl
226
  if ( $alm_installed_ver != ALM_VERSION ) {
227
+
228
  // Delete ALM transients
229
  delete_transient('alm_dismiss_sharing');
230
+
231
  // Update repeaters
232
+ alm_run_update();
233
+
234
+ }
235
  }
236
 
237
 
244
  */
245
 
246
  function alm_run_update(){
247
+ global $wpdb;
248
+
249
+ if ( is_multisite()) {
250
+ $blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
251
+
252
+ // Loop all blogs and run update routine
253
  foreach ( $blog_ids as $blog_id ) {
254
  switch_to_blog( $blog_id );
255
  alm_update_template_files();
256
  restore_current_blog();
257
  }
258
+
259
  } else {
260
  alm_update_template_files();
261
  }
262
+
263
  update_option( "alm_version", ALM_VERSION ); // Update the WP Option tbl with the new version num
264
  }
265
 
273
  */
274
 
275
  function alm_update_template_files(){
276
+ global $wpdb;
277
  $table_name = $wpdb->prefix . "alm";
278
+ $blog_id = $wpdb->blogid;
279
+
280
+ // Get all templates ($rows) where name is 'default'
281
+ $rows = $wpdb->get_results("SELECT * FROM $table_name WHERE name = 'default'");
282
 
283
  if($rows){
284
  foreach( $rows as $row ) { // Loop $rows
285
+
286
  $data = $wpdb->get_var("SELECT repeaterDefault FROM $table_name WHERE name = 'default'");
287
+
288
  if($blog_id > 1){
289
  $dir = ALM_PATH. 'core/repeater/'. $blog_id;
290
  if( !is_dir($dir) ){
291
  mkdir($dir);
292
+ }
293
  $f = ALM_PATH. 'core/repeater/'. $blog_id .'/default.php';
294
  }else{
295
  $f = ALM_PATH. 'core/repeater/default.php';
296
  }
297
+
298
  try {
299
  $o = fopen($f, 'w+'); //Open file
300
  if ( !$o ) {
301
  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 /ajax-load-more/core/repeater directory', 'ajax-load-more'));
302
+ }
303
  $w = fwrite($o, $data); //Save the file
304
  if ( !$w ) {
305
  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 /ajax-load-more/core/repeater directory.', 'ajax-load-more'));
306
+ }
307
  fclose($o); //now close it
308
+
309
  } catch ( Exception $e ) {
310
  // Display error message in console.
311
+ if(!isset($options['_alm_error_notices']) || $options['_alm_error_notices'] == '1'){
312
  echo '<script>console.log("' .$e->getMessage(). '");</script>';
313
  }
314
  }
315
+
316
  }
317
  }
318
+
319
  }
320
 
321
 
329
  */
330
 
331
  add_action( 'admin_menu', 'alm_admin_menu' );
332
+ function alm_admin_menu() {
333
  $icon = 'dashicons-plus-alt';
334
  $icon = ALM_ADMIN_URL . "/img/alm-logo-16x16.svg";
335
+
336
+ $alm_page = add_menu_page(
337
+ 'Ajax Load More',
338
+ 'Ajax Load More',
339
+ 'edit_theme_options',
340
+ 'ajax-load-more',
341
  'alm_settings_page',
342
  $icon
343
  );
344
+
345
+ $alm_settings_page = add_submenu_page(
346
+ 'ajax-load-more',
347
+ 'Settings',
348
+ 'Settings',
349
+ 'edit_theme_options',
350
+ 'ajax-load-more',
351
  'alm_settings_page'
352
+ );
353
+
354
+ $alm_template_page = add_submenu_page(
355
+ 'ajax-load-more',
356
+ 'Repeater Templates',
357
+ 'Repeater Templates',
358
+ 'edit_theme_options',
359
+ 'ajax-load-more-repeaters',
360
  'alm_repeater_page'
361
  );
362
+
363
+ $alm_shortcode_page = add_submenu_page(
364
+ 'ajax-load-more',
365
+ 'Shortcode Builder',
366
+ 'Shortcode Builder',
367
+ 'edit_theme_options',
368
+ 'ajax-load-more-shortcode-builder',
369
  'alm_shortcode_builder_page'
370
  );
371
+
372
+ $alm_addons_page = add_submenu_page(
373
+ 'ajax-load-more',
374
+ 'Add-ons',
375
+ 'Add-ons',
376
+ 'edit_theme_options',
377
+ 'ajax-load-more-add-ons',
378
  'alm_add_ons_page'
379
+ );
380
+
381
+ $alm_examples_page = add_submenu_page(
382
+ 'ajax-load-more',
383
+ 'Examples',
384
+ 'Examples',
385
+ 'edit_theme_options',
386
+ 'ajax-load-more-examples',
387
  'alm_examples_page'
388
+ );
389
+
390
+ $alm_help_page = add_submenu_page(
391
+ 'ajax-load-more',
392
+ 'Help',
393
+ 'Help',
394
+ 'edit_theme_options',
395
+ 'ajax-load-more-help',
396
  'alm_help_page'
397
+ );
398
+
399
  $alm_licenses_page = add_submenu_page(
400
+ 'ajax-load-more',
401
+ 'Licenses',
402
+ 'Licenses',
403
+ 'edit_theme_options',
404
+ 'ajax-load-more-licenses',
405
  'alm_licenses_page'
406
+ );
407
+
408
  if(has_action('alm_cache_installed')){
409
+ $alm_cache_page = add_submenu_page(
410
+ 'ajax-load-more',
411
+ 'Cache',
412
+ '<span style="color: #f2f5bf; display:block; border-top: 1px solid #555; padding-top: 8px; border-radius: 3px;">Cache<span>',
413
+ 'edit_theme_options',
414
+ 'ajax-load-more-cache',
415
  'alm_cache_page'
416
  );
417
  add_action( 'load-' . $alm_cache_page, 'alm_load_admin_js' );
418
  add_action( 'load-' . $alm_cache_page, 'alm_load_cache_admin_js' );
419
+ add_action( 'load-' . $alm_cache_page, 'alm_set_admin_nonce' );
420
  }
421
+
422
  //Add our admin scripts
423
  add_action( 'load-' . $alm_settings_page, 'alm_load_admin_js' );
424
+ add_action( 'load-' . $alm_settings_page, 'alm_set_admin_nonce' );
425
  add_action( 'load-' . $alm_template_page, 'alm_load_admin_js' );
426
+ add_action( 'load-' . $alm_template_page, 'alm_set_admin_nonce' );
427
  add_action( 'load-' . $alm_shortcode_page, 'alm_load_admin_js' );
428
  add_action( 'load-' . $alm_shortcode_page, 'alm_set_admin_nonce' );
429
  add_action( 'load-' . $alm_examples_page, 'alm_load_admin_js' );
434
  add_action( 'load-' . $alm_addons_page, 'alm_set_admin_nonce' );
435
  add_action( 'load-' . $alm_licenses_page, 'alm_load_admin_js' );
436
  add_action( 'load-' . $alm_licenses_page, 'alm_set_admin_nonce' );
437
+ }
438
+
439
 
440
 
441
  /**
471
  wp_enqueue_style( 'alm-tooltipster', ALM_ADMIN_URL. 'css/tooltipster/tooltipster.css');
472
  wp_enqueue_style( 'alm-core', ALM_URL. '/core/css/ajax-load-more.css');
473
  wp_enqueue_style( 'alm-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css');
474
+
475
+ wp_dequeue_style( 'acf-input' );
476
+
477
+ //Load CodeMirror Syntax Highlighting if on Repater Template page
478
  $screen = get_current_screen();
479
+ if ( in_array( $screen->id, array( 'ajax-load-more_page_ajax-load-more-repeaters') ) ){
480
+
481
  //CodeMirror CSS
482
  wp_enqueue_style( 'alm-codemirror-css', ALM_ADMIN_URL. 'codemirror/lib/codemirror.css' );
483
+
484
  //CodeMirror JS
485
+ wp_enqueue_script( 'alm-codemirror', ALM_ADMIN_URL. 'codemirror/lib/codemirror.js');
486
  wp_enqueue_script( 'alm-codemirror-matchbrackets', ALM_ADMIN_URL. 'codemirror/addon/edit/matchbrackets.js' );
487
  wp_enqueue_script( 'alm-codemirror-htmlmixed', ALM_ADMIN_URL. 'codemirror/mode/htmlmixed/htmlmixed.js' );
488
  wp_enqueue_script( 'alm-codemirror-xml', ALM_ADMIN_URL. 'codemirror/mode/xml/xml.js' );
490
  wp_enqueue_script( 'alm-codemirror-mode-css', ALM_ADMIN_URL. 'codemirror/mode/css/css.js' );
491
  wp_enqueue_script( 'alm-codemirror-clike', ALM_ADMIN_URL. 'codemirror/mode/clike/clike.js' );
492
  wp_enqueue_script( 'alm-codemirror-php', ALM_ADMIN_URL. 'codemirror/mode/php/php.js' );
493
+
494
  }
495
+
496
+ //Load JS
497
  wp_enqueue_script( 'jquery-form' );
498
  wp_enqueue_script( 'alm-select2', ALM_ADMIN_URL. 'js/libs/select2.min.js', array( 'jquery' ));
499
  wp_enqueue_script( 'alm-drops', ALM_ADMIN_URL. 'js/libs/jquery.drops.js', array( 'jquery' ));
512
  * @since 2.0.0
513
  */
514
 
515
+ function alm_settings_page(){
516
  include_once( ALM_PATH . 'admin/views/settings.php');
517
  }
518
 
525
  * @since 2.0.0
526
  */
527
 
528
+ function alm_repeater_page(){
529
  include_once( ALM_PATH . 'admin/views/repeater-templates.php');
530
  }
531
 
538
  * @since 2.0.0
539
  */
540
 
541
+ function alm_shortcode_builder_page(){
542
+ include_once( ALM_PATH . 'admin/views/shortcode-builder.php');
543
  }
544
 
545
 
551
  * @since 2.0.0
552
  */
553
 
554
+ function alm_examples_page(){
555
+ include_once( ALM_PATH . 'admin/views/examples.php');
556
  }
557
 
558
 
559
 
560
  /*
561
  * alm_help_page
562
+ * Help Page (Implementation Inforgraphic)
563
  *
564
  * @since 2.8.7
565
  */
566
 
567
+ function alm_help_page(){
568
+ include_once( ALM_PATH . 'admin/views/help.php');
569
  }
570
 
571
 
577
  * @since 2.0.0
578
  */
579
 
580
+ function alm_add_ons_page(){
581
  include_once( ALM_PATH . 'admin/views/add-ons.php');
582
  }
583
 
590
  * @since 2.7.0
591
  */
592
 
593
+ function alm_licenses_page(){
594
  include_once( ALM_PATH . 'admin/views/licenses.php');
595
  }
596
 
602
  * @since 2.6.0
603
  */
604
 
605
+ function alm_cache_page(){
606
  include_once( ALM_CACHE_PATH . 'admin/views/cache.php');
607
  }
608
 
617
  */
618
 
619
  function alm_save_repeater(){
620
+
621
  if (current_user_can( 'edit_theme_options' )){
622
+
623
  global $wpdb;
624
  $table_name = $wpdb->prefix . "alm";
625
+ $blog_id = $wpdb->blogid;
626
  $options = get_option( 'alm_settings' ); //Get plugin options
627
+
628
  $nonce = $_POST["nonce"];
629
  // Check our nonce, if they don't match then bounce!
630
  if (! wp_verify_nonce( $nonce, 'alm_repeater_nonce' ))
631
  die('Error - unable to verify nonce, please try again.');
632
+
633
+ // Get _POST Vars
634
  $c = Trim(stripslashes($_POST["value"])); // Repeater Value
635
  $n = Trim(stripslashes($_POST["repeater"])); // Repeater name
636
  $t = Trim(stripslashes($_POST["type"])); // Repeater name
637
  $a = Trim(stripslashes($_POST["alias"])); // Repeater alias
638
+
639
+ // Write to repeater templates
640
+
641
  // (Default)
642
  if($t === 'default'){
643
+
644
+ if($blog_id > 1){
645
  $dir = ALM_PATH. 'core/repeater/'. $blog_id;
646
  if( !is_dir($dir) ){
647
  mkdir($dir);
648
+ }
649
  $f = ALM_PATH. 'core/repeater/'. $blog_id .'/default.php';
650
  }else{
651
+ $f = ALM_PATH. 'core/repeater/default.php';
652
  }
653
+
654
  }
655
  // (Unlimited)
656
  elseif($t === 'unlimited'){
657
+
658
  if($blog_id > 1){
659
  $dir = ALM_UNLIMITED_PATH. 'repeaters/'. $blog_id;
660
  if( !is_dir($dir) ){
664
  }else{
665
  $f = ALM_UNLIMITED_PATH. 'repeaters/'.$n .'.php';
666
  }
667
+
668
  }
669
  // (Unlimited v1)
670
  else{
671
+
672
  $f = ALM_REPEATER_PATH. 'repeaters/'.$n .'.php';
673
+
674
  }
675
+
676
  try {
677
  $o = fopen($f, 'w+'); //Open file
678
  if ( !$o ) {
679
  throw new Exception(__('[Ajax Load More] Unable to open repeater template - '.$f.' - Please check your file path and ensure your server is configured to allow Ajax Load More to read and write files.', 'ajax-load-more'));
680
+ }
681
  $w = fwrite($o, $c); //Save the file
682
  if ( !$w ) {
683
  throw new Exception(__('[Ajax Load More] Error saving repeater template - '.$f.' - Please check your file path and ensure your server is configured to allow Ajax Load More to read and write files.', 'ajax-load-more'));
684
+ }
685
  fclose($o); //now close it
686
+
687
  } catch ( Exception $e ) {
688
  // Display error message in console.
689
+ if(!isset($options['_alm_error_notices']) || $options['_alm_error_notices'] == '1'){
690
  echo '<script>console.log("' .$e->getMessage(). '");</script>';
691
  }
692
  }
693
+
694
+ //Save to database
695
+
696
+ if($t === 'default') {
697
  $data_update = array('repeaterDefault' => "$c", 'pluginVersion' => ALM_VERSION);
698
  $data_where = array('name' => "default");
699
  }
700
+ elseif($t === 'unlimited'){ // Unlimited Repeaters
701
+ $table_name = $wpdb->prefix . "alm_unlimited";
702
  $data_update = array('repeaterDefault' => "$c", 'alias' => "$a", 'pluginVersion' => ALM_UNLIMITED_VERSION);
703
  $data_where = array('name' => $n);
704
  }
706
  $data_update = array('repeaterDefault' => "$c", 'alias' => "$a", 'pluginVersion' => ALM_REPEATER_VERSION);
707
  $data_where = array('name' => $n);
708
  }
709
+
710
  $wpdb->update($table_name , $data_update, $data_where);
711
+
712
  //Our results
713
  if($w){
714
  echo '<span class="saved">Template Saved Successfully</span>';
716
  echo '<span class="saved-error"><b>'. __('Error Writing File', 'ajax-load-more') .'</b></span><br/>Something went wrong and the data could not be saved.';
717
  }
718
  die();
719
+
720
  }else {
721
  echo __('You don\'t belong here.', 'ajax-load-more');
722
  }
735
  */
736
 
737
  function alm_update_repeater(){
738
+
739
  if (current_user_can( 'edit_theme_options' )){
740
+
741
  $nonce = $_POST["nonce"];
742
  // Check our nonce, if they don't match then bounce!
743
  if (! wp_verify_nonce( $nonce, 'alm_repeater_nonce' ))
744
  die('Error - unable to verify nonce, please try again.');
745
+
746
+ // Get _POST Vars
747
  $n = Trim(stripslashes($_POST["repeater"])); // Repeater name
748
  $t = Trim(stripslashes($_POST["type"])); // Repeater type (default | unlimited)
749
+
750
+
751
  // Get value from database
752
  global $wpdb;
753
+ $table_name = $wpdb->prefix . "alm";
754
+
755
+ if($t === 'default') $n = 'default';
756
+ if($t === 'unlimited') $table_name = $wpdb->prefix . "alm_unlimited";
757
+
758
  $the_repeater = $wpdb->get_var("SELECT repeaterDefault FROM " . $table_name . " WHERE name = '$n'");
759
+
760
  echo $the_repeater; // Return repeater value
761
+
762
  die();
763
+
764
  } else {
765
  echo __('You don\'t belong here.', 'ajax-load-more');
766
  }
767
+
768
  }
769
 
770
 
777
  * @since 2.1.0
778
  */
779
 
780
+ function alm_get_tax_terms(){
781
  if (current_user_can( 'edit_theme_options' )){
782
+
783
  $nonce = $_GET["nonce"];
784
  // Check our nonce, if they don't match then bounce!
785
  if (! wp_verify_nonce( $nonce, 'alm_repeater_nonce' ))
786
  die('Get Bounced!');
787
+
788
+ $taxonomy = (isset($_GET['taxonomy'])) ? $_GET['taxonomy'] : '';
789
+ $index = (isset($_GET['index'])) ? $_GET['index'] : '1';
790
+
791
  $tax_args = array(
792
+ 'orderby' => 'name',
793
  'order' => 'ASC',
794
  'hide_empty' => false
795
+ );
796
  $terms = get_terms($taxonomy, $tax_args);
797
  $returnVal = '';
798
+ if ( !empty( $terms ) && !is_wp_error( $terms ) ){
799
  $returnVal .= '<ul>';
800
  foreach ( $terms as $term ) {
801
 
802
+ $returnVal .='<li><input type="checkbox" class="alm_element" name="tax-term-'.$term->slug.'" id="tax-term-'.$term->slug.'-'.$index.'" data-type="'.$term->slug.'"><label for="tax-term-'.$term->slug.'-'.$index.'">'.$term->name.'</label></li>';
803
+
804
  }
805
+ $returnVal .= '</ul>';
806
  echo $returnVal;
807
+
808
  die();
809
  }else{
810
  echo "<p class='warning'>No terms exist within this taxonomy</p>";
811
  die();
812
  }
813
+
814
+ } else {
815
+ echo __('You don\'t belong here.', 'ajax-load-more');
816
  }
817
  }
818
 
826
  */
827
  function alm_layouts_dismiss(){
828
  if (current_user_can( 'edit_theme_options' )){
829
+
830
  $nonce = $_POST["nonce"];
831
+
832
  // Check our nonce, if they don't match then bounce!
833
  if (! wp_verify_nonce( $nonce, 'alm_repeater_nonce' ))
834
+ die('Error - unable to verify nonce, please try again.');
835
+
836
  update_option('alm_layouts_dismiss', 'true');
837
  echo 'Success';
838
+
839
  die();
840
  }
841
  }
850
  */
851
  function alm_dismiss_sharing(){
852
  if (current_user_can( 'edit_theme_options' )){
853
+
854
  $nonce = $_POST["nonce"];
855
+
856
  // Check our nonce, if they don't match then bounce!
857
  if (! wp_verify_nonce( $nonce, 'alm_repeater_nonce' ))
858
+ die('Error - unable to verify nonce, please try again.');
859
+
860
  set_transient( 'alm_dismiss_sharing', 'true', YEAR_IN_SECONDS );
861
  echo 'ALM sharing dismissed successfully.';
862
+
863
  die();
864
  }
865
  }
873
  * @since 2.12.0
874
  */
875
 
876
+ function alm_filter_admin_footer_text( $text ) {
877
+ $screen = alm_is_admin_screen();
878
  if(!$screen){
879
  return;
880
  }
881
+
882
  echo '<strong>Ajax Load More</strong> is made with <span style="color: #e25555;">♥</span> by <a href="https://connekthq.com" target="_blank" style="font-weight: 500;">Connekt</a> | <a href="https://wordpress.org/support/plugin/ajax-load-more/reviews/" target="_blank" style="font-weight: 500;">Leave a Review</a> | <a href="https://connekthq.com/plugins/ajax-load-more/support/" target="_blank" style="font-weight: 500;">Get Support</a>';
883
  }
884
 
894
  add_action( 'admin_init', 'alm_admin_init');
895
  function alm_admin_init(){
896
 
897
+ register_setting(
898
+ 'alm-setting-group',
899
+ 'alm_settings',
900
+ 'alm_sanitize_settings'
901
+ );
902
+
903
+ add_settings_section(
904
+ 'alm_general_settings',
905
+ 'Global Settings',
906
+ 'alm_general_settings_callback',
907
+ 'ajax-load-more'
908
  );
909
+
910
+ add_settings_section(
911
+ 'alm_admin_settings',
912
+ 'Admin Settings',
913
+ 'alm_admin_settings_callback',
914
+ 'ajax-load-more'
915
  );
916
+
 
 
 
 
 
 
 
917
  add_settings_field( // Container type
918
  '_alm_container_type',
919
  __('Container Type', 'ajax-load-more' ),
921
  'ajax-load-more',
922
  'alm_general_settings'
923
  );
924
+
925
  add_settings_field( // Classnames
926
+ '_alm_classname',
927
+ __('Container Classes', 'ajax-load-more' ),
928
+ 'alm_class_callback',
929
+ 'ajax-load-more',
930
+ 'alm_general_settings'
931
  );
932
+
933
  add_settings_field( // Disbale CSS
934
+ '_alm_disable_css',
935
+ __('Disable CSS', 'ajax-load-more' ),
936
+ 'alm_disable_css_callback',
937
+ 'ajax-load-more',
938
+ 'alm_general_settings'
939
  );
940
+
941
  add_settings_field( // Btn color
942
+ '_alm_btn_color',
943
+ __('Button/Loading Style', 'ajax-load-more' ),
944
+ 'alm_btn_color_callback',
945
+ 'ajax-load-more',
946
+ 'alm_general_settings'
947
+ );
948
+
949
  add_settings_field( // Button classes
950
+ '_alm_btn_classname',
951
+ __('Button Classes', 'ajax-load-more' ),
952
+ 'alm_btn_class_callback',
953
+ 'ajax-load-more',
954
+ 'alm_general_settings'
955
  );
956
+
957
  add_settings_field( // Nonce security
958
+ '_alm_nonce_security',
959
+ __('Ajax Security', 'ajax-load-more' ),
960
+ '_alm_nonce_security_callback',
961
+ 'ajax-load-more',
962
+ 'alm_general_settings'
963
+ );
964
+
965
  add_settings_field( // Scroll to top on load
966
+ '_alm_scroll_top',
967
+ __('Top of Page', 'ajax-load-more' ),
968
+ '_alm_scroll_top_callback',
969
+ 'ajax-load-more',
970
+ 'alm_general_settings'
971
+ );
972
+
973
  add_settings_field( // Load dynamic queries
974
+ '_alm_disable_dynamic',
975
+ __('Dynamic Content', 'ajax-load-more' ),
976
+ 'alm_disable_dynamic_callback',
977
+ 'ajax-load-more',
978
+ 'alm_admin_settings'
979
+ );
980
+
981
  add_settings_field( // Hide btn
982
+ '_alm_hide_btn',
983
+ __('Editor Button', 'ajax-load-more' ),
984
+ 'alm_hide_btn_callback',
985
+ 'ajax-load-more',
986
+ 'alm_admin_settings'
987
  );
988
+
989
  add_settings_field( // Display error notices
990
+ '_alm_error_notices',
991
+ __('Error Notices', 'ajax-load-more' ),
992
+ '_alm_error_notices_callback',
993
+ 'ajax-load-more',
994
+ 'alm_admin_settings'
995
+ );
996
+
997
+
998
  // CACHE
999
+ if(has_action('alm_cache_settings')){
1000
+ do_action('alm_cache_settings');
1001
+ }
1002
+
1003
+
1004
  // CUSTOM REPEATERS
1005
+ if(has_action('alm_unlimited_settings')){
1006
+ do_action('alm_unlimited_settings');
1007
  }
1008
+
1009
+
1010
  // LAYOUTS
1011
+ if(has_action('alm_layouts_settings')){
1012
+ do_action('alm_layouts_settings');
1013
  }
1014
+
1015
+
1016
  // PAGINATION
1017
+ if(has_action('alm_paging_settings')){
1018
+ do_action('alm_paging_settings');
1019
  }
1020
+
1021
+
1022
  // PREVIOUS POST
1023
+ if(has_action('alm_prev_post_settings')){
1024
+ do_action('alm_prev_post_settings');
1025
  }
1026
+
1027
+
1028
  // PRELOADED
1029
+ if(has_action('alm_preloaded_settings')){
1030
+ do_action('alm_preloaded_settings');
1031
  }
1032
+
1033
+
1034
  // REST API
1035
+ if(has_action('alm_rest_api_settings')){
1036
+ do_action('alm_rest_api_settings');
1037
  }
1038
+
1039
+
1040
  // SEO
1041
+ if(has_action('alm_seo_settings')){
1042
+ do_action('alm_seo_settings');
1043
  }
1044
+
1045
+
1046
  // THEME REPEATERS
1047
+ if(has_action('alm_theme_repeaters_settings')){
1048
+ do_action('alm_theme_repeaters_settings');
1049
+ }
1050
  }
1051
 
1052
 
1098
 
1099
  function alm_disable_css_callback(){
1100
  $options = get_option( 'alm_settings' );
1101
+ if(!isset($options['_alm_disable_css']))
1102
  $options['_alm_disable_css'] = '0';
1103
+
1104
  $html = '<input type="hidden" name="alm_settings[_alm_disable_css]" value="0" />';
1105
  $html .= '<input type="checkbox" id="alm_disable_css_input" name="alm_settings[_alm_disable_css]" value="1"'. (($options['_alm_disable_css']) ? ' checked="checked"' : '') .' />';
1106
  $html .= '<label for="alm_disable_css_input">'.__('I want to use my own CSS styles.', 'ajax-load-more').'<br/><span style="display:block;"><i class="fa fa-file-text-o"></i> &nbsp;<a href="'.ALM_URL.'/core/css/ajax-load-more.css" target="blank">'.__('View Ajax Load More CSS', 'ajax-load-more').'</a></span></label>';
1107
+
1108
  echo $html;
1109
  }
1110
 
1119
 
1120
  function alm_hide_btn_callback(){
1121
  $options = get_option( 'alm_settings' );
1122
+ if(!isset($options['_alm_hide_btn']))
1123
  $options['_alm_hide_btn'] = '0';
1124
+
1125
  $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"' : '') .' />';
1126
+ $html .= '<label for="alm_hide_btn">'.__('Hide shortcode button in WYSIWYG editor.', 'ajax-load-more').'</label>';
1127
+
1128
  echo $html;
1129
  }
1130
 
1138
  */
1139
 
1140
  function _alm_error_notices_callback(){
1141
+ $options = get_option( 'alm_settings' );
1142
+ if(!isset($options['_alm_error_notices']))
1143
  $options['_alm_error_notices'] = '1';
1144
+
1145
  $html = '<input type="hidden" name="alm_settings[_alm_error_notices]" value="0" />';
1146
  $html .= '<input type="checkbox" name="alm_settings[_alm_error_notices]" id="_alm_error_notices" value="1"'. (($options['_alm_error_notices']) ? ' checked="checked"' : '') .' />';
1147
+ $html .= '<label for="_alm_error_notices">'.__('Display error messaging regarding repeater template updates in the browser console.', 'ajax-load-more').'</label>';
1148
+
1149
  echo $html;
1150
  }
1151
 
1159
  */
1160
 
1161
  function alm_disable_dynamic_callback(){
1162
+ $options = get_option( 'alm_settings' );
1163
+ if(!isset($options['_alm_disable_dynamic']))
1164
  $options['_alm_disable_dynamic'] = '0';
1165
+
1166
  $html = '<input type="hidden" name="alm_settings[_alm_disable_dynamic]" value="0" />';
1167
  $html .= '<input type="checkbox" name="alm_settings[_alm_disable_dynamic]" id="_alm_disable_dynamic" value="1"'. (($options['_alm_disable_dynamic']) ? ' checked="checked"' : '') .' />';
1168
+ $html .= '<label for="_alm_disable_dynamic">'.__('Disable dynamic population of categories, tags and authors in the Shortcode Builder.<span style="display:block">Recommended if you have an extraordinary number of categories, tags and/or authors.', 'ajax-load-more').'</label>';
1169
+
1170
  echo $html;
1171
  }
1172
 
1177
  *
1178
  * @since 2.0.0
1179
  */
1180
+
1181
  function alm_container_type_callback() {
1182
+
1183
  $options = get_option( 'alm_settings' );
1184
+
1185
+ if(!isset($options['_alm_container_type']))
1186
  $options['_alm_container_type'] = '1';
1187
+
1188
  $html = '<input type="radio" id="_alm_container_type_one" name="alm_settings[_alm_container_type]" value="1"' . checked( 1, $options['_alm_container_type'], false ) . '/>';
1189
  $html .= '<label for="_alm_container_type_one">&lt;ul&gt; <span>&lt;!-- '.__('Ajax Posts Here', 'ajax-load-more').' --&gt;</span> &lt;/ul&gt;</label><br/>';
1190
+
1191
  $html .= '<input type="radio" id="_alm_container_type_two" name="alm_settings[_alm_container_type]" value="2"' . checked( 2, $options['_alm_container_type'], false ) . '/>';
1192
  $html .= '<label for="_alm_container_type_two">&lt;div&gt; <span>&lt;!-- '.__('Ajax Posts Here', 'ajax-load-more').' --&gt;</span> &lt;/div&gt;</label>';
1193
+
1194
  $html .= '<label style="cursor: default !important"><span style="display:block">'.__('You can modify the container type when building a shortcode.', 'ajax-load-more').'</span></label>';
1195
+
1196
  echo $html;
1197
+
1198
  }
1199
 
1200
 
1207
 
1208
  function alm_class_callback(){
1209
  $options = get_option( 'alm_settings' );
1210
+
1211
  $html = '<label for="alm_settings[_alm_classname]">'.__('Add classes to Ajax Load More 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/>';
1212
+ $html .= '<input type="text" id="alm_settings[_alm_classname]" name="alm_settings[_alm_classname]" value="'.$options['_alm_classname'].'" placeholder="posts listing etc..." /> ';
1213
+
1214
  echo $html;
1215
  }
1216
 
1222
  *
1223
  * @since 2.0.0
1224
  */
1225
+
1226
  function alm_btn_color_callback() {
1227
+
1228
  $options = get_option( 'alm_settings' );
1229
  $type = $options['_alm_btn_color'];
1230
+
1231
+ if(!isset($type))
1232
  $options['_alm_btn_color'] = '0';
1233
+
1234
+ $selected0 = '';
1235
  if($type == 'default') $selected0 = 'selected="selected"';
1236
+
1237
+ $selected1 = '';
1238
  if($type == 'blue') $selected1 = 'selected="selected"';
1239
+
1240
+ $selected2 = '';
1241
  if($type == 'green') $selected2 = 'selected="selected"';
1242
+
1243
+ $selected3 = '';
1244
  if($type == 'red') $selected3 = 'selected="selected"';
1245
+
1246
+ $selected4 = '';
1247
  if($type == 'purple') $selected4 = 'selected="selected"';
1248
+
1249
+ $selected5 = '';
1250
  if($type == 'grey') $selected5 = 'selected="selected"';
1251
+
1252
+ $selected6 = '';
1253
  if($type == 'white') $selected6 = 'selected="selected"';
1254
+
1255
+ $selected7 = '';
1256
  if($type == 'infinite classic') $selected7 = 'selected="selected"';
1257
+
1258
+ $selected8 = '';
1259
  if($type == 'infinite skype') $selected8 = 'selected="selected"';
1260
+
1261
+ $selected9 = '';
1262
  if($type == 'infinite ring') $selected9 = 'selected="selected"';
1263
+
1264
+ $selected10 = '';
1265
  if($type == 'infinite fading-blocks') $selected10 = 'selected="selected"';
1266
+
1267
+ $selected11 = '';
1268
  if($type == 'infinite fading-circles') $selected11 = 'selected="selected"';
1269
+
1270
+ $selected12 = '';
1271
  if($type == 'infinite chasing-arrows') $selected12 = 'selected="selected"';
1272
+
1273
  $html = '<label for="alm_settings_btn_color">'.__('Select an Ajax loading style - you can choose between a <strong>button</strong> or <strong>infinite scroll</strong>', 'ajax-load-more');
1274
  $html .= '.<br/><span style="display:block">Selecting an Infinite Scroll button style will remove the click interaction and load content on scroll only.</span>';
1275
  $html .= '</label>';
1290
  $html .= '<option value="infinite chasing-arrows" class="infinite chasing-arrows" ' . $selected12 .'>Chasing Arrows</option>';
1291
  $html .= '</optgroup>';
1292
  $html .= '</select>';
1293
+
1294
  $html .= '<div class="clear"></div><div class="ajax-load-more-wrap core '.$type.'"><span>'.__('Preview', 'ajax-load-more') .'</span><button class="alm-load-more-btn loading" disabled="disabled">'.apply_filters('alm_button_label', __('Older Posts', 'ajax-load-more')).'</button></div>';
1295
  echo $html;
1296
  }
1306
 
1307
  function alm_btn_class_callback(){
1308
  $options = get_option( 'alm_settings' );
1309
+
1310
+ if(!isset($options['_alm_btn_classname']))
1311
  $options['_alm_btn_classname'] = '';
1312
+
1313
  $html = '<label for="alm_settings[_alm_btn_classname]">'.__('Add classes to your <strong>Load More</strong> button', 'ajax-load-more').'.</label>';
1314
+ $html .= '<input type="text" class="btn-classes" id="alm_settings[_alm_btn_classname]" name="alm_settings[_alm_btn_classname]" value="'.$options['_alm_btn_classname'].'" placeholder="button rounded listing etc..." /> ';
1315
+
1316
  echo $html;
1317
+ ?>
1318
  <script>
1319
+
1320
  // Check if Disable CSS === true
1321
  if(jQuery('input#alm_disable_css_input').is(":checked")){
1322
  jQuery('select#alm_settings_btn_color').parent().parent().hide(); // Hide button color
1327
  if(el.is(":checked")) {
1328
  el.parent().parent('tr').next('tr').hide(); // Hide button color
1329
  //el.parent().parent('tr').next('tr').next('tr').hide(); // Hide Button Classes
1330
+ }else{
1331
  el.parent().parent('tr').next('tr').show(); // show button color
1332
  //el.parent().parent('tr').next('tr').next('tr').show(); // show Button Classes
1333
  }
1334
  });
1335
+
1336
  </script>
1337
  <?php
1338
  }
1347
  */
1348
 
1349
  function _alm_scroll_top_callback(){
1350
+ $options = get_option( 'alm_settings' );
1351
+ if(!isset($options['_alm_scroll_top']))
1352
  $options['_alm_scroll_top'] = '0';
1353
+
1354
  $html = '<input type="hidden" name="alm_settings[_alm_scroll_top]" value="0" />';
1355
  $html .= '<input type="checkbox" name="alm_settings[_alm_scroll_top]" id="_alm_scroll_top" value="1"'. (($options['_alm_scroll_top']) ? ' checked="checked"' : '') .' />';
1356
+ $html .= '<label for="_alm_scroll_top">'.__('On initial page load, move the user\'s browser window to the top of the screen.<span style="display:block">This <u>may</u> help prevent the loading of unnecessary posts.</span>', 'ajax-load-more').'</label>';
1357
+
1358
  echo $html;
1359
  }
1360
 
1368
  */
1369
 
1370
  function _alm_nonce_security_callback(){
1371
+ $options = get_option( 'alm_settings' );
1372
+ if(!isset($options['_alm_nonce_security']))
1373
  $options['_alm_nonce_security'] = '0';
1374
+
1375
  $html = '<input type="hidden" name="alm_settings[_alm_nonce_security]" value="0" />';
1376
  $html .= '<input type="checkbox" name="alm_settings[_alm_nonce_security]" id="_alm_nonce_security" value="1"'. (($options['_alm_nonce_security']) ? ' checked="checked"' : '') .' />';
1377
+ $html .= '<label for="_alm_nonce_security">'.__('Enable <a href="https://codex.wordpress.org/WordPress_Nonces" target="_blank">WP nonce</a> verification to help protect URLs against certain types of misuse, malicious or otherwise on each Ajax Load More query.', 'ajax-load-more').'</label>';
1378
+
1379
  echo $html;
1380
  }
1381
 
admin/css/admin.css CHANGED
@@ -123,7 +123,10 @@
123
  min-width: 48%;
124
  display: inline-block;
125
  vertical-align: top;
126
- }
 
 
 
127
 
128
  #alm-settings form h2{
129
  padding: 12px 0 6px 12px;
@@ -1103,7 +1106,8 @@ a.layout-hover{
1103
  .form-table label span{
1104
  font-size: 13px;
1105
  color: #999;
1106
- padding-top: 4px;
 
1107
  }
1108
 
1109
  .form-table .template-tags{
@@ -1262,16 +1266,11 @@ a.layout-hover{
1262
  color: #999 !important;
1263
  }
1264
 
1265
- .ajax-load-more h3.add-on-title,
1266
- .ajax-load-more .cnkt-sidebar h3{
1267
  padding: 0 0 10px;
1268
  margin: 0 0 20px;
1269
  border-bottom: 1px solid #efefef;
1270
  }
1271
- .ajax-load-more .cnkt-sidebar h3{
1272
- font-size: 15px;
1273
- padding: 0 0 15px !important;
1274
- }
1275
  .ajax-load-more h3{
1276
  margin-bottom: 10px;
1277
  }
@@ -1838,11 +1837,18 @@ table.highlight{
1838
  }
1839
  .ajax-load-more .cnkt-sidebar .cta{
1840
  background: #fff;
1841
- padding: 20px;
1842
  margin: 0 0 20px;
1843
  overflow: visible;
1844
  position: relative;
1845
  }
 
 
 
 
 
 
 
1846
  .ajax-load-more .cnkt-sidebar .cta.mailing-list{
1847
  padding: 0;
1848
  }
@@ -1851,16 +1857,27 @@ table.highlight{
1851
  padding: 20px;
1852
  }
1853
  .ajax-load-more .cnkt-sidebar .cta.padding-bottom{
1854
- padding-bottom: 60px;
1855
  }
1856
  .ajax-load-more .cnkt-sidebar h3,
1857
  .ajax-load-more .cnkt-sidebar h4{
1858
  margin-top: 0;
 
 
 
 
 
 
 
 
 
 
 
1859
  }
1860
 
 
1861
  .ajax-load-more .cnkt-sidebar .item{
1862
  overflow: hidden;
1863
- padding: 0 0 10px;
1864
  }
1865
  .ajax-load-more .cnkt-sidebar .item h4{
1866
  margin: 0 0 5px;
@@ -1876,6 +1893,7 @@ table.highlight{
1876
  margin: 0 0 5px;
1877
  font-size: 14px;
1878
  }
 
1879
  .ajax-load-more .cnkt-sidebar .cta.dyk p{
1880
  margin: 15px 0 0;
1881
  display: block;
@@ -1925,9 +1943,8 @@ table.highlight{
1925
  background: #efefef;
1926
  line-height: 18px;
1927
  text-align: center;
1928
- margin:0 7px 0 0;
1929
  position: relative;
1930
-