/**
  * Initializer
  *
  * @return boolean hook value; true means continue processing, false means stop.
  */
 function initialize()
 {
     $this->filter = new SpamFilter(common_config('activityspam', 'server'), common_config('activityspam', 'consumerkey'), common_config('activityspam', 'secret'));
     $this->hideSpam = common_config('activityspam', 'hidespam');
     // Let DB_DataObject find Spam_score
     common_config_set('db', 'class_location', common_config('db', 'class_location') . ':' . dirname(__FILE__));
     return true;
 }
 function onStartShowStylesheets(Action $action)
 {
     //get the theme and set the current config for site and theme.
     if ($action->getScoped() instanceof Profile) {
         $site_theme = common_config('site', 'theme');
         $user_theme = $action->getScoped()->getPref('chosen_theme', 'theme', $site_theme);
         common_config_set('site', 'theme', $user_theme);
     }
     return true;
 }
示例#3
0
 public static function delPlugin($name)
 {
     // Remove our plugin if it was previously loaded
     $name = ucfirst($name);
     if (isset(self::$plugins[$name])) {
         unset(self::$plugins[$name]);
     }
     // make sure initPlugins will avoid this
     common_config_set('plugins', 'disable-' . $name, true);
     return true;
 }
示例#4
0
 static function settings($setting)
 {
     /* · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
        ·        							     ·
        ·                          S E T T I N G S                          ·
        ·         							     ·
        · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
     // THESE SETTINGS CAN BE OVERRIDDEN IN CONFIG.PHP
     // e.g. $config['site']['qvitter']['enabledbydefault'] = false;
     // ENABLED BY DEFAULT (true/false)
     $settings['enabledbydefault'] = true;
     // DEFAULT BACKGROUND COLOR
     $settings['defaultbackgroundcolor'] = '#f4f4f4';
     // DEFAULT BACKGROUND IMAGE
     $settings['sitebackground'] = 'img/vagnsmossen.jpg';
     // DEFAULT FAVICON
     $settings['favicon'] = 'img/favicon.ico?v=5';
     // DEFAULT SPRITE
     $settings['sprite'] = Plugin::staticPath('Qvitter', '') . 'img/sprite.png?v=41';
     // DEFAULT LINK COLOR
     $settings['defaultlinkcolor'] = '#0084B4';
     // ENABLE DEFAULT WELCOME TEXT
     $settings['enablewelcometext'] = true;
     // CUSTOM WELCOME TEXT (overrides the previous setting)
     $settings['customwelcometext'] = false;
     // 		Example:
     // 		$settings['customwelcometext']['sv'] = '<h1>Välkommen till Quitter.se – en federerad<sup>1</sup> mikrobloggsallmänning!</h1><p>Etc etc...</p>';
     // 		$settings['customwelcometext']['en'] = '<h1>Welcome to Quitter.se – a federated microblog common!</h1><p>Etc etc...</p>';
     // TIME BETWEEN POLLING
     $settings['timebetweenpolling'] = 5000;
     // ms
     // URL SHORTENER
     $settings['urlshortenerapiurl'] = 'http://qttr.at/yourls-api.php';
     $settings['urlshortenersignature'] = 'b6afeec983';
     // CUSTOM TERMS OF USE
     $settings['customtermsofuse'] = false;
     // IP ADDRESSES BLOCKED FROM REGISTRATION
     $settings['blocked_ips'] = array();
     // LINKIFY DOMAINS WITHOUT PROTOCOL AS DEFAULT
     $settings['linkify_bare_domains'] = true;
     /* · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
     	  ·                                                                   ·
     	  ·                (o>                                  >o)           ·
     	  ·            \\\\_\                                    /_////       .
     	  ·             \____)                                  (____/        ·
     	  ·                                                                   ·
     	  · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */
     // config.php settings override the settings in this file
     $configphpsettings = common_config('site', 'qvitter') ?: array();
     foreach ($configphpsettings as $configphpsetting => $value) {
         $settings[$configphpsetting] = $value;
     }
     // set linkify setting
     common_config_set('linkify', 'bare_domains', $settings['linkify_bare_domains']);
     if (isset($settings[$setting])) {
         return $settings[$setting];
     } else {
         return false;
     }
 }
 public function initialize()
 {
     common_config_set('email', 'notify_fave', $this->email_notify_fave);
 }
示例#6
0
 public function initialize()
 {
     common_config_set('webfinger', 'http_alias', $this->http_alias);
 }
示例#7
0
 public function execute(array $args = array())
 {
     // checkMirror stuff
     if (common_config('db', 'mirror') && $this->isReadOnly($args)) {
         if (is_array(common_config('db', 'mirror'))) {
             // "load balancing", ha ha
             $arr = common_config('db', 'mirror');
             $k = array_rand($arr);
             $mirror = $arr[$k];
         } else {
             $mirror = common_config('db', 'mirror');
         }
         // everyone else uses the mirror
         common_config_set('db', 'database', $mirror);
     }
     if (Event::handle('StartActionExecute', array($this, &$args))) {
         $prepared = $this->prepare($args);
         if ($prepared) {
             $this->handle($args);
         } else {
             common_debug('Prepare failed for Action.');
         }
         $this->flush();
         Event::handle('EndActionExecute', array($this));
     }
 }