@@ -40,17 +40,14 @@ class ByScriptsAjaxPostsLoader
4040 public $ identifier = 'byscripts_ajax_posts_loader ' ;
4141
4242 public function __construct () {
43- add_action ('template_redirect ' , array ($ this , 'init ' ));
43+ add_action ('template_redirect ' , array ($ this , 'start ' ));
4444 add_action ('admin_init ' , array ($ this , 'adminInit ' ));
4545 add_action ('admin_menu ' , array ($ this , 'adminMenu ' ));
46+ add_action ('init ' , array ($ this , 'loadTextDomain ' ));
4647 add_filter (sprintf ('plugin_action_links_%s ' , plugin_basename (__FILE__ )), array ($ this , 'settingsLink ' ));
47- load_plugin_textdomain ($ this ->identifier , false , dirname (plugin_basename (__FILE__ )) . '/lang/ ' );
48-
49- // Small hack to make the string visible in PoEdit (I18n)
50- __ ('Load the next page of posts with AJAX. ' );
5148 }
5249
53- public function init () {
50+ public function start () {
5451 global $ wp_query ;
5552
5653 // Don't load script on singular pages
@@ -70,7 +67,7 @@ public function init() {
7067
7168 // Next page to load
7269 $ page_number_next = (get_query_var ('paged ' ) > 1 ) ? get_query_var ('paged ' ) + 1 : 2 ;
73-
70+
7471 // Add some parameters for the JS.
7572 wp_localize_script (
7673 $ this ->identifier ,
@@ -89,6 +86,13 @@ public function init() {
8986 );
9087 }
9188
89+ public function loadTextDomain () {
90+ load_plugin_textdomain ($ this ->identifier , false , dirname (plugin_basename (__FILE__ )) . '/lang/ ' );
91+
92+ // Small hack to make the string visible in PoEdit (I18n)
93+ __ ('Load the next page of posts with AJAX. ' , $ this ->identifier );
94+ }
95+
9296 /**
9397 * Prefixes a string with an unique identifier
9498 *
0 commit comments