Commit 61bdc2a7 authored by Dave Lane's avatar Dave Lane
Browse files

pushing plugin debug info into javascript

parent 7a0bc135
...@@ -41,7 +41,6 @@ class BFFForm extends BFFCourse { ...@@ -41,7 +41,6 @@ class BFFForm extends BFFCourse {
// this enables the setblogfeed service for authenticated users... // this enables the setblogfeed service for authenticated users...
add_action('wp_ajax_bff_set', array($this, 'ajax_set')); add_action('wp_ajax_bff_set', array($this, 'ajax_set'));
$this->log('finished setting up scripts'); $this->log('finished setting up scripts');
} }
// the function called after the bff-submit button is clicked in our form // the function called after the bff-submit button is clicked in our form
...@@ -61,6 +60,7 @@ class BFFForm extends BFFCourse { ...@@ -61,6 +60,7 @@ class BFFForm extends BFFCourse {
wp_die(); wp_die();
} }
// function called after the bff-set button is clicked
public function ajax_set() { public function ajax_set() {
$this->log('in ajax_set: '.print_r($_POST, true)); $this->log('in ajax_set: '.print_r($_POST, true));
// check if the submitted nonce matches the generated nonce created in the auth_init functionality // check if the submitted nonce matches the generated nonce created in the auth_init functionality
...@@ -186,7 +186,7 @@ class BFFForm extends BFFCourse { ...@@ -186,7 +186,7 @@ class BFFForm extends BFFCourse {
public function add_post_class($classes) { public function add_post_class($classes) {
global $post; global $post;
$post_slug=$post->post_name; $post_slug=$post->post_name;
$this->log('running body_class filter - post_slug = '.$post_slug); $this->log('running class filter - post_slug = '.$post_slug);
if ($post_slug === BFF_SLUG) { if ($post_slug === BFF_SLUG) {
$this->log('setting class on '.BFF_SLUG.' to '.BFF_CLASS); $this->log('setting class on '.BFF_SLUG.' to '.BFF_CLASS);
$classes[] = BFF_CLASS; $classes[] = BFF_CLASS;
......
/* created by Dave Lane, dave@oerfoundation.org, https://oeru.org */ /* created by Dave Lane, dave@oerfoundation.org, https://oeru.org */
var DEBUG = false; // set to false to disable debugging var BFF_DEBUG = true; // set to false to disable debugging
var LOG = DEBUG ? console.log.bind(console) : function () {}; function LOG() { if (BFF_DEBUG) { console.log.apply(this, arguments); }}
LOG('BFF DEBUG = true'); // only prints if DEBUG = true LOG('BFF DEBUG =', BFF_DEBUG); // only prints if DEBUG = true
/* jquery-independent functions */ /* jquery-independent functions */
function addslashes(string) { function addslashes(string) {
...@@ -133,7 +133,7 @@ function get_course_id(str) { ...@@ -133,7 +133,7 @@ function get_course_id(str) {
return id; return id;
} }
// jQuery seletors and related functions in that context // jQuery selectors and related functions in that context
jQuery(document).ready(function() { jQuery(document).ready(function() {
var $ = jQuery; var $ = jQuery;
var feeds, feed_types, courses, authenticated; var feeds, feed_types, courses, authenticated;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment