public function action_init_theme()
 {
     Stack::add('template_stylesheet', array(URL::get_from_filesystem(__FILE__) . '/magicarchives.css', 'screen'), 'magicarchives');
     Stack::add('template_header_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery');
     Stack::add('template_header_javascript', URL::get_from_filesystem(__FILE__) . '/magicarchives.js', 'magicarchives', array('jquery', 'ajax_manager'));
     Stack::add('template_header_javascript', URL::get_from_filesystem(__FILE__) . '/ajax_manager.js', 'ajax_manager', 'jquery');
     Stack::add('template_header_javascript', 'magicArchives.endpoint=\'' . URL::get('ajax', array('context' => 'archive_posts')) . '\'', 'magicurl', 'magicarchives');
 }
Пример #2
0
 public function remove_template()
 {
     Post::deactivate_post_type('poll');
     $this->remove_template('widget', dirname(__FILE__) . '/widget.php');
     Stack::remove('template_header_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery');
     Stack::remove('template_stylesheet', array(URL::get_from_filesystem(__FILE__) . '/widget.css', 'screen'), 'pollwigitcss');
     $this->remove_template('poll.single', dirname(__FILE__) . '/poll.single.php');
 }
Пример #3
0
 /**
  * Return basic information about this silo
  *     name- The name of the silo, used as the root directory for media in this silo
  *	  icon- An icon to represent the silo
  */
 public function silo_info()
 {
     if (User::identify()->info->lastfm__username != '') {
         return array('name' => self::SILO_NAME, 'icon' => URL::get_from_filesystem(__FILE__) . '/icon.png');
     } else {
         return array();
     }
 }
Пример #4
0
 /**
  * Handle register_success action
  */
 public function action_plugin_act_register_success($handler)
 {
     if (!User::identify()->loggedin) {
         Utils::redirect(URL::get('register_page'), false);
     }
     $handler->theme->user = User::identify();
     Stack::add('template_header_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery', array('jquery'));
     // Stack::add( 'template_header_javascript', Site::get_url('admin_theme') . "/js/admin.js", 'admin', array('jquery', 'registration') );
     Stack::add('template_header_javascript', URL::get_from_filesystem(__FILE__) . '/registration.js', 'registration', array('jquery'));
     Stack::add('template_stylesheet', array(URL::get_from_filesystem(__FILE__) . '/registration.css', 'screen'), 'registration', array());
     $handler->theme->display('registration.success');
 }
Пример #5
0
	/**
	* Return basic information about this silo
	*     name- The name of the silo, used as the root directory for media in this silo
	*	  icon- An icon to represent the silo
	*/
	public function silo_info()
	{
		if ( $this->is_auth() ) {
			return array( 'name' => self::SILO_NAME, 'icon' => URL::get_from_filesystem(__FILE__) . '/icon.png' );
		}
		else {
			return array();
		}
	}
Пример #6
0
 public function action_init_theme()
 {
     //Add the stylesheet for LaTeX images and such
     Stack::add('template_stylesheet', array(URL::get_from_filesystem(__FILE__) . '/latex.css', 'screen', 'screen'), 'jLaTeX-css');
 }
 public function action_init_theme()
 {
     Stack::add('template_header_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery');
     Stack::add('template_header_javascript', URL::get_from_filesystem(__FILE__) . '/commentated.js', 'commentated');
 }
Пример #8
0
 public function theme_footer()
 {
     if ($this->has_spoilers) {
         // Load jQuery, if it's not already loaded
         if (!Stack::has('template_header_javascript', 'jquery')) {
             Stack::add('template_footer_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery', array('jquery'));
         }
         Stack::add('template_footer_javascript', URL::get_from_filesystem(__FILE__) . '/spoilers.js', 'spoilers', array('jquery'));
         Stack::add('template_stylesheet', array(URL::get_from_filesystem(__FILE__) . '/spoilers.css', 'screen'), 'spoilers', array());
     }
 }
Пример #9
0
 /**
  * Add CSS & JS to admin stack
  *
  * @return void
  **/
 public function action_admin_header()
 {
     if (Options::get('spamview__spambutton')) {
         Stack::add('admin_stylesheet', array(URL::get_from_filesystem(__FILE__) . '/spamview.css', 'screen'), 'spamview');
         Stack::add('admin_header_javascript', URL::get_from_filesystem(__FILE__) . '/spamview.js', 'spamview', array('jquery', 'jquery.hotkeys'));
     }
 }
