Пример #1
0
/**
 * Get Page Excerpt
 *
 * @since 2.0
 * @uses $content
 * @uses exec_filter
 * @uses strip_decode
 *
 * @param string $n Optional, default is 200.
 * @param bool $striphtml Optional, default false, true will strip html from $content
 * @param string $ellipsis Optional, Default '...', specify an ellipsis
 * @return string Echos.
 */
function get_page_excerpt($len = 200, $striphtml = true, $ellipsis = '...')
{
    global $content;
    if ($len < 1) {
        return '';
    }
    $content_e = strip_decode($content);
    $content_e = exec_filter('content', $content_e);
    echo getExcerpt($content_e, $len, $striphtml, $ellipsis);
}
Пример #2
0
 public function showBooks()
 {
     $books = Book::all();
     function getExcerpt($str, $startPos = 0, $maxLength = 100)
     {
         if (strlen($str) > $maxLength) {
             $excerpt = substr($str, $startPos, $maxLength - 3);
             $lastSpace = strrpos($excerpt, ' ');
             $excerpt = substr($excerpt, 0, $lastSpace);
             $excerpt .= ' ...';
         } else {
             $excerpt = $str;
         }
         return $excerpt;
     }
     foreach ($books as $book) {
         $book->description = getExcerpt($book->description, 0, 1000);
     }
     return View('books', compact('books'));
 }
Пример #3
0
     <img src="<?php 
        echo $r['gambar'];
        ?>
" alt="">
    </span>
    <div class="right">
    	<a href="?p=newsdetail&id=<?php 
        echo $r['id'];
        ?>
"><?php 
        echo $r['judul'];
        ?>
</a>
        <span class="summary">
        	<?php 
        echo getExcerpt(html_entities_decode($r['content']), 50);
        ?>
 
        </span>
        <small><?php 
        echo showDateTime($r['createdate']);
        ?>
</small>
    </div> 
    <div class="clr"></div>
</div>
<?php 
    }
}
?>
Пример #4
0
/**
 * Get Page Meta Description
 *
 * @since 2.0
 * @uses $metad
 * @uses strip_decode
 *
 * @param bool $echo Optional, default is true. False will 'return' value
 * @return string Echos or returns based on param $echo
 */
function get_page_meta_desc($echo = true)
{
    $metad = getPageGlobal('metad');
    $desc = '';
    if ($metad != '') {
        $desc = encode_quotes(strip_decode($metad));
    } else {
        if (getDef('GSAUTOMETAD', true)) {
            // use content excerpt, NOT filtered
            $desc = strip_decode($content);
            if (getDef('GSCONTENTSTRIP', true)) {
                $desc = strip_content($desc);
            }
            $desc = cleanHtml($desc, array('style', 'script'));
            // remove unwanted elements that strip_tags fails to remove
            $desc = getExcerpt($desc, 160);
            // grab 160 chars
            $desc = strip_whitespace($desc);
            // remove newlines, tab chars
            $desc = encode_quotes($desc);
            $desc = trim($desc);
        }
    }
    $str = exec_filter('metad', $desc);
    // @filter metad (str) meta description in get_page_meta_desc
    return echoReturn($str, $echo);
}
Пример #5
0
        echo base_url('profile/' . $row['id_user']);
        ?>
"><?php 
        echo $this->Profile_Model->getName($row['id_user']);
        ?>
</a> | <a href="<?php 
        echo base_url('posts/category/' . $row['category_permalink']);
        ?>
"><?php 
        echo $row['category'];
        ?>
</a></span>
		</div>
		<div class="blog-item-post-desc">
			<p><?php 
        echo getExcerpt($row['content'], $siteOptions['numwords']);
        ?>
</p>
		</div>
		<div class="blog-more-desc">
			<div class="row">
				<div class="col-sm-7 col-xs-12">
					<ul class="list-inline social-colored">
						<li class="empty-text">Поделиться:</li>
						<li><a target="_blank" title="Share on Facebook" href="http://www.facebook.com/sharer/sharer.php?s=100&amp;p[url]=<?php 
        echo urlencode(base_url("posts/view/" . $row['permalink']));
        ?>
