/** * Class handler. * * @param array $args query arguments * * @return boolean false if user doesn't exist */ function handle($args) { parent::handle($args); $type = $this->trimmed('type'); $short_name = ''; if ($type == 'people') { $type = 'peoplesearch'; // TRANS: ShortName in the OpenSearch interface when trying to find users. $short_name = _('People Search'); } else { $type = 'noticesearch'; // TRANS: ShortName in the OpenSearch interface when trying to find notices. $short_name = _('Notice Search'); } header('Content-Type: application/opensearchdescription+xml'); $this->startXML(); $this->elementStart('OpenSearchDescription', array('xmlns' => 'http://a9.com/-/spec/opensearch/1.1/')); $short_name = common_config('site', 'name') . ' ' . $short_name; $this->element('ShortName', null, $short_name); $this->element('Contact', null, common_config('site', 'email')); $this->element('Url', array('type' => 'text/html', 'method' => 'get', 'template' => str_replace('---', '{searchTerms}', common_local_url($type, array('q' => '---'))))); $this->element('Image', array('height' => 16, 'width' => 16, 'type' => 'image/vnd.microsoft.icon'), common_path('favicon.ico')); $this->element('Image', array('height' => 50, 'width' => 50, 'type' => 'image/png'), Theme::path('logo.png')); $this->element('AdultContent', null, 'false'); $this->element('Language', null, common_language()); $this->element('OutputEncoding', null, 'UTF-8'); $this->element('InputEncoding', null, 'UTF-8'); $this->elementEnd('OpenSearchDescription'); $this->endXML(); }
protected function handle() { parent::handle(); switch ($this->format) { case 'xml': $this->initDocument('xml'); $this->elementStart('config'); // XXX: check that all sections and settings are legal XML elements foreach ($this->keys as $section => $settings) { $this->elementStart($section); foreach ($settings as $setting) { $value = $this->setting($section, $setting); if (is_array($value)) { $value = implode(',', $value); } else { if ($value === false || $value == '0') { $value = 'false'; } else { if ($value === true || $value == '1') { $value = 'true'; } } } // return theme logo if there's no site specific one if (empty($value)) { if ($section == 'site' && $setting == 'logo') { $value = Theme::path('logo.png'); } } $this->element($setting, null, $value); } $this->elementEnd($section); } $this->elementEnd('config'); $this->endDocument('xml'); break; case 'json': $result = array(); foreach ($this->keys as $section => $settings) { $result[$section] = array(); foreach ($settings as $setting) { $result[$section][$setting] = $this->setting($section, $setting); } } $this->initDocument('json'); $this->showJsonObjects($result); $this->endDocument('json'); break; default: // TRANS: Client error displayed when coming across a non-supported API method. $this->clientError(_('API method not found.'), 404); } }
/** * Show the timeline of notices * * @return void */ function showTimeline() { $sitename = common_config('site', 'name'); $sitelogo = common_config('site', 'logo') ? common_config('site', 'logo') : Theme::path('logo.png'); // TRANS: Title for timeline with lastest notices with a given tag. // TRANS: %s is the tag. $title = sprintf(_("Notices tagged with %s"), $this->tag); $subtitle = sprintf(_('Updates tagged with %1$s on %2$s!'), $this->tag, $sitename); $taguribase = TagURI::base(); $id = "tag:{$taguribase}:TagTimeline:" . $this->tag; $link = common_local_url('tag', array('tag' => $this->tag)); $self = $this->getSelfUri(); switch ($this->format) { case 'xml': $this->showXmlTimeline($this->notices); break; case 'rss': $this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $sitelogo, $self); break; case 'atom': header('Content-Type: application/atom+xml; charset=utf-8'); $atom = new AtomNoticeFeed($this->auth_user); $atom->setId($id); $atom->setTitle($title); $atom->setSubtitle($subtitle); $atom->setLogo($sitelogo); $atom->setUpdated('now'); $atom->addLink($link); $atom->setSelfLink($self); $atom->addEntryFromNotices($this->notices); $this->raw($atom->getString()); break; case 'json': $this->showJsonTimeline($this->notices); break; case 'as': header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE); $doc = new ActivityStreamJSONDocument($this->auth_user); $doc->setTitle($title); $doc->addLink($link, 'alternate', 'text/html'); $doc->addItemsFromNotices($this->notices); $this->raw($doc->asString()); break; default: // TRANS: Client error displayed when coming across a non-supported API method. $this->clientError(_('API method not found.'), $code = 404); break; } }
function Header() { $this->Image(Theme::path('logo.png'), 10, 8, 33); // Arial bold 15 $this->SetFont('Arial', 'B', 15); // Movernos a la derecha $this->Cell(80); // Título $this->Cell(0, 0, 'Apuntes ' . $this->modo, 0, 1, 'R'); $this->Ln(10); $this->SetFont('Arial', 'I', 12); $this->SetTextColor(199, 199, 199); $this->MultiCell(0, 6, 'Este documento es únicamente una recopilación de ideas. En ningún caso sustituye al material proporcionado por el profesor.', 0); $this->Ln(5); }
function _showLogo($action) { $action->elementStart('address', 'vcard'); if (common_config('singleuser', 'enabled')) { $user = User::singleUser(); $url = common_local_url('showstream', array('nickname' => $user->nickname)); } else { $url = common_local_url('public'); } $action->elementStart('a', array('class' => 'url home bookmark', 'href' => $url)); if (common_config('site', 'mobilelogo') || file_exists(Theme::file('logo.png')) || file_exists(Theme::file('mobilelogo.png'))) { $action->element('img', array('class' => 'photo', 'src' => common_config('site', 'mobilelogo') ? common_config('site', 'mobilelogo') : (file_exists(Theme::file('mobilelogo.png')) ? Theme::path('mobilelogo.png') : Theme::path('logo.png')), 'alt' => common_config('site', 'name'))); } $action->element('span', array('class' => 'fn org'), common_config('site', 'name')); $action->elementEnd('a'); $action->elementEnd('address'); }
/** * output a css link * * @param string $src relative path within the theme directory, or an absolute path * @param string $theme 'theme' that contains the stylesheet * @param string media 'media' attribute of the tag * * @return void */ function cssLink($src, $theme = null, $media = null) { if (Event::handle('StartCssLinkElement', array($this, &$src, &$theme, &$media))) { $url = parse_url($src); if (empty($url['scheme']) && empty($url['host']) && empty($url['query']) && empty($url['fragment'])) { if (file_exists(Theme::file($src, $theme))) { $src = Theme::path($src, $theme); } else { $src = common_path($src, GNUsocial::isHTTPS()); } $src .= '?version=' . GNUSOCIAL_VERSION; } $this->element('link', array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => $src, 'media' => $media)); Event::handle('EndCssLinkElement', array($this, $src, $theme, $media)); } }
function showNotice($notice) { $profile = $notice->getProfile(); if (empty($profile)) { common_log(LOG_WARNING, sprintf("Notice %d has no profile", $notice->id)); return; } $this->out->elementStart('li', 'hentry notice'); $this->out->elementStart('div', 'entry-title'); $avatar = $profile->getAvatar(AVATAR_MINI_SIZE); $this->out->elementStart('span', 'vcard author'); $this->out->elementStart('a', array('title' => $profile->fullname ? $profile->fullname : $profile->nickname, 'href' => $profile->profileurl, 'class' => 'url')); $this->out->element('img', array('src' => $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_MINI_SIZE), 'width' => AVATAR_MINI_SIZE, 'height' => AVATAR_MINI_SIZE, 'class' => 'avatar photo', 'alt' => $profile->fullname ? $profile->fullname : $profile->nickname)); $this->out->text(' '); $this->out->element('span', 'fn nickname', $profile->nickname); $this->out->elementEnd('a'); $this->out->elementEnd('span'); $this->out->elementStart('p', 'entry-content'); $this->out->raw($notice->rendered); $notice_link_cfg = common_config('site', 'notice_link'); if ('direct' === $notice_link_cfg) { $this->out->text(' ('); $this->out->element('a', array('href' => $notice->uri), 'see'); $this->out->text(')'); } elseif ('attachment' === $notice_link_cfg) { if ($count = $notice->hasAttachments()) { // link to attachment(s) pages if (1 === $count) { $f2p = File_to_post::staticGet('post_id', $notice->id); $href = common_local_url('attachment', array('attachment' => $f2p->file_id)); $att_class = 'attachment'; } else { $href = common_local_url('attachments', array('notice' => $notice->id)); $att_class = 'attachments'; } $clip = Theme::path('images/icons/clip.png', 'base'); $this->out->elementStart('a', array('class' => $att_class, 'style' => "font-style: italic;", 'href' => $href, 'title' => "# of attachments: {$count}")); $this->out->raw(" ({$count} "); $this->out->element('img', array('style' => 'display: inline', 'align' => 'top', 'width' => 20, 'height' => 20, 'src' => $clip, 'alt' => 'alt')); $this->out->text(')'); $this->out->elementEnd('a'); } else { $this->out->text(' ('); $this->out->element('a', array('href' => $notice->uri), 'see'); $this->out->text(')'); } } $this->out->elementEnd('p'); if (!empty($notice->value)) { $this->out->elementStart('p'); $this->out->text($notice->value); $this->out->elementEnd('p'); } $this->out->elementEnd('div'); $this->out->elementEnd('li'); }
function showContent() { $this->raw('<p style="margin: 20px 80px">'); // @fixme this would be better using standard CSS class, but the present theme's a bit scary. $this->element('img', array('src' => Theme::path('images/icons/icon_processing.gif', 'base'), 'style' => 'display: inline')); // TRANS: OpenID plugin message used while requesting authorization user's OpenID login provider. $this->text(_m('Requesting authorization from your login provider...')); $this->raw('</p>'); $this->raw('<p style="margin-top: 60px; font-style: italic">'); // TRANS: OpenID plugin message. User instruction while requesting authorization user's OpenID login provider. $this->text(_m('If you are not redirected to your login provider in a few seconds, try pushing the button below.')); $this->raw('</p>'); $this->raw($this->form_html); }
/** * Show configured logo. * * @return nothing */ function showLogo() { $this->elementStart('address', array('id' => 'site_contact', 'class' => 'vcard grid_8')); $url = common_local_url('public'); $this->elementStart('a', array('class' => 'url home bookmark', 'href' => $url)); $this->element('img', array('class' => 'logo photo', 'src' => common_config('site', 'logo') ? common_config('site', 'logo') : Theme::path('logo.png'), 'alt' => common_config('site', 'name'))); $this->text(' '); //$this->element ( 'span', array ('class' => 'fn org' ), common_config ( 'site', 'name' ) ); $this->elementEnd('a'); $this->elementEnd('address'); }
/** * Show configured logo. * * @return nothing */ function showLogo() { $this->elementStart('address', array('id' => 'site_contact', 'class' => 'vcard')); if (Event::handle('StartAddressData', array($this))) { if (common_config('singleuser', 'enabled')) { $url = common_local_url('showstream', array('nickname' => common_config('singleuser', 'nickname'))); } else { $url = common_local_url('public'); } $this->elementStart('a', array('class' => 'url home bookmark', 'href' => $url)); if (common_config('site', 'logo') || file_exists(Theme::file('logo.png'))) { $this->element('img', array('class' => 'logo photo', 'src' => common_config('site', 'logo') ? common_config('site', 'logo') : Theme::path('logo.png'), 'alt' => common_config('site', 'name'))); } $this->text(' '); $this->element('span', array('class' => 'fn org'), common_config('site', 'name')); $this->elementEnd('a'); Event::handle('EndAddressData', array($this)); } $this->elementEnd('address'); }
/** * Show the timeline of notices * * @return void */ function showTimeline() { $nonapi_action = substr($this->action, strlen('apitimeline')); // Just so we don't need to set this explicitly $sitelogo = common_config('site', 'logo') ? common_config('site', 'logo') : Theme::path('logo.png'); $title = $this->title(); $taguribase = TagURI::base(); $id = "tag:{$taguribase}:" . ucfirst($nonapi_action) . 'Timeline'; // Public or Networkpublic probably $link = common_local_url($nonapi_action); $self = $this->getSelfUri(); // TRANS: Subtitle for site timeline. %s is the GNU social sitename. $subtitle = sprintf(_("%s updates from everyone!"), common_config('site', 'name')); switch ($this->format) { case 'xml': $this->showXmlTimeline($this->notices); break; case 'rss': $this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $sitelogo, $self); break; case 'atom': header('Content-Type: application/atom+xml; charset=utf-8'); $atom = new AtomNoticeFeed($this->auth_user); $atom->setId($id); $atom->setTitle($title); $atom->setSubtitle($subtitle); $atom->setLogo($sitelogo); $atom->setUpdated('now'); $atom->addLink(common_local_url($nonapi_action)); $atom->setSelfLink($self); $atom->addEntryFromNotices($this->notices); $this->raw($atom->getString()); break; case 'json': $this->showJsonTimeline($this->notices); break; case 'as': header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE); $doc = new ActivityStreamJSONDocument($this->auth_user); $doc->setTitle($title); $doc->addLink($link, 'alternate', 'text/html'); $doc->addItemsFromNotices($this->notices); $this->raw($doc->asString()); break; default: // TRANS: Client error displayed when coming across a non-supported API method. $this->clientError(_('API method not found.'), $code = 404); break; } }
|-------------------------------------------------------------------------- | | The "down" Artisan command gives you the ability to put an application | into maintenance mode. Here, you will define what is displayed back | to the user if maintenance mode is in effect for the application. | */ App::down(function () { return Response::make("Be right back!", 503); }); /* |-------------------------------------------------------------------------- | Require The Filters File |-------------------------------------------------------------------------- | | Next we will load the filters file for the application. This gives us | a nice separate location to store our route and application filter | definitions instead of putting them all in the main routes file. | */ /* |-------------------------------------------------------------------------- | Load theme view path to namespace |-------------------------------------------------------------------------- | | Here you can add view's name space to currently used theme. | */ View::addNamespace('Admin', public_path() . '/' . Theme::path(Config::get('lavalite.admin.theme'))); View::addNamespace('Public', public_path() . '/' . Theme::path(Config::get('lavalite.public.theme'))); require app_path() . '/filters.php';
/** * Show the timeline of notices * * @return void */ function showTimeline() { $sitename = common_config('site', 'name'); $sitelogo = common_config('site', 'logo') ? common_config('site', 'logo') : Theme::path('logo.png'); $title = sprintf(_("Notices tagged with %s"), $this->tag); $subtitle = sprintf(_('Updates tagged with %1$s on %2$s!'), $this->tag, $sitename); $taguribase = TagURI::base(); $id = "tag:{$taguribase}:TagTimeline:" . $tag; $link = common_local_url('tag', array('tag' => $this->tag)); $self = $this->getSelfUri(); common_debug("self link is: {$self}"); switch ($this->format) { case 'xml': $this->showXmlTimeline($this->notices); break; case 'rss': $this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $sitelogo, $self); break; case 'atom': header('Content-Type: application/atom+xml; charset=utf-8'); $atom = new AtomNoticeFeed($this->auth_user); $atom->setId($id); $atom->setTitle($title); $atom->setSubtitle($subtitle); $atom->setLogo($logo); $atom->setUpdated('now'); $atom->addLink($link); $atom->setSelfLink($self); $atom->addEntryFromNotices($this->notices); $this->raw($atom->getString()); break; case 'json': $this->showJsonTimeline($this->notices); break; default: $this->clientError(_('API method not found.'), $code = 404); break; } }
/** * Show configured logo. * * @return nothing */ function showLogo() { $this->elementStart('address', array('id' => 'site_contact', 'class' => 'vcard')); if (Event::handle('StartAddressData', array($this))) { if (common_config('singleuser', 'enabled')) { $user = User::singleUser(); $url = common_local_url('showstream', array('nickname' => $user->nickname)); } else { $url = common_local_url('public'); } $this->elementStart('a', array('class' => 'url home bookmark', 'href' => $url)); if (StatusNet::isHTTPS()) { $logoUrl = common_config('site', 'ssllogo'); if (empty($logoUrl)) { // if logo is an uploaded file, try to fall back to HTTPS file URL $httpUrl = common_config('site', 'logo'); if (!empty($httpUrl)) { $f = File::staticGet('url', $httpUrl); if (!empty($f) && !empty($f->filename)) { // this will handle the HTTPS case $logoUrl = File::url($f->filename); } } } } else { $logoUrl = common_config('site', 'logo'); } if (empty($logoUrl) && file_exists(Theme::file('logo.png'))) { // This should handle the HTTPS case internally $logoUrl = Theme::path('logo.png'); } if (!empty($logoUrl)) { $this->element('img', array('class' => 'logo photo', 'src' => $logoUrl, 'alt' => common_config('site', 'name'))); } $this->text(' '); $this->element('span', array('class' => 'fn org'), common_config('site', 'name')); $this->elementEnd('a'); Event::handle('EndAddressData', array($this)); } $this->elementEnd('address'); }
/** * Show the timeline of notices * * @return void */ function showTimeline() { $sitename = common_config('site', 'name'); $sitelogo = common_config('site', 'logo') ? common_config('site', 'logo') : Theme::path('logo.png'); $title = sprintf(_("%s public timeline"), $sitename); $taguribase = TagURI::base(); $id = "tag:{$taguribase}:PublicTimeline"; $link = common_local_url('public'); $self = $this->getSelfUri(); $subtitle = sprintf(_("%s updates from everyone!"), $sitename); switch ($this->format) { case 'xml': $this->showXmlTimeline($this->notices); break; case 'rss': $this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $sitelogo, $self); break; case 'atom': header('Content-Type: application/atom+xml; charset=utf-8'); $atom = new AtomNoticeFeed($this->auth_user); $atom->setId($id); $atom->setTitle($title); $atom->setSubtitle($subtitle); $atom->setLogo($sitelogo); $atom->setUpdated('now'); $atom->addLink(common_local_url('public')); $atom->setSelfLink($self); $atom->addEntryFromNotices($this->notices); $this->raw($atom->getString()); break; case 'json': $this->showJsonTimeline($this->notices); break; default: $this->clientError(_('API method not found.'), $code = 404); break; } }
function _showLogo($action) { $action->elementStart('address', 'vcard'); $action->elementStart('a', array('class' => 'url home bookmark', 'href' => common_local_url('public'))); if (common_config('site', 'mobilelogo') || file_exists(Theme::file('logo.png')) || file_exists(Theme::file('mobilelogo.png'))) { $action->element('img', array('class' => 'photo', 'src' => common_config('site', 'mobilelogo') ? common_config('site', 'mobilelogo') : (file_exists(Theme::file('mobilelogo.png')) ? Theme::path('mobilelogo.png') : Theme::path('logo.png')), 'alt' => common_config('site', 'name'))); } $action->element('span', array('class' => 'fn org'), common_config('site', 'name')); $action->elementEnd('a'); $action->elementEnd('address'); }
/** * Show the timeline of notices * * @return void */ function showTimeline() { $sitename = common_config('site', 'name'); $sitelogo = common_config('site', 'logo') ? common_config('site', 'logo') : Theme::path('logo.png'); // TRANS: Title for site timeline. %s is the StatusNet sitename. $title = sprintf(_("%s public and external timeline"), $sitename); $taguribase = TagURI::base(); $id = "tag:{$taguribase}:PublicAndExternalTimeline"; $link = common_local_url('public'); $self = $this->getSelfUri(); // TRANS: Subtitle for site timeline. %s is the StatusNet sitename. $subtitle = sprintf(_("%s updates from the whole known network!"), $sitename); switch ($this->format) { case 'xml': $this->showXmlTimeline($this->notices); break; case 'rss': $this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $sitelogo, $self); break; case 'atom': header('Content-Type: application/atom+xml; charset=utf-8'); $atom = new AtomNoticeFeed($this->auth_user); $atom->setId($id); $atom->setTitle($title); $atom->setSubtitle($subtitle); $atom->setLogo($sitelogo); $atom->setUpdated('now'); $atom->addLink(common_local_url('public')); $atom->setSelfLink($self); $atom->addEntryFromNotices($this->notices); $this->raw($atom->getString()); break; case 'json': $this->showJsonTimeline($this->notices); break; case 'as': header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE); $doc = new ActivityStreamJSONDocument($this->auth_user); $doc->setTitle($title); $doc->addLink($link, 'alternate', 'text/html'); $doc->addItemsFromNotices($this->notices); $this->raw($doc->asString()); break; default: // TRANS: Client error displayed when coming across a non-supported API method. $this->clientError(_('API method not found.'), $code = 404); break; } }
function defaultLogo($size) { static $sizenames = array(AVATAR_PROFILE_SIZE => 'profile', AVATAR_STREAM_SIZE => 'stream', AVATAR_MINI_SIZE => 'mini'); return Theme::path('default-avatar-' . $sizenames[$size] . '.png'); }
/** * Inherit from an ancestor theme. * * @param string $name Name of ancestor theme * @return bool TRUE on success, FALSE on unavailable/invalid ancestor theme */ public static function based_on($name) { global $production_status; $theme = Theme::factory($name); if (!$theme) { set_pref('theme_name', 'hive'); if ($production_status === 'debug') { echo gTxt('cannot_instantiate_theme', array('{name}' => $name, '{class}' => "{$name}_theme", '{path}' => Theme::path($name))); } return false; } return true; }