本文整理汇总了PHP中kernel::get_themes_host_url方法的典型用法代码示例。如果您正苦于以下问题:PHP kernel::get_themes_host_url方法的具体用法?PHP kernel::get_themes_host_url怎么用?PHP kernel::get_themes_host_url使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kernel
的用法示例。
在下文中一共展示了kernel::get_themes_host_url方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: theme_widget_hb_pic_list
/**
* ShopEx licence
*
* @copyright Copyright (c) 2005-2010 ShopEx Technologies Inc. (http://www.shopex.cn)
* @license http://ecos.shopex.cn/ ShopEx License
*/
function theme_widget_hb_pic_list(&$setting)
{
$setting['allimg'] = "";
$setting['allurl'] = "";
$theme_dir = kernel::get_themes_host_url() . '/' . theme::getThemeName();
if (!$setting['pic']) {
foreach ($setting['img'] as $value) {
$setting['allimg'] .= $rvalue . "|";
$setting['allurl'] .= urlencode($value["url"]) . "|";
}
} else {
foreach ($setting['pic'] as $key => $value) {
if ($value['link']) {
if ($value["url"]) {
$value["linktarget"] = $value["url"];
}
$setting['allimg'] .= $rvalue . "|";
$setting['allurl'] .= urlencode($value["linktarget"]) . "|";
$setting['pic'][$key]['link'] = str_replace('%THEME%', $theme_dir, $value['link']);
}
}
}
// var_dump($setting["pic"]);
return $setting;
}
示例2: theme_widget_main_slide
/**
* ShopEx licence
*
* @copyright Copyright (c) 2005-2010 ShopEx Technologies Inc. (http://www.shopex.cn)
* @license http://ecos.shopex.cn/ ShopEx License
*/
function theme_widget_main_slide(&$setting,&$render){
$setting['allimg']="";
$setting['allurl']="";
if($system->theme){
$theme_dir = kernel::get_themes_host_url().'/'.$smarty->theme;
}else{
$theme_dir = kernel::get_themes_host_url().'/'.app::get('site')->getConf('current_theme');
}
if(!$setting['pic']){
foreach($setting['img'] as $value){
$setting['allimg'].=$rvalue."|";
$setting['allurl'].=urlencode($value["url"])."|";
}
}else{
foreach($setting['pic'] as $key=>$value){
if($value['link']){
if($value["url"]){
$value["linktarget"]=$value["url"];
}
$setting['allimg'].=$rvalue."|";
$setting['allurl'].=urlencode($value["linktarget"])."|";
$setting['pic'][$key]['link'] = str_replace('%THEME%',$theme_dir,$value['link']);
}
}
}
return $setting;
}
示例3: compile_widgets
function compile_widgets($attrs, &$compiler)
{
$current_file = theme::getCurrentLayoutOrPartial();
$current_file = substr($current_file, strpos($current_file, ':') + 1);
$slot = intval(static::$_wgbar[$current_file]++);
$allWidgetsGroup = static::$_cache[$current_file];
if (!isset($allWidgetsGroup)) {
// preview模式, 并且SESSION中存在数据
if (theme::isPreview() && $_SESSION['WIDGET_TMP_DATA'][$current_file] && is_array($_SESSION['WIDGET_TMP_DATA'][$current_file])) {
$widgets = (array) $_SESSION['WIDGET_TMP_DATA'][$current_file];
} else {
$qb = app::get('site')->database()->createQueryBuilder();
$qb->select('*')->from('site_widgets_instance')->where('core_file=' . $qb->createPositionalParameter($current_file))->orderBy('widgets_order', 'asc');
$widgets = app::get('site')->model('widgets_instance')->tidy_data($qb->execute()->fetchAll());
}
foreach ($widgets as $key => $widget) {
if ($widget['core_id']) {
$allWidgetsGroup['id'][$widget['core_id']][] = $widgets[$key];
} else {
$allWidgetsGroup['slot'][$widget['core_slot']][] = $widgets[$key];
}
}
static::$_cache[$current_file] = $allWidgetsGroup;
}
if (isset($attrs['id'])) {
$attrs['id'] = trim($attrs['id'], '\'"');
$widgets_group = $allWidgetsGroup['id'][$attrs['id']];
} else {
$widgets_group = $allWidgetsGroup['slot'][$slot];
}
/*--------------------- 获取全部widgets ------------------------------*/
if (is_array($widgets_group)) {
$return = sprintf('$__THEME_URL = \'%s\';', kernel::get_themes_host_url() . '/' . theme::getThemeName());
$return .= 'unset($this->_vars);';
foreach ($widgets_group as $widget) {
$return .= $this->__site_parse_widget_instance($widget, $compiler);
}
return $return . '$__widgets_setting=null;$__THEME_URL=null;$__widgets_id=null;$__widgets_data=null;';
} else {
return '';
}
}
示例4: admin_load
public function admin_load($widgets_id = null, $edit_mode = false)
{
if (empty($widgets_id)) {
return null;
}
//print_r(func_get_args());
if (!$this->fastmode && $edit_mode) {
$this->fastmode = true;
}
$widgets = app::get('site')->model('widgets_proinstance')->select()->where('widgets_id = ?', $widgets_id)->instance()->fetch_row();
$smarty = kernel::single('site_admin_render');
$files = $smarty->_files;
$_wgbar = $smarty->_wgbar;
if ($widgets) {
$theme = $widgets['flag'] ? $widgets['flag'] : '';
if ($theme) {
$wights_border = kernel::single('site_theme_base')->get_border_from_themes($theme);
}
if ($widgets['widgets_type'] == 'html') {
$widgets['widgets_type'] = 'usercustom';
}
$widgets['html'] = $this->fetch($widgets);
$title = $widgets['title'] ? $widgets['title'] : $widgets['widgets_type'];
$wReplace = array('<{$body}>', '<{$title}>', '<{$widgets_classname}>', '"<{$widgets_id}>"');
$wArt = array($this->admin_wg_border($widgets, $theme), $widgets['title'], $widgets['classname'], ($widgets['domid'] ? $widgets['domid'] : 'widgets_' . $widgets['widgets_id']) . ' widgets_id="' . $widgets['widgets_id'] . '" title="' . $title . '"' . ' widgets_theme="' . $theme . '"');
if ($widgets['border'] != '__none__' && $wights_border[$widgets['border']]) {
$content = preg_replace("/(class\\s*=\\s*\")|(class\\s*=\\s*\\')/", "\$0shopWidgets_box ", $wights_border[$widgets['border']], 1);
$widgets_box = str_replace($wReplace, $wArt, $content);
} else {
$widgets_box = '<div class="shopWidgets_box clearfix" widgets_id="' . $widgets['widgets_id'] . '" title="' . $title . '" widgets_theme="' . $theme . '">' . $this->admin_wg_border($widgets, $theme) . '</div>';
}
$widgets_box = preg_replace("/<object[^>]*>([\\s\\S]*?)<\\/object>/i", "<div class='sWidgets_flash' title='Flash'> </div>", $widgets_box);
$replacement = array("'onmouse'i", "'onkey'i", "'onmousemove'i", "'onload'i", "'onclick'i", "'onselect'i", "'unload'i");
$widgets_box = preg_replace($replacement, array_fill(0, count($replacement), 'xshopex'), $widgets_box);
$theme_url = kernel::get_themes_host_url() . '/' . $theme;
$widgets_box = str_replace('%THEME%', $theme_url, $widgets_box);
echo preg_replace("/<script[^>]*>([\\s\\S]*?)<\\/script>/i", "", $widgets_box);
}
$smarty->_files = $files;
$smarty->_wgbar = $_wgbar;
}
示例5: admin_load
public function admin_load($file, $slot, $id = null, $edit_mode = false)
{
if (!$this->fastmode && $edit_mode) {
$this->fastmode = true;
}
$model = app::get('site')->model('widgets_instance');
$qb = $model->database()->createQueryBuilder();
$qb->select('*')->from('site_widgets_instance')->where('core_file=' . $qb->createPositionalParameter($file))->orderBy('widgets_order', 'asc');
if (!$id) {
$qb->andWhere('core_slot=', $qb->createPositionalParameter($slot));
} else {
$qb->andWhere('core_id=' . $qb->createPositionalParameter($id));
}
// 因为数据有serializes数据. 因此取出后要经过 tidy_data处理
$rows = $model->tidy_data($qb->execute()->fetchAll());
if (!strpos($file, ':')) {
$theme = substr($file, 0, strpos($file, '/'));
} else {
$theme = kernel::single('site_theme_base')->get_default();
}
$obj_session = kernel::single('base_session');
$obj_session->start();
foreach ($rows as $widgets) {
//$_SESSION['WIDGET_TMP_DATA'][$widgets['core_file']][$widgets['widgets_id']] = $widgets;
$_SESSION['_tmp_wg_update'][$widgets['widgets_id']] = null;
if ($widgets['widgets_type'] == 'html') {
$widgets['widgets_type'] = 'usercustom';
}
$widgets['html'] = $this->fetch($widgets);
$title = $widgets['title'] ? $widgets['title'] : $widgets['widgets_type'];
// 无边框
$widgets_box = '<div class="shopWidgets_box clearfix" widgets_id="' . $widgets['widgets_id'] . '" title="' . $title . '" widgets_theme="' . $theme . '">' . $this->admin_wg_border($widgets, $theme) . '</div>';
$widgets_box = preg_replace("/<object[^>]*>([\\s\\S]*?)<\\/object>/i", "<div class='sWidgets_flash' title='Flash'> </div>", $widgets_box);
$replacement = array("'onmouse'i", "'onkey'i", "'onmousemove'i", "'onload'i", "'onclick'i", "'onselect'i", "'unload'i");
$widgets_box = preg_replace($replacement, array_fill(0, count($replacement), 'xshopex'), $widgets_box);
$theme_url = kernel::get_themes_host_url() . '/' . $theme;
$widgets_box = str_replace('%THEME%', $theme_url, $widgets_box);
echo preg_replace("/<script[^>]*>([\\s\\S]*?)<\\/script>/i", "", $widgets_box);
}
$obj_session->close();
}
示例6: page
public final function page($view, $no_theme = false, $app_id = null)
{
$params = $this->_request->get_params(true);
$current_theme = $params['theme'] ? $params['theme'] : kernel::single('site_theme_base')->get_default();
$is_preview = isset($_COOKIE['site']['preview']) && $_COOKIE['site']['preview'] == 'true' ? true : false;
$views = kernel::single('site_theme_base')->get_theme_views($current_theme);
$views_app_id = is_null($app_id) ? $this->app->app_id : $app_id;
if (is_array($views[$views_app_id]) && array_key_exists($view, $views[$views_app_id])) {
$view = 'theme:' . $views[$views_app_id][$view];
} else {
$service = kernel::service(sprintf('site_controller_display.%s.%s.%s', $this->_request->get_app_name(), $this->_request->get_ctl_name(), $this->_request->get_act_name()));
if (is_object($service)) {
if (method_exists($service, 'get_view')) {
$view = $service->get_view();
}
if (method_exists($service, 'get_app_id')) {
$app_id = $service->get_app_id();
}
if (method_exists($service, 'get_no_theme')) {
$no_theme = $service->get_no_theme();
}
}
}
$global_prepare = kernel::servicelist('site_controller_prepare');
$single_prepare = kernel::servicelist(sprintf('site_controller_prepare.%s.%s.%s', $this->_request->get_app_name(), $this->_request->get_ctl_name(), $this->_request->get_act_name()));
foreach ($global_prepare as $prepare) {
$prepare->modify($this);
}
foreach ($single_prepare as $prepare) {
$prepare->modify($this);
}
if ($no_theme == false && $current_theme) {
$this->set_theme($current_theme);
$this->pagedata['_MAIN_'] = $view;
//强制替换
$this->pagedata['_THEME_'] = kernel::get_themes_host_url() . "/" . $this->get_theme();
//模版地址
$tmpl_file = $this->get_tmpl_file();
//指定模板
$tmplObj = kernel::single('site_theme_tmpl');
if (!$tmpl_file || !$tmplObj->tmpl_file_exists($tmpl_file, $current_theme)) {
$tmpl = $this->get_tmpl() ? $this->get_tmpl() : 'defalut';
$tmpl = $tmplObj->get_default($tmpl, $current_theme);
$tmpl_file = $tmpl ? $tmpl : (($tmpl_default = $tmplObj->get_default('default', $current_theme)) ? $tmpl_default : 'default.html');
}
//如果有模版,检测当前theme下是否有此模板
$this->set_tmpl_main_app_id($app_id);
$html = $this->fetch_tmpl($tmpl_file, $is_preview);
} else {
$html = $this->fetch($view, $app_id, $is_preview);
}
//finish html modify
foreach ($this->__finish_modifier as $modifier) {
$modifier->modify($html, $this);
}
//modify html services
$services = kernel::servicelist('site_controller_content');
foreach ($services as $service) {
if ($service instanceof site_interface_controller_content) {
$service->modify($html, $this);
}
}
//append widgets css add by edwin.lzh@gmail.com 2010/6/11
//$html = str_replace('<%site_widgets_css%>', implode("", array_unique($this->__widgets_css)), $html);
$this->extract_widgets_css($html);
$html = str_replace('<%site_widgets_css%>', app::get('site')->base_url(1) . 'widgetsproinstance-get_css-' . $current_theme . '-' . base64_encode($tmpl_file) . '.html', $html);
//filter html special
if ($this->enable_strip_whitespace) {
$this->strip_whitespace($html);
}
if (!$this->_response->get_header('Content-type', $header)) {
$this->_response->set_header('Content-type', $this->contentType, true);
}
//如果没有定义Content-type,默认加text/html;charset=utf-8
if (!$this->_response->get_header('Cache-Control', $header)) {
${$cache_control} = array();
foreach ($this->__cachecontrol as $val) {
$val = trim($val);
if (empty($val)) {
continue;
}
$cache_control[] = $val;
}
$this->_response->set_header('Cache-Control', join(',', $cache_control), true);
}
//如果没有定义Content-Control,使用系统配置
$this->_response->set_body($html);
}
示例7: preview_prefix
function preview_prefix($theme)
{
$theme_url = kernel::get_themes_host_url();
$preview_prefix = $theme_url . '/' . $theme;
return $preview_prefix;
}
示例8: save_widget
public function save_widget()
{
header('Content-Type: text/html;charset=utf-8');
$widgets_id = $this->_request->get_get('widgets_id');
$widgets = $this->_request->get_get('widgets');
$widgets_app = $this->_request->get_get('widgets_app');
$widgets_theme = $this->_request->get_get('widgets_theme');
$theme = $this->_request->get_get('theme');
$domid = $this->_request->get_get('domid');
$wg = $this->_request->get_post('__wg');
if ($widgets_type == 'html') {
$widgets_type = 'usercustom';
}
$set = array('widgets_type' => $widgets, 'app' => $widgets_app, 'theme' => $widgets_theme, 'title' => $wg['title'], 'border' => $wg['border'], 'tpl' => $wg['tpl'], 'domid' => $wg['domid'] ? $wg['domid'] : $domid, 'classname' => $wg['classname']);
$post = $this->_request->get_post();
unset($post['__wg']);
$set['params'] = $post;
$set['_domid'] = $set['domid'];
if (is_numeric($widgets_id)) {
$sdata = $set;
kernel::single('site_theme_widget')->save_widgets($widgets_id, $sdata);
$set['widgets_id'] = $widgets_id;
$_SESSION['_tmp_wg_update'][$widgets_id] = $set;
} elseif (preg_match('/^tmp_([0-9]+)$/i', $widgets_id, $match)) {
$_SESSION['_tmp_wg_insert'][$match[1]] = $set;
}
$data = kernel::single('site_theme_widget')->admin_wg_border(array('widgets_id' => $widgets_id, 'title' => $set['title'], 'domid' => $set['domid'], 'border' => $set['border'], 'widgets_type' => $set['widgets_type'], 'html' => kernel::single('site_theme_widget')->fetch($set, true), 'border' => $set['border']), $theme, true);
$theme_url = kernel::get_themes_host_url() . '/' . $theme;
$data = str_replace('%THEME%', $theme_url, $data);
echo $data;
}
示例9: insert_widget
public function insert_widget()
{
header('Content-Type: text/html;charset=utf-8');
$widgets = $this->_request->get_get('widgets');
$widgets_app = $this->_request->get_get('widgets_app');
$widgets_theme = $this->_request->get_get('widgets_theme');
$theme = $this->_request->get_get('theme');
$domid = $this->_request->get_get('domid');
$wg = $this->_request->get_post('__wg');
$set = array('flag' => $theme, 'widgets_type' => $widgets, 'app' => $widgets_app, 'theme' => $widgets_theme, 'title' => $wg['title'], 'border' => $wg['border'], 'tpl' => $wg['tpl'], 'domid' => $wg['domid'] ? $wg['domid'] : $domid, 'classname' => $wg['classname']);
$post = $this->_request->get_post();
unset($post['__wg']);
$set['params'] = $post;
$_SESSION['_tmp_wg_proinsert'] = $set;
$data = kernel::single('site_widget_proinstance')->admin_wg_border(array('title' => $set['title'], 'domid' => $set['domid'], 'border' => $set['border'], 'widgets_type' => $set['widgets_type'], 'html' => kernel::single('site_widget_proinstance')->fetch($set, true)), $theme, true);
$theme_url = kernel::get_themes_host_url() . '/' . $theme;
$data = str_replace('%THEME%', $theme_url, $data);
echo $data;
}
示例10: install
public function install()
{
set_time_limit(120);
$ident = $this->_request->get_get('ident');
$downObj = kernel::single('site_utility_download');
$ident = $downObj->dl($ident);
if (!$ident) {
echo '<script>failure("' . app::get('site')->_('下载出错') . '")</script>';
exit;
}
$task_info = $downObj->get_task($ident);
if (empty($task_info)) {
$this->_error();
}
$file = $downObj->get_work_dir() . '/' . $ident . '/' . $task_info['name'];
$msg = app::get('site')->_('无法找到安装文件');
if (is_file($file)) {
$fileInfo['tmp_name'] = $file;
$fileInfo['name'] = time();
$fileInfo['error'] = '0';
$fileInfo['size'] = filesize($file);
$themeInstallObj = kernel::single('site_theme_install');
$res = $themeInstallObj->install($fileInfo, $msg);
}
if ($res) {
$theme_url = kernel::get_themes_host_url();
$img = $theme_url . '/' . $res['theme'] . '/preview.jpg';
$this->pagedata['img'] = '<img src="' . $img . '" />';
$this->pagedata['msg'] = app::get('site')->_('模板安装成功,您可以在模板列表中启用它。');
} else {
$this->pagedata['msg'] = $msg;
}
$this->singlepage('admin/download/result.html');
}
示例11: admin_load
public function admin_load($file, $slot, $id = null, $edit_mode = false)
{
if (!$this->fastmode && $edit_mode) {
$this->fastmode = true;
}
$selectObj = app::get('site')->model('widgets_instance')->select()->where('core_file = ?', $file)->order('widgets_order ASC');
if (!$id) {
$rows = $selectObj->where('core_slot = ?', $slot)->instance()->fetch_all();
} else {
$rows = $selectObj->where('core_id = ?', $id)->instance()->fetch_all();
}
$smarty = kernel::single('site_admin_render');
$files = $smarty->_files;
$_wgbar = $smarty->_wgbar;
if (!strpos($file, ':')) {
$theme = substr($file, 0, strpos($file, '/'));
} else {
$theme = kernel::single('site_theme_base')->get_default();
}
$obj_session = kernel::single('base_session');
$obj_session->start();
$wights_border = kernel::single('site_theme_base')->get_border_from_themes($theme);
foreach ($rows as $widgets) {
//$_SESSION['WIDGET_TMP_DATA'][$widgets['core_file']][$widgets['widgets_id']] = $widgets;
$_SESSION['_tmp_wg_update'][$widgets['widgets_id']] = null;
if ($widgets['widgets_type'] == 'html') {
$widgets['widgets_type'] = 'usercustom';
}
$widgets['html'] = $this->fetch($widgets);
$title = $widgets['title'] ? $widgets['title'] : $widgets['widgets_type'];
$wReplace = array('<{$body}>', '<{$title}>', '<{$widgets_classname}>', '"<{$widgets_id}>"');
$wArt = array($this->admin_wg_border($widgets, $theme), $widgets['title'], $widgets['classname'], ($widgets['domid'] ? $widgets['domid'] : 'widgets_' . $widgets['widgets_id']) . ' widgets_id="' . $widgets['widgets_id'] . '" title="' . $title . '"' . ' widgets_theme="' . $theme . '"');
if ($widgets['border'] != '__none__' && $wights_border[$widgets['border']]) {
$content = preg_replace("/(class\\s*=\\s*\")|(class\\s*=\\s*\\')/", "\$0shopWidgets_box ", $wights_border[$widgets['border']], 1);
$widgets_box = str_replace($wReplace, $wArt, $content);
} else {
$widgets_box = '<div class="shopWidgets_box clearfix" widgets_id="' . $widgets['widgets_id'] . '" title="' . $title . '" widgets_theme="' . $theme . '">' . $this->admin_wg_border($widgets, $theme) . '</div>';
}
$widgets_box = preg_replace("/<object[^>]*>([\\s\\S]*?)<\\/object>/i", "<div class='sWidgets_flash' title='Flash'> </div>", $widgets_box);
$replacement = array("'onmouse'i", "'onkey'i", "'onmousemove'i", "'onload'i", "'onclick'i", "'onselect'i", "'unload'i");
$widgets_box = preg_replace($replacement, array_fill(0, count($replacement), 'xshopex'), $widgets_box);
$theme_url = kernel::get_themes_host_url() . '/' . $theme;
$widgets_box = str_replace('%THEME%', $theme_url, $widgets_box);
echo preg_replace("/<script[^>]*>([\\s\\S]*?)<\\/script>/i", "", $widgets_box);
}
$smarty->_files = $files;
$smarty->_wgbar = $_wgbar;
$obj_session->close();
}
示例12: fixThemeMedia
private function fixThemeMedia($code)
{
//return $code;
$from = array('/((?:background|src|href)\\s*=\\s*["|\'])(?:\\.\\/|\\.\\.\\/)?(images\\/.*?["|\'])/is', '/((?:background|background-image):\\s*?url\\()(?:\\.\\/|\\.\\.\\/)?(images\\/)/is');
$themeUrl = kernel::get_themes_host_url();
$to = array(sprintf('\\1%s\\2', $themeUrl . '/' . theme::getThemeName() . '/'), sprintf('\\1%s\\2', $themeUrl . '/' . theme::getThemeName() . '/'));
// var_dump($to);exit;
return preg_replace($from, $to, $code);
}