本文整理汇总了PHP中snippet函数的典型用法代码示例。如果您正苦于以下问题:PHP snippet函数的具体用法?PHP snippet怎么用?PHP snippet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了snippet函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showLoginPasswordProtect
function showLoginPasswordProtect($error_msg)
{
?>
<!-- Start template for the login form -->
<!-- Header -->
<?php
snippet('header');
?>
<!-- Login -->
<h2>Authorisation required:</h2>
<!-- Display error message -->
<h3><span style="color:#DB1010"><?php
echo $error_msg;
?>
</span></h3>
<form method="post">
<input type="text" name="access_login" placeholder="Username" /><br /><br />
<input type="password" name="access_password" placeholder="Password" /><br /><br />
<input type="submit" name="Login" value="Login" />
</form>
<!-- End template for the login form -->
<?php
// stop at this point
die;
}
示例2: Parse
public function Parse($topic)
{
if ($_COOKIE['ostrich_mode'] == 1) {
foreach ($User->IgnoreList as $ignored_phrase) {
if (stripos($reply_body, $ignored_phrase) !== false) {
$this->Ignored = true;
$this->ParsedBody = '[This post has matched a phrase on your ignore list and is therefore hidden.]';
return;
}
}
}
$body = parse($this->Body);
// Linkify citations. (This might be updated to use preg_replace_callback in the future.)
preg_match_all('/^@([0-9,]+)/m', $body, $matches);
foreach ($matches[0] as $formatted_id) {
$name = '';
$pure_id = str_replace(array('@', ','), '', $formatted_id);
if (!array_key_exists($pure_id, $topic->Replies)) {
$body = str_replace($formatted_id, '<span class="unimportant">(Citing a deleted or non-existent reply.)</span>', $body);
} else {
if ($topic->Replies[$pure_id]->isHidden()) {
$body = str_replace($formatted_id, '<span class="unimportant help" title="' . snippet($topic->Replies[$pure_id]->Body) . '">@hidden</span>', $body);
} else {
if ($pure_id == $topic->PreviousReply->ID) {
$link_text = '@previous';
} else {
$link_text = $formatted_id;
}
$body = str_replace($formatted_id, '<a href="#reply_' . $pure_id . '" onclick="highlightReply(\'' . $pure_id . '\'); createSnapbackLink(\'' . $reply_id . '\')" class="unimportant help" title="' . snippet($topic->Replies[$pure_id]->Body) . '">' . $link_text . '</a> <span class="unimportant citation">(' . $topic->GetName($this, $pure_id) . ')</span>', $body);
}
}
}
$this->ParsedBody = preg_replace('/^@OP/', '<span class="unimportant">@OP</span>', $body);
}
示例3: output
/**
* Übergbt der 'snippet'-Funktion den Pfad zu einem AtomicDesign-
*
* @author
* @param $level Name der AtomicDesign-Ebene (vereinfacht)
* @param $uid Eindeutiger Name eines existierenden Ebenen-Blocks
* @param $vars Array von Variablen, die im Snippet Verwendung finden
* @param $return Rückgabe des konstruierten Snippet aus AtomicDesign-Ebenen-Blocks
* @return Konstruiertes Snippet aus Atomic-Ebenen-Blocks
*/
public static function output($level, $uid, $vars = array(), $return = false)
{
if (!isset(self::$levelmap[$level])) {
throw new Exception("AtomicDesign-Level not found: " . $level);
}
$template = self::get_snip($uid, false, self::$levelmap[$level]);
return snippet($template, $vars, $return);
// the function 'snippet' is introduced by kirby
}
示例4: handle
/**
* Handle the event
*
* @param League\Event\EventInterface $event
* @return void
*/
public function handle(EventInterface $event, $data = [])
{
$studio = $data['studio'];
$event = $data['event'];
$data['order'] = $event->children()->find('orders')->children()->findBy('uid', $data['orderId']);
$email = new Mailer(['body' => snippet('emails/tickets-studio', $data, true), 'subject' => "[{$studio->title()->html()}] Tickets Purchased"]);
$email->send();
$custEmail = new Mailer(['body' => snippet('emails/tickets-customer', $data, true), 'to' => $data['order']->customerEmail()->toString(), 'subject' => "Your Tickets"]);
$custEmail->send();
}
示例5: xmail
function xmail($to, $subject, $body)
{
$message = snippet(EMAIL_SHELL, array('body' => $body));
$hdrs = array('From' => EMAIL_FROM, 'Subject' => $subject);
$mime = new Mail_mime(array('eol' => $crlf));
$mime->setTXTBody(strip_tags($html));
$mime->setHTMLBody($message);
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
$mail =& Mail::factory('mail');
$mail->send($to, $hdrs, $body);
}
示例6: disqus_comments
/**
* Disqus Plugin
*
* @author Guillem Lorman <guillem@bajoelcocotero.com>
* @version 2.0.0
*/
function disqus_comments($post, $params = array())
{
// set all default values
$defaults = array('disqus_shortname' => c::get('disqus-shortname'), 'disqus_identifier ' => $post->slug(), 'disqus_title ' => $post->title()->title(), 'disqus_url ' => getPostUrl($post), 'snippet' => false);
$options = array_merge($defaults, $params);
if ($options['snippet']) {
$html .= snippet($options['snippet'], $options, true);
} else {
$html .= tpl::load(__DIR__ . DS . 'comments.php', $options);
}
return $html;
}
示例7: body
function body()
{
$body = $this->option('body');
if (empty($body)) {
$body = snippet('contactform.mail', array(), true);
if (empty($body)) {
$body = 'Name: {name}' . PHP_EOL;
$body .= '---------' . PHP_EOL;
$body .= 'Email: {email}' . PHP_EOL;
$body .= '---------' . PHP_EOL;
$body .= 'Text: {text}' . PHP_EOL;
}
}
foreach ($this->data() as $key => $value) {
$body = str_replace('{' . $key . '}', $value, $body);
}
return trim($body);
}
示例8: afterSave
protected function afterSave($args)
{
// A record's search text is public by default, but there are times
// when this is not desired, e.g. when an item is marked as
// private. @todo: Make a check to see if the record is public or private.
if (!$this->approved || $this->is_spam) {
// Setting the search text to private makes it invisible to
// most users.
$this->setSearchTextPrivate();
}
// Set the record's title. This will be used to identify the record
// in the search results.
//comments don't have titles
$this->setSearchTextTitle(snippet($this->body, 0, 40));
// Set the record's search text. Records that implement the
// Mixin_ElementText mixin during _initializeMixins() will
// automatically have all element texts added. Note that you
// can add multiple search texts, which simply appends them.
//$this->addSearchText($recordTitle);
$this->addSearchText($this->body);
}
示例9: entry
public function entry($data)
{
if (isset($data->_fieldset)) {
$fieldsetName = $data->_fieldset;
} else {
return "No fieldset found in entry.";
}
if (isset($this->fieldsets[$fieldsetName])) {
$fieldset = $this->fieldsets[$fieldsetName];
if (isset($fieldset["entry"])) {
$this->entry = $fieldset["entry"];
} else {
$this->entry = null;
}
$this->fields = $fieldset["fields"];
} else {
return 'No fieldset with name "' . $fieldsetName . '" found.';
}
//$data->_fileUrl = $this->page->url() . DS;
//return parent::entry($data);
return snippet('form-builder/' . $fieldsetName, array("fields" => $this->fieldsets[$fieldsetName]['fields'], "data" => $data, "preview" => true));
//return parent::entry($data);
}
示例10: toHTML
public function toHTML()
{
$content = "";
foreach ($this->data[self::ARRAY_IMAGES] as $image) {
$imageExt = new ImageExtImage($this->imageExt, $image);
$imageExt->generate();
$imageExt->optimizeOutput();
$content .= $imageExt->toHTML();
}
if ($this->data[self::ARRAY_ATTR][self::PARA_SNIPPET_GALLERY] !== false && file_exists(kirby()->roots->snippets() . '/' . $this->data[self::ARRAY_ATTR][self::PARA_SNIPPET_GALLERY] . '.php')) {
$attr = array();
if (!empty($this->data[self::ARRAY_ATTR][self::PARA_GALLERY_CLASS])) {
$attr['class'] = $this->data[self::ARRAY_ATTR][self::PARA_GALLERY_CLASS];
}
$attr['images'] = $content;
return (string) snippet($this->data[self::ARRAY_ATTR][self::PARA_SNIPPET_GALLERY], array('data' => $attr), true);
} else {
$attr = array();
if (!empty($this->data[self::ARRAY_ATTR][self::PARA_GALLERY_CLASS])) {
$attr['class'] = $this->data[self::ARRAY_ATTR][self::PARA_GALLERY_CLASS];
}
return \Html::tag("div", $content, $attr);
}
}
示例11: css
echo css('https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css');
echo js('https://code.jquery.com/jquery-2.1.4.min.js');
echo js('assets/js/jquery.fitvids.js');
echo js('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js');
echo js('assets/js/main.js');
echo css('assets/css/main.css');
?>
</head>
<body>
<header class="header" role="banner">
<div class="top"></div>
<div class="container">
<h1><a href="<?php
echo $site->url();
?>
"><span class="titleFirst">De <span class="Ttuut">t</span><span class="skew1">u</span><span class="skew2">u</span><span class="Ttuut">t</span> van</span><span class="titleSecond">tegenwoordig<strong>.</strong>be</span></a></h1>
<div class="social">
<ul>
<li><a href="http://www.twitter.com/detuutbe" target="_blank"><i class="fa fa-twitter"></i></a></li>
<li><a href="https://www.facebook.com/tuutvantegenwoordig" target="_blank"><i class="fa fa-facebook"></i></a></li>
<!--<li><a href="#" class="search"><i class="fa fa-search"></i></a></li>-->
</ul>
</div>
</div>
<?php
snippet('menu');
?>
<div class="uuu"></div>
</header>
示例12: snippet
<?php
if ($coupon->active()->bool()) {
?>
<span class="text-success">Active</span>
<?php
} else {
?>
<span class="text-danger">Inactive</span>
<?php
}
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
} else {
?>
<div class="alert alert-warning">
No coupons
</div>
<?php
}
?>
<?php
snippet('layouts/manage/footer');
示例13: snippet
<h4>Filtertable</h4>
<div class="table-responsive table-responsive-maxheight">
<?php
$tabledata = $firmen;
include snippet("makeTableFromData");
?>
</div>
</div>
</div>
</div> <!-- /container -->
<?php
// JAVASCRIPT
// This includes the needed javascript files
// DO NOT REMOVE
include snippet("meta_javascripts");
?>
<script>
$(function(){
$("#favoriteColorChange").change(function() {
$("#favColor").html($(this).val());
updateSessionVar("set","favoriteColor",$(this).val());
$(this).val("");
$("#reloadInfo").removeClass("hide");
});
})
</script>
</body>
示例14: snippet
<?php
if (!isset($_GET['ajax'])) {
snippet('_header');
}
?>
<section class="cover">
<?php
echo kirbytext($page->text());
?>
</section>
<?php
if (!isset($_GET['ajax'])) {
snippet('_footer');
}
示例15: snippet
<?php
snippet('header');
snippet('project-' . $page->title());