• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP fn_array_merge函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中fn_array_merge函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_array_merge函数的具体用法?PHP fn_array_merge怎么用?PHP fn_array_merge使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了fn_array_merge函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: apiUpdateOrder

 public static function apiUpdateOrder($order, $response)
 {
     if (!defined('ORDER_MANAGEMENT')) {
         define('ORDER_MANAGEMENT', true);
     }
     if (!empty($order['status'])) {
         $statuses = fn_get_statuses(STATUSES_ORDER, false, true);
         if (!isset($statuses[$order['status']])) {
             $response->addError('ERROR_OBJECT_UPDATE', str_replace('[object]', 'orders', __('twgadmin_wrong_api_object_data')));
         } else {
             fn_change_order_status($order['order_id'], $order['status']);
         }
     }
     $cart = array();
     fn_clear_cart($cart, true);
     $customer_auth = fn_fill_auth(array(), array(), false, 'C');
     fn_form_cart($order['order_id'], $cart, $customer_auth);
     $cart['order_id'] = $order['order_id'];
     // update only profile data
     $profile_data = fn_check_table_fields($order, 'user_profiles');
     $cart['user_data'] = fn_array_merge($cart['user_data'], $profile_data);
     $cart['user_data'] = fn_array_merge($cart['user_data'], $order);
     fn_calculate_cart_content($cart, $customer_auth, 'A', true, 'I');
     if (!empty($order['details'])) {
         db_query('UPDATE ?:orders SET details = ?s WHERE order_id = ?i', $order['details'], $order['order_id']);
     }
     if (!empty($order['notes'])) {
         $cart['notes'] = $order['notes'];
     }
     fn_update_payment_surcharge($cart, $customer_auth);
     list($order_id, $process_payment) = fn_place_order($cart, $customer_auth, 'save');
     return array($order_id, $process_payment);
 }
开发者ID:askzap,项目名称:ultimate,代码行数:33,代码来源:TwigmoOrder.php


示例2: clear

 static function clear($changed_tables)
 {
     $tags = array();
     foreach ($changed_tables as $table => $flag) {
         if (!empty(self::$_cache_handlers[$table])) {
             $tags = fn_array_merge($tags, array_keys(self::$_cache_handlers[$table]), false);
         }
     }
     self::$db->query("DELETE FROM cache WHERE tags IN ('" . implode("', '", $tags) . "')");
     self::$db->query("REPLACE INTO cache (name, data) VALUES ('cache_handlers', '" . sqlite_escape_string(serialize(self::$_cache_handlers)) . "')");
     return true;
 }
开发者ID:diedsmiling,项目名称:busenika,代码行数:12,代码来源:class.cache_backend_sqlite.php


示例3: clear

 static function clear($changed_tables)
 {
     $tags = array();
     foreach ($changed_tables as $table => $flag) {
         if (!empty(self::$_cache_handlers[$table])) {
             $tags = fn_array_merge($tags, array_keys(self::$_cache_handlers[$table]), false);
         }
     }
     db_query("DELETE FROM ?:cache WHERE tags IN (?a)", $tags);
     db_query("REPLACE INTO ?:cache ?e", array('name' => 'cache_handlers', 'data' => serialize(self::$_cache_handlers)));
     return true;
 }
开发者ID:diedsmiling,项目名称:busenika,代码行数:12,代码来源:class.cache_backend_mysql.php


示例4: fn_google_anaylitics_send

function fn_google_anaylitics_send($account, $order_info, $refuse = false)
{
    $url = 'http://www.google-analytics.com/collect';
    $sign = $refuse == true ? '-' : '';
    //Common data which should be sent with any request
    $required_data = array('v' => '1', 'tid' => $account, 'cid' => md5($order_info['email']), 'ti' => $order_info['order_id'], 'cu' => $order_info['secondary_currency']);
    $transaction = array('t' => 'transaction', 'tr' => $sign . $order_info['total'], 'ts' => $sign . $order_info['shipping_cost'], 'tt' => $sign . $order_info['tax_subtotal']);
    $result = Http::get($url, fn_array_merge($required_data, $transaction));
    foreach ($order_info['products'] as $item) {
        $item = array('t' => 'item', 'in' => $item['product'], 'ip' => fn_format_price($item['subtotal'] / $item['amount']), 'iq' => $sign . $item['amount'], 'ic' => $item['product_code'], 'iv' => fn_ga_get_main_category($item['product_id'], $order_info['lang_code']));
        $result = Http::get($url, fn_array_merge($required_data, $item));
    }
}
开发者ID:askzap,项目名称:ultimate,代码行数:13,代码来源:func.php


