本文整理汇总了PHP中modules_path函数的典型用法代码示例。如果您正苦于以下问题:PHP modules_path函数的具体用法?PHP modules_path怎么用?PHP modules_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了modules_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$is_installed = mw_is_installed();
if (!$is_installed) {
if (!$is_installed) {
$installer = new InstallController();
return $installer->index();
}
} else {
if (defined('MW_VERSION')) {
$config_version = Config::get('microweber.version');
if ($config_version != MW_VERSION) {
$this->app->update->post_update(MW_VERSION);
}
}
}
if (!defined('MW_BACKEND')) {
define('MW_BACKEND', true);
}
//create_mw_default_options();
mw()->content_manager->define_constants();
if (defined('TEMPLATE_DIR')) {
$load_template_functions = TEMPLATE_DIR . 'functions.php';
if (is_file($load_template_functions)) {
include_once $load_template_functions;
}
}
event_trigger('mw.admin');
event_trigger('mw_backend');
$view = modules_path() . 'admin/';
$hasNoAdmin = User::where('is_admin', 1)->limit(1)->count();
if (!$hasNoAdmin) {
$this->hasNoAdmin();
}
$view .= (!$hasNoAdmin ? 'create' : 'index') . '.php';
$layout = new View($view);
$layout = $layout->__toString();
$layout = mw()->parser->process($layout);
event_trigger('on_load');
$layout = execute_document_ready($layout);
event_trigger('mw.admin.header');
$apijs_loaded = mw()->template->get_apijs_url();
$apijs_settings_loaded = mw()->template->get_apijs_settings_url();
$default_css = '<link rel="stylesheet" href="' . mw_includes_url() . 'default.css" type="text/css" />';
if (!stristr($layout, $apijs_loaded)) {
$rep = 0;
$default_css = $default_css . "\r\n" . '<script src="' . $apijs_settings_loaded . '"></script>' . "\r\n";
$default_css = $default_css . "\r\n" . '<script src="' . $apijs_loaded . '"></script>' . "\r\n";
$layout = str_ireplace('<head>', '<head>' . $default_css, $layout, $rep);
}
$template_headers_src = mw()->template->admin_head(true);
if ($template_headers_src != false and $template_headers_src != '') {
$layout = str_ireplace('</head>', $template_headers_src . '</head>', $layout, $one);
}
return $layout;
}
示例2: load_all_functions_files_for_modules
function load_all_functions_files_for_modules($options = false)
{
$is_installed = mw_is_installed();
if (!$is_installed) {
return;
}
$modules = mw()->modules->get('ui=any&installed=1&limit=99999');
$files = array();
if (!empty($modules)) {
foreach ($modules as $module) {
if (isset($module['module'])) {
$is_function = normalize_path(modules_path() . $module['module'] . DS . 'functions.php', false);
if (is_file($is_function)) {
include_once $is_function;
$files[] = $is_function;
}
}
}
return $files;
}
}
示例3: checkout
//.........这里部分代码省略.........
$place_order['session_id'] = $sid;
$place_order['order_completed'] = 0;
$items_count = 0;
foreach ($flds_from_data as $value) {
if (isset($data[$value]) and $data[$value] != false) {
$place_order[$value] = $data[$value];
$posted_fields[$value] = $data[$value];
}
}
$amount = $this->cart_total();
$tax = $this->app->cart_manager->get_tax();
if (!empty($checkout_errors)) {
return array('error' => $checkout_errors);
}
$place_order['amount'] = $amount;
$place_order['allow_html'] = true;
$place_order['currency'] = $this->app->option_manager->get('currency', 'payments');
if (isset($data['shipping_gw'])) {
$place_order['shipping_service'] = $data['shipping_gw'];
}
$place_order['shipping'] = $shipping_cost;
if ($tax != 0) {
$place_order['taxes_amount'] = $tax;
}
$items_count = $this->cart_sum(false);
$place_order['items_count'] = $items_count;
$cart_checksum = md5($sid . serialize($check_cart) . uniqid());
$place_order['payment_verify_token'] = $cart_checksum;
define('FORCE_SAVE', $table_orders);
if (isset($save_custom_fields_for_order) and !empty($save_custom_fields_for_order)) {
$place_order['custom_fields_data'] = $this->app->format->array_to_base64($save_custom_fields_for_order);
}
if (!isset($place_order['shipping']) or $place_order['shipping'] == false) {
$place_order['shipping'] = 0;
}
$temp_order = $this->app->database_manager->save($table_orders, $place_order);
if ($temp_order != false) {
$place_order['id'] = $temp_order;
} else {
$place_order['id'] = 0;
}
if ($custom_order_id != false) {
foreach ($place_order as $key => $value) {
$custom_order_id = str_ireplace('{' . $key . '}', $value, $custom_order_id);
}
$custom_order_id = str_ireplace('{YYYYMMDD}', date('Ymd'), $custom_order_id);
$custom_order_id = str_ireplace('{date}', date('Y-m-d'), $custom_order_id);
}
if ($custom_order_id != false) {
$place_order['item_name'] = 'Order id:' . ' ' . $custom_order_id;
$place_order['order_id'] = $custom_order_id;
} else {
$place_order['item_name'] = 'Order id:' . ' ' . $place_order['id'];
}
if ($mw_process_payment == true) {
$shop_dir = module_dir('shop');
$shop_dir = $shop_dir . DS . 'payments' . DS . 'gateways' . DS;
if ($data['payment_gw'] != 'none') {
$gw_process = modules_path() . $data['payment_gw'] . '_process.php';
if (!is_file($gw_process)) {
$gw_process = normalize_path(modules_path() . $data['payment_gw'] . DS . 'process.php', false);
}
$mw_return_url = $this->app->url_manager->api_link('checkout') . '?mw_payment_success=1&order_id=' . $place_order['id'] . '&payment_gw=' . $data['payment_gw'] . '&payment_verify_token=' . $place_order['payment_verify_token'] . '&order_id=' . $place_order['id'] . $return_url_after;
$mw_cancel_url = $this->app->url_manager->api_link('checkout') . '?mw_payment_failure=1&order_id=' . $place_order['id'] . '&payment_gw=' . $data['payment_gw'] . '&payment_verify_token=' . $place_order['payment_verify_token'] . '&order_id=' . $place_order['id'] . $return_url_after;
$mw_ipn_url = $this->app->url_manager->api_link('checkout_ipn') . '?payment_gw=' . $data['payment_gw'] . '&order_id=' . $place_order['id'] . '&payment_verify_token=' . $place_order['payment_verify_token'] . $return_url_after;
// $place_order['success_url'] = $mw_return_url;
// $place_order['cancel_url'] = $mw_cancel_url;
// $place_order['notify_url'] = $mw_ipn_url;
if (is_file($gw_process)) {
require_once $gw_process;
} else {
$checkout_errors['payment_gw'] = 'Payment gateway\'s process file not found.';
}
} else {
$place_order['order_completed'] = 1;
$place_order['is_paid'] = 0;
$place_order['success'] = 'Your order has been placed successfully!';
}
$place_order['order_status'] = 'pending';
if (!empty($checkout_errors)) {
return array('error' => $checkout_errors);
}
$ord = $this->place_order($place_order);
$place_order['id'] = $ord;
}
if (isset($place_order) and !empty($place_order)) {
if (!isset($place_order['success'])) {
$place_order['success'] = 'Your order has been placed successfully!';
}
$return = $place_order;
if (isset($place_order['redirect'])) {
$return['redirect'] = $place_order['redirect'];
}
return $return;
}
}
if (!empty($checkout_errors)) {
return array('error' => $checkout_errors);
}
}
示例4: get_modules_from_current_site_template
public function get_modules_from_current_site_template()
{
if (!defined('ACTIVE_TEMPLATE_DIR')) {
$this->app->content_manager->define_constants();
}
$dir_name = ACTIVE_TEMPLATE_DIR . 'modules' . DS;
if (is_dir($dir_name)) {
$configs = array();
$glob_patern = '*config.php';
$dir = rglob($glob_patern, 0, $dir_name);
$replace_root = normalize_path($dir_name);
$def_icon = modules_path() . 'default.png';
if (!empty($dir)) {
foreach ($dir as $module) {
$module_dir = dirname($module);
$module_dir = normalize_path($module_dir);
$config = array();
include $module;
$module_name = str_replace($replace_root, '', $module_dir);
$module_name = rtrim($module_name, '\\');
$module_name = rtrim($module_name, '/');
$config['module'] = $module_name;
$config['module'] = rtrim($config['module'], '\\');
$config['module'] = rtrim($config['module'], '/');
$try_icon = $module_dir . $module_name . '.png';
if (is_file($try_icon)) {
$config['icon'] = $this->app->url_manager->link_to_file($try_icon);
} else {
$config['icon'] = $this->app->url_manager->link_to_file($def_icon);
}
$configs[] = $config;
}
}
return $configs;
}
}
示例5: modules_path
print $mod_obj_str;
?>
= {}
</script>
<?php
}
?>
<ul class="modules-list list-<?php
print $mod_obj_str;
?>
">
<?php
$def_icon = modules_path() . 'default.png';
$def_icon = mw()->url_manager->link_to_file($def_icon);
?>
<?php
if (isset($dynamic_layouts) and is_array($dynamic_layouts)) {
?>
<?php
foreach ($dynamic_layouts as $dynamic_layout) {
?>
<?php
if (isset($dynamic_layout['template_dir']) and isset($dynamic_layout['layout_file'])) {
?>
<li data-module-name="layout"
template="<?php
print $dynamic_layout['template_dir'];
?>
示例6: only_admin_access
<?php
only_admin_access();
$is_shop = false;
if (isset($params['is_shop'])) {
$is_shop = $params['is_shop'];
}
$dir_name = normalize_path(modules_path());
$posts_mod = $dir_name . 'posts' . DS . 'admin_live_edit_tab1.php';
$set_content_type_mod = 'page';
if (isset($params['global']) and $params['global'] != false) {
$set_content_type_mod_1 = get_option('data-content-type', $params['id']);
if ($set_content_type_mod_1 != false and $set_content_type_mod_1 != '') {
$set_content_type_mod = $set_content_type_mod_1;
}
}
$add_post_q = '';
if (isset($params['id'])) {
$add_post_q .= ' module-id="' . $params['id'] . '" ';
}
if (isset($params['content-id'])) {
$add_post_q .= ' data-content-id=' . $params['content-id'];
}
if (isset($params['related'])) {
$add_post_q .= ' related=' . $params['related'];
}
$parent_page = false;
$is_global = false;
if (isset($params['global'])) {
$add_post_q .= ' global=' . $params['global'];
$is_global = true;
示例7: get_all_functions_files_for_modules
function get_all_functions_files_for_modules($options = false)
{
if (mw_is_installed() == false) {
return false;
}
$args = func_get_args();
$function_cache_id = '';
$function_cache_id = serialize($options);
$cache_id = $function_cache_id = __FUNCTION__ . crc32($function_cache_id);
$cache_group = 'modules/global';
$cache_content = mw()->cache_manager->get($cache_id, $cache_group);
if ($cache_content != false) {
return $cache_content;
}
if (isset($options['glob'])) {
$glob_patern = $options['glob'];
} else {
$glob_patern = '*functions.php';
}
if (isset($options['dir_name'])) {
$dir_name = $options['dir_name'];
} else {
$dir_name = normalize_path(modules_path());
}
$installed = mw()->modules->get('ui=any&installed=1');
$configs = false;
if (is_array($installed) and !empty($installed)) {
$configs = array();
foreach ($installed as $module) {
if (isset($module['module'])) {
$file = normalize_path($dir_name . $module['module'] . DS . 'functions.php', false);
if (is_file($file)) {
$configs[] = $file;
}
}
}
}
mw()->cache_manager->save($configs, $function_cache_id, $cache_group);
return $configs;
}
示例8: modules_url
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td>modules_url</td>
<td><?php
echo modules_url();
?>
</td>
</tr>
<tr>
<td>modules_path</td>
<td><?php
echo modules_path();
?>
</td>
</tr>
<tr>
<td>userfiles_path</td>
<td><?php
echo userfiles_path();
?>
</td>
</tr>
<tr>
<td>userfiles_folder</td>
<td><?php
echo modules_url();
?>
</td>
</tr>
<tr>
<td>site_url</td>
示例9: load
public function load($module_name, $attrs = array())
{
$is_element = false;
$custom_view = false;
if (isset($attrs['view'])) {
$custom_view = $attrs['view'];
$custom_view = trim($custom_view);
$custom_view = str_replace('\\', '/', $custom_view);
$attrs['view'] = $custom_view = str_replace('..', '', $custom_view);
}
if ($custom_view != false and strtolower($custom_view) == 'admin') {
if ($this->app->user_manager->is_admin() == false) {
mw_error('Not logged in as admin');
}
}
$module_name = trim($module_name);
$module_name = str_replace('\\', '/', $module_name);
$module_name = str_replace('..', '', $module_name);
// prevent hack of the directory
$module_name = reduce_double_slashes($module_name);
$module_namei = $module_name;
if (strstr($module_name, 'admin')) {
$module_namei = str_ireplace('\\admin', '', $module_namei);
$module_namei = str_ireplace('/admin', '', $module_namei);
}
//$module_namei = str_ireplace($search, $replace, $subject)e
$uninstall_lock = $this->app->modules->get('one=1&ui=any&module=' . $module_namei);
if (isset($uninstall_lock["installed"]) and $uninstall_lock["installed"] != '' and intval($uninstall_lock["installed"]) != 1) {
return '';
}
if (!defined('ACTIVE_TEMPLATE_DIR')) {
$this->app->content_manager->define_constants();
}
$module_in_template_dir = ACTIVE_TEMPLATE_DIR . 'modules/' . $module_name . '';
$module_in_template_dir = normalize_path($module_in_template_dir, 1);
$module_in_template_file = ACTIVE_TEMPLATE_DIR . 'modules/' . $module_name . '.php';
$module_in_template_file = normalize_path($module_in_template_file, false);
$try_file1 = false;
$mod_d = $module_in_template_dir;
$mod_d1 = normalize_path($mod_d, 1);
$try_file1zz = $mod_d1 . 'index.php';
$in_dir = false;
if ($custom_view == true) {
$try_file1zz = $mod_d1 . trim($custom_view) . '.php';
} else {
$try_file1zz = $mod_d1 . 'index.php';
}
if (is_dir($module_in_template_dir) and is_file($try_file1zz)) {
$try_file1 = $try_file1zz;
$in_dir = true;
} elseif (is_file($module_in_template_file)) {
$try_file1 = $module_in_template_file;
$in_dir = false;
} else {
$module_in_default_dir = modules_path() . $module_name . '';
$module_in_default_dir = normalize_path($module_in_default_dir, 1);
// d($module_in_default_dir);
$module_in_default_file = modules_path() . $module_name . '.php';
$module_in_default_file_custom_view = modules_path() . $module_name . '_' . $custom_view . '.php';
$element_in_default_file = elements_path() . $module_name . '.php';
$element_in_default_file = normalize_path($element_in_default_file, false);
//
$module_in_default_file = normalize_path($module_in_default_file, false);
if (is_file($module_in_default_file)) {
$in_dir = false;
if ($custom_view == true and is_file($module_in_default_file_custom_view)) {
$try_file1 = $module_in_default_file_custom_view;
} else {
$try_file1 = $module_in_default_file;
}
} else {
if (is_dir($module_in_default_dir)) {
$in_dir = true;
$mod_d1 = normalize_path($module_in_default_dir, 1);
if ($custom_view == true) {
$try_file1 = $mod_d1 . trim($custom_view) . '.php';
} else {
$try_file1 = $mod_d1 . 'index.php';
}
} elseif (is_file($element_in_default_file)) {
$in_dir = false;
$is_element = true;
$try_file1 = $element_in_default_file;
}
}
}
//
if (isset($try_file1) != false and $try_file1 != false and is_file($try_file1)) {
if (isset($attrs) and is_array($attrs) and !empty($attrs)) {
$attrs2 = array();
foreach ($attrs as $attrs_k => $attrs_v) {
$attrs_k2 = substr($attrs_k, 0, 5);
if (strtolower($attrs_k2) == 'data-') {
$attrs_k21 = substr($attrs_k, 5);
$attrs2[$attrs_k21] = $attrs_v;
} elseif (!isset($attrs['data-' . $attrs_k])) {
$attrs2['data-' . $attrs_k] = $attrs_v;
}
$attrs2[$attrs_k] = $attrs_v;
}
//.........这里部分代码省略.........
示例10: get_custom_css
public function get_custom_css()
{
if (!defined('MW_NO_SESSION')) {
define("MW_NO_SESSION", 1);
}
ob_start();
event_trigger('mw.template.print_custom_css_includes');
$fonts_file = modules_path() . 'editor' . DS . 'fonts' . DS . 'stylesheet.php';
if (is_file($fonts_file)) {
include $fonts_file;
}
$custom_css = get_option("custom_css", "template");
if (is_string($custom_css)) {
print $custom_css;
}
event_trigger('mw.template.print_custom_css');
$output = ob_get_contents();
ob_end_clean();
$l = $output;
$compile_assets = \Config::get('microweber.compile_assets');
if ($compile_assets and defined('MW_VERSION')) {
$userfiles_dir = userfiles_path();
$userfiles_cache_dir = normalize_path($userfiles_dir . 'cache' . DS);
$userfiles_cache_filename = $userfiles_cache_dir . 'custom_css.' . md5(site_url()) . '.' . MW_VERSION . '.css';
if (!is_file($userfiles_cache_filename)) {
if (!is_dir($userfiles_cache_dir)) {
mkdir_recursive($userfiles_cache_dir);
}
if (is_dir($userfiles_cache_dir)) {
@file_put_contents($userfiles_cache_filename, $l);
}
} else {
$fmd5 = md5_file($userfiles_cache_filename);
$fmd = md5($l);
if ($fmd5 != $fmd) {
@file_put_contents($userfiles_cache_filename, $l);
}
}
}
return $output;
}
示例11: scan
//.........这里部分代码省略.........
$configs = array();
if (!empty($dir)) {
foreach ($dir as $filename) {
$skip = false;
if (!isset($options['get_dynamic_layouts'])) {
if (!isset($options['for_modules'])) {
if (strstr($filename, 'modules' . DS)) {
$skip = true;
}
} else {
if (!strstr($filename, 'modules' . DS)) {
$skip = true;
}
}
}
if ($skip == false and is_file($filename)) {
$fin = file_get_contents($filename);
$here_dir = dirname($filename) . DS;
$to_return_temp = array();
if (preg_match('/type:.+/', $fin, $regs)) {
$result = $regs[0];
$result = str_ireplace('type:', '', $result);
$to_return_temp['type'] = trim($result);
$to_return_temp['directory'] = $here_dir;
if (strstr($here_dir, templates_path())) {
$templ_dir = str_replace(templates_path(), '', $here_dir);
if ($templ_dir != '') {
$templ_dir = explode(DS, $templ_dir);
if (isset($templ_dir[0])) {
$to_return_temp['template_dir'] = $templ_dir[0];
}
}
}
if (strstr($here_dir, modules_path())) {
$templ_dir1 = str_replace(modules_path(), '', $here_dir);
$templ_dir1 = str_ireplace('templates', '', $templ_dir1);
$templ_dir1 = str_ireplace('\\', '/', $templ_dir1);
$templ_dir1 = str_ireplace('//', '/', $templ_dir1);
$to_return_temp['module_directory'] = $templ_dir1;
}
if (strtolower($to_return_temp['type']) == 'layout') {
$to_return_temp['directory'] = $here_dir;
if (preg_match('/is_shop:.+/', $fin, $regs)) {
$result = $regs[0];
$result = str_ireplace('is_shop:', '', $result);
$to_return_temp['is_shop'] = trim($result);
}
if (preg_match('/name:.+/', $fin, $regs)) {
$result = $regs[0];
$result = str_ireplace('name:', '', $result);
$to_return_temp['name'] = trim($result);
}
if (preg_match('/is_default:.+/', $fin, $regs)) {
$result = $regs[0];
$result = str_ireplace('is_default:', '', $result);
$to_return_temp['is_default'] = trim($result);
}
if (preg_match('/position:.+/', $fin, $regs)) {
$result = $regs[0];
$result = str_ireplace('position:', '', $result);
$to_return_temp['position'] = intval($result);
} else {
$to_return_temp['position'] = 99999;
}
if (preg_match('/version:.+/', $fin, $regs)) {
$result = $regs[0];
示例12: mw_includes_path
function mw_includes_path()
{
static $folder;
if (!$folder) {
$folder = modules_path() . MW_SYSTEM_MODULE_FOLDER . '/';
}
return $folder;
}
示例13: get_custom_css
public function get_custom_css()
{
ob_start();
event_trigger('mw.template.print_custom_css_includes');
$fonts_file = modules_path() . 'editor' . DS . 'fonts' . DS . 'stylesheet.php';
if (is_file($fonts_file)) {
include $fonts_file;
}
$custom_css = get_option("custom_css", "template");
if (is_string($custom_css)) {
print $custom_css;
}
event_trigger('mw.template.print_custom_css');
$output = ob_get_contents();
ob_end_clean();
return $output;
}
示例14: get_layout
/**
* Return the path to the layout file that will render the page
*
*/
public function get_layout($page = array())
{
$function_cache_id = '';
if (is_array($page)) {
ksort($page);
}
$function_cache_id = $function_cache_id . serialize($page);
$cache_id = __FUNCTION__ . crc32($function_cache_id);
$cache_group = 'content/global';
if (!defined('ACTIVE_TEMPLATE_DIR')) {
if (isset($page['id'])) {
$this->app->content_manager->define_constants($page);
}
}
$cache_content = false;
// $cache_content = $this->app->cache_manager->get($cache_id, $cache_group);
if ($cache_content != false) {
// return $cache_content;
}
$override = $this->app->event_manager->trigger('mw.front.get_layout', $page);
$render_file = false;
$look_for_post = false;
$template_view_set_inner = false;
$fallback_render_internal_file = false;
$site_template_settings = $this->app->option_manager->get('current_template', 'template');
if (!isset($page['active_site_template'])) {
$page['active_site_template'] = 'default';
} elseif (isset($page['active_site_template']) and $page['active_site_template'] == '') {
$page['active_site_template'] = $site_template_settings;
}
if ($page['active_site_template'] and ($page['active_site_template'] == 'default' or $page['active_site_template'] == 'mw_default')) {
if ($site_template_settings != 'default' and $page['active_site_template'] == 'mw_default') {
$page['active_site_template'] = 'default';
$site_template_settings = 'default';
}
if ($site_template_settings != false) {
$site_template_settings = str_replace('..', '', $site_template_settings);
$site_template_settings_dir = TEMPLATES_DIR . $site_template_settings . DS;
if (is_dir($site_template_settings_dir) != false) {
$page['active_site_template'] = $site_template_settings;
}
}
}
if (isset($page['content_type'])) {
$page['content_type'] = str_replace('..', '', $page['content_type']);
}
if (isset($page['subtype'])) {
$page['subtype'] = str_replace('..', '', $page['subtype']);
}
if (isset($page['layout_file'])) {
$page['layout_file'] = str_replace('..', '', $page['layout_file']);
}
if (isset($page['active_site_template'])) {
$page['active_site_template'] = str_replace('..', '', $page['active_site_template']);
}
if (is_array($override)) {
foreach ($override as $resp) {
if (isset($resp['render_file']) and $resp['render_file'] != false) {
$render_file = $resp['render_file'];
} elseif (is_array($resp) and !empty($resp)) {
$page = array_merge($page, $resp);
}
}
}
if ($render_file == false) {
if (isset($page['active_site_template']) and isset($page['layout_file'])) {
$page['layout_file'] = str_replace('___', DS, $page['layout_file']);
$page['layout_file'] = str_replace('__', DS, $page['layout_file']);
$page['layout_file'] = str_replace('..', '', $page['layout_file']);
$template_d = $page['active_site_template'];
if ($template_d == 'mw_default') {
$template_d = 'default';
}
$render_file_temp = normalize_path(TEMPLATES_DIR . $template_d . DS . $page['layout_file'], false);
$render_use_default = normalize_path(TEMPLATES_DIR . $template_d . DS . 'use_default_layouts.php', false);
$render_file_module_temp = modules_path() . DS . $page['layout_file'];
$render_file_module_temp = normalize_path($render_file_module_temp, false);
if (is_file($render_file_temp)) {
$render_file = $render_file_temp;
} elseif (is_file($render_file_module_temp)) {
$render_file = $render_file_module_temp;
} elseif (is_file($render_use_default)) {
$render_file_temp = DEFAULT_TEMPLATE_DIR . $page['layout_file'];
if (is_file($render_file_temp)) {
$render_file = $render_file_temp;
}
}
}
}
if ($render_file == false and isset($page['content_type']) and isset($page['parent']) and $page['content_type'] != 'page') {
$get_layout_from_parent = false;
$par = $this->app->content_manager->get_by_id($page['parent']);
if (isset($par['layout_file']) and $par['layout_file'] != '' and $par['layout_file'] != 'inherit') {
$get_layout_from_parent = $par;
} elseif (isset($par['is_home']) and isset($par['active_site_template']) and (!isset($par['layout_file']) or $par['layout_file'] == '') and $par['is_home'] == 'y') {
$par['layout_file'] = 'index.php';
//.........这里部分代码省略.........
示例15: checkout_ipn
public function checkout_ipn($data)
{
if (isset($data['payment_verify_token'])) {
$payment_verify_token = $data['payment_verify_token'];
}
if (!isset($data['payment_gw'])) {
return array('error' => 'You must provide a payment gateway parameter!');
}
$data['payment_gw'] = str_replace('..', '', $data['payment_gw']);
$hostname = $this->get_domain_from_str($_SERVER['REMOTE_ADDR']);
$payment_verify_token = $this->app->database_manager->escape_string($payment_verify_token);
$table = $this->tables['cart_orders'];
$query = array();
$query['payment_verify_token'] = $payment_verify_token;
if (isset($data['order_id'])) {
$query['id'] = intval($data['order_id']);
} else {
$query['transaction_id'] = '[null]';
}
$query['limit'] = 1;
$query['table'] = $table;
$query['no_cache'] = true;
$ord_data = $this->app->database_manager->get($query);
if (!isset($ord_data[0]) or !is_array($ord_data[0])) {
return array('error' => 'Order is completed or expired.');
} else {
$ord_data = $ord_data[0];
$ord = $ord_data['id'];
}
$cart_table = $this->tables['cart'];
$table_orders = $this->tables['cart_orders'];
$data['payment_gw'] = str_replace('..', '', $data['payment_gw']);
$gw_process = modules_path() . $data['payment_gw'] . '_checkout_ipn.php';
if (!is_file($gw_process)) {
$gw_process = normalize_path(modules_path() . $data['payment_gw'] . DS . 'checkout_ipn.php', false);
}
$update_order = array();
if (is_file($gw_process)) {
include $gw_process;
} else {
return array('error' => 'The payment gateway is not found!');
}
if (!empty($update_order) and isset($update_order['order_completed']) and trim($update_order['order_completed']) == 1) {
$update_order['id'] = $ord;
$update_order['payment_gw'] = $data['payment_gw'];
$ord = $this->app->database_manager->save($table_orders, $update_order);
$this->confirm_email_send($ord);
if (isset($update_order['is_paid']) and $update_order['is_paid'] == 1) {
$this->update_quantities($ord);
}
if ($ord > 0) {
$this->app->cache_manager->delete('cart/global');
$this->app->cache_manager->delete('cart_orders/global');
//return true;
}
}
if (isset($data['return_to'])) {
$return_to = urldecode($data['return_to']);
$append = '?';
if (strstr($return_to, '?')) {
$append = '&';
}
$return_to = $return_to . $append . 'mw_payment_success=1';
return $this->app->url_manager->redirect($return_to);
}
return;
}