Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Sep 16th, 2012  |  syntax: None  |  size: 0.67 KB  |  views: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. class BBE_plugin {
  2.         public function __construct() {
  3.                 if ( ! is_admin() ) {
  4.                         add_action( 'wp_enqueue_scripts', array( &$this, 'bbe_scripts' ) );            
  5.                 }
  6.                
  7.                 if ( is_admin() ) {
  8.                         add_action( 'wp_ajax_nopriv_bbe_box', array( &$this, 'bbe_box' ) );
  9.                         add_action( 'wp_ajax_bbe_box', array( &$this, 'bbe_box' ) );
  10.                 }              
  11.         }
  12.         // this function is run through AJAX
  13.         public function bbe_box() {
  14.                 if ( is_single() && get_post_type() == 'boxy' ) { // this check fails...
  15.                         echo '500';
  16.                         exit;
  17.                 } else {
  18.                         echo '200';
  19.                         exit;
  20.                 }
  21.         }
  22. } // end class
  23.  
  24. add_action( 'plugins_loaded', 'bbe_start' );
  25.  
  26. function bbe_start() {
  27.         $bbe_core = new BBE_plugin();  
  28.         return true;
  29. }