static function hasKeys()
{
- $key = common_config('twitter', 'consumer_key');
- $secret = common_config('twitter', 'consumer_secret');
+ $ckey = common_config('twitter', 'consumer_key');
+ $csecret = common_config('twitter', 'consumer_secret');
- if (empty($key) && empty($secret)) {
- $key = common_config('twitter', 'global_consumer_key');
- $secret = common_config('twitter', 'global_consumer_secret');
+ if (empty($ckey) && empty($csecret)) {
+ $ckey = common_config('twitter', 'global_consumer_key');
+ $csecret = common_config('twitter', 'global_consumer_secret');
}
- if (!empty($key) && !empty($secret)) {
+ if (!empty($ckey) && !empty($csecret)) {
return true;
}
function onRouterInitialized($m)
{
+ $m->connect('admin/twitter', array('action' => 'twitteradminpanel'));
+
if (self::hasKeys()) {
$m->connect(
'twitter/authorization',
}
}
- $m->connect('admin/twitter', array('action' => 'twitteradminpanel'));
-
return true;
}
);
$this->unli();
+ $globalConsumerKey = common_config('twitter', 'global_consumer_key');
+ $globalConsumerSec = common_config('twitter', 'global_consumer_secret');
+
+ if (!empty($globalConsumerKey)) {
+ $this->li();
+ $this->out->element(
+ 'label',
+ array('for' => 'global_consumer_key'),
+ ''
+ );
+ $this->out->element(
+ 'input',
+ array(
+ 'name' => 'global_consumer_key',
+ 'type' => 'text',
+ 'id' => 'global_consumer_key',
+ 'value' => $globalConsumerKey,
+ 'disabled' => 'true'
+ )
+ );
+ $this->out->element('p', 'form_guide', _('Global consumer key'));
+ $this->unli();
+
+ $this->li();
+ $this->out->element(
+ 'label',
+ array('for' => 'global_consumer_secret'),
+ ''
+ );
+ $this->out->element(
+ 'input',
+ array(
+ 'name' => 'global_consumer_secret',
+ 'type' => 'text',
+ 'id' => 'global_consumer_secret',
+ 'value' => $globalConsumerSec,
+ 'disabled' => 'true'
+ )
+ );
+ $this->out->element('p', 'form_guide', _('Global consumer secret'));
+ $this->unli();
+ }
+
$this->li();
$this->input(
'source',