NinJa911 Blog - 兼容
type: channel
link: https://blog.ninja911.com/tag/%E5%85%BC%E5%AE%B9/
items: drupal 7 兼容视图模块php5.5
items: ecshop兼容php5.4+解决方案

drupal 7 兼容视图模块php5.5
type: item
date: 2014-04-08T17:13:00+08:00
description: 公司同事留下几个他做的集团公司 企业站，全用Drupal 7搭建的。拿到站点源码，进入php5.5下面报错了！"preg_replace() /e modifier is deprecated, use preg_replace_callback()"参考官方讨论组的解决方案对比修改的。 立刻修复之。https://drupal.org/node/1872616 修复的文件sites\\all\\modules\\views_slideshow\\theme\\views_slideshow.theme.inc全部源码<?php /** * Callback function for preg_replace. * * @param array $m * replacement strings * * @return array * replacement strings */ function views_slideshow_replace_callback($m) { return strtoupper($m[1]); } /** /** * @file * The theme system, which controls the output of views slideshow. * * This just adds a wrapper div to the slideshow. */ function _views_slideshow_preprocess_views_slideshow(&$vars) { $options = $vars['options']; $vars['skin'] = 'default'; $vars['slideshow'] = ''; $main_frame_module = $options['slideshow_type']; if (empty($main_frame_module)) { // Get all slideshow types. $slideshows = module_invoke_all('views_slideshow_slideshow_info'); if ($slideshows) { foreach ($slideshows as $slideshow_id => $slideshow_info) { $main_frame_module = $slideshow_id; break; } } } // Make sure the main slideshow settings are defined before building the // slideshow. if (empty($main_frame_module)) { drupal_set_message(t('No main frame module is enabled for views slideshow.'), 'error'); } elseif (empty($options[$main_frame_module])) { drupal_set_message(t('The options for !module does not exists.', array('!module' => $main_frame_module)), 'error'); } else { $settings = $options[$main_frame_module]; $view = $vars['view']; $rows = $vars['rows']; $num_divs = count($rows); $vss_id = $view->name . '-' . $view->current_display; // Give each slideshow a unique id if there are more than one on the page. static $instances = array(); if (isset($instances[$vss_id])) { $instances[$vss_id]++; $vss_id .= "_" . $instances[$vss_id]; } else { $instances[$vss_id] = 1; } // Building our default methods. $methods = array( 'goToSlide' => array(), 'nextSlide' => array(), 'pause' => array(), 'play' => array(), 'previousSlide' => ar…

ecshop兼容php5.4+解决方案
type: item
date: 2014-03-30T00:16:00+08:00
description: cls_template.php<?php /** * ECSHOP 模版类 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司，并保留所有权利。 * 网站地址: http://www.ecshop.com； * ---------------------------------------------------------------------------- * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用；不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: cls_template.php 17063 2010-03-25 06:35:46Z liuhui $ */ class cls_template { var $template_dir = ''; var $cache_dir = ''; var $compile_dir = ''; var $cache_lifetime = 3600; // 缓存更新时间, 默认 3600 秒 var $direct_output = false; var $caching = false; var $template = array(); var $force_compile = false; var $_var = array(); var $_echash = '554fcae493e564ee0dc75bdf2ebf94ca'; var $_foreach = array(); var $_current_file = ''; var $_expires = 0; var $_errorlevel = 0; var $_nowtime = null; var $_checkfile = true; var $_foreachmark = ''; var $_seterror = 0; var $_temp_key = array(); // 临时存放 foreach 里 key 的数组 var $_temp_val = array(); // 临时存放 foreach 里 item 的数组 function __construct() { $this->cls_template(); } function cls_template() { $this->_errorlevel = error_reporting(); $this->_nowtime = time(); if (defined('EC_CHARSET')) { $charset = EC_CHARSET; } else { $charset = 'utf-8'; } header('Content-type: text/html; charset='.$charset); } /** * 注册变量 * * @access public * @param mix $tpl_var * @param mix $value * * @return void */ function assign($tpl_var, $value = '') { if (is_array($tpl_var)) { foreach ($tpl_var AS $key => $val) { if ($key != '') { $this->_var[$key] = $val; } } } else { if ($tpl_var != '') { $this->_var[$tpl_var] = $value; } } } /** * 显示页面函数 * * @access public * @param string $filename * @param sting $cache_id * * @return void */ function display($filename, $cache_id = '') { $this->_seterror++; error_reporting(E_ALL ^ E_NOTICE); $this->_checkfile = false; $out = $this->fetch($filename, $cache_id); if (strpos($out, $this->_echash) !== f…