本文整理汇总了PHP中fn_define函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_define函数的具体用法?PHP fn_define怎么用?PHP fn_define使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_define函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionComplete
/**
* Setup complete action
*
* @param array $params Request variables
*
* @return bool Always true
*/
public function actionComplete($params = array())
{
$validator = new Validator();
$app = App::instance();
fn_define('CART_LANGUAGE', $app->getCurrentLangCode());
fn_define('DESCR_SL', $app->getCurrentLangCode());
$database = $app->getFromStorage('database_settings');
if (!empty($database)) {
$result = $validator->isMysqlSettingsValid($database['host'], $database['name'], $database['user'], $database['password'], $database['table_prefix'], $database['database_backend'], false);
if ($result) {
// Delete installer after store was installed.
fn_rm(Registry::get('config.dir.root') . '/install');
session_destroy();
$this->_prepareHttpData();
Session::init($params);
$user_data = array('user_id' => 1, 'user_type' => 'A', 'area' => 'A', 'login' => 'admin', 'is_root' => 'Y', 'company_id' => 0);
$_SESSION['auth'] = fn_fill_auth($user_data, array(), false, 'A');
if (is_file(Registry::get('config.dir.root') . '/install/index.php')) {
$_SESSION['notifications']['installer'] = array('type' => 'W', 'title' => 'warning', 'message' => 'delete_install_folder', 'message_state' => 'S', 'new' => true, 'extra' => '', 'init_message' => true);
}
$redirect_url = Registry::get('config.http_location') . '/' . Registry::get('config.admin_index') . '?welcome';
fn_redirect($redirect_url);
}
}
fn_redirect('install/index.php');
return true;
}
示例2: fn_watermarks_init_company_data
function fn_watermarks_init_company_data(&$params, &$company_id, &$company_data)
{
if (fn_allowed_for('ULTIMATE')) {
if ($company_id) {
fn_define('WATERMARK_IMAGE_ID', $company_id);
fn_define('WATERMARKS_DIR_NAME', 'watermarked/' . $company_id . '/');
} else {
fn_define('WATERMARK_IMAGE_ID', 0);
fn_define('WATERMARKS_DIR_NAME', 'watermarked/');
}
} else {
fn_define('WATERMARK_IMAGE_ID', 1);
fn_define('WATERMARKS_DIR_NAME', 'watermarked/');
}
}
示例3: update
public function update($id, $params)
{
fn_define('NEW_FEATURE_GROUP_ID', 'OG');
$status = Response::STATUS_BAD_REQUEST;
$data = array();
unset($params['feature_id']);
if (!empty($params['variants'])) {
list($variants) = fn_get_product_feature_variants(array('feature_id' => $id));
$params['original_var_ids'] = implode(',', array_keys($variants));
}
$lang_code = $this->safeGet($params, 'lang_code', DEFAULT_LANGUAGE);
$feature_id = fn_update_product_feature($params, $id, $lang_code);
if ($feature_id) {
$status = Response::STATUS_OK;
$data = array('feature_id' => $feature_id);
}
return array('status' => $status, 'data' => $data);
}
示例4: fn_detect_cyrillic_charset
/**
* Detect the cyrillic encoding of string
*
* @param string $str
* @return string cyrillic encoding
*/
function fn_detect_cyrillic_charset($str)
{
fn_define('LOWERCASE', 3);
fn_define('UPPERCASE', 1);
$charsets = array('KOI8-R' => 0, 'CP1251' => 0, 'CP866' => 0, 'ISO-8859-5' => 0, 'MAC-CYRILLIC' => 0);
for ($i = 0, $length = strlen($str); $i < $length; $i++) {
$char = ord($str[$i]);
//non-russian characters
if ($char < 128 || $char > 256) {
continue;
}
//CP866
if ($char > 159 && $char < 176 || $char > 223 && $char < 242) {
$charsets['CP866'] += LOWERCASE;
}
if ($char > 127 && $char < 160) {
$charsets['CP866'] += UPPERCASE;
}
//KOI8-R
if ($char > 191 && $char < 223) {
$charsets['KOI8-R'] += LOWERCASE;
}
if ($char > 222 && $char < 256) {
$charsets['KOI8-R'] += UPPERCASE;
}
//CP1251
if ($char > 223 && $char < 256) {
$charsets['CP1251'] += LOWERCASE;
}
if ($char > 191 && $char < 224) {
$charsets['CP1251'] += UPPERCASE;
}
//MAC-CYRILLIC
if ($char > 221 && $char < 255) {
$charsets['MAC-CYRILLIC'] += LOWERCASE;
}
if ($char > 127 && $char < 160) {
$charsets['MAC-CYRILLIC'] += UPPERCASE;
}
//ISO-8859-5
if ($char > 207 && $char < 240) {
$charsets['ISO-8859-5'] += LOWERCASE;
}
if ($char > 175 && $char < 208) {
$charsets['ISO-8859-5'] += UPPERCASE;
}
}
arsort($charsets);
return current($charsets) > 0 ? key($charsets) : '';
}
示例5: fn_print_die
if (defined('AJAX_REQUEST')) {
Tygh::$app['view']->display('addons/ebay/views/ebay/components/category_features.tpl');
exit;
} else {
fn_print_die($features, $_REQUEST);
}
} elseif ($mode == 'get_shippings') {
$template_data = fn_get_ebay_template($_REQUEST['template_id']);
Tygh::$app['view']->assign('shipping_type', $_REQUEST['shipping_type']);
Tygh::$app['view']->assign('template_data', $template_data);
if (defined('AJAX_REQUEST')) {
Tygh::$app['view']->display('addons/ebay/views/ebay/update.tpl');
exit;
}
} elseif ($mode == 'get_orders') {
fn_define('ORDER_MANAGEMENT', true);
if (fn_allowed_for('ULTIMATE')) {
if (Registry::get('runtime.company_id')) {
list($success_orders, $failed_orders) = fn_get_ebay_orders($cart, $customer_auth);
if (!empty($success_orders)) {
fn_set_notification('N', __('successful'), __('ebay_success_orders_notice', array('[SUCCESS_IDS]' => implode(', ', $success_orders))));
} elseif (!empty($failed_orders)) {
fn_set_notification('W', __('warning'), __('ebay_failed_orders_notice', array('[FAILED_EBAY_IDS]' => implode(', ', $failed_orders))));
} else {
fn_set_notification('W', __('warning'), 'no orders found');
}
} else {
fn_set_notification('W', __('warning'), __('store_object_denied', array('[object_type]' => '', '[object_name]' => '')), '', 'store_object_denied');
}
} else {
list($success_orders, $failed_orders) = fn_get_ebay_orders($cart, $customer_auth);
示例6: fn_init_addon_controllers
/**
* Generates list of (pre/post)controllers from active addons
*
* @param string $controller controller name
* @param string $type controller type (pre/post)
* @return array controllers list and active addons
*/
function fn_init_addon_controllers($controller, $type = GET_CONTROLLERS, $area = AREA)
{
$controllers = array();
static $addons = array();
$prefix = '';
$area_name = fn_get_area_name($area);
if ($type == GET_POST_CONTROLLERS) {
$prefix = '.post';
} elseif ($type == GET_PRE_CONTROLLERS) {
$prefix = '.pre';
}
foreach ((array) Registry::get('addons') as $addon_name => $data) {
if ($data['status'] == 'A') {
// try to find area-specific controller
$dir = Registry::get('config.dir.addons') . $addon_name . '/controllers/' . $area_name . '/';
if (is_readable($dir . $controller . $prefix . '.php')) {
$controllers[] = $dir . $controller . $prefix . '.php';
$addons[$addon_name] = true;
if (empty($prefix)) {
fn_define('LOADED_ADDON_PATH', $addon_name);
}
}
// try to find common controller
$dir = Registry::get('config.dir.addons') . $addon_name . '/controllers/common/';
if (is_readable($dir . $controller . $prefix . '.php')) {
$controllers[] = $dir . $controller . $prefix . '.php';
$addons[$addon_name] = true;
if (empty($prefix)) {
fn_define('LOADED_ADDON_PATH', $addon_name);
}
}
}
}
return array($controllers, $addons);
}
示例7: die
<?php
/***************************************************************************
* *
* Copyright (c) 2004 Simbirsk Technologies Ltd. All rights reserved. *
* *
* This is commercial software, only users who have purchased a valid *
* license and accept to the terms of the License Agreement can install *
* and use this program. *
* *
****************************************************************************
* PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
****************************************************************************/
//
// $Id: init.php 10229 2010-07-27 14:21:39Z 2tl $
//
if (!defined('AREA')) {
die('Access denied');
}
fn_define('SEO_FILENAME_EXTENSION', '.html');
fn_register_hooks('url', 'get_route', 'before_dispatch', 'update_category', 'get_category_data', 'get_category_data_post', 'get_categories', 'get_categories_post', 'delete_category', 'update_product', 'get_products', 'get_products_post', 'get_product_data', 'delete_product', 'update_page', 'get_page_data', 'delete_page', 'get_product_feature_variants', 'update_product_feature', 'get_news', 'get_news_post', 'get_news_data', 'update_news', 'delete_news');
示例8: die
* *
****************************************************************************
* PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
****************************************************************************/
use Tygh\Bootstrap;
use Tygh\Registry;
use Tygh\Storage;
use Tygh\Tools\Url;
if (!defined('BOOTSTRAP')) {
die('Access denied');
}
// Set line endings autodetection
ini_set('auto_detect_line_endings', true);
set_time_limit(0);
fn_define('DB_LIMIT_SELECT_ROW', 30);
if (empty($_SESSION['export_ranges'])) {
$_SESSION['export_ranges'] = array();
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$suffix = '';
$layout_data = !empty($_REQUEST['layout_data']) ? $_REQUEST['layout_data'] : array();
//
// Select layout
//
if ($mode == 'set_layout') {
db_query("UPDATE ?:exim_layouts SET active = 'N' WHERE pattern_id = ?s", $layout_data['pattern_id']);
db_query("UPDATE ?:exim_layouts SET active = 'Y' WHERE layout_id = ?i", $layout_data['layout_id']);
return array(CONTROLLER_STATUS_OK, 'exim.export?section=' . $_REQUEST['section'] . '&pattern_id=' . $layout_data['pattern_id']);
}
//
示例9: die
<?php
/***************************************************************************
* *
* (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev *
* *
* This is commercial software, only users who have purchased a valid *
* license and accept to the terms of the License Agreement can install *
* and use this program. *
* *
****************************************************************************
* PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
****************************************************************************/
// rus_build_kupivkredit dbazhenov
if (!defined('BOOTSTRAP')) {
die('Access denied');
}
fn_define('KVK_API_URL', 'api.kupivkredit.ru');
fn_define('KVK_API_TEST_URL', 'kupivkredit-test-api.tcsbank.ru');
fn_define('KVK_WIDGET_URL', 'www.kupivkredit.ru');
fn_define('KVK_WIDGET_TEST_URL', 'kupivkredit-test-fe.tcsbank.ru');
示例10: die
if (!defined('AREA')) {
die('Access denied');
}
use Tygh\Registry;
use Twigmo\Core\TwigmoSettings;
use Twigmo\Core\TwigmoConnector;
// addon version
fn_define('TWIGMO_VERSION', '3.8');
fn_define('TWIGMO_UPGRADE_DIR', Registry::get('config.dir.var') . 'twigmo/');
fn_define('TWIGMO_UA_RULES_FILE', TWIGMO_UPGRADE_DIR . 'ua_rules.txt');
fn_define('TWIGMO_UPGRADE_VERSION_FILE', 'version_info.txt');
fn_define('TWG_UA_RULES_STAT', 'http://twigmo.com/svc2/ua_meta/stat.php');
fn_define('TWG_DEFAULT_DATA_FORMAT', 'json');
fn_define('TWG_DEFAULT_API_VERSION', '2.0');
fn_define('TWG_RESPONSE_ITEMS_LIMIT', 10);
fn_define('TWG_MAX_DESCRIPTION_LEN', 200);
if (Registry::get('addons.twigmo.status') == 'A' && TwigmoSettings::dbIsInited()) {
$settings = array();
$settings['unsupported_payment_methods'] = array('FRIbetaling', 'PayPal Advanced', 'FuturePay');
$settings['unsupported_shipping_methods'] = array();
$settings['block_types'] = array('products', 'categories', 'pages', 'html_block');
if (Registry::get('addons.banners.status') == 'A') {
$settings['block_types'][] = 'banners';
}
$settings['images'] = array('cart' => array('width' => 96, 'height' => 96), 'catalog' => array('width' => 200, 'height' => 200), 'prewiew' => array('width' => 130, 'height' => 120), 'big' => array('width' => 800, 'height' => 800, 'keep_proportions' => true));
fn_set_hook('twg_config', $settings);
// Init twigmo settings
TwigmoSettings::moveToRuntime($settings);
}
if (file_exists(Registry::get('config.dir.addons') . 'twigmo/local_conf.php')) {
include Registry::get('config.dir.addons') . 'twigmo/local_conf.php';
示例11: fn_calculate_tax_rates
function fn_calculate_tax_rates($taxes, $price, $amount, $auth, &$cart)
{
static $destination_id;
static $tax_description;
static $user_data;
$taxed_price = $price;
if (!empty($cart['user_data']) && !fn_is_empty($cart['user_data'])) {
$profile_fields = fn_get_profile_fields('O', $auth);
$billing_population = fn_check_profile_fields_population($cart['user_data'], 'B', $profile_fields);
$shipping_population = fn_check_profile_fields_population($cart['user_data'], 'S', $profile_fields);
if (empty($auth['user_id']) && (!$shipping_population || !$billing_population)) {
fn_define('ESTIMATION', true);
}
}
if (empty($auth['user_id']) && (empty($cart['user_data']) || fn_is_empty($cart['user_data']) || $billing_population != true || $shipping_population != true) && Registry::get('runtime.checkout') && Registry::get('settings.Appearance.taxes_using_default_address') !== 'Y' && !defined('ESTIMATION')) {
return false;
}
if (empty($destination_id) || $user_data != @$cart['user_data']) {
// Get billing location
$location = fn_get_customer_location($auth, $cart, true);
$destination_id['B'] = fn_get_available_destination($location);
// Get shipping location
$location = fn_get_customer_location($auth, $cart);
$destination_id['S'] = fn_get_available_destination($location);
}
if (!empty($cart['user_data'])) {
$user_data = $cart['user_data'];
}
$_tax = 0;
$previous_priority = -1;
$previous_price = '';
foreach ($taxes as $key => $tax) {
if (empty($tax['tax_id'])) {
$tax['tax_id'] = $key;
}
if (empty($tax['priority'])) {
$tax['priority'] = 0;
}
$_is_zero = floatval($taxed_price);
if (empty($_is_zero)) {
continue;
}
if (!empty($cart['stored_taxes']) && $cart['stored_taxes'] == 'Y' && (!empty($tax['rate_type']) || isset($cart['taxes'][$tax['tax_id']]['rate_value']))) {
$rate = array('rate_value' => isset($cart['taxes'][$tax['tax_id']]['rate_value']) ? $cart['taxes'][$tax['tax_id']]['rate_value'] : $tax['rate_value'], 'rate_type' => isset($cart['taxes'][$tax['tax_id']]['rate_type']) ? $cart['taxes'][$tax['tax_id']]['rate_type'] : $tax['rate_type']);
} else {
if (!isset($destination_id[$tax['address_type']])) {
continue;
}
$rate = db_get_row("SELECT destination_id, rate_value, rate_type FROM ?:tax_rates WHERE tax_id = ?i AND destination_id = ?i", $tax['tax_id'], $destination_id[$tax['address_type']]);
if (!@floatval($rate['rate_value'])) {
continue;
}
}
$base_price = $tax['priority'] == $previous_priority ? $previous_price : $taxed_price;
if ($rate['rate_type'] == 'P') {
// Percent dependence
// If tax is included into the price
if ($tax['price_includes_tax'] == 'Y') {
$_tax = fn_format_price($base_price - $base_price / (1 + $rate['rate_value'] / 100));
// If tax is NOT included into the price
} else {
$_tax = fn_format_price($base_price * ($rate['rate_value'] / 100));
$taxed_price += $_tax;
}
} else {
$_tax = fn_format_price($rate['rate_value']);
// If tax is NOT included into the price
if ($tax['price_includes_tax'] != 'Y') {
$taxed_price += $_tax;
}
}
$previous_priority = $tax['priority'];
$previous_price = $base_price;
if (empty($tax_description[$tax['tax_id']])) {
$tax_description[$tax['tax_id']] = db_get_field("SELECT tax FROM ?:tax_descriptions WHERE tax_id = ?i AND lang_code = ?s", $tax['tax_id'], CART_LANGUAGE);
}
$taxes_data[$tax['tax_id']] = array('rate_type' => $rate['rate_type'], 'rate_value' => $rate['rate_value'], 'price_includes_tax' => $tax['price_includes_tax'], 'regnumber' => @$tax['regnumber'], 'priority' => @$tax['priority'], 'tax_subtotal' => fn_format_price($_tax * $amount), 'description' => $tax_description[$tax['tax_id']]);
}
return empty($taxes_data) ? false : $taxes_data;
}
示例12: fn_promotion_get_dynamic
/**
* Get promotion dynamic properties
*
* @param array $promotion_id promotion ID
* @param array $promotion promotion condition
* @param array $condition condition
* @param array $cart cart
* @param array $auth auth information
* @return mixed
*/
function fn_promotion_get_dynamic($promotion_id, $promotion, $condition, &$cart, &$auth = NULL)
{
if ($condition == 'number_of_usages') {
$usages = db_get_field("SELECT number_of_usages FROM ?:promotions WHERE promotion_id = ?i", $promotion_id);
return intval($usages) + 1;
} elseif ($condition == 'once_per_customer') {
fn_define('PROMOTION_MIN_MATCHES', 5);
$order_statuses = fn_get_statuses(STATUSES_ORDER, false, true);
$_statuses = array();
foreach ($order_statuses as $v) {
if ($v['inventory'] == 'D') {
// decreasing (positive) status
$_statuses[] = $v['status'];
}
}
if (empty($cart['user_data'])) {
return 'Y';
}
$udata = $cart['user_data'];
fn_fill_user_fields($udata);
$exists = db_get_field("SELECT ((firstname = ?s) + (lastname = ?s) + (b_city = ?s) + (b_state = ?s) + (b_country = ?s) + (b_zipcode = ?s) + (email = ?s) * 6) as r FROM ?:orders WHERE FIND_IN_SET(promotion_ids, ?i) AND status IN (?a) HAVING r >= ?i LIMIT 1", $udata['firstname'], $udata['lastname'], $udata['b_city'], $udata['b_state'], $udata['b_country'], $udata['b_zipcode'], $udata['email'], $promotion_id, $_statuses, PROMOTION_MIN_MATCHES);
$promotion_data = fn_get_promotion_data($promotion_id);
$coupon_exist = false;
if (!empty($promotion_data['conditions']['conditions'])) {
foreach ($promotion_data['conditions']['conditions'] as $val) {
if ($val['condition'] == 'coupon_code') {
$coupon_exist = fn_promotion_validate_coupon($val, $cart);
if (!empty($coupon_exist) && !empty($exists)) {
fn_set_notification('E', fn_get_lang_var('error'), fn_get_lang_var('text_can_be_used_once'), false, 'error_coupon_already_used');
}
break;
}
}
}
if (!empty($exists)) {
return 'N';
}
return 'Y';
// this is checkbox with values (Y/N), so we need to return appropriate values
}
}
示例13: fn_define
require DIR_CORE . 'fn.init.php';
require DIR_CORE . 'fn.control.php';
require DIR_CORE . 'fn.search.php';
require DIR_CORE . 'fn.promotions.php';
require DIR_CORE . 'fn.log.php';
require DIR_CORE . 'fn.companies.php';
if (in_array(PRODUCT_TYPE, array('PROFESSIONAL', 'MULTIVENDOR', 'MULTISHOP'))) {
require DIR_CORE . 'editions/fn.pro_functions.php';
}
if (in_array(PRODUCT_TYPE, array('MULTIVENDOR', 'MULTISHOP'))) {
require DIR_CORE . 'editions/fn.mve_functions.php';
}
if (PRODUCT_TYPE == 'MULTISHOP') {
require DIR_CORE . 'editions/fn.mse_functions.php';
}
fn_define('ACCOUNT_TYPE', 'customer');
if (file_exists(DIR_CORE . 'classes/profiler.php')) {
require DIR_CORE . 'classes/profiler.php';
require DIR_CORE . 'classes/registry.php';
require DIR_CORE . 'classes/session.php';
} else {
require DIR_CORE . 'class.profiler.php';
require DIR_CORE . 'class.registry.php';
require DIR_CORE . 'class.session.php';
}
// Used for the javascript to be able to hide the Loading box when a downloadable file (pdf, etc.) is ready
//setcookie('page_unload', 'N', '0', !empty($config['current_path'])? $config['current_path'] : '/');
if (isset($_GET['ct']) && (AREA == 'A' || defined('DEVELOPMENT'))) {
fn_rm(DIR_THUMBNAILS, false);
}
// Set configuration options from config.php to registry
示例14: fn_define
// API request timeout
fn_define('SE_PRODUCTS_PER_PASS', 100);
// Number of products submitted in a single API request during a full catalog synchronization
fn_define('SE_USE_RELEVANCE_AS_DEFAULT_SORTING', 'Y');
// Y or N (Set Sorting by relevance as the default sorting on product search in the storefront)
//
// Not configurable constants
//
fn_define('SE_VERSION', '1.3');
fn_define('SE_IMAGE_SIZE', 100);
fn_define('SE_MEMORY_LIMIT', 512);
fn_define('SE_MAX_ERROR_COUNT', 15);
fn_define('SE_MAX_PROCESSING_TIME', 720);
fn_define('SE_MAX_SEARCH_REQUEST_LENGTH', '8000');
fn_define('SE_SERVICE_URL', 'http://www.searchanise.com');
fn_define('SE_PLATFORM', 'cs-cart4');
function fn_searchanise_init_secure_controllers(&$controllers)
{
$controllers['searchanise'] = 'passive';
}
function fn_searchanise_dispatch_assign_template($controller, $mode, $area)
{
if (AREA != 'C') {
return;
}
if (!fn_allowed_for('ULTIMATE') && fn_se_get_import_status(fn_se_get_company_id(), CART_LANGUAGE) == 'done') {
$se_active_companies = db_get_fields("SELECT company_id FROM ?:companies WHERE status = 'A'");
$se_active_companies = join('|', $se_active_companies);
$se_active_companies = '0' . (empty($se_active_companies) ? '' : '|') . $se_active_companies;
Registry::set('se_active_companies', $se_active_companies);
Tygh::$app['view']->assign('se_active_companies', $se_active_companies);
示例15: die
<?php
if (!defined('BOOTSTRAP')) {
die('Access denied');
}
fn_define('DISABLE_HOOK_CACHE', true);
fn_register_hooks('get_products_post');