예제 #1
0
파일: _header.php 프로젝트: rsms/gitblog
 <span class="note">‹ visit site</span></a>
			</h1>
		</div>
		<div id="gb-errors" <?php 
echo !gb::$errors ? 'style="display:none"' : '';
?>
>
			<div class="wrapper">
				<a class="close" 
					href="javascript:ui.hideAlert()"
					title="Hide this message"><span>X</span></a>
				<div class="icon"></div>
				<ul>
					<li class="title">
						<?php 
echo count(gb::$errors) === 1 ? 'An error occured' : counted(count(gb::$errors), '', 'errors occured');
?>
					</li>
				<?php 
foreach (gb::$errors as $error) {
    ?>
					<li><?php 
    echo h($error);
    ?>
</li>
				<?php 
}
?>
				</ul>
			</div>
		</div>
예제 #2
0
파일: posts.php 프로젝트: rsms/gitblog
			<?php 
    }
    ?>
			</ol>
		</div>
	</div>
	<div class="breaker"></div>
</div>
<?php 
} elseif (gb::$is_categories && count($categories) > 1 || gb::$is_tags) {
    ?>
<div id="summary" class="breadcrumb">
	<div class="wrapper">
		<p>
			<?php 
    echo counted($postspage->numtotal, 'post', 'posts');
    ?>
		<?php 
    if (gb::$is_categories) {
        ?>
			filed under <span class="highlight"><?php 
        echo sentenceize($categories, 'h');
        ?>
</span>
		<?php 
    } elseif (gb::$is_tags) {
        ?>
			tagged with <span class="highlight"><?php 
        echo sentenceize($tags, 'h');
        ?>
</span>
예제 #3
0
 function importItem(DOMNode $item, $fallbackTZOffset = 0)
 {
     $obj = $this->createItemObject($item);
     if ($obj === null) {
         $this->report('discarded unknown item <code>%s<code>', h($this->doc->saveXML($item)));
         return null;
     }
     if (!$this->includeAttachments && $obj instanceof WPAttachment) {
         return null;
     }
     $is_exposed = !$obj instanceof WPAttachment;
     $obj->mimeType = 'text/html';
     $datelocalstr = null;
     $datelocal = false;
     $dateutc = false;
     foreach ($item->childNodes as $n) {
         if ($n->nodeType !== XML_ELEMENT_NODE) {
             continue;
         }
         # we're doing doing this to avoid a bug in php where accessing this property
         # from strpos or str_replace causes a silent hang.
         $name = '' . $n->nodeName;
         if ($is_exposed && $name === 'title') {
             $obj->title = $n->nodeValue;
         } elseif ($is_exposed && $name === 'content:encoded') {
             $obj->body = $n->nodeValue;
         } elseif ($name === 'excerpt:encoded') {
             # will be derived from body by the content rebuilder, so in case WP
             # adds this in the future, just discard it. (In WP 2.6 this is never
             # present anyway.)
         } elseif ($is_exposed && $name === 'category') {
             if (($domain = $n->attributes->getNamedItem('domain')) !== null) {
                 if ($domain->nodeValue === 'category' && $n->nodeValue !== 'Uncategorized' && $n->attributes->getNamedItem('nicename') !== 'uncategorized' && !in_array($n->nodeValue, $obj->categories)) {
                     $obj->categories[] = $n->nodeValue;
                 } elseif ($domain->nodeValue === 'tag' && !in_array($n->nodeValue, $obj->tags)) {
                     $obj->tags[] = $n->nodeValue;
                 }
             }
         } elseif ($is_exposed && $name === 'wp:comment_status') {
             $obj->commentsOpen = $n->nodeValue === 'open';
         } elseif ($is_exposed && $name === 'wp:ping_status') {
             $obj->pingbackOpen = $n->nodeValue === 'open';
         } elseif ($is_exposed && $name === 'wp:post_name') {
             $obj->slug = $n->nodeValue;
         } elseif ($name === 'wp:post_date_gmt') {
             if ($n->nodeValue !== '0000-00-00 00:00:00') {
                 $dateutc = new GBDateTime($n->nodeValue);
             }
         } elseif ($name === 'wp:post_date') {
             $datelocalstr = $n->nodeValue;
             $datelocal = new GBDateTime($n->nodeValue);
             $obj->wpdate = $datelocal;
         } elseif ($name === 'wp:menu_order' && $obj instanceof WPPage) {
             $obj->order = intval($n->nodeValue);
         } elseif ($is_exposed && $name === 'wp:status') {
             $obj->draft = $n->nodeValue === 'draft';
         } elseif ($name === 'wp:post_id') {
             $obj->wpid = (int) $n->nodeValue;
         } elseif ($name === 'wp:postmeta') {
             if ($is_exposed === false) {
                 # get attachment filename
                 $k = $v = null;
                 foreach ($n->childNodes as $n2) {
                     if ($n2->nodeType !== XML_ELEMENT_NODE) {
                         continue;
                     }
                     if ($n2->nodeName === 'wp:meta_key') {
                         $k = $n2->nodeValue;
                     } elseif ($n2->nodeName === 'wp:meta_value') {
                         if ($k === '_wp_attached_file') {
                             $obj->wpfilename = $n2->nodeValue;
                         } elseif ($k === '_wp_attachment_metadata') {
                             $obj->wpmeta = @unserialize(trim($n2->nodeValue));
                             if ($obj->wpmeta === false) {
                                 $this->wpmeta = array();
                             }
                         }
                     }
                 }
             }
         } elseif ($name === 'wp:post_parent') {
             $obj->wpparent = $n->nodeValue;
         } elseif ($is_exposed === false && $name === 'wp:attachment_url') {
             $obj->wpurl = $n->nodeValue;
         } elseif ($name === 'wp:post_type') {
             # discard
         } elseif ($name === 'dc:creator') {
             $obj->author = new GBAuthor($n->nodeValue, $this->defaultAuthorEmail);
         } elseif ($is_exposed && $name === 'wp:comment') {
             if ($obj->comments === null) {
                 $obj->comments = array();
             }
             $comment = $this->parseComment($n, $wpid);
             $comment->post = $obj;
             $obj->comments[$wpid] = $comment;
         } elseif ($is_exposed && substr($name, 0, 3) === 'wp:' && trim($n->nodeValue)) {
             $obj->meta[str_replace(array(':', '_'), '-', $name)] = $n->nodeValue;
         }
     }
     if ($is_exposed && $obj->comments) {
         $this->report('Imported ' . counted(count($obj->comments), 'comment', 'comments', 'zero', 'one'));
     }
     # date
     $obj->modified = $obj->published = $this->_mkdatetime($datelocal, $dateutc, $datelocalstr, $fallbackTZOffset);
     return $obj;
 }
예제 #4
0
파일: gitblog.php 프로젝트: rsms/gitblog
 function numberOfUnapprovedComments($sone = 'comment', $smany = 'comments', $zero = 'No', $one = 'One')
 {
     return counted($this->comments ? $this->comments->countUnapproved() : 0, $sone, $smany, $zero, $one);
 }