Пример #10
0
 public function action_admin_header()
 {
     Stack::add('admin_header_javascript', URL::get_from_filesystem(__FILE__) . '/suggestr.js', 'suggestr');
     Stack::add('admin_stylesheet', array(URL::get_from_filesystem(__FILE__) . '/suggestr.css', 'screen'), 'suggestr');
 }
 /**
  * Return basic information about this silo
  *     name- The name of the silo, used as the root directory for media in this silo
  */
 public function silo_info()
 {
     return array('name' => self::SILO_NAME, 'icon' => URL::get_from_filesystem(__FILE__) . '/icon.png');
 }
Пример #12
0
	/**
	 * Get a fully-qualified URL directory that contains this pluggable class
	 *
	 * @param bool whether to include a trailing slash.  Default: No
	 * @return string URL
	 */
	public function get_url( $trail = false )
	{
		return URL::get_from_filesystem( $this->get_file(), $trail );
	}
Пример #13
0
 /**
  * Add media files 
  **/
 public function action_admin_header()
 {
     Stack::add('admin_stylesheet', array(URL::get_from_filesystem(__FILE__) . '/helpify.css', 'screen'), 'helpify');
     Stack::add('admin_header_javascript', URL::get_from_filesystem(__FILE__) . '/helpify.js', 'helpify', array('jquery', 'jquery.hotkeys'));
 }
 /**
  * Insert player into post content.
  *
  * @param array $matches from callback function
  * @return string
  */
 private static function insertPlayerOut($matches)
 {
     $options = Options::get(self::OPTNAME);
     static $playerID = 0;
     list($files, $data) = self::getfileData($matches);
     $playerOptions = array();
     $playerOptions['soundFile'] = $options['encode'] ? self::encodeSource(implode(",", $files)) : implode(",", $files);
     for ($i = 1; $i < count($data); $i++) {
         $pair = explode("=", $data[$i]);
         $playerOptions[trim($pair[0])] = trim($pair[1]);
     }
     $playerElementID = "audioplayer_{$playerID}";
     $output = '';
     // Load the Javascript only on the pages/posts it's actually needed - some will argue about the problems with adding JS to the body of a doc like this, but we're using Flash already, so we can't be too pedantic :-)
     if ($playerID == 0) {
         $output .= '<script type="text/javascript" src="' . URL::get_from_filesystem(__FILE__) . '/lib/js/audio-player.js"></script>';
         $output .= '<script type="text/javascript">AudioPlayer.setup("' . URL::get_from_filesystem(__FILE__) . '/lib/player.swf",' . self::php2js(self::getPlayerOptions()) . ');</script>';
     }
     $output .= '<p class="audioplayer_container"><span style="display:block" id="' . $playerElementID . '"><!-- [audio:' . $data[0] . '] --></span>';
     $output .= '<script type="text/javascript">';
     $output .= 'AudioPlayer.embed("' . $playerElementID . '", ' . self::php2js($playerOptions) . ' );';
     $output .= '</script></p>';
     $playerID++;
     return $output;
 }
Пример #15
0
 /**
  * Plugin UI - Displays the 'authorize' config option
  *
  * @access public
  * @return void
  */
 public function action_theme_loginform_after()
 {
     if (Options::get('twitter__login') == 1) {
         echo '<a href="' . URL::get('auth_twitter_go') . '"><img src="' . URL::get_from_filesystem(__FILE__) . '/lib/twitter_connect.png" alt="Sign in with Twitter" /></a>';
     }
 }
