本文整理汇总了PHP中Registry::prop方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::prop方法的具体用法?PHP Registry::prop怎么用?PHP Registry::prop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Registry
的用法示例。
在下文中一共展示了Registry::prop方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: article_category_id
function article_category_id()
{
if ($category = Registry::prop('article', 'category')) {
$categories = Registry::get('all_categories');
return $categories[$category]->id;
}
}
示例2: page_custom_field
function page_custom_field($key, $default = '')
{
$id = Registry::prop('page', 'id');
if ($extend = Extend::field('page', $key, $id)) {
return Extend::value($extend, $default);
}
return $default;
}
示例3: my_get_description
function my_get_description($len = 500)
{
if (!Registry::get('article')) {
$description = site_description();
} else {
$description = trim(Registry::prop('article', 'description'));
if (empty($description)) {
$description = parse(Registry::prop('article', 'html'));
}
$description = trim(preg_replace('#<[^>]+>#', ' ', $description));
}
if (strlen($description) > $len) {
$description = substr($description, 0, $len - 3) . '...';
}
return preg_replace('/[\\n\\r\\t]+/', ' ', preg_replace('/\\s+/', ' ', $description));
}
示例4: active
public function active()
{
if (Registry::prop('page', 'slug') == $this->slug || Registry::prop('page', 'parent') == $this->id) {
return true;
}
}
示例5: article_adjacent_url
/**
* Get the url to an adjacent article
* @param string prev || previous || next
* @return string
*/
function article_adjacent_url($side = 'next')
{
$comparison = '>';
$order = 'asc';
if (strtolower($side) == 'prev' || strtolower($side) == 'previous') {
$comparison = '<';
$order = 'desc';
}
$page = Registry::get('posts_page');
$query = Post::where('created', $comparison, Registry::prop('article', 'created'))->where('status', '!=', 'draft');
if ($query->count()) {
$article = $query->sort('created', $order)->fetch();
$page = Registry::get('posts_page');
return base_url($page->slug . '/' . $article->slug);
}
}
示例6: comments_open
function comments_open()
{
return Registry::prop('article', 'comments') ? true : false;
}
示例7: is_postspage
function is_postspage()
{
return Registry::prop('page', 'id') == Config::meta('posts_page');
}
示例8: menu_parent
function menu_parent()
{
return Registry::prop('menu_item', 'parent');
}
示例9: search_item_slug
function search_item_slug()
{
return Registry::prop('search_item', 'slug');
}
示例10: article_author_bio
function article_author_bio()
{
return Registry::prop('article', 'author_bio');
}
示例11: category_description
function category_description()
{
return Registry::prop('category', 'description');
}
示例12: menu_parent
function menu_parent($menu_item = null)
{
if (is_array($menu_item)) {
return $menu_item['parent'];
}
return $menu_item ? $menu_item->parent : Registry::prop('menu_item', 'parent');
}