" rel="nofollow" onclick="popUp = window.open('http://www.facebook.com/sharer/sharer.php?s=100&amp;p[url]=<?php 
        echo urlencode(base_url("posts/view/" . $row['permalink']));
        ?>
', 'popupwindow', 'scrollbars=yes,width=800,height=400'); popUp.focus(); return FALSE"><i class="fa fa-facebook-square icon-fb"></i></a></li>
Пример #6
0
/**
 * truncate a string, multibyte safe
 *
 * @since 3.4
 * @param  str $str      string to truncate
 * @param  int $numchars number of characters to return
 * @return str           truncated string
 */
function truncate($str, $numchars)
{
    return getExcerpt($str, $numchars, false, '', true, false);
}
Пример #7
0
/**
 * Get Page Header HTML
 *
 * This will return header html for a particular page. This will include the 
 * meta desriptions & keywords, canonical and title tags
 *
 * @since 1.0
 * @uses exec_action
 * @uses get_page_url
 * @uses strip_quotes
 * @uses get_page_meta_desc
 * @uses get_page_meta_keywords
 * @uses $metad
 * @uses $title
 * @uses $content
 * @uses $site_full_name from configuration.php
 * @uses GSADMININCPATH
 *
 * @return string HTML for template header
 */
function get_header($full = true)
{
    global $metad;
    global $title;
    global $content;
    include GSADMININCPATH . 'configuration.php';
    // meta description
    if ($metad != '') {
        $desc = get_page_meta_desc(FALSE);
    } else {
        if (getDef('GSAUTOMETAD', true)) {
            // use content excerpt, NOT filtered
            $desc = strip_decode($content);
            if (getDef('GSCONTENTSTRIP', true)) {
                $desc = strip_content($desc);
            }
            $desc = cleanHtml($desc, array('style', 'script'));
            // remove unwanted elements that strip_tags fails to remove
            $desc = getExcerpt($desc, 160);
            // grab 160 chars
            $desc = strip_whitespace($desc);
            // remove newlines, tab chars
            $desc = encode_quotes($desc);
            $desc = trim($desc);
        }
    }
    if (!empty($desc)) {
        echo '<meta name="description" content="' . $desc . '" />' . "\n";
    }
    // meta keywords
    $keywords = get_page_meta_keywords(FALSE);
    if ($keywords != '') {
        echo '<meta name="keywords" content="' . $keywords . '" />' . "\n";
    }
    if ($full) {
        echo '<link rel="canonical" href="' . get_page_url(true) . '" />' . "\n";
    }
    // script queue
    get_scripts_frontend();
    exec_action('theme-header');
}
Пример #8
0
        <header class="news-item__header">
            <?php 
if ($options['excerpt']) {
    echo '<h1><a href="' . $page->url . '">' . $page->title . '</a></h1>';
} else {
    echo '<h1>' . $page->get('headline|title') . '</h1>';
}
?>
            <time datetime="<?php 
echo date(DATE_ATOM, $page->getUnformatted('date'));
?>
"><?php 
echo $page->date;
?>
</time>
        </header>
        <div class="news-item__text">
            <?php 
if ($options['excerpt']) {
    echo getExcerpt(strip_tags($page->body));
} else {
    echo $page->body;
}
?>
        </div>
    </article>

<?php 
if (!$options['partial']) {
    include './_foot.php';
}
           <?php 
    $args = array('user_id' => $cur_user->ID, 'number' => 6);
    $comments = get_comments($args);
    echo "<ul>";
    if ($comments == 0) {
        echo "";
    } else {
        foreach ($comments as $comment) {
            ?>
              <li>
                <div class="comment">
                  <?php 
            $postID = $comment->comment_post_ID;
            $postURL = get_post_permalink($postID);
            if (function_exists('getExcerpt')) {
                echo "<a href=" . $postURL . ">" . getExcerpt($comment->comment_content) . "</a>";
            }
            ?>
                </div>
                <div class="date">
                    <?php 
            echo comment_date('d M Y', $comment->comment_ID);
            ?>
                </div>
              	<!-- echo($comment->comment_author . '<br />' . ); -->
              </li>

            <?php 
        }
    }
    echo "</ul>";