- struggled to make ajax works, but now is ok
- starting to make serverside works
This commit is contained in:
@@ -54,10 +54,13 @@ class PLGNTLS_class
|
||||
public function add_to_front($scripts_arr = null, $vars = null) {
|
||||
if (!is_null($scripts_arr))
|
||||
{
|
||||
console_log("in is null scripts_arr");
|
||||
// add ajax file at beginning of files list
|
||||
array_unshift($scripts_arr, "utils/plugin_ajax.js");
|
||||
$nonce = array("ajax_nonce" => wp_create_nonce('wp-pageviews-nonce'));
|
||||
$url = array("ajax_url" => admin_url('admin-ajax.php'));
|
||||
if (!is_array($vars))
|
||||
$vars = array();
|
||||
$vars = array_merge($vars, $nonce);
|
||||
$vars = array_merge($vars, $url);
|
||||
}
|
||||
@@ -68,6 +71,9 @@ class PLGNTLS_class
|
||||
}
|
||||
if (!is_null($scripts_arr))
|
||||
$this->add_scripts_to_front($scripts);
|
||||
|
||||
console_log("vars:");
|
||||
console_log($vars);
|
||||
if (!is_null($vars))
|
||||
$this->add_vars_to_front($vars);
|
||||
return $this->create_html($scripts, $vars);
|
||||
@@ -248,8 +254,6 @@ class PLGNTLS_class
|
||||
else
|
||||
$script->basename = pathinfo($script_name, PATHINFO_BASENAME);
|
||||
$script->handle = "PLGNTLS_" . str_replace(".", "_", $script->basename);
|
||||
console_log("script->handle:");
|
||||
console_log($script->handle);
|
||||
|
||||
if ($script->ext === "url") {
|
||||
$script->url = $script_name;
|
||||
|
||||
Reference in New Issue
Block a user