Пример #16
0
 public function action_admin_header()
 {
     Stack::add('admin_stylesheet', array(URL::get_from_filesystem(__FILE__) . '/supertypes.css', 'screen'), 'supertypes');
 }
    /**
     * Respond to the user selecting an action on the plugin page
     *
     * @param string $plugin_id The string id of the acted-upon plugin
     * @param string $action The action string supplied via the filter_plugin_config hook
     */
    public function action_plugin_ui($plugin_id, $action)
    {
        $ui = new FormUI(strtolower(__CLASS__));
        $user = User::identify();
        require_once dirname(__FILE__) . '/lib/twitteroauth/twitteroauth.php';
        switch ($action) {
            case 'authorize':
                unset($_SESSION['TwitterSiloReqToken']);
                // Just being safe.
                $oauth = new TwitterOAuth(TwitterSilo::CONSUMER_KEY, TwitterSilo::CONSUMER_SECRET);
                $oauth_token = $oauth->getRequestToken(URL::get('admin', array('page' => 'plugins', 'configure' => $this->plugin_id(), 'configaction' => 'confirm')));
                $request_link = $oauth->getAuthorizeURL($oauth_token);
                $reqToken = array("request_link" => $request_link, "request_token" => $oauth_token['oauth_token'], "request_token_secret" => $oauth_token['oauth_token_secret']);
                $_SESSION['TwitterSiloReqToken'] = serialize($reqToken);
                $ui->append('static', 'nocontent', '<h3>Authorize the Habari TwitterSilo Plugin</h3>
													 <p>Authorize your blog to have access to your Twitter account.</p>
													 <p>Click the button below, and you will be taken to Twitter.com. If you\'re already logged in, you will be presented with the option to authorize your blog. Press the "Allow" button to do so, and you will come right back here.</p>
													 <br><p style="text-align:center"><a href="' . $reqToken['request_link'] . '"><img src="' . URL::get_from_filesystem(__FILE__) . '/lib/twitter_connect.png" alt="Sign in with Twitter" /></a></p>
							');
                $ui->out();
                break;
            case 'confirm':
                if (!isset($_SESSION['TwitterSiloReqToken'])) {
                    $auth_url = URL::get('admin', array('page' => 'plugins', 'configure' => $this->plugin_id(), 'configaction' => 'authorize'));
                    $ui->append('static', 'nocontent', '<p>' . _t('Either you have already authorized Habari to access your Twitter account, or you have not yet done so.  Please ') . '<strong><a href="' . $auth_url . '">' . _t('try again') . '</a></strong>.</p>');
                    $ui->out();
                } else {
                    $reqToken = unserialize($_SESSION['TwitterSiloReqToken']);
                    $oauth = new TwitterOAuth(TwitterSilo::CONSUMER_KEY, TwitterSilo::CONSUMER_SECRET, $reqToken['request_token'], $reqToken['request_token_secret']);
                    $token = $oauth->getAccessToken($_GET['oauth_verifier']);
                    //$config_url = URL::get( 'admin', array( 'page' => 'plugins', 'configure' => $this->plugin_id(), 'configaction' => 'Configure' ) );
                    if (!empty($token) && isset($token['oauth_token'])) {
                        $user->info->twittersilo__access_token = $token['oauth_token'];
                        $user->info->twittersilo__access_token_secret = $token['oauth_token_secret'];
                        $user->info->twittersilo__user_id = $token['user_id'];
                        $user->info->commit();
                        echo '<form><p>' . _t('Habari TwitterSilo plugin successfully authorized.') . '</p></form>';
                        Session::notice(_t('Habari TwitterSilo plugin successfully authorized.', 'twittersilo'));
                        //Utils::redirect( $config_url );
                    } else {
                        // TODO: We need to fudge something to report the error in the event something fails.  Sadly, the Twitter OAuth class we use doesn't seem to cater for errors very well and returns the Twitter XML response as an array key.
                        // TODO: Also need to gracefully cater for when users click "Deny"
                        echo '<form><p>' . _t('There was a problem with your authorization.') . '</p></form>';
                    }
                    unset($_SESSION['TwitterSiloReqToken']);
                }
                break;
            case 'deauthorize':
                $user->info->twittersilo__user_id = '';
                $user->info->twittersilo__access_token = '';
                $user->info->twittersilo__access_token_secret = '';
                $user->info->commit();
                $reauth_url = URL::get('admin', array('page' => 'plugins', 'configure' => $this->plugin_id(), 'configaction' => 'authorize')) . '#plugin_options';
                $ui->append('static', 'nocontent', '<p>' . _t('The Twitter Plugin authorization has been deleted. Please ensure you ') . '<a href="http://twitter.com/settings/connections" target="_blank">' . _t('revoke access ') . '</a>' . _t('from your Twitter account too.') . '<p><p>' . _t('Do you want to ') . '<b><a href="' . $reauth_url . '">' . _t('re-authorize this plugin') . '</a></b>?<p>');
                Session::notice(_t('Habari TwitterSilo plugin authorization revoked. <br>Don\'t forget to revoke access on Twitter itself.', 'twitter'));
                //Utils::redirect( $reauth_url );
                $ui->out();
                break;
        }
    }
Пример #18
0
 public function action_init_theme()
 {
     //Add the stylesheet
     Stack::add('template_stylesheet', array(URL::get_from_filesystem(__FILE__) . '/formatting.css', 'screen', 'screen'), 'jLaTeXp-css');
 }
 public function action_init_theme()
 {
     Stack::add('template_header_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery');
     Stack::add('template_header_javascript', Site::get_url('scripts') . '/aliencontact.js', 'aliencontact');
     Stack::add('template_stylesheet', array(URL::get_from_filesystem(__FILE__) . '/aliencontact.css', 'screen'), 'aliencontactcss');
 }
Пример #20
0
 /**
  * Return basic information about this silo
  *   name- The name of the silo, used as the root directory for media in this silo
  **/
 public function silo_info()
 {
     $s3 = $this->gets3();
     if (false == $s3->listBuckets()) {
         return false;
     }
     return array('name' => self::SILO_NAME, 'icon' => URL::get_from_filesystem(__FILE__) . '/icon.png');
 }