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 Oct 10th, 2012  |  syntax: PHP  |  size: 0.90 KB  |  views: 11  |  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 IBLikeable {
  2.  
  3.         function __construct() {
  4.                 // ... initialize class properties
  5.                 add_action( 'admin_print_scripts', array( $this, 'enqueue_admin' ) );
  6.         }
  7.  
  8.         function register_admin_menus() {
  9.  
  10.                 $hook = add_options_page('ibLikeable Settings', 'ibLikeable', 'manage_options', $this->prefix, array( $this, 'render_settings_page' ) );
  11.                 $this->settings_hook = $hook;
  12.  
  13.                 add_action( 'admin_print_scripts-' . $hook, array( $this, 'enqueue_admin') );
  14.  
  15.         }
  16.         // ... more code ...
  17.  
  18.         function enqueue_admin() {
  19.                 $screen = get_current_screen();
  20.  
  21.                 if( $screen->id == $this->settings_hook ) {
  22.                         wp_register_style($this->prefix . '-settings', $this->url . 'css/settings_page.css' );
  23.                         wp_enqueue_style( $this->prefix . '-settings');
  24.                         wp_register_script( $this->prefix . '-settings-js', $this->url . 'js/settings_page.js', array('jQuery') );
  25.                         wp_enqueue_script($this->prefix . '-settings-js');
  26.                 }
  27.         }
  28. }