本文整理汇总了PHP中Config::meta方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::meta方法的具体用法?PHP Config::meta怎么用?PHP Config::meta使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config::meta方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($template, $vars = array())
{
// base path
$base = PATH . 'themes' . DS . Config::meta('theme') . DS;
// custom article and page templates
if ($template == 'page' or $template == 'article') {
if ($item = Registry::get($template)) {
if (is_readable($base . $template . '-' . $item->slug . EXT)) {
$template .= '-' . $item->slug;
} elseif (is_readable($base . $template . 's/' . $template . '-' . $item->slug . EXT)) {
$template .= 's/' . $template . '-' . $item->slug;
} elseif (is_readable($base . $item->pagetype . EXT)) {
$template = $item->pagetype;
if (is_readable($base . $item->pagetype . '-' . $item->slug . EXT)) {
$template .= '-' . $item->slug;
}
}
}
}
if ($template == 'posts') {
if ($item = Registry::get('post_category')) {
if (is_readable($base . 'category-' . $item->slug . EXT)) {
$template = 'category';
$template .= '-' . $item->slug;
}
}
}
$this->path = $base . $template . EXT;
$this->vars = array_merge($this->vars, $vars);
}
示例2: format
public static function format($date, $format = null)
{
// set the meta format
if (is_null($format)) {
$format = Config::meta('date_format', 'jS F, Y');
}
$date = new DateTime($date, new DateTimeZone('GMT'));
$date->setTimezone(new DateTimeZone(Config::app('timezone')));
return $date->format($format);
}
示例3: page_description
function page_description($default = '')
{
if ($title = Registry::prop('article', 'description')) {
return $title;
}
if ($title = Config::meta('description')) {
return $title;
}
return $default;
}
示例4: version
public static function version()
{
// first time
if (!($last = Config::meta('last_update_check'))) {
$last = static::setup();
}
// was update in the last 30 days
if (strtotime($last) < time() - 60 * 60 * 24 * 30) {
static::renew();
}
}
示例5: migrations
public static function migrations()
{
$current = Config::meta('current_migration');
$migrate_to = Config::migrations('current');
$migrations = new Migrations($current);
$table = Base::table('meta');
if (is_null($current)) {
$number = $migrations->up($migrate_to);
Query::table($table)->insert(array('key' => 'current_migration', 'value' => $number));
} else {
if ($current < $migrate_to) {
$number = $migrations->up($migrate_to);
Query::table($table)->where('key', '=', 'current_migration')->update(array('value' => $number));
}
}
}
示例6: search_next
function search_next($text = 'Next', $default = '')
{
$per_page = Config::meta('posts_per_page');
$page = Registry::get('page_offset');
$offset = ($page - 1) * $per_page;
$total = Registry::get('total_posts');
$pages = floor($total / $per_page);
$search_page = Registry::get('page');
$next = $page + 1;
$term = Registry::get('search_term');
Session::put(slug($term), $term);
$url = base_url($search_page->slug . '/' . $term . '/' . $next);
if ($page - 1 < $pages) {
return '<a href="' . $url . '">' . $text . '</a>';
}
return $default;
}
示例7: search_prev
function search_prev($text = 'Previous', $default = '')
{
$per_page = Config::meta('posts_per_page');
$page = Registry::get('page_offset');
$offset = ($page - 1) * $per_page;
$total = Registry::get('total_posts');
$pages = ceil($total / $per_page);
$search_page = Registry::get('page');
$prev = $page - 1;
$term = Registry::get('search_term');
Session::put(slug($term), $term);
$url = base_url($search_page->slug . '/' . $term . '/' . $prev);
if ($offset > 0) {
return '<a href="' . $url . '">' . $text . '</a>';
}
return $default;
}
示例8: parse
function parse($str, $markdown = true)
{
// process tags
$pattern = '/[\\{\\{]{1}([a-z]+)[\\}\\}]{1}/i';
if (preg_match_all($pattern, $str, $matches)) {
list($search, $replace) = $matches;
foreach ($replace as $index => $key) {
$replace[$index] = Config::meta($key);
}
$str = str_replace($search, $replace, $str);
}
$str = html_entity_decode($str, ENT_NOQUOTES, System\Config::app('encoding'));
// Parse Markdown as well?
if ($markdown === true) {
$md = new Parsedown();
$str = $md->text($str);
}
return $str;
}
示例9: perPage
public static function perPage()
{
return Config::meta('show_all_posts') ? self::count() + 1 : Config::meta('posts_per_page');
}
示例10: posts_per_page
function posts_per_page()
{
return min(Registry::get('total_posts'), Config::meta('posts_per_page'));
}
示例11: foreach
</hgroup>
<hgroup class="wrap"><h1>Français</h1></hgroup>
<ul class="main list">
<?php
$introParts = ['custom_address1', 'custom_address2', 'custom_mail', 'custom_telnumber'];
foreach ($introParts as $part) {
echo "<li>" . "<a href='" . Uri::to('admin/accueil/editInfo/' . $part) . "'>" . "<strong>" . strip_tags(Config::meta($part)) . "</strong>" . "</a>" . "</li>";
}
?>
</ul>
<hgroup class="wrap"><h1>Anglais</h1></hgroup>
<ul class="main list">
<?php
$introParts = ['custom_address1_en', 'custom_address2_en', 'custom_mail_en', 'custom_telnumber_en'];
foreach ($introParts as $part) {
echo "<li>" . "<a href='" . Uri::to('admin/accueil/editInfo/' . $part) . "'>" . "<strong>" . strip_tags(Config::meta($part)) . "</strong>" . "</a>" . "</li>";
}
?>
</ul>
</section>
<section class="wrap">
<hgroup class="wrap">
<h1>Votre biographie</h1>
<nav>
<!-- --><?php
//echo Html::link('admin/accueil/addBio', __('accueil.create_bio'), array('class' => 'btn'));
?>
</nav>
</hgroup>
<hgroup class="wrap"><h1>Français</h1></hgroup>
示例12: posts
public static function posts()
{
return static::find(Config::meta('posts_page'));
}
示例13: site_meta
function site_meta($key, $default = '')
{
return Config::meta('custom_' . $key, $default);
}
示例14: is_postspage
function is_postspage()
{
return Registry::prop('page', 'id') == Config::meta('posts_page');
}
示例15: my_full_theme_url
function my_full_theme_url($file = '')
{
$theme_folder = Config::meta('theme');
$base = 'themes' . '/' . $theme_folder . '/';
return full_url($base . ltrim($file, '/'));
}