当前位置: 首页>>代码示例>>PHP>>正文


PHP context::getcontext方法代码示例

本文整理汇总了PHP中context::getcontext方法的典型用法代码示例。如果您正苦于以下问题:PHP context::getcontext方法的具体用法?PHP context::getcontext怎么用?PHP context::getcontext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在context的用法示例。


在下文中一共展示了context::getcontext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: modify_layer_image

function modify_layer_image($img_src = '')
{
    $img_pathinfo = pathinfo($img_src);
    $mainstr = $img_pathinfo['basename'];
    $shop_url = context::getcontext()->shop->getBaseURL();
    $static_url = 'modules/revsliderprestashop/uploads/';
    return $shop_url . $static_url . $mainstr;
}
开发者ID:evgrishin,项目名称:se1614,代码行数:8,代码来源:revprestashoploader.php

示例2: initContent


//.........这里部分代码省略.........
         return $this->setTemplate($config->get('template', 'default') . '/blog.tpl');
     }
     $category = new leoblogcat($blog->id_leoblogcat, $this->context->language->id);
     $image_w = $config->get('item_img_width', 690);
     $image_h = $config->get('item_img_height', 300);
     $template = !empty($category->template) ? $category->template : 'default';
     // have to have a value ( not empty )
     $this->template_path .= $template . '/';
     $module_tpl = $this->template_path;
     $url = _PS_BASE_URL_;
     if (Tools::usingSecureMode()) {
         # validate module
         $url = _PS_BASE_URL_SSL_;
     }
     $blog->preview_url = '';
     if ($blog->image) {
         $blog->image_url = $url . _LEOBLOG_BLOG_IMG_URI_ . 'b/' . $blog->image;
         if (ImageManager::resize(_LEOBLOG_BLOG_IMG_DIR_ . 'b/' . $blog->image, _LEOBLOG_CACHE_IMG_DIR_ . 'b/lg-' . $blog->image, $image_w, $image_h)) {
             # validate module
             $blog->preview_url = $url . _LEOBLOG_CACHE_IMG_URI_ . 'b/lg-' . $blog->image;
         }
     }
     $captcha_image = $helper->getBlogLink(get_object_vars($blog), array('captchaimage' => 1));
     $blog_link = $helper->getBlogLink(get_object_vars($blog));
     $params = array('rewrite' => $category->link_rewrite, 'id' => $category->id_leoblogcat);
     $blog->category_link = $helper->getBlogCatLink($params);
     $blog->category_title = $category->title;
     $employee = new Employee($blog->id_employee);
     $blog->author = $employee->firstname . ' ' . $employee->lastname;
     $blog->author_link = $helper->getBlogAuthorLink($employee->id);
     $tags = array();
     if ($blog->tags && ($tmp = explode(',', $blog->tags))) {
         foreach ($tmp as $tag) {
             $tags[] = array('tag' => $tag, 'link' => $helper->getBlogTagLink($tag));
         }
     }
     $blog->hits = $blog->hits + 1;
     //$blog->save();
     $blog->updateField($blog->id, array('hits' => $blog->hits));
     /* breadscrumb */
     $params = array('rewrite' => $category->link_rewrite, 'id' => $category->id_leoblogcat);
     $category_link = $helper->getBlogCatLink($params);
     $full_path = '<a href="' . $helper->getFontBlogLink() . '">' . htmlentities($config->get('blog_link_title_' . $this->context->language->id, 'Blog'), ENT_NOQUOTES, 'UTF-8') . '</a><span class="navigation-pipe">' . Configuration::get('PS_NAVIGATION_PIPE') . '</span>';
     $full_path .= '<a href="' . Tools::safeOutput($category_link) . '">' . htmlentities($category->title, ENT_NOQUOTES, 'UTF-8') . '</a><span class="navigation-pipe">' . Configuration::get('PS_NAVIGATION_PIPE') . '</span>' . $blog->meta_title;
     $limit = 5;
     $samecats = LeoBlogBlog::getListBlogs($category->id_leoblogcat, $this->context->language->id, 0, $limit, 'date_add', 'DESC', array('type' => 'samecat', 'id_leoblog_blog' => $blog->id_leoblog_blog), true);
     foreach ($samecats as $key => $sblog) {
         $sblog['link'] = $helper->getBlogLink($sblog);
         $samecats[$key] = $sblog;
     }
     $tagrelated = array();
     if ($blog->tags) {
         $tagrelated = LeoBlogBlog::getListBlogs($category->id_leoblogcat, $this->context->language->id, 0, $limit, 'id_leoblog_blog', 'DESC', array('type' => 'tag', 'tag' => $blog->tags), true);
         foreach ($tagrelated as $key => $tblog) {
             $tblog['link'] = $helper->getBlogLink($tblog);
             $tagrelated[$key] = $tblog;
         }
     }
     /* Comments */
     $evars = array();
     if ($config->get('item_comment_engine', 'local') == 'local') {
         $count_comment = 0;
         if ($config->get('comment_engine', 'local') == 'local') {
             # validate module
             $count_comment = LeoBlogComment::countComments($blog->id_leoblog_blog, true);
         }
         $blog_link = $helper->getBlogLink(get_object_vars($blog));
         $limit = (int) $config->get('item_limit_comments', 10);
         $n = $limit;
         $p = abs((int) Tools::getValue('p', 1));
         $comment = new LeoBlogComment();
         $comments = $comment->getList($blog->id_leoblog_blog, $this->context->language->id, $p, $limit);
         $nb_blogs = $count_comment;
         $range = 2;
         /* how many pages around page selected */
         if ($p > $nb_blogs / $n + 1) {
             Tools::redirect(preg_replace('/[&?]p=\\d+/', '', $_SERVER['REQUEST_URI']));
         }
         $pages_nb = ceil($nb_blogs / (int) $n);
         $start = (int) ($p - $range);
         if ($start < 1) {
             $start = 1;
         }
         $stop = (int) ($p + $range);
         if ($stop > $pages_nb) {
             $stop = (int) $pages_nb;
         }
         $evars = array('pages_nb' => $pages_nb, 'nb_items' => $count_comment, 'p' => (int) $p, 'n' => (int) $n, 'requestPage' => $blog_link, 'requestNb' => $blog_link, 'start' => $start, 'comments' => $comments, 'range' => $range, 'blog_count_comment' => $count_comment, 'stop' => $stop);
     }
     if ((bool) Module::isEnabled('smartshortcode')) {
         if (context::getcontext()->controller->controller_type == 'front') {
             $smartshortcode = Module::getInstanceByName('smartshortcode');
             $blog->content = $smartshortcode->parse($blog->content);
         }
     }
     $vars = array('tags' => $tags, 'meta_title' => Tools::ucfirst($blog->meta_title) . ' - ' . $this->context->shop->name, 'meta_keywords' => $blog->meta_keywords, 'meta_description' => $blog->meta_description, 'blog' => $blog, 'samecats' => $samecats, 'tagrelated' => $tagrelated, 'path' => $full_path, 'config' => $config, 'id_leoblog_blog' => $blog->id_leoblog_blog, 'is_active' => $blog->active, 'productrelated' => array(), 'module_tpl' => $module_tpl, 'captcha_image' => $captcha_image, 'blog_link' => $blog_link);
     $vars = array_merge($vars, $evars);
     $this->context->smarty->assign($vars);
     $this->setTemplate($template . '/blog.tpl');
 }
