本文整理汇总了PHP中fn_is_empty函数 的典型用法代码示例。如果您正苦于以下问题:PHP fn_is_empty函数的具体用法?PHP fn_is_empty怎么用?PHP fn_is_empty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_is_empty函数 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: downloadDistr
public static function downloadDistr()
{
// Get needed version
$version_info = self::GetNextVersionInfo();
if (!$version_info['next_version'] || !$version_info['update_url']) {
return false;
}
$download_file_dir = TWIGMO_UPGRADE_DIR . $version_info['next_version'] . '/';
$download_file_path = $download_file_dir . 'twigmo.tgz';
$unpack_path = $download_file_path . '_unpacked';
fn_rm($download_file_dir);
fn_mkdir($download_file_dir);
fn_mkdir($unpack_path);
$data = fn_get_contents($version_info['update_url']);
if (!fn_is_empty($data)) {
fn_put_contents($download_file_path, $data);
$res = fn_decompress_files($download_file_path, $unpack_path);
if (!$res) {
fn_set_notification('E', __('error'), __('twgadmin_failed_to_decompress_files'));
return false;
}
return $unpack_path . '/';
} else {
fn_set_notification('E', __('error'), __('text_uc_cant_download_package'));
return false;
}
}
开发者ID:askzap, 项目名称:ultimate, 代码行数:27, 代码来源:TwigmoUpgrade.php
示例2: write
public function write($type, $object, $message = '')
{
$data = array(0 => '', 1 => '', 2 => '');
if ($type == self::SKIP_PRODUCT) {
$product_name = fn_substr($object['product'], 0, 20);
if (strlen($object['product']) > 20) {
$product_name .= "...";
}
$data[0] = '[SKIP PRODUCT]';
$data[1] = $object['product_id'] . " (" . $product_name . ") - ";
$data[2] = $message;
} elseif ($type == self::INFO) {
$data[0] = '[INFO]';
if (!is_array($object)) {
$data[1] = $object;
}
if (!empty($message)) {
$data[2] = $message;
}
}
if (!fn_is_empty($data)) {
if ($this->format == 'csv') {
fwrite($this->file, $this->csv($data) . PHP_EOL);
} else {
fwrite($this->file, implode(' ', $data) . PHP_EOL);
}
}
}
开发者ID:ambient-lounge, 项目名称:site, 代码行数:28, 代码来源:Logs.php
示例3: fn_send_sms_notification
function fn_send_sms_notification($body)
{
$access_data = fn_get_sms_auth_data();
$to = Registry::get('addons.sms_notifications.phone_number');
if (fn_is_empty($access_data) || empty($to)) {
return false;
}
$concat = Registry::get('addons.sms_notifications.clickatel_concat');
//get the last symbol
if (!empty($concat)) {
$concat = intval($concat[strlen($concat) - 1]);
}
if (!in_array($concat, array('1', '2', '3'))) {
$concat = 1;
}
$data = array('user' => $access_data['login'], 'password' => $access_data['password'], 'api_id' => $access_data['api_id'], 'to' => $to, 'concat' => $concat);
$unicode = Registry::get('addons.sms_notifications.clickatel_unicode') == 'Y' ? 1 : 0;
$sms_length = $unicode ? SMS_NOTIFICATIONS_SMS_LENGTH_UNICODE : SMS_NOTIFICATIONS_SMS_LENGTH;
if ($concat > 1) {
$sms_length *= $concat;
$sms_length -= $concat * SMS_NOTIFICATIONS_SMS_LENGTH_CONCAT;
// If a message is concatenated, it reduces the number of characters contained in each message by 7
}
$body = html_entity_decode($body, ENT_QUOTES, 'UTF-8');
$body = fn_substr($body, 0, $sms_length);
if ($unicode) {
$data['unicode'] = '1';
$body = fn_convert_encoding('UTF-8', 'UCS-2', $body);
$body = bin2hex($body);
}
$data['text'] = $body;
Http::get('http://api.clickatell.com/http/sendmsg', $data);
}
开发者ID:heg-arc-ne, 项目名称:cscart, 代码行数:33, 代码来源:func.php
示例4: fn_exim_set_product_categories
function fn_exim_set_product_categories($product_id, $link_type, $data, $category_delimiter, $lang_code = CART_LANGUAGE)
{
if (empty($data)) {
return false;
}
$set_delimiter = ';';
$paths = array();
$updated_categories = array();
// Check if array is provided
if (strpos($data, $set_delimiter) !== false) {
$paths = explode($set_delimiter, $data);
array_walk($paths, 'fn_trim_helper');
} else {
$paths[] = $data;
}
if (!fn_is_empty($paths)) {
$old_data = db_get_hash_array("SELECT * FROM ?:products_categories WHERE product_id= ?i", 'category_id', $product_id);
foreach ($old_data as $k => $v) {
if ($v['link_type'] == $link_type) {
$updated_categories[] = $k;
}
}
db_query("DELETE FROM ?:products_categories WHERE product_id = ?i AND link_type = ?s", $product_id, $link_type);
}
foreach ($paths as $category) {
$categories = strpos($category, $category_delimiter) !== false ? explode($category_delimiter, $category) : array($category);
if (!empty($categories)) {
$parent_id = '0';
foreach ($categories as $cat) {
$category_id = db_get_field("SELECT ?:categories.category_id FROM ?:category_descriptions INNER JOIN ?:categories ON ?:categories.category_id = ?:category_descriptions.category_id WHERE ?:category_descriptions.category = ?s AND lang_code = ?s AND parent_id = ?i", $cat, $lang_code, $parent_id);
if (!empty($category_id)) {
$parent_id = $category_id;
} else {
$category_data = array('parent_id' => $parent_id, 'category' => $cat);
$category_id = fn_update_category($category_data);
$parent_id = $category_id;
}
}
$data = array('product_id' => $product_id, 'category_id' => $category_id, 'link_type' => $link_type);
if (!empty($old_data) && !empty($old_data[$category_id])) {
$data = fn_array_merge($old_data[$category_id], $data);
}
db_query("REPLACE INTO ?:products_categories ?e", $data);
$updated_categories[] = $category_id;
}
}
if (!empty($updated_categories)) {
fn_update_product_count($updated_categories);
return true;
}
return false;
}
开发者ID:diedsmiling, 项目名称:busenika, 代码行数:52, 代码来源:products.php
示例5: fn_statistics_get_banners
function fn_statistics_get_banners(&$banners)
{
if (AREA == 'C' && !fn_is_empty($banners) && !defined('AJAX_REQUEST')) {
foreach ($banners as $k => $v) {
if ($v['type'] == 'T' && !empty($v['description'])) {
$i = $pos = 0;
$matches = array();
while (preg_match('/href=([\'|"])(.*?)([\'|"])/i', $banners[$k]['description'], $matches, PREG_OFFSET_CAPTURE, $pos)) {
$banners[$k]['description'] = substr_replace($banners[$k]['description'], fn_url("statistics.banners?banner_id={$v['banner_id']}&link=" . $i++, 'C'), $matches[2][1], strlen($matches[2][0]));
$pos = $matches[2][1];
}
} elseif (!empty($v['url'])) {
$banners[$k]['url'] = "statistics.banners?banner_id={$v['banner_id']}";
}
db_query('INSERT INTO ?:stat_banners_log ?e', array('banner_id' => $v['banner_id'], 'type' => 'V', 'timestamp' => TIME));
}
} else {
return false;
}
}
开发者ID:diedsmiling, 项目名称:busenika, 代码行数:20, 代码来源:func.php
示例6: content_55e354516160e0_24473059
//.........这里部分代码省略.........
" href="<?php
echo htmlspecialchars(fn_url("companies.update?company_id=" . (string) $_smarty_tpl->tpl_vars['company']->value['company_id']), ENT_QUOTES, 'UTF-8');
?>
"><?php
echo htmlspecialchars($_smarty_tpl->tpl_vars['company']->value['company'], ENT_QUOTES, 'UTF-8');
?>
</a></td>
<?php
if (!fn_allowed_for("ULTIMATE")) {
?>
<td><a href="mailto:<?php
echo htmlspecialchars($_smarty_tpl->tpl_vars['company']->value['email'], ENT_QUOTES, 'UTF-8');
?>
"><?php
echo htmlspecialchars($_smarty_tpl->tpl_vars['company']->value['email'], ENT_QUOTES, 'UTF-8');
?>
</a></td>
<?php
}
?>
<td><?php
echo htmlspecialchars(smarty_modifier_date_format($_smarty_tpl->tpl_vars['company']->value['timestamp'], (string) $_smarty_tpl->tpl_vars['settings']->value['Appearance']['date_format'] . ", " . (string) $_smarty_tpl->tpl_vars['settings']->value['Appearance']['time_format']), ENT_QUOTES, 'UTF-8');
?>
</td>
<?php
if (!fn_allowed_for("ULTIMATE")) {
?>
<td class="right"><?php
if ($_smarty_tpl->tpl_vars['company']->value['status'] != "A") {
echo $_smarty_tpl->__("disable");
} else {
echo $_smarty_tpl->__("active");
}
?>
</td>
<?php
}
?>
</tr>
<?php
}
if (!$_smarty_tpl->tpl_vars['company']->_loop) {
?>
<tr class="no-items">
<?php
if (!fn_allowed_for("ULTIMATE")) {
?>
<td colspan="6"><p><?php
echo $_smarty_tpl->__("no_data");
?>
</p></td>
<?php
} else {
?>
<td colspan="4"><p><?php
echo $_smarty_tpl->__("no_data");
?>
</p></td>
<?php
}
?>
</tr>
<?php
}
?>
</table>
<?php
echo $_smarty_tpl->getSubTemplate("common/pagination.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('div_id' => "pagination_" . (string) $_REQUEST['data_id']), 0);
?>
<div class="buttons-container">
<?php
if ($_REQUEST['display'] == "radio") {
?>
<?php
$_smarty_tpl->tpl_vars["but_close_text"] = new Smarty_variable($_smarty_tpl->__("choose"), null, 0);
?>
<?php
} else {
?>
<?php
$_smarty_tpl->tpl_vars["but_close_text"] = new Smarty_variable($_smarty_tpl->__("add_companies_and_close"), null, 0);
?>
<?php
$_smarty_tpl->tpl_vars["but_text"] = new Smarty_variable($_smarty_tpl->__("add_companies"), null, 0);
?>
<?php
}
?>
<?php
echo $_smarty_tpl->getSubTemplate("buttons/add_close.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('is_js' => fn_is_empty($_REQUEST['extra'])), 0);
?>
</div>
</form>
<?php
}
开发者ID:OneataBogdan, 项目名称:lead_coriolan, 代码行数:101, 代码来源:f7fa302308845ca96ec9515a558833805d7d1392.tygh.picker_contents.tpl.php
示例7: array
return array(CONTROLLER_STATUS_OK, 'categories.update?category_id=' . $_REQUEST['category_id']);
}
}
$category_id = fn_update_category($_REQUEST['category_data'], $_REQUEST['category_id'], DESCR_SL);
if (!empty($category_id)) {
fn_attach_image_pairs('category_main', 'category', $category_id, DESCR_SL);
$suffix = ".update?category_id={$category_id}" . (!empty($_REQUEST['category_data']['block_id']) ? "&selected_block_id=" . $_REQUEST['category_data']['block_id'] : "");
} else {
$suffix = '.manage';
}
}
//
// Processing mulitple addition of new category elements
//
if ($mode == 'm_add') {
if (!fn_is_empty($_REQUEST['categories_data'])) {
$is_added = false;
foreach ($_REQUEST['categories_data'] as $k => $v) {
if (!empty($v['category'])) {
// Checking for required fields for new category
if (fn_update_category($v)) {
$is_added = true;
}
}
}
if ($is_added) {
fn_set_notification('N', __('notice'), __('categories_have_been_added'));
}
}
$suffix = ".manage";
}
开发者ID:askzap, 项目名称:ultimate, 代码行数:31, 代码来源:categories.php
示例8: array
$parent = true;
}
$offer_type_parent_category = array();
if (!empty($category_id)) {
$offer_type_parent_category = fn_yml_get_parent_categories_field('yml2_offer_type', $category_id, $parent);
$yml2_model_category = fn_yml_get_parent_categories_field('yml2_model', $category_id, $parent);
$yml2_type_prefix_category = fn_yml_get_parent_categories_field('yml2_type_prefix', $category_id, $parent);
$yml2_market_category = fn_yml_get_parent_categories_field('yml2_market_category', $category_id, $parent);
$yml2_parent_type_prefix_select = fn_yml_get_parent_categories_field('yml2_type_prefix_select', $category_id, $parent);
$yml2_parent_type_prefix_select = explode('.', $yml2_parent_type_prefix_select);
if (fn_is_empty($yml2_parent_type_prefix_select)) {
$yml2_parent_type_prefix_select = array();
}
$yml2_parent_model_select = fn_yml_get_parent_categories_field('yml2_model_select', $category_id, $parent);
$yml2_parent_model_select = explode('.', $yml2_parent_model_select);
if (fn_is_empty($yml2_parent_model_select)) {
$yml2_parent_model_select = array();
}
Tygh::$app['view']->assign('yml2_model_category', $yml2_model_category);
Tygh::$app['view']->assign('yml2_type_prefix_category', $yml2_type_prefix_category);
Tygh::$app['view']->assign('yml2_market_category', $yml2_market_category);
Tygh::$app['view']->assign('yml2_parent_type_prefix_select', $yml2_parent_type_prefix_select);
Tygh::$app['view']->assign('yml2_parent_model_select', $yml2_parent_model_select);
}
$offer_types = fn_get_schema('yml', 'offer_types');
unset($offer_types['common']);
Tygh::$app['view']->assign('yml2_offer_types', $offer_types);
Tygh::$app['view']->assign('offer_type_parent_category', $offer_type_parent_category);
if (!empty($offer_type_parent_category)) {
Tygh::$app['view']->assign('offer_type_parent_name', $offer_types[$offer_type_parent_category]);
}
开发者ID:ambient-lounge, 项目名称:site, 代码行数:31, 代码来源:categories.post.php
示例9: fn_paypal_apply_discount
function fn_paypal_apply_discount($data, &$order_data, $product_index)
{
$discount_applied = false;
if (!fn_is_empty(floatval($data['subtotal_discount']))) {
$order_data['L_PAYMENTREQUEST_0_NAME' . $product_index] = __('discount');
$order_data['L_PAYMENTREQUEST_0_QTY' . $product_index] = 1;
$order_data['L_PAYMENTREQUEST_0_AMT' . $product_index] = -$data['subtotal_discount'];
$discount_applied = true;
}
fn_set_hook('paypal_apply_discount_post', $data, $order_data, $product_index, $discount_applied);
}
开发者ID:askzap, 项目名称:ultimate, 代码行数:11, 代码来源:paypal_express.functions.php
示例10: array
$cart['chosen_shipping'] = array();
if (!empty($_REQUEST['shipping_ids'])) {
fn_checkout_update_shipping($cart, $_REQUEST['shipping_ids']);
}
$cart['calculate_shipping'] = true;
list($cart_products, $product_groups) = fn_calculate_cart_content($cart, $auth, 'A', true, 'F', true);
if (Registry::get('settings.Checkout.display_shipping_step') != 'Y' && fn_allowed_for('ULTIMATE')) {
Tygh::$app['view']->assign('show_only_first_shipping', true);
}
Tygh::$app['view']->assign('product_groups', $cart['product_groups']);
Tygh::$app['view']->assign('cart', $cart);
Tygh::$app['view']->assign('cart_products', array_reverse($cart_products, true));
Tygh::$app['view']->assign('location', empty($_REQUEST['location']) ? 'cart' : $_REQUEST['location']);
Tygh::$app['view']->assign('additional_id', empty($_REQUEST['additional_id']) ? '' : $_REQUEST['additional_id']);
if (defined('AJAX_REQUEST')) {
if (fn_is_empty($cart_products) && fn_is_empty($cart['product_groups'])) {
Tygh::$app['ajax']->assignHtml('shipping_estimation_sidebox' . (empty($_REQUEST['additional_id']) ? '' : '_' . $_REQUEST['additional_id']), __('no_rates_for_empty_cart'));
} else {
Tygh::$app['view']->display(empty($_REQUEST['location']) ? 'views/checkout/components/checkout_totals.tpl' : 'views/checkout/components/shipping_estimation.tpl');
}
exit;
}
$redirect_mode = !empty($_REQUEST['current_mode']) ? $_REQUEST['current_mode'] : 'cart';
return array(CONTROLLER_STATUS_OK, 'checkout.' . $redirect_mode . '?show_shippings=Y');
}
if ($mode == 'update_shipping') {
if (!empty($_REQUEST['shipping_ids'])) {
fn_checkout_update_shipping($cart, $_REQUEST['shipping_ids']);
}
return array(CONTROLLER_STATUS_OK, 'checkout.' . $_REQUEST['redirect_mode']);
}
开发者ID:askzap, 项目名称:ultimate, 代码行数:31, 代码来源:checkout.php
示例11: die
* This source file is subject to the EULA
* that is bundled with this package in the file CR-LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://www.cscartrocks.com/CR-LICENSE.txt
*
* @copyright Copyright (c) 2010 cscartrocks.com
* @license http://www.cscartrocks.com/CR-LICENSE.txt
*/
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
die('Access denied');
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
if ($mode == 'place_order' || $mode == 'subscribe_customer') {
$subscriber = db_get_row("SELECT * FROM ?:subscribers WHERE email = ?s", $_SESSION['cart']['user_data']['email']);
if (!empty($_REQUEST['mailing_lists']) && !fn_is_empty($_REQUEST['mailing_lists'])) {
if (empty($subscriber)) {
$_data = array('email' => $_SESSION['cart']['user_data']['email'], 'timestamp' => TIME);
$subscriber_id = db_query("INSERT INTO ?:subscribers ?e", $_data);
} else {
$subscriber_id = $subscriber['subscriber_id'];
}
fn_update_subscriptions($subscriber_id, $_REQUEST['mailing_lists'], NULL, fn_get_notification_rules(true));
} elseif (isset($_REQUEST['mailing_lists'])) {
if (!empty($subscriber)) {
fn_delete_subscribers($subscriber['subscriber_id']);
}
}
}
if ($mode == 'subscribe_customer') {
return array(CONTROLLER_STATUS_REDIRECT, 'onestepcheckout.checkout');
开发者ID:ambient-lounge, 项目名称:site, 代码行数:31, 代码来源:onestepcheckout.pre.php
示例12: fn_reports_get_conditions
$table_conditions[$table['table_id']] = fn_reports_get_conditions($_table_cond);
}
$_values = fn_get_report_statistics($table);
$report['tables'][$table_id]['values'] = $_values;
// Calculate totals
$report['tables'][$table_id]['totals'] = array();
foreach ($_values as $v) {
foreach ($v as $_k => $_v) {
$report['tables'][$table_id]['totals'][$_k] = empty($report['tables'][$table_id]['totals'][$_k]) ? $_v : $report['tables'][$table_id]['totals'][$_k] + $_v;
}
}
$_element_id = db_get_field("SELECT element_id FROM ?:sales_reports_table_elements WHERE table_id = ?i", $table['table_id']);
if (!empty($_element_id)) {
$report['tables'][$table_id]['parameter'] = __("reports_parameter_{$_element_id}");
}
if (fn_is_empty($_values)) {
$report['tables'][$table_id]['empty_values'] = 'Y';
}
// Find max value
$_max = 0;
foreach (@$_values as $kkk => $vvv) {
foreach ($vvv as $kk => $vv) {
if ($vv > $_max) {
$_max = $vv;
}
}
}
$report['tables'][$table_id]['max_value'] = $_max;
if ($table['type'] == 'B' && $intervals_limits[count($table['elements'])] < count($table['intervals'])) {
$report['tables'][$table_id]['pages'] = ceil(count($table['intervals']) / $intervals_limits[count($table['elements'])]);
}
开发者ID:OneataBogdan, 项目名称:lead_coriolan, 代码行数:31, 代码来源:sales_reports.php
示例13: fn_gift_certificates_exclude_products_from_calculation
function fn_gift_certificates_exclude_products_from_calculation(&$cart, &$auth, &$pure_subtotal, &$subtotal)
{
if (isset($cart['gift_certificates']) && !fn_is_empty($cart['gift_certificates'])) {
foreach ($cart['gift_certificates'] as $k => $v) {
if (isset($v['extra']['exclude_from_calculate'])) {
unset($cart['gift_certificates'][$k]);
} else {
$subtotal += $v['amount'];
$pure_subtotal += $v['amount'];
}
}
}
if (!empty($cart['use_gift_certificates'])) {
foreach ($cart['use_gift_certificates'] as $code => $value) {
// This step is performed when editing the existent order only.
if (is_array($value) && isset($value['log_id'])) {
// indicates that the order is being edited
$gift_cert_data = $value;
// Merge with the current balance.
$last_log_item = db_get_row("SELECT log_id, debit, debit_products FROM ?:gift_certificates_log WHERE gift_cert_id = ?i ORDER BY log_id DESC", $value['gift_cert_id']);
$last_log_item['debit_products'] = unserialize($last_log_item['debit_products']);
$gift_cert_data['amount'] = $gift_cert_data['previous_state']['cost'] + $last_log_item['debit'];
if (!empty($last_log_item['debit_products'])) {
foreach ($last_log_item['debit_products'] as $product_id => $quantity) {
if (!isset($gift_cert_data['products'][$product_id])) {
$gift_cert_data['products'][$product_id] = $quantity['amount'];
} else {
$gift_cert_data['products'][$product_id] = (isset($gift_cert_data['previous_state']['products'][$product_id]) ? $gift_cert_data['previous_state']['products'][$product_id] : 0) + $quantity['amount'];
}
}
}
$cart['use_gift_certificates_previous_state'][$code] = $gift_cert_data;
// This step is performed when editing the existent order only.
} elseif (defined('ORDER_MANAGEMENT') && !empty($cart['use_gift_certificates_previous_state'][$code])) {
//
// If the certificate was deleted when editing, and then it was applied again.
// It is necessary to set its data (not currect ones) again with the performed changes.
//
$gift_cert_data = $cart['use_gift_certificates_previous_state'][$code];
// This step is performed only on Create order and in the frontend.
} else {
$gift_cert_data = db_get_row("SELECT gift_cert_id, amount, products FROM ?:gift_certificates WHERE gift_cert_code = ?s ?p", $code, fn_get_gift_certificate_company_condition('company_id'));
if (!$gift_cert_data) {
return false;
}
$gift_cert_data['products'] = empty($gift_cert_data['products']) ? array() : @unserialize($gift_cert_data['products']);
$debit_balance = db_get_row("SELECT debit AS amount, debit_products as products FROM ?:gift_certificates_log WHERE gift_cert_id = ?i ORDER BY log_id DESC", $gift_cert_data['gift_cert_id']);
if (!empty($debit_balance)) {
$debit_balance['products'] = @unserialize($debit_balance['products']);
$gift_cert_data = fn_array_merge($gift_cert_data, $debit_balance);
}
}
$cart['use_gift_certificates'][$code] = $gift_cert_data;
if (!empty($gift_cert_data['products']) && AREA == 'C') {
$product_data = array();
foreach ((array) $gift_cert_data['products'] as $key => $product_item) {
if (!empty($debit_balance) && !isset($debit_balance['products'][$key])) {
continue;
}
$product_data[$product_item['product_id']] = array('product_id' => $product_item['product_id'], 'amount' => $product_item['amount'], 'extra' => array('exclude_from_calculate' => GIFT_CERTIFICATE_EXCLUDE_PRODUCTS, 'in_use_certificate' => array($code => $product_item['amount'])));
if (isset($product_item['product_options'])) {
$product_data[$product_item['product_id']]['product_options'] = $product_item['product_options'];
}
// Сhoose the option which the product had before editing.
if (!empty($value['log_id']) && !empty($value['product_options'][$product_id])) {
$product_data[$product_id]['product_options'] = $value['product_options'][$product_id];
}
}
fn_add_product_to_cart($product_data, $cart, $auth);
$cart['recalculate'] = true;
}
}
}
}
开发者ID:arpad9, 项目名称:bygmarket, 代码行数:74, 代码来源:func.php
示例14: _addDellinCities
public function _addDellinCities($url_cities, $post)
{
$file_dir = fn_get_files_dir_path() . "dellin/";
fn_mkdir($file_dir);
@chmod($file_dir, 0777);
$file_path = $file_dir . date("Y-m-d", TIME) . '_cities.csv';
if (!file_exists($file_path)) {
$response = Http::post($url_cities, json_encode($post), $this->url_params);
$result = (array) json_decode($response);
file_put_contents($file_path, file_get_contents($result['url']));
if (!empty($result['url'])) {
$max_line_size = 65536;
// 64 Кб
$data_city = array();
$delimiter = ',';
$encoding = fn_detect_encoding($result['url'], 'F', CART_LANGUAGE);
if (!empty($encoding)) {
$result['url'] = fn_convert_encoding($encoding, 'UTF-8', $result['url'], 'F');
} else {
fn_set_notification('W', __('warning'), __('text_exim_utf8_file_format'));
}
$f = false;
if ($result['url'] !== false) {
$f = fopen($result['url'], 'rb');
}
if ($f) {
$import_schema = fgetcsv($f, $max_line_size, $delimiter);
$schema_size = sizeof($import_schema);
$skipped_lines = array();
$line_it = 1;
while (($data = fn_fgetcsv($f, $max_line_size, $delimiter)) !== false) {
$line_it++;
if (fn_is_empty($data)) {
continue;
}
if (sizeof($data) != $schema_size) {
$skipped_lines[] = $line_it;
continue;
}
$data = str_replace(array('\\r', '\\n', '\\t', '"'), '', $data);
$data_city = array_combine($import_schema, Bootstrap::stripSlashes($data));
if (!empty($data_city)) {
$dellin_city = array('number_city' => $data_city['id'], 'code_kladr' => str_replace(' ', '', $data_city['codeKLADR']), 'is_terminal' => $data_city['isTerminal']);
$first_pos = strpos($data_city['name'], '(');
$end_pos = strpos($data_city['name'], ')') - $first_pos;
if (!empty($first_pos)) {
$dellin_city['state'] = str_replace(array("(", ")"), "", substr($data_city['name'], $first_pos, $end_pos));
$dellin_city['city'] = str_replace(array('(' . $dellin_city['state'] . ')', '"'), "", $data_city['name']);
} else {
$dellin_city['state'] = str_replace(array('г.', 'г', 'г. ', 'г '), '', $data_city['name']);
$dellin_city['city'] = $data_city['name'];
}
$dellin_city['city_id'] = db_get_field("SELECT city_id FROM ?:rus_dellin_cities WHERE code_kladr = ?s", $dellin_city['code_kladr']);
db_query("REPLACE INTO ?:rus_dellin_cities ?e", $dellin_city);
}
}
}
}
}
}
开发者ID:ambient-lounge, 项目名称:site, 代码行数:60, 代码来源:Dellin.php
示例15: fn_is_not_empty
function fn_is_not_empty($var)
{
return !fn_is_empty($var);
}
开发者ID:arpad9, 项目名称:bygmarket, 代码行数:4, 代码来源:fn.common.php
示例16: 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;
}
开发者ID:heg-arc-ne, 项目名称:cscart, 代码行数:80, 代码来源:fn.cart.php
示例17: fn_yml_update_price_list
function fn_yml_update_price_list($price_id, $price_list)
{
if (!empty($price_id)) {
$price_list['price_id'] = $price_id;
}
if (!empty($price_list['delivery_options'])) {
foreach ($price_list['delivery_options'] as $index => $delivery_option) {
if (fn_is_empty($delivery_option)) {
unset($price_list['delivery_options'][$index]);
}
}
$price_list['delivery_options'] = array_slice($price_list['delivery_options'], 0, 5);
}
fn_yml_get_categories_data($price_list);
$company_id = Registry::get('runtime.company_id');
if (Registry::get('runtime.simple_ultimate')) {
$company_id = Registry::get('runtime.forced_company_id');
}
$price_list['company_id'] = $company_id;
$data = array('param_type' => 'price_list', 'param_key' => $price_list['access_key'], 'param_data' => serialize($price_list), 'company_id' => $company_id);
if (!empty($price_id)) {
$data['param_id'] = $price_id;
}
$new_price_id = db_query("INSERT INTO ?:yml_param ?e ON DUPLICATE KEY UPDATE ?u", $data, $data);
return !empty($new_price_id) ? $new_price_id : $price_id;
}
开发者ID:ambient-lounge, 项目名称:site, 代码行数:26, 代码来源:func.php
示例18: fn_delete_rate_values
function fn_delete_rate_values($delete_rate_data, $shipping_id, $destination_id)
{
$rate_values = db_get_field("SELECT rate_value FROM ?:shipping_rates WHERE shipping_id = ?i AND destination_id = ?i", $shipping_id, $destination_id);
if (!empty($rate_values)) {
$rate_values = unserialize($rate_values);
}
foreach ((array) $rate_values as $rate_type => $rd) {
foreach ((array) $rd as $amount => $data) {
if (isset($delete_rate_data[$rate_type][$amount]) && $delete_rate_data[$rate_type][$amount] == 'Y') {
unset($rate_values[$rate_type][$amount]);
}
}
}
if (is_array($rate_values)) {
foreach ($rate_values as $k => $v) {
if (count($v) == 1 && floatval($v[0]['value']) == 0) {
unset($rate_values[$k]);
continue;
}
}
}
if (fn_is_empty($rate_values)) {
db_query("DELETE FROM ?:shipping_rates WHERE shipping_id = ?i AND destination_id = ?i", $shipping_id, $destination_id);
} else {
db_query("UPDATE ?:shipping_rates SET ?u WHERE shipping_id = ?i AND destination_id = ?i", array('rate_value' => serialize($rate_values)), $shipping_id, $destination_id);
}
}
开发者ID:askzap, 项目名称:ultimate, 代码行数:27, 代码来源:shippings.php
示例19: empty
//
if ($mode == 'shipping_estimation') {
$customer_location = empty($_REQUEST['customer_location']) ? array() : $_REQUEST['customer_location'];
foreach ($customer_location as $k => $v) {
$cart['user_data']['s_' . $k] = $v;
}
$_SESSION['customer_loc'] = $customer_location;
$cart['recalculate'] = true;
list($cart_products, $_SESSION['shipping_rates']) = fn_calculate_cart_content($cart, $auth, 'A', true, 'F', true);
$view->assign('shipping_rates', $_SESSION['shipping_rates']);
$view->assign('cart', $cart);
$view->assign('cart_products', array_reverse($cart_products, true));
$view->assign('location', empty($_REQUEST['location']) ? 'cart' : $_REQUEST['location']);
$view->assign('additional_id', empty($_REQUEST['additional_id']) ? '' : $_REQUEST['additional_id']);
if (defined('AJAX_REQUEST')) {
if (fn_is_empty($cart_products) && fn_is_empty($_SESSION['shipping_rates'])) {
$ajax->assign_html('shipping_estimation_sidebox' . (empty($_REQUEST['additional_id']) ? '' : '_' . $_REQUEST['additional_id']), fn_get_lang_var('no_rates_for_empty_cart'));
} else {
$view->display(empty($_REQUEST['location']) ? 'views/checkout/components/checkout_totals.tpl' : 'views/checkout/components/shipping_estimation.tpl');
}
exit;
}
$_suffix = '.' . (empty($_REQUEST['current_mode']) ? 'cart' : $_REQUEST['current_mode']) . '?show_shippings=Y';
}
if ($mode == 'update_shipping') {
if (!empty($_REQUEST['shipping_ids'])) {
fn_checkout_update_shipping($cart, $_REQUEST['shipping_ids']);
}
$_suffix = ".{$_REQUEST['redirect_mode']}";
}
// Apply Discount Coupon
开发者ID:diedsmiling, 项目名称:busenika, 代码行数:31, 代码来源:checkout.php
示例20: fn_sdek_get_ticket_order
librespeed/speedtest: Self-hosted Speedtest for HTML5 and more. Easy setup, exam
阅读:1291| 2022-08-30
IBM Security Verify Information Queue 10.0.2 is vulnerable to cross-site request
阅读:843| 2022-07-29
avehtari/BDA_m_demos: Bayesian Data Analysis demos for Matlab/Octave
阅读:1205| 2022-08-17
女人怀孕后,为了有一个健康聪明的宝宝,经历各种体检、筛查。其实这些体检和筛查中的
阅读:1002| 2022-11-06
medfreeman/markdown-it-toc-and-anchor: markdown-it plugin to add a toc and ancho
阅读:1402| 2022-08-18
sydney0zq/covid-19-detection: The implementation of A Weakly-supervised Framewor
阅读:518| 2022-08-16
Vesta v1.0.0-5 was discovered to contain a cross-site scripting (XSS) vulnerabil
阅读:533| 2022-07-29
离中国最远的国家是阿根廷。从太平洋直线计算,即往东线走,北京到阿根廷的布宜诺斯艾
阅读:669| 2022-11-06
sslcommerz/SSLCommerz-Laravel: SSLCOMMERZ is a bangladeshi payment gateway provi
阅读:917| 2022-08-13
shem8/MaterialLogin: Login view with material design
阅读:756| 2022-08-17
请发表评论