/**
  * Method bound to the wp_head action.
  */
 function head()
 {
     $this->widget_js();
     // are we on the edit page?
     if (strstr($this->current_page_url(), JanrainCapture::get_option(JanrainCapture::$name . '_widget_edit_page')) === false) {
         add_action('wp_footer', array($this, 'sign_in_screen'));
         $this->sign_in_screen_js();
     } else {
         $this->edit_screen_js();
     }
     // do we feel like sharing?
     if (JanrainCapture::share_enabled()) {
         wp_enqueue_style('janrain_share', plugin_dir_url(__FILE__) . 'stylesheet.css');
         if (has_action('wp_footer', array($this, 'share_js') == false)) {
             add_action('wp_footer', array($this, 'share_js'));
         }
     }
 }
예제 #2
0
 /**
  * Adds javascript libraries to the page.
  */
 function register_scripts()
 {
     $captureName = JanrainCapture::$name;
     $pluginDirUrl = untrailingslashit(plugin_dir_url(__FILE__));
     wp_enqueue_script('json2');
     wp_enqueue_script('localstorage-polyfill', "{$pluginDirUrl}/localstorage-polyfill.js");
     if (JanrainCapture::share_enabled()) {
         wp_enqueue_style('janrain_share', "{$pluginDirUrl}/stylesheet.css");
         add_action('wp_footer', array($this, 'share_js'));
     }
     if ($this->ui_type == 'Capture Legacy') {
         if (JanrainCapture::get_option("{$captureName}_ui_colorbox") != '0') {
             wp_enqueue_script('colorbox', "{$pluginDirUrl}/colorbox/jquery.colorbox.js", array('jquery'));
             wp_enqueue_style('colorbox', "{$pluginDirUrl}/colorbox/colorbox.css");
         }
         if (JanrainCapture::get_option(JanrainCapture::$name . '_ui_capture_js') != '0') {
             wp_enqueue_script(JanrainCapture::$name . '_main_script', "{$pluginDirUrl}/janrain-capture-ui.js");
         }
     }
 }