WordPress Infinite Scroll – Ajax Load More - Version 2.2.1

Version Description

  • Fixed php notice/warning that would trigger if WP_DEBUG was enabled.
  • Adding minified core JS.
  • Adding global option to disable shortcode button in the content editor.
  • Adding touchmove js event for faster scroll detection on mobile devices.
  • Code clean up, removing unused functions.
Download this release

Release Info

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

Code changes from version 2.1.3 to 2.2.1

Files changed (57) hide show
  1. README.txt +55 -33
  2. admin/admin.php +206 -89
  3. admin/codemirror/addon/edit/closebrackets.js +158 -0
  4. admin/codemirror/addon/edit/closetag.js +141 -0
  5. admin/codemirror/addon/edit/continuelist.js +38 -0
  6. admin/codemirror/addon/edit/matchbrackets.js +120 -0
  7. admin/codemirror/addon/edit/matchtags.js +66 -0
  8. admin/codemirror/addon/edit/trailingspace.js +27 -0
  9. admin/codemirror/lib/codemirror.css +301 -0
  10. admin/codemirror/lib/codemirror.js +7801 -0
  11. admin/codemirror/mode/clike/clike.js +440 -0
  12. admin/codemirror/mode/clike/index.html +204 -0
  13. admin/codemirror/mode/clike/scala.html +767 -0
  14. admin/codemirror/mode/css/css.js +717 -0
  15. admin/codemirror/mode/css/index.html +70 -0
  16. admin/codemirror/mode/css/less.html +152 -0
  17. admin/codemirror/mode/css/less_test.js +51 -0
  18. admin/codemirror/mode/css/scss.html +157 -0
  19. admin/codemirror/mode/css/scss_test.js +110 -0
  20. admin/codemirror/mode/css/test.js +135 -0
  21. admin/codemirror/mode/htmlmixed/htmlmixed.js +120 -0
  22. admin/codemirror/mode/htmlmixed/index.html +85 -0
  23. admin/codemirror/mode/index.html +121 -0
  24. admin/codemirror/mode/javascript/index.html +109 -0
  25. admin/codemirror/mode/javascript/javascript.js +685 -0
  26. admin/codemirror/mode/javascript/json-ld.html +72 -0
  27. admin/codemirror/mode/javascript/test.js +187 -0
  28. admin/codemirror/mode/javascript/typescript.html +61 -0
  29. admin/codemirror/mode/php/index.html +64 -0
  30. admin/codemirror/mode/php/php.js +233 -0
  31. admin/codemirror/mode/php/test.js +148 -0
  32. admin/codemirror/mode/xml/index.html +57 -0
  33. admin/codemirror/mode/xml/test.js +51 -0
  34. admin/codemirror/mode/xml/xml.js +384 -0
  35. admin/css/admin.css +145 -32
  36. admin/editor-build.php +2 -2
  37. admin/editor.php +21 -6
  38. admin/img/add.png +0 -0
  39. admin/includes/cta/about.php +28 -11
  40. admin/includes/cta/extend.php +1 -1
  41. admin/includes/cta/resources.php +23 -7
  42. admin/js/editor-btn.js +1 -0
  43. admin/{js → shortcode-builder/js}/shortcode-builder.js +11 -2
  44. admin/{includes → shortcode-builder}/shortcode-builder.php +28 -3
  45. ajax-load-more.php +59 -30
  46. core/css/ajax-load-more.css +44 -34
  47. core/js/ajax-load-more.js +36 -24
  48. core/js/ajax-load-more.min.js +14 -0
  49. core/repeater/default.php +1 -1
  50. lang/ajax-load-more.pot +179 -138
  51. screenshot-1.png +0 -0
  52. screenshot-2.png +0 -0
  53. screenshot-3.png +0 -0
  54. screenshot-4.png +0 -0
  55. screenshot-5.png +0 -0
  56. screenshot-6.png +0 -0
  57. screenshot-7.png +0 -0
README.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: dcooney
3
  Donate link: http://connekthq.com/donate/
4
  Tags: ajax, query, loop, paging, filter, jquery, shortcode builder, shortcode, search, tags, category
5
  Requires at least: 3.6
6
- Tested up to: 3.9.1
7
- Stable tag: 2.1.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -19,10 +19,10 @@ Build complex WordPress queries using our shortcode builder then add the shortco
19
 
20
  = Features =
21
 
22
- * **Multiple Instances** - you can now include multiple instances of Ajax Load More on a single page.
23
- * **Shortcode Builder** - create your own Ajax Load More shortcode by adjusting the various WordPress query parameters (see Shortcode Parameters).
24
- * **Query Parameters** - You can query WordPress for so many different content types it may be difficult to keep track! Query by Post type, Category, Tags, Custom Taxonomies, Search Term, Authors and more!!
25
- * **Customizable Repeater Templates** - edit and extend the functionality of Ajax Load More by adjusting the repeater template (see screenshots).
26
  * **Setting Panel** - Customize your version of Ajax Load More by updating various plugin settings (see screenshots).
27
 
