| @@ -23,15 +23,20 @@ | ||
| 23 | 23 | 'twitter_handle' => array('default' => ''), |
| 24 | 24 | |
| 25 | 25 | ); |
| 26 | 26 | |
| 27 | + static $hooked = null; | |
| 27 | 28 | |
| 28 | 29 | public function __construct() |
| 29 | 30 | { |
| 30 | 31 | $w = MBSocial()->whistle(); |
| 31 | 32 | |
| 32 | - $w->listen('display/vars/twitter_handle', array($this, 'twitter_handle'), 'ask'); | |
| 33 | - $w->listen('display/vars/twitter_hashtags', array($this, 'twitter_hashtags'), 'ask'); | |
| 33 | + if (self::$hooked == null) // listen just once. | |
| 34 | + { | |
| 35 | + $w->listen('display/vars/twitter_handle', array($this, 'twitter_handle'), 'ask'); | |
| 36 | + $w->listen('display/vars/twitter_hashtags', array($this, 'twitter_hashtags'), 'ask'); | |
| 37 | + self::$hooked = true; | |
| 38 | + } | |
| 34 | 39 | } |
| 35 | 40 | |
| 36 | 41 | public function twitter_handle() |
| 37 | 42 | { |
| @@ -61,10 +66,11 @@ | ||
| 61 | 66 | $hash = ( isset($blockdata['twitter_hash'] )) ? $blockdata['twitter_hash'] : false; |
| 62 | 67 | |
| 63 | 68 | if ($hash && strlen($hash) > 0) |
| 64 | 69 | { |
| 65 | - $hashes = array_filter(explode('#', $hash) ); | |
| 66 | - $hashes = array_filter($hashes, 'trim'); | |
| 70 | + | |
| 71 | + $hashes = array_filter(explode(',', trim($hash)) ); | |
| 72 | + $hashes = array_map('trim', $hashes); | |
| 67 | 73 | $hash = implode(',', $hashes); |
| 68 | 74 | } |
| 69 | 75 | return $hash; |
| 70 | 76 | |
| @@ -136,8 +142,9 @@ | ||
| 136 | 142 | $handle->label = __('Twitter Handle', 'mbsocial'); |
| 137 | 143 | $handle->value = $this->getValue('twitter_handle') ; |
| 138 | 144 | $handle->placeholder = '@example'; |
| 139 | 145 | $handle->inputclass = 'medium'; |
| 146 | + $handle->help = __('Adding a handle will include the handle in the proposed message (via)', 'mb-social'); | |
| 140 | 147 | $admin->addField($handle, 'start', 'end', false); |
| 141 | 148 | |
| 142 | 149 | |
| 143 | 150 | |
| @@ -146,8 +153,9 @@ | ||
| 146 | 153 | $hash->name = 'twitter_hash'; |
| 147 | 154 | $hash->label = __('Twitter Default Hash Tag(s)', 'mbsocial'); |
| 148 | 155 | $hash->value = $this->getValue('twitter_hash'); |
| 149 | 156 | $hash->inputclass = 'medium'; |
| 157 | + $hash->help = __('Separate multiple hashtags with a comma (first,second)', 'mb-social'); | |
| 150 | 158 | $hash->placeholder = '#'; |
| 151 | 159 | |
| 152 | 160 | $admin->addField($hash, 'start', 'end', false); |
| 153 | 161 | |