示例5: clear

 static function clear($changed_tables)
 {
     $tags = array();
     foreach ($changed_tables as $table => $flag) {
         if (!empty(self::$_cache_handlers[$table])) {
             $tags = fn_array_merge($tags, array_keys(self::$_cache_handlers[$table]), false);
         }
     }
     foreach ($tags as $tag) {
         fn_rm(DIR_CACHE . $tag, true);
     }
     fn_put_contents(DIR_CACHE . self::$_handlers_name, serialize(self::$_cache_handlers));
     return true;
 }
开发者ID:diedsmiling,项目名称:busenika,代码行数:14,代码来源:class.cache_backend_file.php


示例6: _prepareAnywhere

 private function _prepareAnywhere()
 {
     $company_suburb = Registry::get('settings.Company.company_suburb');
     $code = $this->_shipping_info['service_params']['temando_method'];
     $origination = $this->_shipping_info['package_info']['origination'];
     $location = $this->_shipping_info['package_info']['location'];
     if ($code != 'Door to Door') {
         $x = array('originState' => $origination['state'], 'originCity' => $origination['city'], 'destinationState' => $location['state'], 'destinationCity' => $location['city']);
     } else {
         $x = array('originSuburb' => !empty($company_suburb) ? $company_suburb : $origination['city'], 'destinationSuburb' => $location['suburb']);
     }
     $where = array('itemNature' => 'Domestic', 'itemMethod' => $code, 'originCountry' => 'AU', 'originCode' => $origination['zipcode'], 'destinationCountry' => 'AU', 'destinationCode' => $location['zipcode'], 'destinationIs' => 'Residence', 'originIs' => 'Business');
     return fn_array_merge($where, $x);
 }
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:14,代码来源:Temando.php


示例7: instance

 /**
  * Gets storage object instance
  *
  * @param  string  $type    type of storage
  * @param  array   $options options
  * @return Storage storage object instance
  */
 public static function instance($type, $options = array())
 {
     $options = empty($options) ? Registry::get('runtime.storage') : $options;
     $storage = $options['storage'];
     if (empty($storage)) {
         throw new DeveloperException('Storage: undefined storage backend');
     }
     if (!Registry::get('config.storage.' . $type)) {
         throw new DeveloperException('Storage: undefined storage type - ' . $type);
     }
     if (empty(self::$_instance[$storage])) {
         $class = '\\Tygh\\Backend\\Storage\\' . ucfirst($storage);
         self::$_instance[$storage] = new $class();
     }
     self::$_instance[$storage]->options = fn_array_merge($options, Registry::get('config.storage.' . $type));
     self::$_instance[$storage]->type = $type;
     return self::$_instance[$storage];
 }
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:25,代码来源:Storage.php


示例8: preloadLangVars

 /**
  * Loads received language variables into language cache
  *
  * @param array  $var_names Language variable that to be loaded
  * @param string $lang_code 2-letter language code
  *
  * @return boolean True if any of received language variables were added into cache; false otherwise
  */
 public static function preloadLangVars($var_names, $lang_code = CART_LANGUAGE)
 {
     Registry::registerCache('lang_cache', array('language_values', 'ult_language_values'), Registry::cacheLevel('dispatch'), true);
     $values = Registry::get('lang_cache.' . $lang_code);
     if (empty($values)) {
         $values = array();
     }
     $var_names = array_diff($var_names, array_keys($values));
     if ($var_names) {
         foreach ($var_names as $index => $var_name) {
             $var_names[$index] = strtolower($var_name);
             if (isset($values[$var_name])) {
                 unset($var_names[$index]);
             }
         }
         if (empty($var_names)) {
             return true;
         }
         $fields = array('lang.name' => true, 'lang.value' => true);
         $tables = array('?:language_values lang');
         $left_join = array();
         $condition = array(db_quote('lang.lang_code = ?s', $lang_code), db_quote('lang.name IN (?a)', $var_names));
         $params = array();
         fn_set_hook('get_lang_var', $fields, $tables, $left_join, $condition, $params);
         $joins = !empty($left_join) ? ' LEFT JOIN ' . implode(', ', $left_join) : '';
         $new_values = db_get_hash_single_array('SELECT ' . implode(', ', array_keys($fields)) . ' FROM ' . implode(', ', $tables) . $joins . ' WHERE ' . implode(' AND ', $condition), array('name', 'value'));
         foreach ($var_names as $var_name) {
             if (!isset($new_values[$var_name])) {
                 $new_values[$var_name] = '_' . $var_name;
             }
         }
         $values = fn_array_merge($values, $new_values);
         Registry::set('lang_cache.' . $lang_code, $values);
         return true;
     }
     return false;
 }
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:45,代码来源:Helper.php


