* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
class SitemapPlugin extends Plugin
{
const USERS_PER_MAP = 50000;
*
* @return boolean hook value; true means continue processing, false means stop.
*/
-
function onAutoload($cls)
{
$dir = dirname(__FILE__);
*
* @return boolean hook value.
*/
-
function onEndRobotsTxt($action)
{
$url = common_local_url('sitemapindex');
*
* @return boolean hook value; true means continue processing, false means stop.
*/
-
function onRouterInitialized($m)
{
$m->connect('sitemapindex.xml',
*
* @return boolean hook value.
*/
-
function onStartShowHeadElements($action)
{
$actionName = $action->trimmed('action');
*
* @return boolean hook value; true means continue processing, false means stop.
*/
-
function onCheckSchema()
{
$schema = Schema::get();
function onEndAdminPanelNav($menu) {
if (AdminPanelAction::canAdmin('sitemap')) {
// TRANS: Menu item title/tooltip
- $menu_title = _('Sitemap configuration');
+ $menu_title = _m('Sitemap configuration');
// TRANS: Menu item for site administration
- $menu->out->menuItem(common_local_url('sitemapadminpanel'), _('Sitemap'),
+ $menu->out->menuItem(common_local_url('sitemapadminpanel'), _m('MENU','Sitemap'),
$menu_title, $action_name == 'sitemapadminpanel', 'nav_sitemap_admin_panel');
}
return true;
}
+
+ /**
+ * Provide plugin version information.
+ *
+ * This data is used when showing the version page.
+ *
+ * @param array &$versions array of version data arrays; see EVENTS.txt
+ *
+ * @return boolean hook value
+ */
+ function onPluginVersion(&$versions)
+ {
+ $url = 'http://status.net/wiki/Plugin:Sitemap';
+
+ $versions[] = array('name' => 'Sitemap',
+ 'version' => STATUSNET_VERSION,
+ 'author' => 'Evan Prodromou',
+ 'homepage' => $url,
+ 'rawdescription' =>
+ // TRANS: Plugin description.
+ _m('This plugin allows creation of sitemaps for Bing, Yahoo! and Google.'));
+
+ return true;
+ }
}
*
* @see DB_DataObject
*/
-
class Sitemap_notice_count extends Memcached_DataObject
{
public $__table = 'sitemap_notice_count'; // table name
* @return Sitemap_notice_count object found, or null for no hits
*
*/
-
function staticGet($k, $v=null)
{
return Memcached_DataObject::staticGet('Sitemap_notice_count', $k, $v);
*
* @return array array of column definitions
*/
-
function table()
{
return array('notice_date' => DB_DATAOBJECT_DATE + DB_DATAOBJECT_NOTNULL,
*
* @return array key definitions
*/
-
function keys()
{
return array('notice_date' => 'K');
*
* @return array key definitions
*/
-
function keyTypes()
{
return $this->keys();
$noticeCounts = self::cacheGet('sitemap:notice:counts');
if ($noticeCounts === false) {
-
$snc = new Sitemap_notice_count();
$snc->orderBy('notice_date DESC');
$snc = Sitemap_notice_count::staticGet('notice_date', DB_DataObject_Cast::date($d));
if (empty($snc)) {
- throw new Exception("No such registration date: $d");
+ // TRANS: Exception
+ throw new Exception(_m("No such registration date: $d."));
}
$orig = clone($snc);
*
* @see DB_DataObject
*/
-
class Sitemap_user_count extends Memcached_DataObject
{
public $__table = 'sitemap_user_count'; // table name
* @return Sitemap_user_count object found, or null for no hits
*
*/
-
function staticGet($k, $v=null)
{
return Memcached_DataObject::staticGet('Sitemap_user_count', $k, $v);
*
* @return array array of column definitions
*/
-
function table()
{
return array('registration_date' => DB_DATAOBJECT_DATE + DB_DATAOBJECT_NOTNULL,
*
* @return array key definitions
*/
-
function keyTypes()
{
return $this->keys();
$suc = Sitemap_user_count::staticGet('registration_date', DB_DataObject_Cast::date($d));
if (empty($suc)) {
- throw new Exception("No such registration date: $d");
+ // TRANS: Exception thrown when a registration date cannot be found.
+ throw new Exception(_m("No such registration date: $d."));
}
$orig = clone($suc);
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class NoticesitemapAction extends SitemapAction
{
var $notices = null;
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class SitemapAction extends Action
{
/**
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class SitemapadminpanelAction extends AdminPanelAction
{
/**
*
* @return string page title
*/
-
function title()
{
- return _('Sitemap');
+ // TRANS: Title for sitemap.
+ return _m('Sitemap');
}
/**
*
* @return string instructions
*/
-
function getInstructions()
{
- return _('Sitemap settings for this StatusNet site');
+ // TRANS: Instructions for sitemap.
+ return _m('Sitemap settings for this StatusNet site');
}
/**
*
* @return void
*/
-
function showForm()
{
$form = new SitemapAdminPanelForm($this);
*
* @return void
*/
-
function saveSettings()
{
static $settings = array('sitemap' => array('googlekey', 'yahookey', 'bingkey'));
}
// This throws an exception on validation errors
-
$this->validate($values);
// assert(all values are valid);
/**
* Form for the sitemap admin panel
*/
-
class SitemapAdminPanelForm extends AdminForm
{
/**
*
* @return int ID of the form
*/
-
function id()
{
return 'form_sitemap_admin_panel';
*
* @return string class of the form
*/
-
function formClass()
{
return 'form_sitemap';
*
* @return string URL of the action
*/
-
function action()
{
return common_local_url('sitemapadminpanel');
*
* @return void
*/
-
function formData()
{
$this->out->elementStart('ul', 'form_data');
$this->li();
$this->input('googlekey',
- _('Google key'),
- _('Google Webmaster Tools verification key'),
+ // TRANS: Field label.
+ _m('Google key'),
+ // TRANS: Title for field label.
+ _m('Google Webmaster Tools verification key.'),
'sitemap');
$this->unli();
$this->li();
$this->input('yahookey',
- _('Yahoo key'),
- _('Yahoo! Site Explorer verification key'),
+ // TRANS: Field label.
+ _m('Yahoo key'),
+ // TRANS: Title for field label.
+ _m('Yahoo! Site Explorer verification key.'),
'sitemap');
$this->unli();
$this->li();
$this->input('bingkey',
- _('Bing key'),
- _('Bing Webmaster Tools verification key'),
+ // TRANS: Field label.
+ _m('Bing key'),
+ // TRANS: Title for field label.
+ _m('Bing Webmaster Tools verification key.'),
'sitemap');
$this->unli();
$this->out->elementEnd('ul');
*
* @return void
*/
-
function formActions()
{
- $this->out->submit('submit', _('Save'), 'submit', null, _('Save sitemap settings'));
+ $this->out->submit('submit',
+ // TRANS: Submit button text to save sitemap settings.
+ _m('BUTTON','Save'),
+ 'submit',
+ null,
+ // TRANS: Submit button title to save sitemap settings.
+ _m('Save sitemap settings.'));
}
}
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class SitemapindexAction extends Action
{
/**
*
* @return void
*/
-
function handle($args)
{
header('Content-Type: text/xml; charset=UTF-8');
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class UsersitemapAction extends SitemapAction
{
var $users = null;