TagAction extends ManagedAction

This commit is contained in:
Mikael Nordfeldth 2014-07-04 19:32:57 +02:00
parent f42f7a1c85
commit 182605cb6a
1 changed files with 8 additions and 13 deletions

View File

@ -17,26 +17,28 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } if (!defined('GNUSOCIAL')) { exit(1); }
// @todo FIXME: documentation missing. // @todo FIXME: documentation missing.
class TagAction extends Action class TagAction extends ManagedAction
{ {
var $notice; var $notice;
var $tag; var $tag;
var $page; var $page;
function prepare($args) protected function prepare(array $args=array())
{ {
parent::prepare($args); parent::prepare($args);
$taginput = $this->trimmed('tag'); $taginput = $this->trimmed('tag');
$this->tag = common_canonical_tag($taginput); $this->tag = common_canonical_tag($taginput);
if (!$this->tag) { if (empty($this->tag)) {
common_redirect(common_local_url('publictagcloud'), 301); common_redirect(common_local_url('publictagcloud'), 301);
} }
if ($this->tag != $taginput) { // after common_canonical_tag we have a lowercase, no-specials tag string
if ($this->tag !== $taginput) {
common_redirect(common_local_url('tag', array('tag' => $this->tag)), 301); common_redirect(common_local_url('tag', array('tag' => $this->tag)), 301);
} }
@ -69,13 +71,6 @@ class TagAction extends Action
} }
} }
function handle($args)
{
parent::handle($args);
$this->showPage();
}
function getFeeds() function getFeeds()
{ {
return array(new Feed(Feed::JSON, return array(new Feed(Feed::JSON,
@ -111,7 +106,7 @@ class TagAction extends Action
$this->tag))); $this->tag)));
} }
function showContent() protected function showContent()
{ {
if(Event::handle('StartTagShowContent', array($this))) { if(Event::handle('StartTagShowContent', array($this))) {