本文整理汇总了PHP中kirbytext函数的典型用法代码示例。如果您正苦于以下问题:PHP kirbytext函数的具体用法?PHP kirbytext怎么用?PHP kirbytext使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了kirbytext函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: charcountnospaces
function charcountnospaces($content)
{
$words = kirbytext($content);
$words = strip_tags($words);
$words = trim($words);
$words = ereg_replace('[[:space:]]+', '', $words);
$charcount = strlen($words);
return $charcount;
}
示例2: readingtime
function readingtime($content, $params = array())
{
$defaults = array('minute' => 'minute', 'minutes' => 'minutes', 'second' => 'second', 'seconds' => 'seconds', 'format' => '{minutesCount} {minutesLabel}, {secondsCount} {secondsLabel}');
$options = array_merge($defaults, $params);
//$words = str_word_count(strip_tags($content));
$words = kirbytext($content);
$words = str_word_count(strip_tags($words));
$minutesCount = floor($words / 200);
$secondsCount = floor($words % 200 / (200 / 60));
$minutesLabel = $minutesCount == 1 ? $options['minute'] : $options['minutes'];
$secondsLabel = $secondsCount == 1 ? $options['second'] : $options['seconds'];
$replace = array('minutesCount' => $minutesCount, 'minutesLabel' => $minutesLabel, 'secondsCount' => $secondsCount, 'secondsLabel' => $secondsLabel);
$result = $options['format'];
foreach ($replace as $key => $value) {
$result = str_replace('{' . $key . '}', $value, $result);
}
return $result;
}
示例3: convert
public static function convert($text)
{
$n = 1;
$notes = array();
if (preg_match_all(self::$patternFootnote, $text, $matches)) {
foreach ($matches[0] as $fn) {
$notes[$n] = preg_replace(self::$patternContent, '\\1', $fn);
if (substr($notes[$n], 1, 4) == '<no>') {
$substitute = '';
} else {
$substitute = '<sup class="footnote">';
$substitute .= '<a href="#fn-' . $n . '" id="fnref-' . $n . '">' . $n . '</a>';
$substitute .= '</sup>';
}
$text = str_replace($fn, $substitute, $text);
$notes[$n] = kirbytext($notes[$n]);
$notes[$n] = str_replace('<p>', '', $notes[$n]);
$notes[$n] = str_replace('</p>', '', $notes[$n]);
$n++;
}
// build footnotes references
$text .= "<div class='footnotes' id='footnotes'>";
$text .= "<div class='footnotedivider'></div>";
$text .= "<ol>";
for ($i = 1; $i < $n; $i++) {
$text .= "<li id='fn-" . $i . "'>";
if (substr($notes[$i], 0, 4) == '<no>') {
$notes[$i] = str_replace('<no>', "", $notes[$i]);
$text .= $notes[$i] . "</li>";
} else {
$text .= $notes[$i] . " <span class='footnotereverse'><a href='#fnref-" . $i . "'>↩</a></span></li>";
}
}
$text .= "</ol>";
$text .= "</div>";
if (c::get('footnotes.smoothscroll', false)) {
$text .= self::script();
}
return $text;
}
return $text;
}
示例4: blockFigure
public static function blockFigure($content, $caption = false, $caption_top = false, $caption_class = false)
{
if ($caption === false) {
return $content;
}
if (is_string($caption)) {
$caption = kirbytext($caption);
$figcaption = \Html::tag("figcaption", $caption);
} else {
$figcaption = "";
}
if ($caption_top !== false) {
$content = $figcaption . $content;
} else {
$content = $content . $figcaption;
}
$attr = array();
if ($caption_class !== false && !empty($caption_class)) {
$attr['class'] = $caption_class . ($caption_top !== false ? " figcaption-top" : " figcaption-bottom");
} else {
$attr['class'] = $caption_top !== false ? "figcaption-top" : "figcaption-bottom";
}
return \Html::tag("figure", $content, $attr);
}
示例5: kirbytext
?>
"><?php
echo kirbytext($article->text());
?>
</a></td>
<td><a href="<?php
echo $article->url();
?>
"><?php
echo kirbytext($article->type());
?>
</a></td>
<td class="margin-row"><a href="<?php
echo $article->url();
?>
"><?php
echo kirbytext($article->year());
?>
</a></td>
</tr>
<?php
}
?>
</table>
</main>
<?php
snippet('footer');
示例6: snippet
<?php
snippet('header');
snippet('menu');
?>
<section id="main">
<div class="container">
<div class="seven columns intro">
<?php
echo kirbytext($page->intro());
?>
</div>
<div class="five columns currently">
<?php
echo kirbytext($page->currently());
?>
</div>
</div>
</section>
<?php
snippet('footer');
示例7: clean
private function clean($fn)
{
$fn = preg_replace($this->regexContent, '\\1', $fn);
return str_replace(array('<p>', '</p>'), '', kirbytext($fn));
}
示例8: kirbytext
<div class="row large-space-top">
<footer class="small-12 small-centered medium-12 columns">
<?php
echo kirbytext($site->copyright());
?>
</footer>
</div>
<?php
echo js('assets/js/vendor/jquery.js');
echo js('assets/js/foundation/foundation.min.js');
echo js('assets/js/foundation/foundation.interchange.js');
echo js('assets/js/foundation/foundation.topbar.js');
echo js('assets/js/vendor/kudos.js');
?>
<script>
$(function() {
$(document).foundation();
var kudos = $.ajax({url: "?kudos",async: false});
var parts = window.location.pathname.split('/');
uid = parts[parts.length-1] + parts[parts.length-2];
$(".num").html(kudos.responseText);
$("figure.kudoable").kudoable();
if(localStorage.getItem(uid) == 'true') {
$("figure.kudoable").addClass("complete");
}
示例9: foreach
<ul class="docs-index-list list-4">
<?php
foreach ($page->children()->visible() as $item) {
?>
<!--
--><li>
<div class="text">
<h2 class="delta docs-icon"><a href="<?php
echo $item->url();
?>
"><?php
echo html($item->title());
?>
</a></h2>
<?php
echo kirbytext($item->description());
?>
</div>
<a class="btn" href="<?php
echo $item->url();
?>
">Learn more</a>
</li><!--
--><?php
}
?>
</ul>
<?php
}
?>
示例10: kirbytextRaw
function kirbytextRaw($content)
{
$text = kirbytext($content);
return preg_replace('/(.*)<\\/p>/', '$1', preg_replace('/<p>(.*)/', '$1', $text));
}
示例11: foreach
?>
<div class="cheatsheet-grid">
<?php
foreach ($child->children() as $doc) {
?>
<div class="cheatsheet-grid-item">
<a href="<?php
echo $doc->url();
?>
">
<h3 class="gamma"><?php
echo html($doc->title());
?>
</h3>
<?php
echo kirbytext($doc->excerpt());
?>
</a>
</div>
<?php
}
?>
</div>
</section>
<?php
}
?>
</main>
示例12: function
* Converts html entities and specialchars in the field
* value to valid xml entities
* @param Field $field The calling Kirby Field instance
* @return Field
*/
field::$methods['xml'] = field::$methods['x'] = function ($field) {
$field->value = xml($field->value);
return $field;
};
/**
* Parses the field value as kirbytext
* @param Field $field The calling Kirby Field instance
* @return Field
*/
field::$methods['kirbytext'] = field::$methods['kt'] = function ($field) {
$field->value = kirbytext($field);
return $field;
};
/**
* Parses the field value as markdown
* @param Field $field The calling Kirby Field instance
* @return Field
*/
field::$methods['markdown'] = field::$methods['md'] = function ($field) {
$field->value = markdown($field->value);
return $field;
};
/**
* Converts the field value to lower case
* @param Field $field The calling Kirby Field instance
* @return Field
示例13: foreach
<h2><?php
echo $pages->about->title();
?>
</h2>
<div class="content">
<?php
foreach ($pages->about->images()->limit(1) as $key => $image) {
?>
<div class="bio-image" style="background-image:url(<?php
echo $image->url();
?>
);">
</div>
<?php
}
?>
<div class="bio-text">
<?php
echo kirbytext($pages->about->about());
?>
</div>
</div>
示例14: snippet
<?php
snippet('header');
?>
<main class="main grid" role="main">
<h1 class="alpha"><?php
echo html($page->title());
?>
</h1>
<section class="col-3-6 text">
<h2 class="beta">Responsibility</h2>
<?php
echo kirbytext($page->contact());
?>
</section>
<section class="col-3-6 last text">
<h2 class="beta">Disclaimer</h2>
<?php
echo kirbytext($page->disclaimer());
?>
</section>
</main>
<?php
snippet('footer');
示例15: kirbytext
<footer class="site-footer" role="contentinfo">
<?php
echo kirbytext($site->info());
?>
</footer>
</body>
</html>