本文整理汇总了PHP中Builder::add_plugin方法的典型用法代码示例。如果您正苦于以下问题:PHP Builder::add_plugin方法的具体用法?PHP Builder::add_plugin怎么用?PHP Builder::add_plugin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Builder
的用法示例。
在下文中一共展示了Builder::add_plugin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: article_edit
public function article_edit($opt = array())
{
Builder::add_plugin('ckeditor');
$articles_model = $this->model('articles_model');
$contents = array();
if (empty($opt)) {
$contents = $articles_model->get_empty();
$contents['article'] = '';
} else {
$contents = $articles_model->get_article(reset($opt), next($opt));
$contents['article'] = '';
$path = APPPATH . "views/articles/{$contents['lang']}/{$contents['type']}/{$contents['id']}.php";
if (file_exists($path)) {
$contents['article'] = file_get_contents($path);
}
}
if (!empty($contents['id'])) {
$contents['image_list'] = array();
$dir = "./modules/images/articles/{$contents['id']}/";
if (!file_exists($dir)) {
mkdir($dir);
}
$include_images = scandir($dir);
foreach ($include_images as $name) {
if (!is_file($dir . $name) or in_array($name, array('.', '..'))) {
continue;
}
$contents['image_list'][] = str_replace('./', config('settings', 'base_url'), $dir . $name);
}
}
$page = array();
$page['content'] = $this->view('article_edit', $contents, TRUE);
$this->view('backend/backend', $page);
}
示例2: read
public function read($opt = NULL)
{
Builder::add_plugin('jQuery-slimScroll');
Builder::add_js('system/wx');
Builder::add_css('pages/frontend-article');
Builder::add_css(array('pages/home-about', 'system/github'));
$article_id = reset($opt);
if (empty($article_id)) {
throw new Exception_wx(4040004, $article_id);
}
$article_meta = $this->model('articles_model')->get($article_id);
$content['id'] = $article_id;
$content['type'] =& $article_meta['type'];
$content['header'] =& $article_meta['header'];
$content['creation'] =& $article_meta['creation'];
Builder::set_title(get_string('url_naming', $article_meta['type']) . ' — ' . $article_meta['header']);
$left['list'] = $this->model('articles_model')->get_articles_by_type($content['type']);
$left['current'] = base_url("articles/read/{$article_id}");
$content['previous'] = NULL;
$content['following'] = NULL;
$index = 0;
foreach ($left['list'] as $key => &$item) {
if ($left['current'] == $item['link']) {
$index = $key;
break;
}
}
if ($index > 0) {
$content['previous'] =& $left['list'][$index - 1]['link'];
}
if ($index < count($left['list']) - 1) {
$content['following'] =& $left['list'][$index + 1]['link'];
}
if (isset($article_meta['description'])) {
Builder::add_meta('description', $article_meta['description']);
}
if (isset($article_meta['keywords'])) {
Builder::add_meta('keywords', $article_meta['keywords']);
}
$page = array();
$page['content'] = $this->view('article_read', $content, TRUE);
$this->view('frontend/frontend', $page);
}