开发者ID:ahmedonee,项目名称:morinella,代码行数:101,代码来源:blog.php

示例3: urldecode

<?php

// if (!defined('_PS_VERSION_'))
//     exit;
include_once '../../config/config.inc.php';
include_once '../../init.php';
include_once 'inc_php/revslider_globals.class.php';
// defined('_PS_VERSION_') OR die('No Direct Script Access Allowed');
$action = Tools::getValue('action');
$mod_url = context::getcontext()->shop->getBaseURL() . "modules/revsliderprestashop/";
switch ($action) {
    case 'revsliderprestashop_show_image':
        $imgsrc = Tools::getValue('img');
        if ($imgsrc) {
            $imgsrc = str_replace('../', '', urldecode($imgsrc));
            if (strpos($imgsrc, 'uploads') !== FALSE) {
                $file = @getimagesize($imgsrc);
                if (!empty($file) && isset($file['mime'])) {
                    $size = GlobalsRevSlider::IMAGE_SIZE_MEDIUM;
                    $filename = basename($imgsrc);
                    $filetitle = substr($filename, 0, strrpos($filename, '.'));
                    $fileext = substr($filename, strrpos($filename, '.'));
                    $newfile = "uploads/{$filetitle}-{$size}x{$size}{$fileext}";
                    if ($newfilesize = @getimagesize($newfile)) {
                        $file = $newfilesize;
                        $imgsrc = $newfile;
                    }
                    header('Content-Type:' . $file['mime']);
                    echo file_get_contents($mod_url . $imgsrc);
                }
            }
开发者ID:evgrishin,项目名称:se1614,代码行数:31,代码来源:ajax.php


注:本文中的context::getcontext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。