本文整理汇总了PHP中Journal2Utils::staticAsset方法的典型用法代码示例。如果您正苦于以下问题:PHP Journal2Utils::staticAsset方法的具体用法?PHP Journal2Utils::staticAsset怎么用?PHP Journal2Utils::staticAsset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Journal2Utils
的用法示例。
在下文中一共展示了Journal2Utils::staticAsset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printScript
private function printScript($src, $def = '')
{
$def = rtrim($def) . ' ';
return '<script type="text/javascript"' . $def . 'src="' . Journal2Utils::staticAsset($this->addJournalVersion($src, $this->minify_css)) . '"></script>' . PHP_EOL;
}
示例2: post
//.........这里部分代码省略.........
$this->data['post_categories'] = array();
foreach ($results as $result) {
$this->data['post_categories'][] = array('href' => $this->url->link('journal2/blog', 'journal_blog_category_id=' . $result['category_id']), 'name' => $result['name']);
}
$this->data['grid_classes'] = Journal2Utils::getProductGridClasses($this->journal2->settings->get('config_blog_settings.related_products_per_row.value'), $this->journal2->settings->get('site_width', 1024), $this->journal2->settings->get('config_columns_count', 0));
$this->data['carousel'] = $this->journal2->settings->get('config_blog_settings.related_products_carousel');
$this->data['related_products'] = array();
if ($this->journal2->settings->get('config_blog_settings.related_products', '1')) {
$results = $this->model_journal2_blog->getRelatedProducts($post_id);
foreach ($results as $result) {
$image = Journal2Utils::resizeImage($this->model_tool_image, $result['image'], $this->config->get('config_image_related_width'), $this->config->get('config_image_related_height'), 'fit');
if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) {
$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = false;
}
if ((double) $result['special']) {
$special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$special = false;
}
if ($this->config->get('config_review_status')) {
$rating = (int) $result['rating'];
} else {
$rating = false;
}
$date_end = false;
if (strpos($this->config->get('config_template'), 'journal2') === 0 && $special && $this->journal2->settings->get('show_countdown', 'never') !== 'never') {
$this->load->model('journal2/product');
$date_end = $this->model_journal2_product->getSpecialCountdown($result['product_id']);
if ($date_end === '0000-00-00') {
$date_end = false;
}
}
$additional_images = $this->model_catalog_product->getProductImages($result['product_id']);
$image2 = false;
if (count($additional_images) > 0) {
$image2 = $this->model_tool_image->resize($additional_images[0]['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
}
$this->data['related_products'][] = array('product_id' => $result['product_id'], 'thumb' => $image, 'thumb2' => $image2, 'labels' => $this->model_journal2_product->getLabels($result['product_id']), 'date_end' => $date_end, 'name' => $result['name'], 'price' => $price, 'special' => $special, 'rating' => $rating, 'reviews' => sprintf($this->language->get('text_reviews'), (int) $result['reviews']), 'href' => $this->url->link('product/product', 'product_id=' . $result['product_id']));
}
}
$this->data['allow_comments'] = $this->model_journal2_blog->getCommentsStatus($post_id);
$this->data['comments'] = $this->model_journal2_blog->getComments($post_id);
/* default comment fields */
if (version_compare(VERSION, '2.1', '<')) {
$this->load->library('user');
}
if ($this->customer->isLogged()) {
$this->load->model('account/customer');
$customer_info = $this->model_account_customer->getCustomer($this->customer->getId());
$this->data['default_name'] = trim($customer_info['firstname'] . ' ' . $customer_info['lastname']);
$this->data['default_email'] = $customer_info['email'];
} else {
if ($this->user->isLogged()) {
$admin_info = $this->model_journal2_blog->getAdminInfo($this->user->getId());
$this->data['default_name'] = trim($admin_info['firstname'] . ' ' . $admin_info['lastname']);
$this->data['default_email'] = $admin_info['email'];
} else {
$this->data['default_name'] = '';
$this->data['default_email'] = '';
}
}
$this->model_journal2_blog->updateViews($post_id);
$this->data['heading_title'] = $this->blog_heading_title;
$this->document->setTitle($this->blog_title);
$this->document->setDescription($this->blog_meta_description);
$this->document->setKeywords($this->blog_meta_keywords);
$this->document->addLink($this->url->link('journal2/blog/post', 'journal_blog_post_id=' . $post_id), 'canonical');
$this->journal2->settings->set('blog_meta_title', $this->blog_meta_title);
$this->journal2->settings->set('fb_meta_title', $this->blog_title);
$this->journal2->settings->set('fb_meta_description', trim(utf8_substr(strip_tags(html_entity_decode($post_info['description'], ENT_QUOTES, 'UTF-8')), 0, 300)) . '...');
$this->journal2->settings->set('fb_meta_image', Journal2Utils::staticAsset('image/' . $post_info['image']));
$this->blog_template = $this->config->get('config_template') . '/template/journal2/blog/post.tpl';
} else {
$this->language->load('error/not_found');
$this->document->setTitle($this->language->get('text_error'));
$this->data['heading_title'] = $this->language->get('text_error');
$this->data['text_error'] = $this->language->get('text_error');
$this->data['button_continue'] = $this->language->get('button_continue');
$this->data['continue'] = $this->url->link('common/home');
$this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . '/1.1 404 Not Found');
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/error/not_found.tpl')) {
$this->blog_template = $this->config->get('config_template') . '/template/error/not_found.tpl';
} else {
$this->blog_template = 'default/template/error/not_found.tpl';
}
}
if (Front::$IS_OC2) {
$this->data['column_left'] = $this->load->controller('common/column_left');
$this->data['column_right'] = $this->load->controller('common/column_right');
$this->data['content_top'] = $this->load->controller('common/content_top');
$this->data['content_bottom'] = $this->load->controller('common/content_bottom');
$this->data['footer'] = $this->load->controller('common/footer');
$this->data['header'] = $this->load->controller('common/header');
} else {
$this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header');
}
$this->response->setOutput($this->render());
}
示例3: index
public function index()
{
$this->load->model('tool/image');
/* blog manager compatibility */
$route = isset($this->request->get['route']) ? $this->request->get['route'] : null;
if ($route !== null && in_array($route, array('blog/article', 'blog/category'))) {
return;
}
/* end of blog manager compatibility */
$this->s_url = Journal2Cache::getCurrentUrl();
switch ($this->journal2->page->getType()) {
case 'product':
$this->load->model('catalog/product');
$product_info = $this->model_catalog_product->getProduct($this->journal2->page->getId());
if ($product_info) {
$this->s_title = $product_info['name'];
$this->s_description = trim(utf8_substr(strip_tags(html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8')), 0, 300));
$this->s_image = Journal2Utils::staticAsset('image/' . $product_info['image']);
$this->s_rating = (int) $product_info['rating'];
$this->journal2->settings->set('product_google_snippet', 'itemscope itemtype="http://schema.org/Product"');
$this->journal2->settings->set('product_price_currency', $this->currency->getCode());
$this->journal2->settings->set('product_num_reviews', $product_info['reviews']);
$this->journal2->settings->set('product_in_stock', $product_info['quantity'] > 0 ? 'yes' : 'no');
/* review ratings */
$this->language->load('product/product');
$this->load->model('catalog/review');
$this->data['text_on'] = $this->language->get('text_on');
$this->data['text_no_reviews'] = $this->language->get('text_no_reviews');
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
$this->data['reviews'] = array();
$review_total = $this->model_catalog_review->getTotalReviewsByProductId($this->request->get['product_id']);
$results = $this->model_catalog_review->getReviewsByProductId($this->request->get['product_id'], ($page - 1) * 5, 5);
foreach ($results as $result) {
$this->data['reviews'][] = array('author' => $result['author'], 'text' => $result['text'], 'rating' => (int) $result['rating'], 'reviews' => sprintf($this->language->get('text_reviews'), (int) $review_total), 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])));
}
$pagination = new Pagination();
$pagination->total = $review_total;
$pagination->page = $page;
$pagination->limit = 5;
$pagination->text = $this->language->get('text_pagination');
$pagination->url = $this->url->link('product/product/review', 'product_id=' . $this->request->get['product_id'] . '&page={page}');
$this->data['pagination'] = $pagination->render();
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/review.tpl')) {
$this->template = $this->config->get('config_template') . '/template/product/review.tpl';
} else {
$this->template = 'default/template/product/review.tpl';
}
$this->journal2->settings->set('product_reviews', $this->render());
}
break;
case 'category':
$this->load->model('catalog/category');
$parts = explode('_', $this->journal2->page->getId());
$category_id = (int) array_pop($parts);
$category_info = $this->model_catalog_category->getCategory($category_id);
if ($category_info) {
$this->s_title = $category_info['name'];
$this->s_description = trim(utf8_substr(strip_tags(html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8')), 0, 300));
$this->s_image = Journal2Utils::staticAsset('image/' . $category_info['image']);
}
break;
default:
$this->s_title = $this->config->get('config_name');
$meta_description = $this->config->get('config_meta_description');
if (is_array($meta_description)) {
$lang_id = $this->config->get('config_language_id');
if (isset($meta_description[$lang_id])) {
$this->s_description = $meta_description[$lang_id] . '...';
}
} else {
$this->s_description = $meta_description . '...';
}
$this->s_image = Journal2Utils::resizeImage($this->model_tool_image, $this->config->get('config_logo'), self::IMG_WIDTH, self::IMG_HEIGHT, 'fit');
break;
}
$this->journal2->settings->set('fb_meta_title', $this->s_title);
$this->journal2->settings->set('fb_meta_description', $this->s_description);
$this->journal2->settings->set('fb_meta_url', $this->s_url);
$this->journal2->settings->set('fb_meta_image', $this->s_image);
}