Merge branch '0.7.x' into conversationtree

This commit is contained in:
Evan Prodromou 2009-05-19 17:28:19 -04:00
commit b58edbcc4e
7 changed files with 177 additions and 46 deletions

View File

@ -100,6 +100,14 @@ StartPublicGroupNav: Showing the public group nav menu
EndPublicGroupNav: At the end of the public group nav menu EndPublicGroupNav: At the end of the public group nav menu
- $action: the current action - $action: the current action
StartSubGroupNav: Showing the subscriptions group nav menu
- $action: the current action
EndSubGroupNav: At the end of the subscriptions group nav menu
- $action: the current action
RouterInitialized: After the router instance has been initialized RouterInitialized: After the router instance has been initialized
- $m: the Net_URL_Mapper that has just been set up - $m: the Net_URL_Mapper that has just been set up
ArgsInitialized: After the argument array has been initialized
- $args: associative array of arguments, can be modified

View File

@ -101,6 +101,8 @@ function main()
$args = array_merge($args, $_REQUEST); $args = array_merge($args, $_REQUEST);
Event::handle('ArgsInitialize', array(&$args));
$action = $args['action']; $action = $args['action'];
if (!$action || !preg_match('/^[a-zA-Z0-9_-]*$/', $action)) { if (!$action || !preg_match('/^[a-zA-Z0-9_-]*$/', $action)) {

View File

@ -591,7 +591,10 @@ class Action extends HTMLOutputter // lawsuit
'class' => 'system_notice')); 'class' => 'system_notice'));
$this->element('dt', null, _('Page notice')); $this->element('dt', null, _('Page notice'));
$this->elementStart('dd'); $this->elementStart('dd');
if (Event::handle('StartShowPageNotice', array($this))) {
$this->showPageNotice(); $this->showPageNotice();
Event::handle('EndShowPageNotice', array($this));
}
$this->elementEnd('dd'); $this->elementEnd('dd');
$this->elementEnd('dl'); $this->elementEnd('dl');
} }

View File

@ -51,7 +51,7 @@ class SearchAction extends Action
* *
* @return boolean true * @return boolean true
*/ */
function isReadOnly() function isReadOnly($args)
{ {
return true; return true;
} }

View File

@ -74,6 +74,8 @@ class SubGroupNav extends Widget
$this->out->elementStart('ul', array('class' => 'nav')); $this->out->elementStart('ul', array('class' => 'nav'));
if (Event::handle('StartSubGroupNav', array($this))) {
$this->out->menuItem(common_local_url('subscriptions', $this->out->menuItem(common_local_url('subscriptions',
array('nickname' => array('nickname' =>
$this->user->nickname)), $this->user->nickname)),
@ -106,6 +108,10 @@ class SubGroupNav extends Widget
$action == 'invite', $action == 'invite',
'nav_invite'); 'nav_invite');
} }
Event::handle('EndSubGroupNav', array($this));
}
$this->out->elementEnd('ul'); $this->out->elementEnd('ul');
} }
} }

View File

@ -0,0 +1,109 @@
<?php
/**
* Laconica, the distributed open-source microblogging tool
*
* Plugin to show WikiHashtags content in the sidebar
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugin
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @copyright 2008 Control Yourself, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
*/
if (!defined('LACONICA')) {
exit(1);
}
define('WIKIHASHTAGSPLUGIN_VERSION', '0.1');
/**
* Plugin to use WikiHashtags
*
* @category Plugin
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://laconi.ca/
*
* @see Event
*/
class WikiHashtagsPlugin extends Plugin
{
function __construct($code=null)
{
parent::__construct();
}
function onStartShowSections($action)
{
$name = $action->trimmed('action');
if ($name == 'tag') {
$taginput = $action->trimmed('tag');
$tag = common_canonical_tag($taginput);
if (!empty($tag)) {
$url = sprintf('http://hashtags.wikia.com/index.php?title=%s&action=render',
urlencode($tag));
$editurl = sprintf('http://hashtags.wikia.com/index.php?title=%s&action=edit',
urlencode($tag));
$context = stream_context_create(array('http' => array('method' => "GET",
'header' =>
"User-Agent: " . $this->userAgent())));
$html = @file_get_contents($url, false, $context);
$action->elementStart('div', array('id' => 'wikihashtags', 'class' => 'section'));
if (!empty($html)) {
$action->element('style', null,
"span.editsection { display: none }\n".
"table.toc { display: none }");
$action->raw($html);
$action->elementStart('p');
$action->element('a', array('href' => $editurl,
'title' => sprintf(_('Edit the article for #%s on WikiHashtags'), $tag)),
_('Edit'));
$action->element('a', array('href' => 'http://www.gnu.org/copyleft/fdl.html',
'title' => _('Shared under the terms of the GNU Free Documentation License'),
'rel' => 'license'),
'GNU FDL');
$action->elementEnd('p');
} else {
$action->element('a', array('href' => $editurl),
sprintf(_('Start the article for #%s on WikiHashtags'), $tag));
}
$action->elementEnd('div');
}
}
return true;
}
function userAgent()
{
return 'WikiHashtagsPlugin/'.WIKIHASHTAGSPLUGIN_VERSION .
' Laconica/' . LACONICA_VERSION;
}
}

View File

@ -495,7 +495,7 @@ line-height:1.618;
/* entity_profile */ /* entity_profile */
.entity_profile { .entity_profile {
position:relative; position:relative;
width:67.702%; width:74.702%;
min-height:123px; min-height:123px;
float:left; float:left;
margin-bottom:18px; margin-bottom:18px;
@ -531,12 +531,15 @@ margin-bottom:4px;
.entity_profile .entity_nickname { .entity_profile .entity_nickname {
margin-left:11px; margin-left:11px;
display:inline; display:inline;
font-weight:bold;
} }
.entity_profile .entity_nickname { .entity_profile .entity_nickname {
margin-left:0; margin-left:0;
} }
.entity_profile .fn,
.entity_profile .nickname {
font-size:1.1em;
font-weight:bold;
}
.entity_profile .entity_fn dd:before { .entity_profile .entity_fn dd:before {
content: "("; content: "(";
font-weight:normal; font-weight:normal;
@ -558,7 +561,7 @@ display:none;
/*entity_actions*/ /*entity_actions*/
.entity_actions { .entity_actions {
float:right; float:right;
margin-left:4.35%; margin-left:2.35%;
max-width:25%; max-width:25%;
} }
.entity_actions h2 { .entity_actions h2 {