本文整理匯總了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);
}