28
  Check out the **[demo site](http://connekthq.com/plugins/ajax-load-more/)** for more information!
@@ -33,24 +33,26 @@ Check out the **[demo site](http://connekthq.com/plugins/ajax-load-more/)** for
33
 
34
  Ajax Load More accepts a number of paramaters to pass to the WordPress query. These parameters are passed via shortcode - don't worry, creating your shortcode is simple with our Shortcode Builder.
35
 
36
- * **repeater** - select from a list of customizable repeaters (Add-on available)
37
- * **post_type** - comma seperated list of post types to query
38
- * **category** - query by category slug
39
- * **taxonomy** - query by custom taxonomy
40
- * **taxonomy_terms** - comma seperated list of custom taxonomy terms(slug) to query
41
- * **taxonomy_operator** - Operator to test (IN/NOT IN)
42
- * **author** - query by author id
43
- * **search** - query search term ('s')
44
- * **order** - order posts ASC(ascending) or DESC(descending) order
45
- * **orderby** - order posts by date, title, name, menu order, random, author, post ID or comment count
46
- * **exclude** - comma separated list of post ID's to exclude from query.
47
- * **offset** - offset the initial query (number).
48
- * **posts_per_page** - number of posts to load with each request
49
- * **scroll** - load more posts as the user scrolls the page (true/false)
50
- * **max_pages** - maximum number of pages to load while scrolling (only if scroll == true)
51
- * **pause** - do not load posts until user clicks load button (true/false)
52
- * **transition** - select a loading transition from the drop menu (slide/fade)
53
- * **button_label** - customize the Load More button label
 
 
54
 
55
 
56
 
@@ -73,7 +75,7 @@ The following Add-ons are available to increase the functionality of Ajax Load M
73
 
74
  **Custom Repeaters**
75
 
76
- The **[Custom Repeaters](http://connekthq.com/plugins/ajax-load-more/custom-repeaters) add-on will add five additional customizeable repeater templates and allow you to select unique templates for different content types throughout your theme.
77
  [Get More Information](http://connekthq.com/plugins/ajax-load-more/custom-repeaters)
78
 
79
 
@@ -103,9 +105,15 @@ Your ratings make a big difference! If you like and use Ajax Load More, please c
103
  == Frequently Asked Questions ==
104
 
105
 
 
 
 
 
 
 
106
  = What are my server requirements? =
107
 
108
- 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 you are required to write to the file as well.
109
 
110
  = Is the ajax functionality secure? =
111
 
@@ -117,13 +125,12 @@ Sure, but please be aware that if modifications are made it may affect future up
117
 
118
  = Can I modify the repeater template? =
119
 
120
- Yes, visit the Repeater Template area in the WordPress admin.
121
 
122
- = What are the steps to getting Ajax Load More to display on my website =
 
 
123
 
124
- 1. Create your shortcode
125
- 2. Add the shortcode to your page, by adding it through the content editor or placing it directly within one of your template files.
126
- 3. Load a page with your shortcode in place and watch Ajax Load More fetch your posts.
127
 
128
  == Installation ==
129
 
@@ -163,10 +170,25 @@ How to install Ajax Load More.
163
 
164
  == Changelog ==
165
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  = 2.1.3 =
167
- * Fixed issue with causing the Ajax Load More menu to not show on admin screen do to location conflict.
168
  * Adding column 'alias' to wp_alm table to allow for repeater alias (Only for the custom repeater add-on).
169
- * Remove legasy column 'test' from wp_alm table.
170
  * Updating styles in admin.css.
171
 
172
  = 2.1.2 =
3
  Donate link: http://connekthq.com/donate/
4
  Tags: ajax, query, loop, paging, filter, jquery, shortcode builder, shortcode, search, tags, category
5
  Requires at least: 3.6
6
+ Tested up to: 4.0
7
+ Stable tag: 2.2.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
19
 
20
  = Features =
21
 
22
+ * **Multiple Instances** - One, two, three or ten - you can now include multiple instances of Ajax Load More on a single page.
23
+ * **Shortcode Builder** - Easily create your own Ajax Load More shortcode by adjusting the various WordPress query parameters in our easy-to-use shortcode builder.(see Shortcode Parameters).
24
+ * **Query Parameters** - Ajax Load More allows you to query WordPress by many different content types. Query by Post Type, Post Format, Category, Tags, Custom Taxonomies, Search Term, Authors and more!!
25
+ * **Customizable Repeater Templates** - Edit and extend the functionality of Ajax Load More by creating your own repeater template to match the look and feel of your website.(see screenshots).
26
  * **Setting Panel** - Customize your version of Ajax Load More by updating various plugin settings (see screenshots).
27
 
28
  Check out the **[demo site](http://connekthq.com/plugins/ajax-load-more/)** for more information!
33
 
34
  Ajax Load More accepts a number of paramaters to pass to the WordPress query. These parameters are passed via shortcode - don't worry, creating your shortcode is simple with our Shortcode Builder.
35
 
36
+ * **repeater** - Choose a repeater template (Add-on available). Default = ‘default‘
37
+ * **post_type** - Comma separated list of post types. Default = ‘post’
38
+ * **post_format** - Query by post format. Default = null
39
+ * **category** - Query by category slug. Default = null
40
+ * **tag** - Query by tag name. Default = null
41
+ * **taxonomy** - Query by custom taxonomy name. Default = null
42
+ * **taxonomy_terms** - Comma separated list of custom taxonomy terms(slug). Default = null
43
+ * **taxonomy_operator** - Operator to compare Taxonomy Terms against (IN/NOT IN). Default = ‘IN’
44
+ * **author** - Query by author id. Default = null
45
+ * **search** - Query search term (‘s’). Default = null
46
+ * **order** - Display posts in ASC(ascending) or DESC(descending) order. Default = ‘DESC’
47
+ * **orderby** - Order posts by date, title, name, menu order, random, author, post ID or comment count. Default = ‘date’
48
+ * **exclude** - Comma separated list of post ID’s to exclude from query. Default = null
49
+ * **offset** - Offset the initial query (number). Default = ’0′
50
+ * **posts_per_page** - Number of posts to load with each Ajax request. Default = ’5′
51
+ * **scroll** - Load more posts as the user scrolls the page (true/false). Default = ‘true’
52
+ * **max_pages** - Maximum number of pages to load while user is scrolling (activated on when scroll = true). Default = '5'
53
+ * **pause** - Do not load posts until user clicks the Load More button (true/false). Default = 'false'
54
+ * **transition** - Choose a posts reveal transition (slide/fade). Default = 'slide'
55
+ * **button_label** - The label text for Load More button. Default = 'Older Posts'
56
 
57
 
58
 
75
 
76
  **Custom Repeaters**
77
 
78
+ The **[Custom Repeaters](http://connekthq.com/plugins/ajax-load-more/custom-repeaters)** add-on will add an additional five repeater templates allowing you to create unique templates for different content types throughout your theme.
79
  [Get More Information](http://connekthq.com/plugins/ajax-load-more/custom-repeaters)
80
 
81
 
105
  == Frequently Asked Questions ==
106
 
107
 
108
+ = What are the steps to getting Ajax Load More to display on my website =
109
+
110
+ 1. Create your shortcode
111
+ 2. Add the shortcode to your page, by adding it through the content editor or placing it directly within one of your template files.
112
+ 3. Load a page with your shortcode in place and watch Ajax Load More fetch your posts.
113
+
114
  = What are my server requirements? =
115
 
116
+ 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.
117
 
118
  = Is the ajax functionality secure? =
119
 
125
 
126
  = Can I modify the repeater template? =
127
 
128
+ Yes, visit the Repeater Template section in your WordPress admin.
129
 
130
+ = How are my repeater templates saved? =
131
+
132
+ Repeater template data is saved to the your WordPress database as well as written directly to a repeater template .php file in the ajax-load-more plugin directory.
133
 
 
 
 
134
 
135
  == Installation ==
136
 
170
 
171
  == Changelog ==
172
 
173
+ = 2.2.1 =
174
+ * Fixed php notice/warning that would trigger if WP_DEBUG was enabled.
175
+ * Adding minified core JS.
176
+ * Adding global option to disable shortcode button in the content editor.
177
+ * Adding touchmove js event for faster scroll detection on mobile devices.
178
+ * Code clean up, removing unused functions.
179
+
180
+ = 2.2.0 =
181
+ * Adding Post Format query.
182
+ * Adding syntax highlighting for Repeater Templates with CodeMirror (http://codemirror.net/).
183
+ * Adding custom alias integration for Repeater Templates (Only for the custom repeater add-on).
184
+ * Adding button preview on settings page.
185
+ * Adding 'White' button style.
186
+ * Updated .pot language file.
187
+
188
  = 2.1.3 =
189
+ * Fixed issue causing the Ajax Load More menu to not show on some admin screen do to location conflict with another plugin.
190
  * Adding column 'alias' to wp_alm table to allow for repeater alias (Only for the custom repeater add-on).
191
+ * Remove legacy column 'test' from wp_alm table.
192
  * Updating styles in admin.css.
193
 
194
  = 2.1.2 =
admin/admin.php CHANGED
@@ -154,13 +154,33 @@ function alm_load_admin_js(){
154
 
155
  function alm_enqueue_admin_scripts(){
156
 
157
- //Load CSS
158
- wp_enqueue_style( 'admin-css', ALM_ADMIN_URL. 'css/admin.css');
159
- wp_enqueue_style( 'font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css');
160
-
161
- //Load JS
162
- wp_enqueue_script( 'select2', ALM_ADMIN_URL. 'js/libs/select2.min.js', array( 'jquery' ));
163
- wp_enqueue_script( 'shortcode-builder', ALM_ADMIN_URL. 'js/shortcode-builder.js', array( 'jquery' ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  }
165
 
166
 
@@ -177,26 +197,26 @@ function alm_settings_page(){ ?>
177
  <div class="wrap">
178
  <div class="header-wrap">
179
  <h2><?php echo ALM_TITLE; ?> <span><?php echo ALM_VERSION; ?></span></h2>
180
- <p>A simple solution for lazy loading WordPress posts and pages</p>
181
  </div>
182
  <div class="alm-main">
183
- <section class="group">
184
  <form action="options.php" method="post">
185
  <?php
186
  settings_fields( 'alm-setting-group' );
187
  do_settings_sections( 'ajax-load-more' );
188
  //get the older values, wont work the first time
189
  $options = get_option( '_alm_settings' ); ?>
190
- <div class="row">
191
  <?php submit_button('Save Settings'); ?>
192
  </div>
193
  </form>
194
- </section>
195
  </div>
196
- <aside class="alm-sidebar">
197
  <?php include( plugin_dir_path( __FILE__ ) . 'includes/cta/resources.php'); ?>
198
  <?php include( plugin_dir_path( __FILE__ ) . 'includes/cta/about.php'); ?>
199
- </aside>
200
 
201
  </div>
202
  </div>
@@ -216,13 +236,19 @@ function alm_repeater_page(){ ?>
216
  <div class="admin ajax-load-more" id="alm-repeaters">
217
  <div class="wrap">
218
  <div class="header-wrap">
219
- <h2><?php _e('Ajax load More: Repeater Templates', ALM_NAME); ?></h2>
220
  <p><?php _e('The library of available templates to use throughout your theme', ALM_NAME); ?></p>
221
  </div>
222
  <div class="alm-main form-table repeaters">
 
223
  <!-- Repeaters -->
224
- <section class="group">
225
- <!-- Default -->
 
 
 
 
 
226
  <div class="row default-repeater">
227
  <?php
228
  $filename = ALM_PATH. 'core/repeater/default.php';
@@ -233,21 +259,32 @@ function alm_repeater_page(){ ?>
233
  <h3 class="heading"><?php _e('Default Template', ALM_NAME); ?></h3>
234
  <div class="expand-wrap">
235
  <div class="wrap repeater-wrap" data-name="default">
236
- <label class="template-title" for="default_repeater"><?php _e('Enter the HTML and PHP for the default template', ALM_NAME); ?></label>
237
- <textarea rows="10" id="default_repeater" class="_alm_repeater" contenteditable><?php echo $contents; ?></textarea>
238
- <input type="submit" value="<?php _e('Save Template', ALM_NAME); ?>" class="button button-primary save-repeater">
 
 
 
 
 
 
 
 
 
 
 
 
239
  <div class="saved-response">&nbsp;</div>
240
  </div>
241
  </div>
242
- <?php
243
- if (!has_action('alm_get_custom_repeaters')) {
244
- echo '<div class="row">';
245
- include( ALM_PATH. 'admin/includes/cta/extend.php');
246
- echo '</div>';
247
- }
248
- ?>
249
- <div class="clear"></div>
250
- </div>
251
  <!-- End Default -->
252
  <?php
253
  if (has_action('alm_custom_repeaters'))
@@ -265,15 +302,42 @@ function alm_repeater_page(){ ?>
265
  * @since 2.0.0
266
  */
267
 
268
- _alm_admin.saveRepeater = function(btn) {
269
  var container = btn.parent('.repeater-wrap'),
270
  el = $('textarea._alm_repeater', container),
271
- value = el.val(),
272
  btn = btn,
 
273
  repeater = container.data('name'),
274
  alias = ($('input._alm_repeater_alias', container).length) ? $('input._alm_repeater_alias', container).val() : '',
275
  responseText = $(".saved-response", container);
276
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
  //If submit button has changed class.
278
  if (btn.hasClass('changed')) { // If repeater value has changed.
279
  responseText.addClass('loading').html('<?php _e('Saving data...', ALM_NAME) ?>');
@@ -289,7 +353,7 @@ function alm_repeater_page(){ ?>
289
  },
290
  success: function(e) {
291
  setTimeout(function(){
292
- responseText.html('<?php _e('Custom repeater value saved.', ALM_NAME) ?>').removeClass('loading').addClass('saved');
293
  setTimeout(function() {
294
  responseText.html('&nbsp;').removeClass('saved');
295
  }, 3000);
@@ -297,7 +361,7 @@ function alm_repeater_page(){ ?>
297
  btn.removeClass('changed');
298
  },
299
  error: function(xhr, status, error) {
300
- responseText.html('<?php _e('Something went wrong and the data could not be saved.', ALM_NAME) ?>').removeClass('loading').removeClass('saved');
301
  btn.removeClass('changed');
302
  }
303
  });
@@ -305,17 +369,18 @@ function alm_repeater_page(){ ?>
305
  }
306
  $('input.save-repeater').each(function(){
307
  $(this).click(function() {
308
- var btn = $(this);
 
309
  btn.addClass('changed');
310
- _alm_admin.saveRepeater(btn);
311
  });
312
  });
313
  });
314
  </script>
315
- </section>
316
  <!-- End Repeaters -->
317
  </div>
318
- <aside class="alm-sidebar">
319
  <div class="cta">
320
  <h3><?php _e('Templating Help', ALM_NAME); ?></h3>
321
  <div class="item">
@@ -334,7 +399,7 @@ function alm_repeater_page(){ ?>
334
  </div>
335
  </div>
336
  <?php include( plugin_dir_path( __FILE__ ) . 'includes/cta/writeable.php'); ?>
337
- </aside>
338
  </div>
339
  </div>
340
 
@@ -400,18 +465,18 @@ function alm_shortcode_builder_page(){ ?>
400
  <div class="admin ajax-load-more" id="alm-builder">
401
  <div class="wrap">
402
  <div class="header-wrap">
403
- <h2><?php _e('Ajax load More: Shortcode Builder', ALM_NAME); ?></h2>
404
  <p><?php _e('Create your own Ajax Load More <a href="http://en.support.wordpress.com/shortcodes/" target="_blank">shortcode</a> by adjusting the values below', ALM_NAME); ?></p>
405
  </div>
406
  <div class="alm-main">
407
- <section class="group">
408
- <?php include( plugin_dir_path( __FILE__ ) . 'includes/shortcode-builder.php'); ?>
409
- <div class="row">
410
  <p class="back2top"><a href="#wpcontent"><i class="fa fa-chevron-up"></i> <?php _e('Back to Top', ALM_NAME); ?></a></p>
411
  </div>
412
- </section>
413
  </div>
414
- <aside class="alm-sidebar">
415
  <div class="cta">
416
  <h3><?php _e('Shortcode Output', ALM_NAME); ?></h3>
417
  <p><?php _e('Copy and paste the following shortcode into the content editor or widget area of your theme.', ALM_NAME); ?></p>
@@ -423,9 +488,9 @@ function alm_shortcode_builder_page(){ ?>
423
  <div class="cta">
424
  <h3><?php _e('Did you know?', ALM_NAME); ?></h3>
425
  <img src="<?php echo ALM_ADMIN_URL; ?>img/add-ons/shortcode-editor.jpg"><br/>
426
- <?php _e('<p class="addon-intro">You can generate shortcodes while editing pages!</p><p>Look for the Ajax Load More [+] icon in the content editor toolbar and the <a href="?page=ajax-load-more-shortcode-builder">shortcode builder</a> will pop open.', ALM_NAME); ?></p>
427
  </div>
428
- </aside>
429
  </div>
430
  </div>
431
  <?php
@@ -480,11 +545,11 @@ function alm_example_page(){ ?>
480
  <div class="admin ajax-load-more" id="alm-examples">
481
  <div class="wrap">
482
  <div class="header-wrap">
483
- <h2><?php _e('Ajax load More: Examples', ALM_NAME); ?></h2>
484
  <p><?php _e('A collection of everyday shortcode usages and implementation examples', ALM_NAME); ?></p>
485
  </div>
486
  <div class="alm-main forceColors">
487
- <section class="group">
488
  <div class="row gist">
489
  <h3 class="heading"><?php _e('Author.php', ALM_NAME); ?></h3>
490
  <div class="expand-wrap">
@@ -523,15 +588,15 @@ function alm_example_page(){ ?>
523
  <div class="row">
524
  <p class="back2top"><a href="#wpcontent"><i class="fa fa-chevron-up"></i> <?php _e('Back to Top', ALM_NAME); ?></a></p>
525
  </div>
526
- </section>
527
  </div>
528
- <aside class="alm-sidebar">
529
  <div class="cta">
530
  <h3><?php _e('Request Examples', ALM_NAME); ?></h3>
531
  <p><?php _e('If you\'re having issue\'s with functionality, please submit example requests through the <a href="https://github.com/dcooney/wordpress-ajax-load-more" target="_blank">GitHub repository</a>. ', ALM_NAME); ?></p>
532
  </div>
533
  <?php include( plugin_dir_path( __FILE__ ) . 'includes/cta/about.php'); ?>
534
- </aside>
535
 
536
 
537
  </div>
@@ -552,22 +617,21 @@ function alm_add_ons_page(){ ?>
552
  <div class="admin ajax-load-more" id="alm-add-ons">
553
  <div class="wrap">
554
  <div class="header-wrap">
555
- <h2><?php _e('Ajax load More: Add-ons', ALM_NAME); ?></h2>
556
  <p><?php _e('The following Add-ons are available to increase the functionality of Ajax Load More.', ALM_NAME); ?></p>
557
  </div>
558
- <div class="alm-main forceColors">
559
  <!-- Custom Repeater -->
560
- <section class="group">
561
- <div class="row">
562
  <h3 class="add-on-title"><?php _e('Custom Repeaters', ALM_NAME); ?></h3>
563
  <div class="expand-wrap">
564
  <div class="section-title">
565
  <img src="<?php echo ALM_ADMIN_URL; ?>img/add-ons/repeater-add-ons.jpg">
566
  </div>
567
  <div class="wrap">
568
- <p class="addon-intro"><?php _e('Unlock additional repeater templates and keep your site looking and feeling fresh!', ALM_NAME); ?></p>
569
- <p><?php _e('The Custom Repeaters add-on will add <strong>five</strong> additional <a href="?page=ajax-load-more-repeaters">repeaters</a> and allow you to select unique repeaters for different content types throughout your theme.</p>
570
- <p>It\'s easy, seriously! Simply build each <a href="?page=ajax-load-more-repeaters">repeater</a> just the way you want them, then select a template from the list of available templates while building your <a href="?page=ajax-load-more-shortcode-builder">shortcode</a>.</p><p><strong>Read/Write Access is required!</strong></p>', ALM_NAME); ?>
571
  </div>
572
  </div>
573
  </div>
@@ -578,17 +642,21 @@ function alm_add_ons_page(){ ?>
578
  echo '<a class="btn" href="http://connekthq.com/plugins/ajax-load-more/custom-repeaters/" target="_blank"><i class="fa fa-download"></i> Purchase &amp; Install</a>';
579
  }
580
  ?>
581
- </section>
582
  <!-- End Custom Repeater -->
583
  </div>
584
 
585
- <aside class="alm-sidebar">
 
 
 
 
586
  <div class="cta">
587
  <h3><?php _e('About Add-ons', ALM_NAME); ?></h3>
588
  <p><?php _e('Add-ons are installed as a separate plugin and will receive plug-in update notifications. ', ALM_NAME); ?></p>
589
  </div>
590
  <?php include( plugin_dir_path( __FILE__ ) . 'includes/cta/writeable.php'); ?>
591
- </aside>
592
 
593
  </div>
594
  </div>
@@ -616,20 +684,15 @@ function alm_admin_init(){
616
  'alm_general_settings_callback',
617
  'ajax-load-more'
618
  );
619
- add_settings_field(
620
- '_alm_disable_css',
621
- __('Disable CSS', ALM_NAME ),
622
- 'alm_disable_css_callback',
623
- 'ajax-load-more',
624
- 'alm_general_settings'
625
- );
626
- add_settings_field(
627
  '_alm_html5',
628
  __('HTML5 Elements', ALM_NAME ),
629
  'alm_html5_callback',
630
  'ajax-load-more',
631
  'alm_general_settings'
632
- );
 
633
  add_settings_field(
634
  '_alm_container_type',
635
  __('Container Type', ALM_NAME ),
@@ -637,20 +700,38 @@ function alm_admin_init(){
637
  'ajax-load-more',
638
  'alm_general_settings'
639
  );
 
640
  add_settings_field(
641
  '_alm_classname',
642
- __('Container Class', ALM_NAME ),
643
  'alm_class_callback',
644
  'ajax-load-more',
645
  'alm_general_settings'
646
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
647
  add_settings_field(
648
  '_alm_btn_color',
649
  __('Button Color', ALM_NAME ),
650
  'alm_btn_color_callback',
651
  'ajax-load-more',
652
  'alm_general_settings'
653
- );
654
  }
655
 
656
 
@@ -663,7 +744,7 @@ function alm_admin_init(){
663
  */
664
 
665
  function alm_general_settings_callback() {
666
- echo '<p>' . __('Customize your version of Ajax Load More by updating the fields below.</p><p class="small">All changes will be applied globally accross your theme.', ALM_NAME) . '</p>';
667
  }
668
 
669
 
@@ -692,31 +773,33 @@ function alm_disable_css_callback(){
692
  $options['_alm_disable_css'] = '0';
693
 
694
  echo '<input type="hidden" name="alm_settings[_alm_disable_css]" value="0" />
695
- <label><input type="checkbox" name="alm_settings[_alm_disable_css]" value="1"'. (($options['_alm_disable_css']) ? ' checked="checked"' : '') .' /> I want to use my own CSS styles</label>';
696
- echo '<p class="desc"><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</a></p>';
 
 
697
  }
698
 
699
 
700
  /*
701
- * alm_html5_callback
702
- * Enable HTML5 elements within AjaxLoadMore.
703
  *
704
- * @since 2.0.0
705
  */
706
 
707
- function alm_html5_callback(){
708
  $options = get_option( 'alm_settings' );
709
- if(!isset($options['_alm_html5']))
710
- $options['_alm_html5'] = '1';
711
 
712
- echo '<input type="hidden" name="alm_settings[_alm_html5]" value="0" />
713
- <label><input type="checkbox" name="alm_settings[_alm_html5]" value="1"'. (($options['_alm_html5']) ? ' checked="checked"' : '') .' /> Enable HTML5 elements within Ajax Load More\'s output.</label>';
714
  }
715
 
716
 
717
  /*
718
  * alm_class_callback
719
- * Enable HTML5 elements within AjaxLoadMore.
720
  *
721
  * @since 2.0.0
722
  */
@@ -724,7 +807,7 @@ function alm_html5_callback(){
724
  function alm_class_callback(){
725
  $options = get_option( 'alm_settings' );
726
 
727
- echo '<label for="alm_settings[_alm_classname]">Add classes to Ajax Load More container.</label><br/><input type="text" id="alm_settings[_alm_classname]" name="alm_settings[_alm_classname]" value="'.$options['_alm_classname'].'" /> ';
728
  }
729
 
730
 
@@ -743,10 +826,10 @@ function alm_container_type_callback() {
743
  $options['_alm_container_type'] = '1';
744
 
745
  $html = '<input type="radio" id="_alm_container_type_one" name="alm_settings[_alm_container_type]" value="1"' . checked( 1, $options['_alm_container_type'], false ) . '/>';
746
- $html .= '<label for="_alm_container_type_one">&lt;ul&gt; <span>&lt;!-- Ajax Posts Here --&gt;</span> &lt;/ul&gt;</label><br/>';
747
 
748
  $html .= '<input type="radio" id="_alm_container_type_two" name="alm_settings[_alm_container_type]" value="2"' . checked( 2, $options['_alm_container_type'], false ) . '/>';
749
- $html .= '<label for="_alm_container_type_two">&lt;div&gt; <span>&lt;!-- Ajax Posts Here --&gt;</span> &lt;/div&gt;</label>';
750
 
751
  echo $html;
752
 
@@ -793,18 +876,52 @@ function alm_btn_color_callback() {
793
  if($color == 'grey')
794
  $selected5 = 'selected="selected"';
795
 
796
-
797
- $html = '<select id="name="alm_settings[_alm_btn_color]" name="alm_settings[_alm_btn_color]">';
 
 
 
 
798
  $html .= '<option value="default" ' . $selected0 .'>Default (Orange)</option>';
799
  $html .= '<option value="blue" ' . $selected1 .'>Blue</option>';
800
  $html .= '<option value="green" ' . $selected2 .'>Green</option>';
801
  $html .= '<option value="red" ' . $selected3 .'>Red</option>';
802
  $html .= '<option value="purple" ' . $selected4 .'>Purple</option>';
803
  $html .= '<option value="grey" ' . $selected5 .'>Grey</option>';
 
804
  $html .= '</select>';
805
 
 
806
  echo $html;
807
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
808
  }
809
 
810
 
154
 
155
  function alm_enqueue_admin_scripts(){
156
 
157
+ //Load Admin CSS
158
+ wp_enqueue_style( 'admin-css', ALM_ADMIN_URL. 'css/admin.css');
159
+ wp_enqueue_style( 'core-css', ALM_URL. '/core/css/ajax-load-more.css');
160
+ wp_enqueue_style( 'font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css');
161
+
162
+ //Load CodeMirror Syntax Highlighting if on Repater Template page
163
+ $screen = get_current_screen();
164
+ if ( in_array( $screen->id, array( 'ajax-load-more_page_ajax-load-more-repeaters') ) ){
165
+
166
+ //CodeMirror CSS
167
+ wp_enqueue_style( 'codemirror-css', ALM_ADMIN_URL. 'codemirror/lib/codemirror.css' );
168
+
169
+ //CodeMirror JS
170
+ wp_enqueue_script( 'codemirror', ALM_ADMIN_URL. 'codemirror/lib/codemirror.js');
171
+ wp_enqueue_script( 'codemirror-matchbrackets', ALM_ADMIN_URL. 'codemirror/addon/edit/matchbrackets.js' );
172
+ wp_enqueue_script( 'codemirror-htmlmixed', ALM_ADMIN_URL. 'codemirror/mode/htmlmixed/htmlmixed.js' );
173
+ wp_enqueue_script( 'codemirror-xml', ALM_ADMIN_URL. 'codemirror/mode/xml/xml.js' );
174
+ wp_enqueue_script( 'codemirror-javascript', ALM_ADMIN_URL. 'codemirror/mode/javascript/javascript.js' );
175
+ wp_enqueue_script( 'codemirror-mode-css', ALM_ADMIN_URL. 'codemirror/mode/css/css.js' );
176
+ wp_enqueue_script( 'codemirror-clike', ALM_ADMIN_URL. 'codemirror/mode/clike/clike.js' );
177
+ wp_enqueue_script( 'codemirror-php', ALM_ADMIN_URL. 'codemirror/mode/php/php.js' );
178
+
179
+ }
180
+
181
+ //Load JS
182
+ wp_enqueue_script( 'select2', ALM_ADMIN_URL. 'js/libs/select2.min.js', array( 'jquery' ));
183
+ wp_enqueue_script( 'shortcode-builder', ALM_ADMIN_URL. 'shortcode-builder/js/shortcode-builder.js', array( 'jquery' ));
184
  }
185
 
186
 
197
  <div class="wrap">
198
  <div class="header-wrap">
199
  <h2><?php echo ALM_TITLE; ?> <span><?php echo ALM_VERSION; ?></span></h2>
200
+ <p>A WordPress plugin for lazy loading posts with Ajax</p>
201
  </div>
202
  <div class="alm-main">
203
+ <div class="group">
204
  <form action="options.php" method="post">
205
  <?php
206
  settings_fields( 'alm-setting-group' );
207
  do_settings_sections( 'ajax-load-more' );
208
  //get the older values, wont work the first time
209
  $options = get_option( '_alm_settings' ); ?>
210
+ <div class="row no-brd">
211
  <?php submit_button('Save Settings'); ?>
212
  </div>
213
  </form>
214
+ </div>
215
  </div>
216
+ <div class="alm-sidebar">
217
  <?php include( plugin_dir_path( __FILE__ ) . 'includes/cta/resources.php'); ?>
218
  <?php include( plugin_dir_path( __FILE__ ) . 'includes/cta/about.php'); ?>
219
+ </div>
220
 
221
  </div>
222
  </div>
236
  <div class="admin ajax-load-more" id="alm-repeaters">
237
  <div class="wrap">
238
  <div class="header-wrap">
239
+ <h2><?php _e('Ajax Load More: Repeater Templates', ALM_NAME); ?></h2>
240
  <p><?php _e('The library of available templates to use throughout your theme', ALM_NAME); ?></p>
241
  </div>
242
  <div class="alm-main form-table repeaters">
243
+
244
  <!-- Repeaters -->
245
+ <div class="group">
246
+ <?php
247
+ if (has_action('alm_custom_repeaters')){ ?>
248
+ <span class="toggle-all"><span class="inner-wrap"><em class="collapse"><?php _e('Collapse All', ALM_NAME); ?></em><em class="expand"><?php _e('Expand All', ALM_NAME); ?></em></span></span>
249
+ <?php } ?>
250
+
251
+ <!-- Default -->
252
  <div class="row default-repeater">
253
  <?php
254
  $filename = ALM_PATH. 'core/repeater/default.php';
259
  <h3 class="heading"><?php _e('Default Template', ALM_NAME); ?></h3>
260
  <div class="expand-wrap">
261
  <div class="wrap repeater-wrap" data-name="default">
262
+ <label class="template-title" for="template-default"><?php _e('Enter the HTML and PHP code for the default template', ALM_NAME); ?></label>
263
+ <textarea rows="10" id="template-default" class="_alm_repeater"><?php echo $contents; ?></textarea>
264
+ <script>
265
+ var editorDefault = CodeMirror.fromTextArea(document.getElementById("template-default"), {
266
+ mode: "application/x-httpd-php",
267
+ lineNumbers: true,
268
+ lineWrapping: true,
269
+ indentUnit: 0,
270
+ matchBrackets: true,
271
+ //theme: 'pastel-on-dark',
272
+ viewportMargin: Infinity,
273
+ extraKeys: {"Ctrl-Space": "autocomplete"},
274
+ });
275
+ </script>
276
+ <input type="submit" value="<?php _e('Save Template', ALM_NAME); ?>" class="button button-primary save-repeater" data-editor-id="template-default">
277
  <div class="saved-response">&nbsp;</div>
278
  </div>
279
  </div>
280
+ </div>
281
+ <?php
282
+ if (!has_action('alm_get_custom_repeaters')) {
283
+ echo '<div class="row no-brd">';
284
+ include( ALM_PATH. 'admin/includes/cta/extend.php');
285
+ echo '</div>';
286
+ }
287
+ ?>
 
288
  <!-- End Default -->
289
  <?php
290
  if (has_action('alm_custom_repeaters'))
302
  * @since 2.0.0
303
  */
304
 
305
+ _alm_admin.saveRepeater = function(btn, editorId) {
306
  var container = btn.parent('.repeater-wrap'),
307
  el = $('textarea._alm_repeater', container),
 
308
  btn = btn,
309
+ value = '',
310
  repeater = container.data('name'),
311
  alias = ($('input._alm_repeater_alias', container).length) ? $('input._alm_repeater_alias', container).val() : '',
312
  responseText = $(".saved-response", container);
313
 
314
+ //Get value from CodeMirroweditor
315
+
316
+ // Default Template
317
+ if(editorId === 'template-default')
318
+ value = editorDefault.getValue();
319
+
320
+ //Custom Repeater template add-on
321
+ if(editorId === 'template-repeater2')
322
+ value = editor_repeater2.getValue();
323
+
324
+ if(editorId === 'template-repeater3')
325
+ value = editor_repeater3.getValue();
326
+
327
+ if(editorId === 'template-repeater4')
328
+ value = editor_repeater4.getValue();
329
+
330
+ if(editorId === 'template-repeater5')
331
+ value = editor_repeater5.getValue();
332
+
333
+ if(editorId === 'template-repeater6')
334
+ value = editor_repeater6.getValue();
335
+
336
+ if(value === '' || value === 'undefined'){
337
+ alert("Sorry, an error has occured");
338
+ return false;
339
+ }
340
+
341
  //If submit button has changed class.
342
  if (btn.hasClass('changed')) { // If repeater value has changed.
343
  responseText.addClass('loading').html('<?php _e('Saving data...', ALM_NAME) ?>');
353
  },
354
  success: function(e) {
355
  setTimeout(function(){
356
+ responseText.html('<?php _e('Template saved successfully', ALM_NAME) ?>').removeClass('loading').addClass('saved');
357
  setTimeout(function() {
358
  responseText.html('&nbsp;').removeClass('saved');
359
  }, 3000);
361
  btn.removeClass('changed');
362
  },
363
  error: function(xhr, status, error) {
364
+ responseText.html('<?php _e('Something went wrong and the data could not be saved', ALM_NAME) ?>').removeClass('loading').removeClass('saved');
365
  btn.removeClass('changed');
366
  }
367
  });
369
  }
370
  $('input.save-repeater').each(function(){
371
  $(this).click(function() {
372
+ var btn = $(this),
373
+ editorId = btn.data('editor-id');
374
  btn.addClass('changed');
375
+ _alm_admin.saveRepeater(btn, editorId);
376
  });
377
  });
378
  });
379
  </script>
380
+ </div>
381
  <!-- End Repeaters -->
382
  </div>
383
+ <div class="alm-sidebar">
384
  <div class="cta">
385
  <h3><?php _e('Templating Help', ALM_NAME); ?></h3>
386
  <div class="item">
399
  </div>
400
  </div>
401
  <?php include( plugin_dir_path( __FILE__ ) . 'includes/cta/writeable.php'); ?>
402
+ </div>
403
  </div>
404
  </div>
405
 
465
  <div class="admin ajax-load-more" id="alm-builder">
466
  <div class="wrap">
467
  <div class="header-wrap">
468
+ <h2><?php _e('Ajax Load More: Shortcode Builder', ALM_NAME); ?></h2>
469
  <p><?php _e('Create your own Ajax Load More <a href="http://en.support.wordpress.com/shortcodes/" target="_blank">shortcode</a> by adjusting the values below', ALM_NAME); ?></p>
470
  </div>
471
  <div class="alm-main">
472
+ <div class="group">
473
+ <?php include( plugin_dir_path( __FILE__ ) . 'shortcode-builder/shortcode-builder.php'); ?>
474
+ <div class="row no-brd">
475
  <p class="back2top"><a href="#wpcontent"><i class="fa fa-chevron-up"></i> <?php _e('Back to Top', ALM_NAME); ?></a></p>
476
  </div>
477
+ </div>
478
  </div>
479
+ <div class="alm-sidebar">
480
  <div class="cta">
481
  <h3><?php _e('Shortcode Output', ALM_NAME); ?></h3>
482
  <p><?php _e('Copy and paste the following shortcode into the content editor or widget area of your theme.', ALM_NAME); ?></p>
488
  <div class="cta">
489
  <h3><?php _e('Did you know?', ALM_NAME); ?></h3>
490
  <img src="<?php echo ALM_ADMIN_URL; ?>img/add-ons/shortcode-editor.jpg"><br/>
491
+ <?php _e('<p class="addon-intro">You can generate shortcodes while editing pages!</p><p>Click the Ajax Load More icon in the content editor toolbar and the <a href="?page=ajax-load-more-shortcode-builder">shortcode builder</a> will open in an overlay window.', ALM_NAME); ?></p>
492
  </div>
493
+ </div>
494
  </div>
495
  </div>
496
  <?php
545
  <div class="admin ajax-load-more" id="alm-examples">
546
  <div class="wrap">
547
  <div class="header-wrap">
548
+ <h2><?php _e('Ajax Load More: Examples', ALM_NAME); ?></h2>
549
  <p><?php _e('A collection of everyday shortcode usages and implementation examples', ALM_NAME); ?></p>
550
  </div>
551
  <div class="alm-main forceColors">
552
+ <div class="group">
553
  <div class="row gist">
554
  <h3 class="heading"><?php _e('Author.php', ALM_NAME); ?></h3>
555
  <div class="expand-wrap">
588
  <div class="row">
589
  <p class="back2top"><a href="#wpcontent"><i class="fa fa-chevron-up"></i> <?php _e('Back to Top', ALM_NAME); ?></a></p>
590
  </div>
591
+ </div>
592
  </div>
593
+ <div class="alm-sidebar">
594
  <div class="cta">
595
  <h3><?php _e('Request Examples', ALM_NAME); ?></h3>
596
  <p><?php _e('If you\'re having issue\'s with functionality, please submit example requests through the <a href="https://github.com/dcooney/wordpress-ajax-load-more" target="_blank">GitHub repository</a>. ', ALM_NAME); ?></p>
597
  </div>
598
  <?php include( plugin_dir_path( __FILE__ ) . 'includes/cta/about.php'); ?>
599
+ </div>
600
 
601
 
602
  </div>
617
  <div class="admin ajax-load-more" id="alm-add-ons">
618
  <div class="wrap">
619
  <div class="header-wrap">
620
+ <h2><?php _e('Ajax Load More: Add-ons', ALM_NAME); ?></h2>
621
  <p><?php _e('The following Add-ons are available to increase the functionality of Ajax Load More.', ALM_NAME); ?></p>
622
  </div>
623
+ <div class="alm-main">
624
  <!-- Custom Repeater -->
625
+ <div class="group">
626
+ <div class="row no-brd">
627
  <h3 class="add-on-title"><?php _e('Custom Repeaters', ALM_NAME); ?></h3>
628
  <div class="expand-wrap">
629
  <div class="section-title">
630
  <img src="<?php echo ALM_ADMIN_URL; ?>img/add-ons/repeater-add-ons.jpg">
631
  </div>
632
  <div class="wrap">
633
+ <p class="addon-intro"><?php _e('Unlock additional repeater templates and keep your WordPress theme looking and feeling fresh.', ALM_NAME); ?></p>
634
+ <p><?php _e('The Custom Repeaters add-on will add <strong>five</strong> additional <a href="?page=ajax-load-more-repeaters">repeaters</a> and allow you to select unique repeaters for different content types throughout your theme.</p>', ALM_NAME); ?>
 
635
  </div>
636
  </div>
637
  </div>
642
  echo '<a class="btn" href="http://connekthq.com/plugins/ajax-load-more/custom-repeaters/" target="_blank"><i class="fa fa-download"></i> Purchase &amp; Install</a>';
643
  }
644
  ?>
645
+ </div>
646
  <!-- End Custom Repeater -->
647
  </div>
648
 
649
+ <div class="alm-sidebar">
650
+ <div class="cta">
651
+ <h3><?php _e('About Add-ons', ALM_NAME); ?></h3>
652
+ <p><?php _e('Add-ons are installed as a separate plugin and will receive plug-in update notifications. ', ALM_NAME); ?></p>
653
+ </div>
654
  <div class="cta">
655
  <h3><?php _e('About Add-ons', ALM_NAME); ?></h3>
656
  <p><?php _e('Add-ons are installed as a separate plugin and will receive plug-in update notifications. ', ALM_NAME); ?></p>
657
  </div>
658
  <?php include( plugin_dir_path( __FILE__ ) . 'includes/cta/writeable.php'); ?>
659
+ </div>
660
 
661
  </div>
662
  </div>
684
  'alm_general_settings_callback',
685
  'ajax-load-more'
686
  );
687
+ /*
688
+ add_settings_field(
 
 
 
 
 
 
689
  '_alm_html5',
690
  __('HTML5 Elements', ALM_NAME ),
691
  'alm_html5_callback',
692
  'ajax-load-more',
693
  'alm_general_settings'
694
+ );
695
+ */
696
  add_settings_field(
697
  '_alm_container_type',
698
  __('Container Type', ALM_NAME ),
700
  'ajax-load-more',
701
  'alm_general_settings'
702
  );
703
+
704
  add_settings_field(
705
  '_alm_classname',
706
+ __('Container Classes', ALM_NAME ),
707
  'alm_class_callback',
708
  'ajax-load-more',
709
  'alm_general_settings'
710
  );
711
+
712
+ add_settings_field(
713
+ '_alm_hide_btn',
714
+ __('Editor Shortcode Button', ALM_NAME ),
715
+ 'alm_hide_btn_callback',
716
+ 'ajax-load-more',
717
+ 'alm_general_settings'
718
+ );
719
+
720
+ add_settings_field(
721
+ '_alm_disable_css',
722
+ __('Disable CSS', ALM_NAME ),
723
+ 'alm_disable_css_callback',
724
+ 'ajax-load-more',
725
+ 'alm_general_settings'
726
+ );
727
+
728
  add_settings_field(
729
  '_alm_btn_color',
730
  __('Button Color', ALM_NAME ),
731
  'alm_btn_color_callback',
732
  'ajax-load-more',
733
  'alm_general_settings'
734
+ );
735
  }
736
 
737
 
744
  */
745
 
746
  function alm_general_settings_callback() {
747
+ echo '<p>' . __('Customize your version of Ajax Load More by updating the fields below.</p><p class="small">All changes will be applied globally throughout your theme.', ALM_NAME) . '</p>';
748
  }
749
 
750
 
773
  $options['_alm_disable_css'] = '0';
774
 
775
  echo '<input type="hidden" name="alm_settings[_alm_disable_css]" value="0" />
776
+ <label><input type="checkbox" id="alm_disable_css_input" name="alm_settings[_alm_disable_css]" value="1"'. (($options['_alm_disable_css']) ? ' checked="checked"' : '') .' /> '.__('I want to use my own CSS styles', ALM_NAME).'</label>';
777
+ echo '<p class="desc"><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', ALM_NAME).'</a></p>';
778
+ ?>
779
+ <?php
780
  }
781
 
782
 
783
  /*
784
+ * alm_hide_btn_callback
785
+ * Disbale the ALM shortcode button in the WordPress content editor
786
  *
787
+ * @since 2.2.1
788
  */
789
 
790
+ function alm_hide_btn_callback(){
791
  $options = get_option( 'alm_settings' );
792
+ if(!isset($options['_alm_hide_btn']))
793
+ $options['_alm_hide_btn'] = '0';
794
 
795
+ echo '<input type="hidden" name="alm_settings[_alm_hide_btn]" value="0" />
796
+ <label><input type="checkbox" name="alm_settings[_alm_hide_btn]" value="1"'. (($options['_alm_hide_btn']) ? ' checked="checked"' : '') .' /> '.__('Hide shortcode button in WYSIWYG editor', ALM_NAME).'<p class="desc"></p></label>';
797
  }
798
 
799
 
800
  /*
801
  * alm_class_callback
802
+ * Add classes to the Ajax Load More wrapper
803
  *
804
  * @since 2.0.0
805
  */
807
  function alm_class_callback(){
808
  $options = get_option( 'alm_settings' );
809
 
810
+ echo '<label for="alm_settings[_alm_classname]">'.__('Add classes to Ajax Load More container', ALM_NAME).'</label><br/><input type="text" id="alm_settings[_alm_classname]" name="alm_settings[_alm_classname]" value="'.$options['_alm_classname'].'" placeholder="posts listing etc..." /> ';
811
  }
812
 
813
 
826
  $options['_alm_container_type'] = '1';
827
 
828
  $html = '<input type="radio" id="_alm_container_type_one" name="alm_settings[_alm_container_type]" value="1"' . checked( 1, $options['_alm_container_type'], false ) . '/>';
829
+ $html .= '<label for="_alm_container_type_one">&lt;ul&gt; <span>&lt;!-- '.__('Ajax Posts Here', ALM_NAME).' --&gt;</span> &lt;/ul&gt;</label><br/>';
830
 
831
  $html .= '<input type="radio" id="_alm_container_type_two" name="alm_settings[_alm_container_type]" value="2"' . checked( 2, $options['_alm_container_type'], false ) . '/>';
832
+ $html .= '<label for="_alm_container_type_two">&lt;div&gt; <span>&lt;!-- '.__('Ajax Posts Here', ALM_NAME).' --&gt;</span> &lt;/div&gt;</label>';
833
 
834
  echo $html;
835
 
876
  if($color == 'grey')
877
  $selected5 = 'selected="selected"';
878
 
879
+ $selected6 = '';
880
+ if($color == 'white')
881
+ $selected5 = 'selected="selected"';
882
+
883
+ $html = '<label for="alm_settings_btn_color">'.__('Choose your load more button color', ALM_NAME).'</label><br/>';
884
+ $html .= '<select id="alm_settings_btn_color" name="alm_settings[_alm_btn_color]">';
885
  $html .= '<option value="default" ' . $selected0 .'>Default (Orange)</option>';
886
  $html .= '<option value="blue" ' . $selected1 .'>Blue</option>';
887
  $html .= '<option value="green" ' . $selected2 .'>Green</option>';
888
  $html .= '<option value="red" ' . $selected3 .'>Red</option>';
889
  $html .= '<option value="purple" ' . $selected4 .'>Purple</option>';
890
  $html .= '<option value="grey" ' . $selected5 .'>Grey</option>';
891
+ $html .= '<option value="white" ' . $selected6 .'>White</option>';
892
  $html .= '</select>';
893
 
894
+ $html .= '<div class="ajax-load-more-wrap '.$color.'"><span>'.__('Preview', ALM_NAME) .'</span><button class="alm-load-more-btn loading" disabled="disabled">Show More</button></div>';
895
  echo $html;
896
+ ?>
897
+ <script>
898
+ //Button preview
899
+ var colorArray = "default grey purple green red blue white";
900
+ jQuery("select#alm_settings_btn_color").change(function() {
901
+ var color = jQuery(this).val();
902
+ jQuery('.ajax-load-more-wrap').removeClass(colorArray);
903
+ jQuery('.ajax-load-more-wrap').addClass(color);
904
+ });
905
+ jQuery("select#alm_settings_btn_color").click(function(e){
906
+ e.preventDefault();
907
+ });
908
+
909
+ // Check if Disable CSS === true
910
+ if(jQuery('input#alm_disable_css_input').is(":checked")){
911
+ //alert("true");
912
+ jQuery('input#alm_disable_css_input').parent().parent().parent('tr').next('tr').hide();
913
+ }
914
+ jQuery('input#alm_disable_css_input').change(function() {
915
+ var el = jQuery(this);
916
+ if(el.is(":checked")) {
917
+ el.parent().parent().parent('tr').next('tr').hide();
918
+ }else{
919
+ el.parent().parent().parent('tr').next('tr').show();
920
+ }
921
+ });
922
+
923
+ </script>
924
+ <?php
925
  }
926
 
927
 
admin/codemirror/addon/edit/closebrackets.js ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ var DEFAULT_BRACKETS = "()[]{}''\"\"";
13
+ var DEFAULT_EXPLODE_ON_ENTER = "[]{}";
14
+ var SPACE_CHAR_REGEX = /\s/;
15
+
16
+ var Pos = CodeMirror.Pos;
17
+
18
+ CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) {
19
+ if (old != CodeMirror.Init && old)
20
+ cm.removeKeyMap("autoCloseBrackets");
21
+ if (!val) return;
22
+ var pairs = DEFAULT_BRACKETS, explode = DEFAULT_EXPLODE_ON_ENTER;
23
+ if (typeof val == "string") pairs = val;
24
+ else if (typeof val == "object") {
25
+ if (val.pairs != null) pairs = val.pairs;
26
+ if (val.explode != null) explode = val.explode;
27
+ }
28
+ var map = buildKeymap(pairs);
29
+ if (explode) map.Enter = buildExplodeHandler(explode);
30
+ cm.addKeyMap(map);
31
+ });
32
+
33
+ function charsAround(cm, pos) {
34
+ var str = cm.getRange(Pos(pos.line, pos.ch - 1),
35
+ Pos(pos.line, pos.ch + 1));
36
+ return str.length == 2 ? str : null;
37
+ }
38
+
39
+ // Project the token type that will exists after the given char is
40
+ // typed, and use it to determine whether it would cause the start
41
+ // of a string token.
42
+ function enteringString(cm, pos, ch) {
43
+ var line = cm.getLine(pos.line);
44
+ var token = cm.getTokenAt(pos);
45
+ if (/\bstring2?\b/.test(token.type)) return false;
46
+ var stream = new CodeMirror.StringStream(line.slice(0, pos.ch) + ch + line.slice(pos.ch), 4);
47
+ stream.pos = stream.start = token.start;
48
+ for (;;) {
49
+ var type1 = cm.getMode().token(stream, token.state);
50
+ if (stream.pos >= pos.ch + 1) return /\bstring2?\b/.test(type1);
51
+ stream.start = stream.pos;
52
+ }
53
+ }
54
+
55
+ function buildKeymap(pairs) {
56
+ var map = {
57
+ name : "autoCloseBrackets",
58
+ Backspace: function(cm) {
59
+ if (cm.getOption("disableInput")) return CodeMirror.Pass;
60
+ var ranges = cm.listSelections();
61
+ for (var i = 0; i < ranges.length; i++) {
62
+ if (!ranges[i].empty()) return CodeMirror.Pass;
63
+ var around = charsAround(cm, ranges[i].head);
64
+ if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass;
65
+ }
66
+ for (var i = ranges.length - 1; i >= 0; i--) {
67
+ var cur = ranges[i].head;
68
+ cm.replaceRange("", Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1));
69
+ }
70
+ }
71
+ };
72
+ var closingBrackets = "";
73
+ for (var i = 0; i < pairs.length; i += 2) (function(left, right) {
74
+ if (left != right) closingBrackets += right;
75
+ map["'" + left + "'"] = function(cm) {
76
+ if (cm.getOption("disableInput")) return CodeMirror.Pass;
77
+ var ranges = cm.listSelections(), type, next;
78
+ for (var i = 0; i < ranges.length; i++) {
79
+ var range = ranges[i], cur = range.head, curType;
80
+ var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1));
81
+ if (!range.empty())
82
+ curType = "surround";
83
+ else if (left == right && next == right) {
84
+ if (cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == left + left + left)
85
+ curType = "skipThree";
86
+ else
87
+ curType = "skip";
88
+ } else if (left == right && cur.ch > 1 &&
89
+ cm.getRange(Pos(cur.line, cur.ch - 2), cur) == left + left &&
90
+ (cur.ch <= 2 || cm.getRange(Pos(cur.line, cur.ch - 3), Pos(cur.line, cur.ch - 2)) != left))
91
+ curType = "addFour";
92
+ else if (left == '"' || left == "'") {
93
+ if (!CodeMirror.isWordChar(next) && enteringString(cm, cur, left)) curType = "both";
94
+ else return CodeMirror.Pass;
95
+ } else if (cm.getLine(cur.line).length == cur.ch || closingBrackets.indexOf(next) >= 0 || SPACE_CHAR_REGEX.test(next))
96
+ curType = "both";
97
+ else
98
+ return CodeMirror.Pass;
99
+ if (!type) type = curType;
100
+ else if (type != curType) return CodeMirror.Pass;
101
+ }
102
+
103
+ cm.operation(function() {
104
+ if (type == "skip") {
105
+ cm.execCommand("goCharRight");
106
+ } else if (type == "skipThree") {
107
+ for (var i = 0; i < 3; i++)
108
+ cm.execCommand("goCharRight");
109
+ } else if (type == "surround") {
110
+ var sels = cm.getSelections();
111
+ for (var i = 0; i < sels.length; i++)
112
+ sels[i] = left + sels[i] + right;
113
+ cm.replaceSelections(sels, "around");
114
+ } else if (type == "both") {
115
+ cm.replaceSelection(left + right, null);
116
+ cm.execCommand("goCharLeft");
117
+ } else if (type == "addFour") {
118
+ cm.replaceSelection(left + left + left + left, "before");
119
+ cm.execCommand("goCharRight");
120
+ }
121
+ });
122
+ };
123
+ if (left != right) map["'" + right + "'"] = function(cm) {
124
+ var ranges = cm.listSelections();
125
+ for (var i = 0; i < ranges.length; i++) {
126
+ var range = ranges[i];
127
+ if (!range.empty() ||
128
+ cm.getRange(range.head, Pos(range.head.line, range.head.ch + 1)) != right)
129
+ return CodeMirror.Pass;
130
+ }
131
+ cm.execCommand("goCharRight");
132
+ };
133
+ })(pairs.charAt(i), pairs.charAt(i + 1));
134
+ return map;
135
+ }
136
+
137
+ function buildExplodeHandler(pairs) {
138
+ return function(cm) {
139
+ if (cm.getOption("disableInput")) return CodeMirror.Pass;
140
+ var ranges = cm.listSelections();
141
+ for (var i = 0; i < ranges.length; i++) {
142
+ if (!ranges[i].empty()) return CodeMirror.Pass;
143
+ var around = charsAround(cm, ranges[i].head);
144
+ if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass;
145
+ }
146
+ cm.operation(function() {
147
+ cm.replaceSelection("\n\n", null);
148
+ cm.execCommand("goCharLeft");
149
+ ranges = cm.listSelections();
150
+ for (var i = 0; i < ranges.length; i++) {
151
+ var line = ranges[i].head.line;
152
+ cm.indentLine(line, null, true);
153
+ cm.indentLine(line + 1, null, true);
154
+ }
155
+ });
156
+ };
157
+ }
158
+ });
admin/codemirror/addon/edit/closetag.js ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ /**
5
+ * Tag-closer extension for CodeMirror.
6
+ *
7
+ * This extension adds an "autoCloseTags" option that can be set to
8
+ * either true to get the default behavior, or an object to further
9
+ * configure its behavior.
10
+ *
11
+ * These are supported options:
12
+ *
13
+ * `whenClosing` (default true)
14
+ * Whether to autoclose when the '/' of a closing tag is typed.
15
+ * `whenOpening` (default true)
16
+ * Whether to autoclose the tag when the final '>' of an opening
17
+ * tag is typed.
18
+ * `dontCloseTags` (default is empty tags for HTML, none for XML)
19
+ * An array of tag names that should not be autoclosed.
20
+ * `indentTags` (default is block tags for HTML, none for XML)
21
+ * An array of tag names that should, when opened, cause a
22
+ * blank line to be added inside the tag, and the blank line and
23
+ * closing line to be indented.
24
+ *
25
+ * See demos/closetag.html for a usage example.
26
+ */
27
+
28
+ (function(mod) {
29
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
30
+ mod(require("../../lib/codemirror"), require("../fold/xml-fold"));
31
+ else if (typeof define == "function" && define.amd) // AMD
32
+ define(["../../lib/codemirror", "../fold/xml-fold"], mod);
33
+ else // Plain browser env
34
+ mod(CodeMirror);
35
+ })(function(CodeMirror) {
36
+ CodeMirror.defineOption("autoCloseTags", false, function(cm, val, old) {
37
+ if (old != CodeMirror.Init && old)
38
+ cm.removeKeyMap("autoCloseTags");
39
+ if (!val) return;
40
+ var map = {name: "autoCloseTags"};
41
+ if (typeof val != "object" || val.whenClosing)
42
+ map["'/'"] = function(cm) { return autoCloseSlash(cm); };
43
+ if (typeof val != "object" || val.whenOpening)
44
+ map["'>'"] = function(cm) { return autoCloseGT(cm); };
45
+ cm.addKeyMap(map);
46
+ });
47
+
48
+ var htmlDontClose = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param",
49
+ "source", "track", "wbr"];
50
+ var htmlIndent = ["applet", "blockquote", "body", "button", "div", "dl", "fieldset", "form", "frameset", "h1", "h2", "h3", "h4",
51
+ "h5", "h6", "head", "html", "iframe", "layer", "legend", "object", "ol", "p", "select", "table", "ul"];
52
+
53
+ function autoCloseGT(cm) {
54
+ if (cm.getOption("disableInput")) return CodeMirror.Pass;
55
+ var ranges = cm.listSelections(), replacements = [];
56
+ for (var i = 0; i < ranges.length; i++) {
57
+ if (!ranges[i].empty()) return CodeMirror.Pass;
58
+ var pos = ranges[i].head, tok = cm.getTokenAt(pos);
59
+ var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
60
+ if (inner.mode.name != "xml" || !state.tagName) return CodeMirror.Pass;
61
+
62
+ var opt = cm.getOption("autoCloseTags"), html = inner.mode.configuration == "html";
63
+ var dontCloseTags = (typeof opt == "object" && opt.dontCloseTags) || (html && htmlDontClose);
64
+ var indentTags = (typeof opt == "object" && opt.indentTags) || (html && htmlIndent);
65
+
66
+ var tagName = state.tagName;
67
+ if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch);
68
+ var lowerTagName = tagName.toLowerCase();
69
+ // Don't process the '>' at the end of an end-tag or self-closing tag
70
+ if (!tagName ||
71
+ tok.type == "string" && (tok.end != pos.ch || !/[\"\']/.test(tok.string.charAt(tok.string.length - 1)) || tok.string.length == 1) ||
72
+ tok.type == "tag" && state.type == "closeTag" ||
73
+ tok.string.indexOf("/") == (tok.string.length - 1) || // match something like <someTagName />
74
+ dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1 ||
75
+ closingTagExists(cm, tagName, pos, state, true))
76
+ return CodeMirror.Pass;
77
+
78
+ var indent = indentTags && indexOf(indentTags, lowerTagName) > -1;
79
+ replacements[i] = {indent: indent,
80
+ text: ">" + (indent ? "\n\n" : "") + "</" + tagName + ">",
81
+ newPos: indent ? CodeMirror.Pos(pos.line + 1, 0) : CodeMirror.Pos(pos.line, pos.ch + 1)};
82
+ }
83
+
84
+ for (var i = ranges.length - 1; i >= 0; i--) {
85
+ var info = replacements[i];
86
+ cm.replaceRange(info.text, ranges[i].head, ranges[i].anchor, "+insert");
87
+ var sel = cm.listSelections().slice(0);
88
+ sel[i] = {head: info.newPos, anchor: info.newPos};
89
+ cm.setSelections(sel);
90
+ if (info.indent) {
91
+ cm.indentLine(info.newPos.line, null, true);
92
+ cm.indentLine(info.newPos.line + 1, null, true);
93
+ }
94
+ }
95
+ }
96
+
97
+ function autoCloseSlash(cm) {
98
+ if (cm.getOption("disableInput")) return CodeMirror.Pass;
99
+ var ranges = cm.listSelections(), replacements = [];
100
+ for (var i = 0; i < ranges.length; i++) {
101
+ if (!ranges[i].empty()) return CodeMirror.Pass;
102
+ var pos = ranges[i].head, tok = cm.getTokenAt(pos);
103
+ var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
104
+ if (tok.type == "string" || tok.string.charAt(0) != "<" ||
105
+ tok.start != pos.ch - 1 || inner.mode.name != "xml" ||
106
+ !state.context || !state.context.tagName ||
107
+ closingTagExists(cm, state.context.tagName, pos, state))
108
+ return CodeMirror.Pass;
109
+ replacements[i] = "/" + state.context.tagName + ">";
110
+ }
111
+ cm.replaceSelections(replacements);
112
+ }
113
+
114
+ function indexOf(collection, elt) {
115
+ if (collection.indexOf) return collection.indexOf(elt);
116
+ for (var i = 0, e = collection.length; i < e; ++i)
117
+ if (collection[i] == elt) return i;
118
+ return -1;
119
+ }
120
+
121
+ // If xml-fold is loaded, we use its functionality to try and verify
122
+ // whether a given tag is actually unclosed.
123
+ function closingTagExists(cm, tagName, pos, state, newTag) {
124
+ if (!CodeMirror.scanForClosingTag) return false;
125
+ var end = Math.min(cm.lastLine() + 1, pos.line + 500);
126
+ var nextClose = CodeMirror.scanForClosingTag(cm, pos, null, end);
127
+ if (!nextClose || nextClose.tag != tagName) return false;
128
+ var cx = state.context;
129
+ // If the immediate wrapping context contains onCx instances of
130
+ // the same tag, a closing tag only exists if there are at least
131
+ // that many closing tags of that type following.
132
+ for (var onCx = newTag ? 1 : 0; cx && cx.tagName == tagName; cx = cx.prev) ++onCx;
133
+ pos = nextClose.to;
134
+ for (var i = 1; i < onCx; i++) {
135
+ var next = CodeMirror.scanForClosingTag(cm, pos, null, end);
136
+ if (!next || next.tag != tagName) return false;
137
+ pos = next.to;
138
+ }
139
+ return true;
140
+ }
141
+ });
admin/codemirror/addon/edit/continuelist.js ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ "use strict";
13
+
14
+ var listRE = /^(\s*)([*+-]|(\d+)\.)(\s+)/,
15
+ unorderedBullets = "*+-";
16
+
17
+ CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) {
18
+ if (cm.getOption("disableInput")) return CodeMirror.Pass;
19
+ var ranges = cm.listSelections(), replacements = [];
20
+ for (var i = 0; i < ranges.length; i++) {
21
+ var pos = ranges[i].head, match;
22
+ var inList = cm.getStateAfter(pos.line).list !== false;
23
+
24
+ if (!ranges[i].empty() || !inList || !(match = cm.getLine(pos.line).match(listRE))) {
25
+ cm.execCommand("newlineAndIndent");
26
+ return;
27
+ }
28
+ var indent = match[1], after = match[4];
29
+ var bullet = unorderedBullets.indexOf(match[2]) >= 0
30
+ ? match[2]
31
+ : (parseInt(match[3], 10) + 1) + ".";
32
+
33
+ replacements[i] = "\n" + indent + bullet + after;
34
+ }
35
+
36
+ cm.replaceSelections(replacements);
37
+ };
38
+ });
admin/codemirror/addon/edit/matchbrackets.js ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ var ie_lt8 = /MSIE \d/.test(navigator.userAgent) &&
13
+ (document.documentMode == null || document.documentMode < 8);
14
+
15
+ var Pos = CodeMirror.Pos;
16
+
17
+ var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
18
+
19
+ function findMatchingBracket(cm, where, strict, config) {
20
+ var line = cm.getLineHandle(where.line), pos = where.ch - 1;
21
+ var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];
22
+ if (!match) return null;
23
+ var dir = match.charAt(1) == ">" ? 1 : -1;
24
+ if (strict && (dir > 0) != (pos == where.ch)) return null;
25
+ var style = cm.getTokenTypeAt(Pos(where.line, pos + 1));
26
+
27
+ var found = scanForBracket(cm, Pos(where.line, pos + (dir > 0 ? 1 : 0)), dir, style || null, config);
28
+ if (found == null) return null;
29
+ return {from: Pos(where.line, pos), to: found && found.pos,
30
+ match: found && found.ch == match.charAt(0), forward: dir > 0};
31
+ }
32
+
33
+ // bracketRegex is used to specify which type of bracket to scan
34
+ // should be a regexp, e.g. /[[\]]/
35
+ //
36
+ // Note: If "where" is on an open bracket, then this bracket is ignored.
37
+ //
38
+ // Returns false when no bracket was found, null when it reached
39
+ // maxScanLines and gave up
40
+ function scanForBracket(cm, where, dir, style, config) {
41
+ var maxScanLen = (config && config.maxScanLineLength) || 10000;
42
+ var maxScanLines = (config && config.maxScanLines) || 1000;
43
+
44
+ var stack = [];
45
+ var re = config && config.bracketRegex ? config.bracketRegex : /[(){}[\]]/;
46
+ var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1)
47
+ : Math.max(cm.firstLine() - 1, where.line - maxScanLines);
48
+ for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {
49
+ var line = cm.getLine(lineNo);
50
+ if (!line) continue;
51
+ var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1;
52
+ if (line.length > maxScanLen) continue;
53
+ if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0);
54
+ for (; pos != end; pos += dir) {
55
+ var ch = line.charAt(pos);
56
+ if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) {
57
+ var match = matching[ch];
58
+ if ((match.charAt(1) == ">") == (dir > 0)) stack.push(ch);
59
+ else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};
60
+ else stack.pop();
61
+ }
62
+ }
63
+ }
64
+ return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null;
65
+ }
66
+
67
+ function matchBrackets(cm, autoclear, config) {
68
+ // Disable brace matching in long lines, since it'll cause hugely slow updates
69
+ var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000;
70
+ var marks = [], ranges = cm.listSelections();
71
+ for (var i = 0; i < ranges.length; i++) {
72
+ var match = ranges[i].empty() && findMatchingBracket(cm, ranges[i].head, false, config);
73
+ if (match && cm.getLine(match.from.line).length <= maxHighlightLen) {
74
+ var style = match.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
75
+ marks.push(cm.markText(match.from, Pos(match.from.line, match.from.ch + 1), {className: style}));
76
+ if (match.to && cm.getLine(match.to.line).length <= maxHighlightLen)
77
+ marks.push(cm.markText(match.to, Pos(match.to.line, match.to.ch + 1), {className: style}));
78
+ }
79
+ }
80
+
81
+ if (marks.length) {
82
+ // Kludge to work around the IE bug from issue #1193, where text
83
+ // input stops going to the textare whever this fires.
84
+ if (ie_lt8 && cm.state.focused) cm.display.input.focus();
85
+
86
+ var clear = function() {
87
+ cm.operation(function() {
88
+ for (var i = 0; i < marks.length; i++) marks[i].clear();
89
+ });
90
+ };
91
+ if (autoclear) setTimeout(clear, 800);
92
+ else return clear;
93
+ }
94
+ }
95
+
96
+ var currentlyHighlighted = null;
97
+ function doMatchBrackets(cm) {
98
+ cm.operation(function() {
99
+ if (currentlyHighlighted) {currentlyHighlighted(); currentlyHighlighted = null;}
100
+ currentlyHighlighted = matchBrackets(cm, false, cm.state.matchBrackets);
101
+ });
102
+ }
103
+
104
+ CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) {
105
+ if (old && old != CodeMirror.Init)
106
+ cm.off("cursorActivity", doMatchBrackets);
107
+ if (val) {
108
+ cm.state.matchBrackets = typeof val == "object" ? val : {};
109
+ cm.on("cursorActivity", doMatchBrackets);
110
+ }
111
+ });
112
+
113
+ CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);});
114
+ CodeMirror.defineExtension("findMatchingBracket", function(pos, strict, config){
115
+ return findMatchingBracket(this, pos, strict, config);
116
+ });
117
+ CodeMirror.defineExtension("scanForBracket", function(pos, dir, style, config){
118
+ return scanForBracket(this, pos, dir, style, config);
119
+ });
120
+ });
admin/codemirror/addon/edit/matchtags.js ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"), require("../fold/xml-fold"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror", "../fold/xml-fold"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ "use strict";
13
+
14
+ CodeMirror.defineOption("matchTags", false, function(cm, val, old) {
15
+ if (old && old != CodeMirror.Init) {
16
+ cm.off("cursorActivity", doMatchTags);
17
+ cm.off("viewportChange", maybeUpdateMatch);
18
+ clear(cm);
19
+ }
20
+ if (val) {
21
+ cm.state.matchBothTags = typeof val == "object" && val.bothTags;
22
+ cm.on("cursorActivity", doMatchTags);
23
+ cm.on("viewportChange", maybeUpdateMatch);
24
+ doMatchTags(cm);
25
+ }
26
+ });
27
+
28
+ function clear(cm) {
29
+ if (cm.state.tagHit) cm.state.tagHit.clear();
30
+ if (cm.state.tagOther) cm.state.tagOther.clear();
31
+ cm.state.tagHit = cm.state.tagOther = null;
32
+ }
33
+
34
+ function doMatchTags(cm) {
35
+ cm.state.failedTagMatch = false;
36
+ cm.operation(function() {
37
+ clear(cm);
38
+ if (cm.somethingSelected()) return;
39
+ var cur = cm.getCursor(), range = cm.getViewport();
40
+ range.from = Math.min(range.from, cur.line); range.to = Math.max(cur.line + 1, range.to);
41
+ var match = CodeMirror.findMatchingTag(cm, cur, range);
42
+ if (!match) return;
43
+ if (cm.state.matchBothTags) {
44
+ var hit = match.at == "open" ? match.open : match.close;
45
+ if (hit) cm.state.tagHit = cm.markText(hit.from, hit.to, {className: "CodeMirror-matchingtag"});
46
+ }
47
+ var other = match.at == "close" ? match.open : match.close;
48
+ if (other)
49
+ cm.state.tagOther = cm.markText(other.from, other.to, {className: "CodeMirror-matchingtag"});
50
+ else
51
+ cm.state.failedTagMatch = true;
52
+ });
53
+ }
54
+
55
+ function maybeUpdateMatch(cm) {
56
+ if (cm.state.failedTagMatch) doMatchTags(cm);
57
+ }
58
+
59
+ CodeMirror.commands.toMatchingTag = function(cm) {
60
+ var found = CodeMirror.findMatchingTag(cm, cm.getCursor());
61
+ if (found) {
62
+ var other = found.at == "close" ? found.open : found.close;
63
+ if (other) cm.extendSelection(other.to, other.from);
64
+ }
65
+ };
66
+ });
admin/codemirror/addon/edit/trailingspace.js ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ CodeMirror.defineOption("showTrailingSpace", false, function(cm, val, prev) {
13
+ if (prev == CodeMirror.Init) prev = false;
14
+ if (prev && !val)
15
+ cm.removeOverlay("trailingspace");
16
+ else if (!prev && val)
17
+ cm.addOverlay({
18
+ token: function(stream) {
19
+ for (var l = stream.string.length, i = l; i && /\s/.test(stream.string.charAt(i - 1)); --i) {}
20
+ if (i > stream.pos) { stream.pos = i; return null; }
21
+ stream.pos = l;
22
+ return "trailingspace";
23
+ },
24
+ name: "trailingspace"
25
+ });
26
+ });
27
+ });
admin/codemirror/lib/codemirror.css ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* BASICS */
2
+
3
+ .CodeMirror {
4
+ /* Set height, width, borders, and global font properties here */
5
+ font-family: monospace;
6
+ height: 300px;
7
+ }
8
+ .CodeMirror-scroll {
9
+ /* Set scrolling behaviour here */
10
+ overflow: auto;
11
+ }
12
+
13
+ /* PADDING */
14
+
15
+ .CodeMirror-lines {
16
+ padding: 4px 0; /* Vertical padding around content */
17
+ }
18
+ .CodeMirror pre {
19
+ padding: 0 4px; /* Horizontal padding of content */
20
+ }
21
+
22
+ .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
23
+ background-color: white; /* The little square between H and V scrollbars */
24
+ }
25
+
26
+ /* GUTTER */
27
+
28
+ .CodeMirror-gutters {
29
+ border-right: 1px solid #ddd;
30
+ background-color: #f7f7f7;
31
+ white-space: nowrap;
32
+ }
33
+ .CodeMirror-linenumbers {}
34
+ .CodeMirror-linenumber {
35
+ padding: 0 3px 0 5px;
36
+ min-width: 20px;
37
+ text-align: right;
38
+ color: #999;
39
+ -moz-box-sizing: content-box;
40
+ box-sizing: content-box;
41
+ }
42
+
43
+ .CodeMirror-guttermarker { color: black; }
44
+ .CodeMirror-guttermarker-subtle { color: #999; }
45
+
46
+ /* CURSOR */
47
+
48
+ .CodeMirror div.CodeMirror-cursor {
49
+ border-left: 1px solid black;
50
+ }
51
+ /* Shown when moving in bi-directional text */
52
+ .CodeMirror div.CodeMirror-secondarycursor {
53
+ border-left: 1px solid silver;
54
+ }
55
+ .CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor {
56
+ width: auto;
57
+ border: 0;
58
+ background: #7e7;
59
+ }
60
+ .cm-animate-fat-cursor {
61
+ width: auto;
62
+ border: 0;
63
+ -webkit-animation: blink 1.06s steps(1) infinite;