示例9: fn_update_image_pairs

function fn_update_image_pairs($icons, $detailed, $pairs_data, $object_id = 0, $object_type = 'product_lists', $object_ids = array(), $update_alt_desc = true, $lang_code = CART_LANGUAGE)
{
    $pair_ids = array();
    if (!empty($pairs_data)) {
        foreach ($pairs_data as $k => $p_data) {
            $data = array();
            $pair_id = !empty($p_data['pair_id']) ? $p_data['pair_id'] : 0;
            $o_id = !empty($object_id) ? $object_id : (!empty($p_data['object_id']) ? $p_data['object_id'] : 0);
            if ($o_id == 0 && !empty($object_ids[$k])) {
                $o_id = $object_ids[$k];
            } elseif (!empty($object_ids) && empty($object_ids[$k])) {
                continue;
            }
            // Check if main pair is exists
            if (empty($pair_id) && !empty($p_data['type']) && $p_data['type'] == 'M') {
                $pair_data = db_get_row("SELECT pair_id, image_id, detailed_id FROM ?:images_links WHERE object_id = ?i AND object_type = ?s AND type = ?s", $o_id, $object_type, $p_data['type']);
                $pair_id = !empty($pair_data['pair_id']) ? $pair_data['pair_id'] : 0;
            } else {
                $pair_data = db_get_row("SELECT image_id, detailed_id FROM ?:images_links WHERE pair_id = ?i", $pair_id);
                if (empty($pair_data)) {
                    $pair_id = 0;
                }
            }
            // Update detailed image
            if (!empty($detailed[$k]) && !empty($detailed[$k]['size'])) {
                if (fn_get_image_size($detailed[$k]['path'])) {
                    $data['detailed_id'] = fn_update_image($detailed[$k], !empty($pair_data['detailed_id']) ? $pair_data['detailed_id'] : 0, 'detailed');
                }
            }
            // Update icon
            if (!empty($icons[$k]) && !empty($icons[$k]['size'])) {
                if (fn_get_image_size($icons[$k]['path'])) {
                    $data['image_id'] = fn_update_image($icons[$k], !empty($pair_data['image_id']) ? $pair_data['image_id'] : 0, $object_type);
                }
            }
            // Update alt descriptions
            if ((empty($data) && !empty($pair_id) || !empty($data)) && $update_alt_desc == true) {
                $image_ids = array();
                if (!empty($pair_id)) {
                    $image_ids = db_get_row("SELECT image_id, detailed_id FROM ?:images_links WHERE pair_id = ?i", $pair_id);
                }
                $image_ids = fn_array_merge($image_ids, $data);
                $fields = array('detailed', 'image');
                foreach ($fields as $field) {
                    if (!empty($image_ids[$field . '_id']) && isset($p_data[$field . '_alt'])) {
                        if (!is_array($p_data[$field . '_alt'])) {
                            $_data = array('description' => empty($p_data[$field . '_alt']) ? '' : trim($p_data[$field . '_alt']), 'object_holder' => 'images');
                            // check, if this is new record, create new descriptions for all languages
                            $is_exists = db_get_field('SELECT object_id FROM ?:common_descriptions WHERE object_id = ?i AND lang_code = ?s AND object_holder = ?s', $image_ids[$field . '_id'], $lang_code, 'images');
                            if (!$is_exists) {
                                fn_create_description('common_descriptions', 'object_id', $image_ids[$field . '_id'], $_data);
                            } else {
                                db_query('UPDATE ?:common_descriptions SET ?u WHERE object_id = ?i AND lang_code = ?s AND object_holder = ?s', $_data, $image_ids[$field . '_id'], $lang_code, 'images');
                            }
                        } else {
                            foreach ($p_data[$field . '_alt'] as $lc => $_v) {
                                $_data = array('object_id' => $image_ids[$field . '_id'], 'description' => empty($_v) ? '' : trim($_v), 'lang_code' => $lc, 'object_holder' => 'images');
                                db_query("REPLACE INTO ?:common_descriptions ?e", $_data);
                            }
                        }
                    }
                }
            }
            if (empty($data)) {
                continue;
            }
            // Pair is exists
            $data['position'] = !empty($p_data['position']) ? $p_data['position'] : 0;
            // set data position
            if (!empty($pair_id)) {
                db_query("UPDATE ?:images_links SET ?u WHERE pair_id = ?i", $data, $pair_id);
            } else {
                $data['type'] = $p_data['type'];
                // set link type
                $data['object_id'] = $o_id;
                // assign pair to object
                $data['object_type'] = $object_type;
                $pair_id = db_query("INSERT INTO ?:images_links ?e", $data);
            }
            $pairs_data[$k]['pair_id'] = $pair_id;
            $pair_ids[] = $pair_id;
        }
    }
    fn_set_hook('update_image_pairs', $pair_ids, $icons, $detailed, $pairs_data, $object_id, $object_type, $object_ids, $update_alt_desc, $lang_code);
    return $pair_ids;
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:86,代码来源:fn.images.php


示例10: foreach

 if (!empty($registers)) {
     foreach ($registers as $register_id => $register) {
         $spsr_invoices = db_get_array("SELECT * FROM ?:rus_spsr_invoices WHERE order_id = ?i AND register_id = ?i ", $order_info['order_id'], $register['register_id']);
         if (!empty($spsr_invoices)) {
             $_invoices = array();
             foreach ($spsr_invoices as $invoice) {
                 $_invoices[] = $invoice['invoice_number'];
                 if (!empty($invoice['invoice_number'])) {
                     $spsr_invoice_info[$invoice['invoice_number']] = $invoice;
                 }
                 unset($spsr_shipments[$invoice['shipment_id']]);
             }
             $spsr_couriers = RusSpsr::WAGetActiveOrders();
             Tygh::$app['view']->assign('spsr_couriers', $spsr_couriers);
             $invoice_info = RusSpsr::WAGetInvoiceInfo($_invoices);
             $spsr_invoice_info = fn_array_merge($invoice_info, $spsr_invoice_info);
             if (!empty($invoice_info)) {
                 $spsr_register = 1;
             }
         }
         if ($register['status'] == 'S') {
             $register_status = 'Y';
         }
     }
     Tygh::$app['view']->assign('spsr_invoice_info', $spsr_invoice_info);
 }
 Tygh::$app['view']->assign('spsr_register_status', $register_status);
 Tygh::$app['view']->assign('spsr_register', $spsr_register);
 foreach ($spsr_shipments as $shipment) {
     $shipping_data = fn_get_shipping_info($shipment['shipping_id'], DESCR_SL);
     $shipping_data['rate'] = $order_info['shipping_cost'];
开发者ID:ambient-lounge,项目名称:site,代码行数:31,代码来源:orders.post.php


示例11: _getSettingItem

 /**
  * Returns array of setting item data from xml node
  * @param $xml_node
  * @return array
  */
 protected function _getSettingItem($xml_node)
 {
     $addon_id = (string) $this->_xml->id;
     $default_language = $this->getDefaultLanguage();
     foreach (fn_get_translation_languages() as $lang_code => $_v) {
         $items[$lang_code] = $this->getPoValues($lang_code, 'SettingsOptions');
     }
     if (isset($xml_node['id'])) {
         $_types = $this->_getTypes();
         $translations = $this->_getTranslations($xml_node, 'SettingsOptions', $addon_id);
         $tooltip_translations = $this->_getTranslations($xml_node, 'SettingsTooltips', $addon_id, 'tooltip');
         $setting = array('edition_type' => $this->_getEditionType($xml_node), 'id' => (string) $xml_node['id'], 'name' => isset($items[$default_language][(string) $xml_node['id']]) ? $items[$default_language][(string) $xml_node['id']] : (string) $xml_node->name, 'type' => isset($_types[(string) $xml_node->type]) ? $_types[(string) $xml_node->type] : '', 'translations' => fn_array_merge($translations, $tooltip_translations), 'default_value' => isset($xml_node->default_value) ? (string) $xml_node->default_value : '', 'variants' => $this->_getVariants($xml_node), 'handler' => isset($xml_node->handler) ? (string) $xml_node->handler : '', 'parent_id' => isset($xml_node['parent_id']) ? (string) $xml_node['parent_id'] : '');
         return $setting;
     } else {
         return array();
     }
 }
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:22,代码来源:XmlScheme3.php


示例12: __construct

 /**
  * Init backend
  *
  * @param array $config global configuration params
  * @param array $params additional params passed from Session class
  *
  * @return bool true if backend was init correctly, false otherwise
  */
 public function __construct($config, $params = array())
 {
     parent::__construct($config, $params);
     $this->config = fn_array_merge(array('redis_server' => $config['session_redis_server'], 'saas_uid' => !empty($config['saas_uid']) ? $config['saas_uid'] : null), $this->config);
     return $this->connect();
 }
开发者ID:askzap,项目名称:ultimate,代码行数:14,代码来源:Redis.php


示例13: die

if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    //
    // Creation gift certificate
    //
    if ($mode == 'create_gift_certificate') {
        $change_return_status = $_REQUEST['change_return_status'];
        if (!empty($_REQUEST['accepted'])) {
            $total = 0;
            $return_info = fn_get_return_info($change_return_status['return_id']);
            foreach ((array) $_REQUEST['accepted'] as $item_id => $v) {
                if (isset($v['chosen']) && $v['chosen'] == 'Y') {
                    $total += $v['amount'] * $return_info['items'][RETURN_PRODUCT_ACCEPTED][$item_id]['price'];
                }
            }
            if ($total > 0) {
                $certificate = fn_create_return_gift_certificate($return_info['order_id'], fn_format_price($total));
                $return_info['extra'] = unserialize($return_info['extra']);
                if (!isset($return_info['extra']['gift_certificates'])) {
                    $return_info['extra']['gift_certificates'] = array();
                }
                $return_info['extra']['gift_certificates'] = fn_array_merge($return_info['extra']['gift_certificates'], $certificate);
                $_data = array('extra' => serialize($return_info['extra']));
                db_query("UPDATE ?:rma_returns SET ?u WHERE return_id = ?i", $_data, $change_return_status['return_id']);
            }
        }
        return array(CONTROLLER_STATUS_REDIRECT, 'rma.details?return_id=' . $change_return_status['return_id']);
    }
}
开发者ID:askzap,项目名称:ultimate,代码行数:31,代码来源:rma.post.php


示例14: _prepareData

 /**
  * Parses request URL to use in request
  * @param  string $method request method
  * @param  string $url    request URL
  * @param  mixed  $data   request data
  * @return array  parsed URL and URL-encoded data
  */
 private static function _prepareData($method, $url, $data)
 {
     $components = parse_url($url);
     $upass = '';
     if (!empty($components['user'])) {
         $upass = $components['user'] . (!empty($components['pass']) ? ':' . $components['pass'] : '') . '@';
     }
     if (empty($components['path'])) {
         $components['path'] = '/';
     }
     $port = empty($components['port']) ? '' : ':' . $components['port'];
     $url = $components['scheme'] . '://' . $upass . $components['host'] . $port . $components['path'];
     if (!empty($components['query'])) {
         if ($method == self::GET) {
             parse_str($components['query'], $args);
             if (!empty($data) && !is_array($data) && !empty($args)) {
                 throw new DeveloperException('Http: incompatible data type passed');
             }
             $data = fn_array_merge($args, $data);
         } else {
             $url .= '?' . $components['query'];
         }
     }
     return array($url, is_array($data) ? http_build_query($data) : $data);
 }
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:32,代码来源:Http.php


示例15: fn_get_patterns

/**
 * Gets all available patterns for the section
 *
 * @param string $section section to get patterns for
 * @param string $get_for get import or export patterns
 * @return array
 */
function fn_get_patterns($section, $get_for)
{
    // Get core patterns
    $files = fn_get_dir_contents(Registry::get('config.dir.schemas') . 'exim', false, true, '.php');
    foreach (Registry::get('addons') as $addon_name => $addon_data) {
        if ($addon_data['status'] != 'A') {
            continue;
        }
        $schema_dir = Registry::get('config.dir.addons') . $addon_name . '/schemas/exim';
        if (is_dir($schema_dir)) {
            $_files = fn_get_dir_contents($schema_dir, false, true, '.php');
            foreach ($_files as $key => $filename) {
                if (strpos($filename, '.post.php') !== false) {
                    unset($_files[$key]);
                }
            }
            if (!empty($_files)) {
                $files = fn_array_merge($files, $_files, false);
            }
        }
    }
    $patterns = array();
    $sections = array();
    foreach ($files as $schema_file) {
        if (strpos($schema_file, '.functions.') !== false) {
            // skip functions schema definition
            continue;
        }
        $pattern_id = str_replace('.php', '', $schema_file);
        $pattern = fn_get_pattern_definition($pattern_id, $get_for);
        if (empty($pattern) || !fn_check_pattern_permissions($pattern, $get_for, $_SESSION['auth']['user_id'])) {
            continue;
        }
        $sections[$pattern['section']] = array('title' => __($pattern['section']), 'href' => 'exim.' . Registry::get('runtime.mode') . '?section=' . $pattern['section']);
        if ($pattern['section'] == $section) {
            $patterns[$pattern_id] = $pattern;
        }
    }
    if (Registry::get('runtime.company_id')) {
        $schema = fn_get_permissions_schema('vendor');
        // Check if the selected section is available
        if (isset($schema[$get_for]['sections'][$section]['permission']) && !$schema[$get_for]['sections'][$section]['permission']) {
            return array('', '');
        }
        if (!empty($schema[$get_for]['sections'])) {
            foreach ($schema[$get_for]['sections'] as $section_id => $data) {
                if (isset($data['permission']) && !$data['permission']) {
                    unset($sections[$section_id]);
                }
            }
        }
        if (!empty($schema[$get_for]['patterns'])) {
            foreach ($schema[$get_for]['patterns'] as $pattern_id => $data) {
                if (isset($data['permission']) && !$data['permission']) {
                    unset($patterns[$pattern_id]);
                }
            }
        }
    }
    ksort($sections, SORT_STRING);
    uasort($patterns, 'fn_sort_patterns');
    return array($sections, $patterns);
}
开发者ID:arpad9,项目名称:bygmarket,代码行数:70,代码来源:exim.php


示例16: fn_create_return_gift_certificate

function fn_create_return_gift_certificate($order_id, $amount)
{
    $min = Registry::get('addons.gift_certificates.min_amount') * 1;
    $max = Registry::get('addons.gift_certificates.max_amount') * 1;
    $order_info = fn_get_order_info($order_id);
    $templates = fn_get_gift_certificate_templates();
    $_data = array('send_via' => 'E', 'recipient' => "{$order_info['firstname']} {$order_info['lastname']}", 'sender' => Registry::get('settings.Company.company_name'), 'amount' => $amount, 'email' => $order_info['email'], 'address' => $order_info['s_address'], 'address_2' => $order_info['s_address_2'], 'city' => $order_info['s_city'], 'country' => $order_info['s_country'], 'state' => $order_info['s_state'], 'zipcode' => $order_info['s_zipcode'], 'phone' => $order_info['phone'], 'template' => key($templates));
    if (fn_allowed_for('ULTIMATE')) {
        $_data['company_id'] = Registry::ifGet('runtime.company_id', $order_info['company_id']);
    }
    do {
        $code = fn_generate_gift_certificate_code();
    } while (true == fn_check_gift_certificate_code($code));
    if ($amount < $min || $amount > $max) {
        fn_set_notification('E', __('error'), __('gift_cert_error_amount', array('[min]' => $min, '[max]' => $max)));
        $result = array();
    } else {
        $_data = fn_array_merge($_data, array('gift_cert_code' => $code, 'timestamp' => TIME));
        $gift_cert_id = db_query('INSERT INTO ?:gift_certificates ?e', $_data);
        $result = array($gift_cert_id => array('code' => $code, 'amount' => $amount));
    }
    return $result;
}
开发者ID:arpad9,项目名称:bygmarket,代码行数:23,代码来源:func.php


示例17: fn_te_read_dir

/**
 * Reads directory
 * @param string $path path to directory
 * @param string $base_path path to root directory
 * @return array list of directories/files
 */
function fn_te_read_dir($path, $base_path)
{
    $items = array();
    clearstatcache();
    $path = rtrim($path, '/');
    if ($dh = @opendir($path)) {
        $dirs = array();
        $files = array();
        while (($file = readdir($dh)) !== false) {
            if ($file == '.' || $file == '..' || fn_te_filter_path($path . '/' . $file)) {
                continue;
            }
            if (is_dir($path . '/' . $file)) {
                $dirs[$file] = array('name' => $file, 'type' => 'D', 'full_path' => fn_te_form_path(str_replace($base_path, '', $path . '/' . $file)), 'path' => fn_te_form_path(str_replace($base_path, '', $path . '/')));
            }
            if (is_file($path . '/' . $file)) {
                $files[$file] = array('name' => $file, 'type' => 'F', 'ext' => fn_get_file_ext($file), 'full_path' => fn_te_form_path(str_replace($base_path, '', $path . '/' . $file)), 'path' => fn_te_form_path(str_replace($base_path, '', $path . '/')));
            }
        }
        closedir($dh);
        ksort($dirs, SORT_STRING);
        ksort($files, SORT_STRING);
        $items = fn_array_merge($dirs, $files, false);
    }
    return $items;
}
开发者ID:askzap,项目名称:ultimate,代码行数:32,代码来源:templates.php


示例18: fn_top_menu_form

/**
 * Form top menu
 *
 * @param array $top_menu top menu data from the database
 * @param int $level current menu level
 * @param boolean $active - menu item active flag, returned by reference to set tree branch as active
 * @return array formed top menu
 */
function fn_top_menu_form($top_menu, $level = 0, &$active = NULL)
{
    $_active = false;
    foreach ($top_menu as $k => $v) {
        if (!empty($v['param_3'])) {
            // get extra items
            list($type, $id, $use_name) = fn_explode(':', $v['param_3']);
            if ($type == 'C') {
                // categories
                $cats = fn_get_categories_tree($id, true);
                $v['subitems'] = fn_array_merge(fn_top_menu_standardize($cats, 'category_id', 'category', 'subcategories', 'categories.view?category_id='), !empty($v['subitems']) ? $v['subitems'] : array(), false);
                if ($use_name == 'Y' && !empty($id)) {
                    $v['descr'] = fn_get_category_name($id);
                    $v['param'] = 'categories.view?category_id=' . $id;
                }
            } elseif ($type == 'A') {
                // pages
                $params = array('from_page_id' => $id, 'get_tree' => 'multi_level', 'status' => 'A');
                list($pages) = fn_get_pages($params);
                $v['subitems'] = fn_array_merge(fn_top_menu_standardize($pages, 'page_id', 'page', 'subpages', 'pages.view?page_id='), !empty($v['subitems']) ? $v['subitems'] : array(), false);
                if ($use_name == 'Y' && !empty($id)) {
                    $page_data = fn_get_page_data($id);
                    $v['descr'] = $page_data['page'];
                    $v['param'] = !empty($page_data['link']) ? $page_data['link'] : 'pages.view?page_id=' . $id;
                }
            } else {
                // for addons
                fn_set_hook('top_menu_form', $v, $type, $id, $use_name);
            }
        }
        if (!empty($v['param']) && fn_top_menu_is_current_url($v['param'], $v['param_2'])) {
            $top_menu[$k]['active'] = true;
            // Store active value
            $_active = true;
        }
        if (!empty($v['subitems'])) {
            $top_menu[$k]['subitems'] = fn_top_menu_form($v['subitems'], $level + 1, $active);
            // If active status was returned fron children
            if ($active) {
                $top_menu[$k]['active'] = $active;
                // Strore fo return and reset activity status for athother elements on this level
                // Because in one level may be only one active item
                $_active = true;
                $active = false;
            }
        }
        $top_menu[$k]['item'] = $v['descr'];
        $top_menu[$k]['href'] = $v['param'];
        $top_menu[$k]['level'] = $level;
        unset($top_menu[$k]['descr'], $top_menu[$k]['param']);
    }
    $active = $_active;
    return $top_menu;
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:62,代码来源:fn.cms.php


示例19: fn_recalculate_exceptions

         }
         fn_recalculate_exceptions($_REQUEST['product_id']);
         $suffix = ".exceptions?product_id={$_REQUEST['product_id']}";
     }
     if ($mode == 'm_delete_exceptions') {
         foreach ($_REQUEST['exception_ids'] as $id) {
             fn_delete_exception($id);
         }
         $suffix = ".exceptions?product_id={$_REQUEST['product_id']}";
     }
 }
 if ($mode == 'add_combinations') {
     if (is_array($_REQUEST['add_inventory'])) {
         foreach ($_REQUEST['add_inventory'] as $k => $v) {
             $_data = array('product_id' => $_REQUEST['product_id'], 'combination' => $_REQUEST['add_options_combination'][$k], 'amount' => isset($_REQUEST['add_inventory'][$k]['amount']) ? $_REQUEST['add_inventory'][$k]['amount'] : 0);
             $_data = fn_array_merge($v, $_data);
             fn_update_option_combination($_data);
         }
     }
     $suffix = ".inventory?product_id={$_REQUEST['product_id']}";
 }
 if ($mode == 'update_combinations') {
     if (!empty($_REQUEST['inventory'])) {
         foreach ($_REQUEST['inventory'] as $k => $v) {
             fn_update_option_combination($v, $k);
         }
     }
     $suffix = ".inventory?product_id={$_REQUEST['product_id']}";
 }
 if ($mode == 'm_delete_combinations') {
     foreach ($_REQUEST['combination_hashes'] as $v) {
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:31,代码来源:product_options.php


示例20: fn_install_addon

/**
 * Installes addon
 *
 * @param string $addon Addon to install
 * @param bool $show_notification Display notification if set to true
 * @param bool $install_demo If defined as true, addon's demo data will be installed
 * @return bool True if addons installed successfully, false otherwise
 */
function fn_install_addon($addon, $show_notification = true, $install_demo = false)
{
    $status = db_get_field("SELECT status FROM ?:addons WHERE addon = ?s", $addon);
    // Return true if addon is installed
    if (!empty($status)) {
        return true;
    }
    $addon_scheme = SchemesManager::getScheme($addon);
    if (empty($addon_scheme)) {
        // Required add-on was not found in store.
        return false;
    }
    // Unmanaged addons can be installed via console only
    if ($addon_scheme->getUnmanaged() && !defined('CONSOLE')) {
        return false;
    }
    if ($addon_scheme != false) {
        // Register custom classes
        Registry::get('class_loader')->add('', Registry::get('config.dir.addons') . $addon);
        if ($addon_scheme->isPromo()) {
            $texts = fn_get_addon_permissions_text();
            fn_set_notification('E', __('error'), $texts['text']);
            return false;
        }
        $_data = array('addon' => $addon_scheme->getId(), 'priority' => $addon_scheme->getPriority(), 'dependencies' => implode(',', $addon_scheme->getDependencies()), 'conflicts' => implode(',', $addon_scheme->getConflicts()), 'requirements' => $addon_scheme->getRequirements(), 'version' => $addon_scheme->getVersion(), 'separate' => $addon_scheme->getSettingsLayout() == 'separate' ? 1 : 0, 'has_icon' => $addon_scheme->hasIcon(), 'unmanaged' => $addon_scheme->getUnmanaged(), 'status' => 'D');
        // Check system requirements (needed versions, installed extensions, etc.)
        if (!$addon_scheme->checkRequirements($_data['requirements'])) {
            return false;
        }
        $dependencies = SchemesManager::getInstallDependencies($_data['addon']);
        if (!empty($dependencies)) {
            fn_set_notification('W', __('warning'), __('text_addon_install_dependencies', array('[addon]' => implode(',', $dependencies))));
            return false;
        }
        if ($addon_scheme->callCustomFunctions('before_install') == false) {
            fn_uninstall_addon($addon, false);
            return false;
        }
        // Add add-on to registry
        Registry::set('addons.' . $addon, array('status' => 'D', 'priority' => $_data['priority']));
        // Execute optional queries
        if ($addon_scheme->processQueries('install', Registry::get('config.dir.addons') . $addon) == false) {
            fn_uninstall_addon($addon, false);
            return false;
        }
        if (fn_update_addon_settings($addon_scheme) == false) {
            fn_uninstall_addon($addon, false);
            return false;
        }
        db_query("REPLACE INTO ?:addons ?e", $_data);
        foreach ($addon_scheme->getAddonTranslations() as $translation) {
            db_query("REPLACE INTO ?:addon_descriptions ?e", array('lang_code' => $translation['lang_code'], 'addon' => $addon_scheme->getId(), 'name' => $translation['value'], 'description' => $translation['description']));
        }
        if ($original = $addon_scheme->getOriginals()) {
            db_query("REPLACE INTO ?:original_values ?e", array('msgctxt' => 'Addon:' . $addon, 'msgid' => $original['name']));
            db_query("REPLACE INTO ?:original_values ?e", array('msgctxt' => 'AddonDescription:' . $addon, 'msgid' => $original['description']));
        }
        // Install templates
        fn_install_addon_templates($addon_scheme->getId());
        // Put this addon settings to the registry
        $settings = Settings::instance()->getValues($addon_scheme->getId(), Settings::ADDON_SECTION, false);
        if (!empty($settings)) {
            Registry::set('settings.' . $addon, $settings);
            $addon_data = Registry::get('addons.' . $addon);
            Registry::set('addons.' . $addon, fn_array_merge($addon_data, $settings));
        }
        // Add optional language variables
        $language_variables = $addon_scheme->getLanguageValues(false);
        if (!empty($language_variables)) {
            db_query('REPLACE INTO ?:language_values ?m', $language_variables);
        }
        // Get only original values
        $language_variables = $addon_scheme->getLanguageValues(true);
        if (!empty($language_variables)) {
            db_query('REPLACE INTO ?:original_values ?m', $language_variables);
        }
        if (fn_allowed_for('ULTIMATE')) {
            foreach (fn_get_all_companies_ids() as $company) {
                ProductTabs::instance($company)->createAddonTabs($addon_scheme->getId(), $addon_scheme->getTabOrder());
            }
        } else {
            ProductTabs::instance()->createAddonTabs($addon_scheme->getId(), $addon_scheme->getTabOrder());
        }
        // Execute custom functions
        if ($addon_scheme->callCustomFunctions('install') == false) {
            fn_uninstall_addon($addon, false);
            return false;
        }
        if ($show_notification == true) {
            fn_set_notification('N', __('notice'), __('text_addon_installed', array('[addon]' => $addon_scheme->getName())));
        }
        // If we need to activate addon after install, call "update status" procedure
//.........这里部分代码省略.........
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:101,代码来源:fn.addons.php



注:本文中的fn_array_merge函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP fn_attach_image_pairs函数代码示例发布时间:2022-05-15
下一篇:
PHP fn_allowed_for函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap