本文整理汇总了PHP中Blorg类的典型用法代码示例。如果您正苦于以下问题:PHP Blorg类的具体用法?PHP Blorg怎么用?PHP Blorg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Blorg类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displaySubHeader
/**
* Displays the title and meta information for a weblog post
*
* @param BlorgPost $post
*/
protected function displaySubHeader(BlorgPost $post)
{
ob_start();
$this->displayAuthor($post);
$author = ob_get_clean();
ob_start();
$this->displayPermalink($post);
$permalink = ob_get_clean();
ob_start();
$this->displayCommentCount($post);
$comment_count = ob_get_clean();
echo '<div class="entry-subtitle">';
/*
* Comment count is shown if and only if comment_count element is shown
* AND the following:
* - comments are locked AND there is one or more visible comment OR
* - comments are open OR
* - comments are moderated.
*/
$show_comment_count = strlen($comment_count) > 0 && ($post->comment_status == SiteCommentStatus::LOCKED && $post->getVisibleCommentCount() > 0 || $post->comment_status == SiteCommentStatus::OPEN || $post->comment_status == SiteCommentStatus::MODERATED);
if (strlen($author) > 0) {
if ($show_comment_count) {
printf(Blorg::_('Posted by %s on %s | %s'), $author, $permalink, $comment_count);
} else {
printf(Blorg::_('Posted by %s on %s'), $author, $permalink);
}
} else {
if ($show_comment_count) {
printf('%s %s', $permalink, $comment_count);
} else {
echo $permalink;
}
}
echo '</div>';
}
示例2: buildHeader
protected function buildHeader(XML_Atom_Feed $feed)
{
BlorgAbstractAtomPage::buildHeader($feed);
$tag_href = $this->getBlorgBaseHref() . 'tag/' . $this->tag->shortname;
$feed->addLink($tag_href, 'alternate', 'text/html');
$feed->setSubTitle(sprintf(Blorg::_('Posts Tagged: %s'), $this->tag->title));
}
示例3: insertTag
/**
* Creates a new tag
*
* @throws SwatException if no database connection is set on this tag
* entry control.
*/
protected function insertTag($title, $index)
{
if ($this->app === null) {
throw new SwatException('An application must be set on the tag entry control during ' . 'the widget init phase.');
}
// check to see if the tag already exists
$instance_id = $this->app->getInstanceId();
$sql = sprintf('select * from
BlorgTag where lower(title) = lower(%s) and instance %s %s', $this->app->db->quote($title, 'text'), SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'));
$tags = SwatDB::query($this->app->db, $sql, SwatDBClassMap::get('BlorgTagWrapper'));
// only insert if no tag already exists (prevents creating two tags on
// reloading)
if (count($tags) > 0) {
$tag = $tags->getFirst();
} else {
$tag = new BlorgTag();
$tag->setDatabase($this->app->db);
$tag->instance = $instance_id;
$tag->title = $title;
$tag->save();
if (isset($this->app->memcache)) {
$this->app->memcache->flushNs('tags');
}
$message = new SwatMessage(sprintf(Blorg::_('The tag “%s” has been added.'), $tag->title));
$this->app->messages->add($message);
}
$this->tag_array[$tag->shortname] = $tag->title;
$this->selected_tag_array[$tag->shortname] = $tag->title;
}
示例4: processActions
public function processActions(SwatTableView $view, SwatActions $actions)
{
$num = count($view->getSelection());
$message = null;
$items = SwatDB::implodeSelection($this->app->db, $view->getSelection(), 'integer');
switch ($actions->selected->id) {
case 'delete':
$this->app->replacePage($this->getComponentName() . '/Delete');
$this->app->getPage()->setItems($view->getSelection());
break;
case 'enable':
$instance_id = $this->app->getInstanceId();
$num = SwatDB::exec($this->app->db, sprintf('update BlorgAuthor set visible = %s
where instance %s %s and id in (%s)', $this->app->db->quote(true, 'boolean'), SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'), $items));
if ($num > 0 && isset($this->app->memcache)) {
$this->app->memcache->flushNs('authors');
}
$message = new SwatMessage(sprintf(Blorg::ngettext('One author has been shown on site.', '%s authors have been shown on site.', $num), SwatString::numberFormat($num)));
break;
case 'disable':
$instance_id = $this->app->getInstanceId();
$num = SwatDB::exec($this->app->db, sprintf('update BlorgAuthor set visible = %s
where instance %s %s and id in (%s)', $this->app->db->quote(false, 'boolean'), SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'), $items));
if ($num > 0 && isset($this->app->memcache)) {
$this->app->memcache->flushNs('authors');
}
$message = new SwatMessage(sprintf(Blorg::ngettext('One author has been hidden on site.', '%s authors have been hidden on site.', $num), SwatString::numberFormat($num)));
break;
}
if ($message !== null) {
$this->app->messages->add($message);
}
}
示例5: buildInternal
protected function buildInternal()
{
parent::buildInternal();
$item_list = $this->getItemList('integer');
$instance_id = $this->app->getInstanceId();
$dep = new AdminListDependency();
$dep->setTitle(Blorg::_('post'), Blorg::_('posts'));
$sql = sprintf('select id, title, bodytext from BlorgPost
where instance %s %s and id in (%s)
order by publish_date desc, title', SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'), $item_list);
$posts = SwatDB::query($this->app->db, $sql, 'BlorgPostWrapper');
$entries = array();
foreach ($posts as $post) {
$entry = new AdminDependencyEntry();
$entry->id = $post->id;
$entry->title = $post->getTitle();
$entry->status_level = AdminDependency::DELETE;
$entry->parent = null;
$entries[] = $entry;
}
$dep->entries = $entries;
$message = $this->ui->getWidget('confirmation_message');
$message->content = $dep->getMessage();
$message->content_type = 'text/xml';
if ($dep->getStatusLevelCount(AdminDependency::DELETE) == 0) {
$this->switchToCancelButton();
}
}
示例6: getInlineJavaScriptTranslations
/**
* Gets translatable string resources for the JavaScript object for
* this widget
*
* @return string translatable JavaScript string resources for this widget.
*/
protected function getInlineJavaScriptTranslations()
{
$attach_text = SwatString::quoteJavaScriptString(Blorg::_('Attach'));
$detach_text = SwatString::quoteJavaScriptString(Blorg::_('Detach'));
$attached_text = SwatString::quoteJavaScriptString(Blorg::_('(attached)'));
$detached_text = SwatString::quoteJavaScriptString(Blorg::_('(not attached)'));
return "BlorgFileAttachControl.attach_text = {$attach_text};\n" . "BlorgFileAttachControl.detach_text = {$detach_text};\n" . "BlorgFileAttachControl.attached_text = {$attached_text};\n" . "BlorgFileAttachControl.detached_text = {$detached_text};\n";
}
示例7: buildTitle
protected function buildTitle()
{
if ($this->hasSearchDataValue('type') && $this->getSearchDataValue('type') === 'article') {
$this->layout->data->title = Blorg::_('Article Search Results');
} else {
parent::buildTitle();
}
}
示例8: buildTitle
protected function buildTitle()
{
$this->layout->data->html_title = Blorg::_('Authors');
$authors = array();
foreach ($this->authors as $author) {
$authors[] = sprintf(Blorg::_('%s - %s'), $author->name, SwatString::ellipsizeRight(SwatString::condense($author->description), 200));
}
$this->layout->data->meta_description = SwatString::minimizeEntities(implode('; ', $authors));
}
示例9: define
protected function define()
{
$this->defineDefaultTitle(Blorg::_('Flickr Photos'));
$this->defineSetting('uri', Blorg::_('JSON Photo Feed'), 'string');
$this->defineSetting('limit', Blorg::_('Limit'), 'integer', 10);
$this->defineSetting('size', Blorg::_('Display Size'), 'string', 'square');
$this->defineDescription(Blorg::_('Displays photos from Flickr'));
$this->addJavaScript('packages/blorg/javascript/blorg-flickr-json-gadget.js', Blorg::PACKAGE_ID);
$this->id = uniqid('flickr');
}
示例10: displayHeader
protected function displayHeader()
{
$header_div = new SwatHtmlTag('div');
$header_div->class = 'site-comment-display-header';
$header_div->open();
$anchor_tag = new SwatHtmlTag('a');
$anchor_tag->href = sprintf('Post/Details?id=%s', $this->comment->post->id);
$anchor_tag->setContent($this->comment->post->getTitle());
printf(Blorg::_('Comment on %s'), $anchor_tag);
$this->displayStatusSpan();
$header_div->close();
}
示例11: processDBData
protected function processDBData()
{
parent::processDBData();
$item_list = $this->getItemList('integer');
$sql = sprintf('delete from BlorgTag where id in (%s)', $item_list);
$num = SwatDB::exec($this->app->db, $sql);
if (isset($this->app->memcache)) {
$this->app->memcache->flushNs('tags');
$this->app->memcache->flushNs('posts');
}
$message = new SwatMessage(sprintf(Blorg::ngettext('One tag has been deleted.', '%s tags have been deleted.', $num), SwatString::numberFormat($num)));
$this->app->messages->add($message);
}
示例12: buildInternal
protected function buildInternal()
{
parent::buildInternal();
$this->buildMessages();
$ds = new SwatDetailsStore($this->tag);
$ds->post_count = $this->tag->getPostCount();
$details_view = $this->ui->getWidget('details_view');
$details_view->data = $ds;
$details_frame = $this->ui->getWidget('details_frame');
$details_frame->title = Blorg::_('Tag');
$details_frame->subtitle = $this->tag->title;
$this->buildToolbar();
}
示例13: define
protected function define()
{
$this->defineDefaultTitle(Blorg::_('Recently Listened'));
$this->defineSetting('username', Blorg::_('User Name'), 'string');
$this->defineSetting('limit', Blorg::_('Limit'), 'integer', 10);
$this->defineSetting('invert', Blorg::_('Invert Loading Image'), 'boolean', false);
$this->defineSetting('date_format', Blorg::_('Date Format (“short” 2:36pm, Jan 5 — or — ' . '“long” 2:36 pm, January 5)'), 'string', 'long');
$this->defineDescription(Blorg::_('Lists recently listened songs for a user on Last.fm.'));
$this->defineAjaxProxyMapping('^last\\.fm/([^/]+)$', 'http://ws.audioscrobbler.com/1.0/user/\\1/recenttracks.xml');
$yui = new SwatYUI(array('dom', 'connection', 'animation'));
$this->html_head_entry_set->addEntrySet($yui->getHtmlHeadEntrySet());
$this->addJavaScript('packages/blorg/javascript/blorg-last-fm-gadget.js', Blorg::PACKAGE_ID);
$this->id = uniqid();
}
示例14: displayContent
protected function displayContent()
{
$comment = $this->data_object;
$div_tag = new SwatHtmlTag('div');
$div_tag->setContent($this->data_object->post->getTitle());
$div_tag->display();
$h2_tag = new SwatHtmlTag('h2');
$h2_tag->setContent($this->data_object->fullname);
$h2_tag->display();
$abbr_tag = new SwatHtmlTag('abbr');
$date = clone $comment->createdate;
$date->convertTZ($this->app->default_time_zone);
$abbr_tag->setContent(sprintf(Blorg::_('Posted: %s'), $date->formatLikeIntl(SwatDate::DF_DATE)));
$abbr_tag->display();
echo SwatString::toXHTML($comment->bodytext);
}
示例15: getTableModel
protected function getTableModel(SwatView $view)
{
$sql = sprintf('select count(id) from BlorgTag where %s', $this->getWhereClause());
$pager = $this->ui->getWidget('pager');
$pager->total_records = SwatDB::queryOne($this->app->db, $sql);
$sql = sprintf('select id, title, shortname
from BlorgTag
where %s
order by %s', $this->getWhereClause(), $this->getOrderByClause($view, 'title'));
$tags = SwatDB::query($this->app->db, $sql, 'BlorgTagWrapper');
if (count($tags) > 0) {
$this->ui->getWidget('results_frame')->visible = true;
$this->ui->getWidget('results_message')->content = $pager->getResultsMessage(Blorg::_('result'), Blorg::_('results'));
}
return $tags;
}