当前位置: 首页>>代码示例>>PHP>>正文


PHP Blorg类代码示例

本文整理汇总了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>';
 }
开发者ID:nburka,项目名称:blorgy,代码行数:40,代码来源:DtbPostView.php

示例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));
 }
开发者ID:nburka,项目名称:blorg,代码行数:7,代码来源:BlorgTagAtomPage.php

示例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;
    }
开发者ID:GervaisdeM,项目名称:blorg,代码行数:35,代码来源:BlorgTagEntry.php

示例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);
        }
    }
开发者ID:nburka,项目名称:blorg,代码行数:33,代码来源:Index.php

示例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();
        }
    }
开发者ID:nburka,项目名称:blorg,代码行数:28,代码来源:Delete.php

示例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";
 }
开发者ID:GervaisdeM,项目名称:blorg,代码行数:14,代码来源:BlorgFileAttachControl.php

示例7: buildTitle

 protected function buildTitle()
 {
     if ($this->hasSearchDataValue('type') && $this->getSearchDataValue('type') === 'article') {
         $this->layout->data->title = Blorg::_('Article Search Results');
     } else {
         parent::buildTitle();
     }
 }
开发者ID:nburka,项目名称:blorgy,代码行数:8,代码来源:SearchResultsPage.php

示例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));
 }
开发者ID:GervaisdeM,项目名称:blorg,代码行数:9,代码来源:BlorgAuthorIndexPage.php

示例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');
 }
开发者ID:nburka,项目名称:blorg,代码行数:10,代码来源:BlorgFlickrJsonGadget.php

示例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();
 }
开发者ID:nburka,项目名称:blorg,代码行数:12,代码来源:BlorgCommentDisplay.php

示例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);
 }
开发者ID:GervaisdeM,项目名称:blorg,代码行数:13,代码来源:Delete.php

示例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();
 }
开发者ID:nburka,项目名称:blorg,代码行数:13,代码来源:Details.php

示例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();
 }
开发者ID:GervaisdeM,项目名称:blorg,代码行数:14,代码来源:BlorgLastFmGadget.php

示例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);
 }
开发者ID:nburka,项目名称:blorg,代码行数:16,代码来源:CommentApproval.php

示例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;
    }
开发者ID:nburka,项目名称:blorg,代码行数:16,代码来源:Index.php


注:本文中的Blorg类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。