本文整理汇总了PHP中fn_attach_image_pairs函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_attach_image_pairs函数的具体用法?PHP fn_attach_image_pairs怎么用?PHP fn_attach_image_pairs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_attach_image_pairs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fn_update_paypal_settings
function fn_update_paypal_settings($settings)
{
if (isset($settings['pp_statuses'])) {
$settings['pp_statuses'] = serialize($settings['pp_statuses']);
}
foreach ($settings as $setting_name => $setting_value) {
Settings::instance()->updateValue($setting_name, $setting_value);
}
//Get company_ids for which we should update logos. If root admin click 'update for all', get all company_ids
if (isset($settings['pp_logo_update_all_vendors']) && $settings['pp_logo_update_all_vendors'] == 'Y') {
$company_ids = db_get_fields('SELECT company_id FROM ?:companies');
$company_id = array_shift($company_ids);
} elseif (!Registry::get('runtime.simple_ultimate')) {
$company_id = Registry::get('runtime.company_id');
} else {
$company_id = 1;
}
//Use company_id as pair_id
fn_attach_image_pairs('paypal_logo', 'paypal_logo', $company_id);
if (isset($company_ids)) {
foreach ($company_ids as $logo_id) {
fn_clone_image_pairs($logo_id, $company_id, 'paypal_logo');
}
}
}
示例2: fn_advanced_menu_update_category_pre
function fn_advanced_menu_update_category_pre(&$category_data, $category_id, $lang_code)
{
if (isset($category_data['advanced_menu'])) {
$category_data['advanced_menu'] = serialize($category_data['advanced_menu']);
}
if (!empty($category_id)) {
fn_attach_image_pairs('menu_image', 'menu', $category_id, $lang_code);
}
}
示例3: update
public function update($id, $params)
{
$data = array();
$status = Response::STATUS_BAD_REQUEST;
unset($params['category_id']);
$lang_code = $this->safeGet($params, 'lang_code', DEFAULT_LANGUAGE);
$category_id = fn_update_category($params, $id, $lang_code);
$this->prepareImages($params, $id);
$updated = fn_attach_image_pairs('category_main', 'category', $id, DESCR_SL);
if ($category_id || $updated) {
if ($updated && fn_notification_exists('extra', '404')) {
fn_delete_notification('404');
}
$status = Response::STATUS_OK;
$data = array('category_id' => $id);
}
return array('status' => $status, 'data' => $data);
}
示例4: fn_update_product_option
//.........这里部分代码省略.........
db_query("UPDATE ?:product_options_descriptions SET ?u WHERE option_id = ?i AND lang_code = ?s", $option_data, $option_id, $lang_code);
}
if (fn_allowed_for('ULTIMATE')) {
// options of shared product under the shared store hasn't a company_id. No necessary for updating.
if (!empty($option_data['company_id'])) {
fn_ult_update_share_object($option_id, 'product_options', $option_data['company_id']);
}
if (!empty($option_data['product_id'])) {
fn_ult_share_product_option($option_id, $option_data['product_id']);
}
}
if (!empty($option_data['variants'])) {
$var_ids = array();
// Generate special variants structure for checkbox (2 variants, 1 hidden)
if ($option_data['option_type'] == 'C') {
$option_data['variants'] = array_slice($option_data['variants'], 0, 1);
// only 1 variant should be here
reset($option_data['variants']);
$_k = key($option_data['variants']);
$option_data['variants'][$_k]['position'] = 1;
// checked variant
$v_id = db_get_field("SELECT variant_id FROM ?:product_option_variants WHERE option_id = ?i AND position = 0", $option_id);
$option_data['variants'][] = array('position' => 0, 'variant_id' => $v_id);
}
$variant_images = array();
foreach ($option_data['variants'] as $k => $v) {
if ((!isset($v['variant_name']) || $v['variant_name'] == '') && $option_data['option_type'] != 'C') {
continue;
}
// Update product options variants
if (isset($v['modifier'])) {
$v['modifier'] = floatval($v['modifier']);
if (floatval($v['modifier']) > 0) {
$v['modifier'] = '+' . $v['modifier'];
}
}
if (isset($v['weight_modifier'])) {
$v['weight_modifier'] = floatval($v['weight_modifier']);
if (floatval($v['weight_modifier']) > 0) {
$v['weight_modifier'] = '+' . $v['weight_modifier'];
}
}
// if (isset($v['set_by_user'])) {
//
// }
$v['option_id'] = $option_id;
if (empty($v['variant_id']) || !empty($v['variant_id']) && !db_get_field("SELECT variant_id FROM ?:product_option_variants WHERE variant_id = ?i", $v['variant_id'])) {
$v['variant_id'] = db_query("INSERT INTO ?:product_option_variants ?e", $v);
foreach (fn_get_translation_languages() as $v['lang_code'] => $_v) {
db_query("INSERT INTO ?:product_option_variants_descriptions ?e", $v);
}
} else {
db_query("DELETE FROM ?:product_option_variants_disabled WHERE product_id=?i AND option_id =?i AND variant_id=?i", $option_data['extraProductId'], $option_id, $v['variant_id']);
if ($v['status'] == 'Y') {
$vd = array('product_id' => $option_data['extraProductId'], 'option_id' => $option_id, 'variant_id' => $v['variant_id']);
db_query("INSERT INTO ?:product_option_variants_disabled ?e", $vd);
unset($v['status']);
}
db_query("UPDATE ?:product_option_variants SET ?u WHERE variant_id = ?i", $v, $v['variant_id']);
db_query("UPDATE ?:product_option_variants_descriptions SET ?u WHERE variant_id = ?i AND lang_code = ?s", $v, $v['variant_id'], $lang_code);
}
$var_ids[] = $v['variant_id'];
if ($option_data['option_type'] == 'C') {
fn_delete_image_pairs($v['variant_id'], 'variant_image');
// force deletion of variant image for "checkbox" option
} else {
$variant_images[$k] = $v['variant_id'];
}
}
if ($option_data['option_type'] != 'C' && !empty($variant_images)) {
fn_attach_image_pairs('variant_image', 'variant_image', 0, $lang_code, $variant_images);
}
// Delete obsolete variants
$condition = !empty($var_ids) ? db_quote('AND variant_id NOT IN (?n)', $var_ids) : '';
$deleted_variants = db_get_fields("SELECT variant_id FROM ?:product_option_variants WHERE option_id = ?i {$condition}", $option_id, $var_ids);
if (!empty($deleted_variants)) {
db_query("DELETE FROM ?:product_option_variants WHERE variant_id IN (?n)", $deleted_variants);
db_query("DELETE FROM ?:product_option_variants_descriptions WHERE variant_id IN (?n)", $deleted_variants);
foreach ($deleted_variants as $v_id) {
fn_delete_image_pairs($v_id, 'variant_image');
}
}
}
if (!fn_allowed_for('ULTIMATE:FREE')) {
// Rebuild exceptions
if (!empty($create) && !empty($option_data['product_id'])) {
fn_update_exceptions($option_data['product_id']);
}
}
/**
* Update product option (running after fn_update_product_option() function)
*
* @param array $option_data Array with option data
* @param int $option_id Option identifier
* @param array $deleted_variants Array with deleted variants ids
* @param string $lang_code Language code to add/update option for
*/
fn_set_hook('update_product_option_post', $option_data, $option_id, $deleted_variants, $lang_code);
return $option_id;
}
示例5: fn_update_shipping
/**
* Create/Update shipping name
*
* @param array $shipping_data shipping info
* @param int $shipping_id shipping identifier
* @param string $lang_code 2-letter language code (e.g. 'en', 'ru', etc.)
* @return string Shipping name if shipping identifier is not null; false otherwise
*/
function fn_update_shipping($shipping_data, $shipping_id, $lang_code = DESCR_SL)
{
if (!empty($shipping_data['shipping']) || !empty($shipping_id)) {
$shipping_data['localization'] = empty($shipping_data['localization']) ? '' : fn_implode_localizations($shipping_data['localization']);
$shipping_data['tax_ids'] = !empty($shipping_data['tax_ids']) ? fn_create_set($shipping_data['tax_ids']) : '';
$shipping_data['usergroup_ids'] = empty($shipping_data['usergroup_ids']) ? USERGROUP_ALL : (is_array($shipping_data['usergroup_ids']) ? implode(',', $shipping_data['usergroup_ids']) : $shipping_data['usergroup_ids']);
unset($shipping_data['shipping_id']);
if (isset($shipping_data['rate_calculation']) && $shipping_data['rate_calculation'] == 'M') {
$shipping_data['service_id'] = 0;
$shipping_data['service_params'] = array();
}
if (isset($shipping_data['service_params'])) {
$shipping_data['service_params'] = serialize($shipping_data['service_params']);
}
fn_set_hook('update_shipping', $shipping_data, $shipping_id, $lang_code);
if (!empty($shipping_id)) {
$action = 'update';
$arow = db_query("UPDATE ?:shippings SET ?u WHERE shipping_id = ?i", $shipping_data, $shipping_id);
db_query("UPDATE ?:shipping_descriptions SET ?u WHERE shipping_id = ?i AND lang_code = ?s", $shipping_data, $shipping_id, $lang_code);
if ($arow === false) {
fn_set_notification('E', __('error'), __('object_not_found', array('[object]' => __('shipping'))), '', '404');
$shipping_id = false;
}
} else {
$action = 'add';
$shipping_id = $shipping_data['shipping_id'] = db_query("INSERT INTO ?:shippings ?e", $shipping_data);
foreach (fn_get_translation_languages() as $shipping_data['lang_code'] => $_v) {
db_query("INSERT INTO ?:shipping_descriptions ?e", $shipping_data);
}
}
fn_set_hook('update_shipping_post', $shipping_data, $shipping_id, $lang_code, $action);
if ($shipping_id) {
fn_attach_image_pairs('shipping', 'shipping', $shipping_id, $lang_code);
if (!empty($shipping_data['rates'])) {
fn_update_shipping_rates($shipping_data, $shipping_id);
}
}
}
return $shipping_id;
}
示例6: fn_update_product_feature
function fn_update_product_feature($feature_data, $feature_id, $lang_code = DESCR_SL)
{
$deleted_variants = array();
// If this feature belongs to the group, get categories assignment from this group
if (!empty($feature_data['parent_id'])) {
$gdata = db_get_row("SELECT categories_path, display_on_product, display_on_catalog FROM ?:product_features WHERE feature_id = ?i", $feature_data['parent_id']);
$feature_data = fn_array_merge($feature_data, $gdata);
}
if (!intval($feature_id)) {
// check for intval as we use "0G" for new group
$feature_data['feature_id'] = $feature_id = db_query("INSERT INTO ?:product_features ?e", $feature_data);
foreach (Registry::get('languages') as $feature_data['lang_code'] => $_d) {
db_query("INSERT INTO ?:product_features_descriptions ?e", $feature_data);
}
} else {
db_query("UPDATE ?:product_features SET ?u WHERE feature_id = ?i", $feature_data, $feature_id);
db_query('UPDATE ?:product_features_descriptions SET ?u WHERE feature_id = ?i AND lang_code = ?s', $feature_data, $feature_id, $lang_code);
}
// If this feature is group, set its categories to all children
if ($feature_data['feature_type'] == 'G') {
$u = array('categories_path' => $feature_data['categories_path'], 'display_on_product' => $feature_data['display_on_product'], 'display_on_catalog' => $feature_data['display_on_catalog']);
db_query("UPDATE ?:product_features SET ?u WHERE parent_id = ?i", $u, $feature_id);
}
// Delete variants for simple features
if (strpos('SMNE', $feature_data['feature_type']) === false) {
$var_ids = db_get_fields("SELECT variant_id FROM ?:product_feature_variants WHERE feature_id = ?i", $feature_id);
if (!empty($var_ids)) {
db_query("DELETE FROM ?:product_feature_variants WHERE variant_id IN (?n)", $var_ids);
db_query("DELETE FROM ?:product_feature_variant_descriptions WHERE variant_id IN (?n)", $var_ids);
db_query("DELETE FROM ?:product_features_values WHERE variant_id IN (?n)", $var_ids);
foreach ($var_ids as $v_id) {
fn_delete_image_pairs($v_id, 'feature_variant');
}
}
} elseif (!empty($feature_data['variants'])) {
$var_ids = array();
foreach ($feature_data['variants'] as $k => $v) {
if (empty($v['variant'])) {
continue;
}
$v['feature_id'] = $feature_id;
if (empty($v['variant_id'])) {
$v['variant_id'] = db_query("INSERT INTO ?:product_feature_variants ?e", $v);
foreach (Registry::get('languages') as $v['lang_code'] => $_v) {
db_query("INSERT INTO ?:product_feature_variant_descriptions ?e", $v);
}
} else {
db_query("UPDATE ?:product_feature_variants SET ?u WHERE variant_id = ?i", $v, $v['variant_id']);
db_query("UPDATE ?:product_feature_variant_descriptions SET ?u WHERE variant_id = ?i AND lang_code = ?s", $v, $v['variant_id'], $lang_code);
}
if ($feature_data['feature_type'] == 'N') {
// number
db_query('UPDATE ?:product_features_values SET ?u WHERE variant_id = ?i AND lang_code = ?s', array('value_int' => $v['variant']), $v['variant_id'], $lang_code);
}
$var_ids[$k] = $v['variant_id'];
$feature_data['variants'][$k]['variant_id'] = $v['variant_id'];
// for addons
}
if (!empty($var_ids)) {
fn_attach_image_pairs('variant_image', 'feature_variant', 0, $lang_code, $var_ids);
}
// Delete obsolete variants
$deleted_variants = db_get_fields("SELECT variant_id FROM ?:product_feature_variants WHERE feature_id = ?i AND variant_id NOT IN (?n)", $feature_id, $var_ids);
if (!empty($deleted_variants)) {
db_query("DELETE FROM ?:product_feature_variants WHERE variant_id IN (?n)", $deleted_variants);
db_query("DELETE FROM ?:product_feature_variant_descriptions WHERE variant_id IN (?n)", $deleted_variants);
db_query("DELETE FROM ?:product_features_values WHERE variant_id IN (?n)", $deleted_variants);
foreach ($deleted_variants as $v_id) {
fn_delete_image_pairs($v_id, 'feature_variant');
}
}
}
fn_set_hook('update_product_feature', $feature_data, $feature_id, $deleted_variants, $lang_code);
return $feature_id;
}
示例7: foreach
if ($mode == 'add_combinations') {
if (is_array($_REQUEST['add_inventory'])) {
foreach ($_REQUEST['add_inventory'] as $k => $v) {
$combination_hash = fn_generate_cart_id($_REQUEST['product_id'], array('product_options' => $_REQUEST['add_options_combination'][$k]));
$combination = fn_get_options_combination($_REQUEST['add_options_combination'][$k]);
$product_code = fn_get_product_code($_REQUEST['product_id'], $_REQUEST['add_options_combination'][$k]);
$_data = array('product_id' => $_REQUEST['product_id'], 'combination_hash' => $combination_hash, 'combination' => $combination, 'product_code' => !empty($product_code) ? $product_code : '');
$_data = fn_array_merge($v, $_data);
db_query("REPLACE INTO ?:product_options_inventory ?e", $_data);
}
}
$suffix = ".inventory?product_id={$_REQUEST['product_id']}";
}
if ($mode == 'update_combinations') {
// Updating images
fn_attach_image_pairs('combinations', 'product_option', 0, CART_LANGUAGE, array());
$inventory = db_get_hash_array("SELECT * FROM ?:product_options_inventory WHERE product_id = ?i", 'combination_hash', $_REQUEST['product_id']);
foreach ($inventory as $i) {
$inventory_ids[] = $i['combination_hash'];
}
fn_attach_aditional_image_pairs('product_option_add_additional', 'product_option', 0, CART_LANGUAGE, $inventory_ids);
if (!empty($_REQUEST['inventory'])) {
foreach ($_REQUEST['inventory'] as $k => $v) {
db_query("UPDATE ?:product_options_inventory SET ?u WHERE combination_hash = ?s", $v, $k);
if ($inventory[$k]['amount'] <= 0 && $v['amount'] > 0) {
fn_send_product_notifications($_REQUEST['product_id']);
}
}
}
$suffix = ".inventory?product_id={$_REQUEST['product_id']}";
}
示例8: die
* 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. *
****************************************************************************/
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
die('Access denied');
}
fn_trusted_vars("processor_params", "payment_data");
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($mode == 'update') {
$payment_id = fn_attach_image_pairs('path_stamp', 'stamp', $_REQUEST['payment_id'], DESCR_SL);
}
return array(CONTROLLER_STATUS_OK, "payments.manage");
}
if ($mode == 'update' || $mode == 'manage') {
$processors = Tygh::$app['view']->getTemplateVars('payment_processors');
if (!empty($processors)) {
$rus_payments = array();
foreach (fn_get_schema('rus_payments', 'processors') as $rus_payment) {
$rus_payments[$rus_payment['processor']] = $rus_payment;
}
foreach ($processors as &$processor) {
$processor['position'] = 'default_' . $processor['processor'];
if (!empty($rus_payments[$processor['processor']])) {
$processor['russian'] = 'Y';
$processor['type'] = 'R';
示例9: fn_banners_update_banner
function fn_banners_update_banner($data, $banner_id, $lang_code = DESCR_SL)
{
if (isset($data['timestamp'])) {
$data['timestamp'] = fn_parse_date($data['timestamp']);
}
$data['localization'] = empty($data['localization']) ? '' : fn_implode_localizations($data['localization']);
if (!empty($banner_id)) {
db_query("UPDATE ?:banners SET ?u WHERE banner_id = ?i", $data, $banner_id);
db_query("UPDATE ?:banner_descriptions SET ?u WHERE banner_id = ?i AND lang_code = ?s", $data, $banner_id, $lang_code);
$banner_image_id = fn_get_banner_image_id($banner_id, $lang_code);
$banner_image_exist = !empty($banner_image_id);
$banner_is_multilang = Registry::get('addons.banners.banner_multilang') == 'Y';
$image_is_update = fn_banners_need_image_update();
if ($banner_is_multilang) {
if ($banner_image_exist && $image_is_update) {
fn_delete_image_pairs($banner_image_id, 'promo');
db_query("DELETE FROM ?:banner_images WHERE banner_id = ?i AND lang_code = ?s", $banner_id, $lang_code);
$banner_image_exist = false;
}
} else {
if (isset($data['url'])) {
db_query("UPDATE ?:banner_descriptions SET url = ?s WHERE banner_id = ?i", $data['url'], $banner_id);
}
}
if ($image_is_update && !$banner_image_exist) {
$banner_image_id = db_query("INSERT INTO ?:banner_images (banner_id, lang_code) VALUE(?i, ?s)", $banner_id, $lang_code);
}
$pair_data = fn_attach_image_pairs('banners_main', 'promo', $banner_image_id, $lang_code);
if (!$banner_is_multilang && !$banner_image_exist) {
fn_banners_image_all_links($banner_id, $pair_data, $lang_code);
}
} else {
$banner_id = $data['banner_id'] = db_query("REPLACE INTO ?:banners ?e", $data);
foreach (Languages::getAll() as $data['lang_code'] => $v) {
db_query("REPLACE INTO ?:banner_descriptions ?e", $data);
}
if (fn_banners_need_image_update()) {
$data_banner_image = array('banner_id' => $banner_id, 'lang_code' => $lang_code);
$banner_image_id = db_get_next_auto_increment_id('banner_images');
$pair_data = fn_attach_image_pairs('banners_main', 'promo', $banner_image_id, $lang_code);
if (!empty($pair_data)) {
db_query("INSERT INTO ?:banner_images ?e", $data_banner_image);
fn_banners_image_all_links($banner_id, $pair_data, $lang_code);
}
}
}
return $banner_id;
}
示例10: fn_update_configurator_group
function fn_update_configurator_group($data, $group_id, $lang_code = DESCR_SL)
{
if (!empty($group_id)) {
db_query('UPDATE ?:conf_groups SET ?u WHERE group_id = ?i', $data, $group_id);
db_query('UPDATE ?:conf_group_descriptions SET ?u WHERE group_id = ?i AND lang_code = ?s', $data, $group_id, $lang_code);
} else {
$group_id = $data['group_id'] = db_query('INSERT INTO ?:conf_groups ?e', $data);
foreach ((array) Registry::get('languages') as $data['lang_code'] => $_v) {
db_query("INSERT INTO ?:conf_group_descriptions ?e", $data);
}
}
// Updating category images
fn_attach_image_pairs('configurator_main', 'conf_group', $group_id, $lang_code);
// Update group products
db_query("DELETE FROM ?:conf_group_products WHERE group_id = ?i", $group_id);
if (!empty($data['product_ids'])) {
$p_ids = explode(',', $data['product_ids']);
foreach ($p_ids as $p_id) {
db_query("INSERT INTO ?:conf_group_products (group_id, product_id) VALUES (?i, ?i)", $group_id, $p_id);
}
}
return $group_id;
}
示例11: fn_projects_update_page_post
function fn_projects_update_page_post($page_data, $page_id, $lang_code, $create, $old_page_data)
{
if (!empty($page_data['page_type']) && $page_data['page_type'] == PAGE_TYPE_PROJECTS) {
fn_attach_image_pairs('projects_image', 'projects', $page_id, $lang_code);
db_query("REPLACE INTO ?:projects_authors ?e", array('page_id' => $page_id, 'user_id' => $_SESSION['auth']['user_id']));
}
}
示例12: fn_update_shipping
function fn_update_shipping($data, $shipping_id, $lang_code = DESCR_SL)
{
$data['localization'] = empty($data['localization']) ? '' : fn_implode_localizations($data['localization']);
$data['tax_ids'] = !empty($data['tax_ids']) ? fn_create_set($data['tax_ids']) : '';
$data['usergroup_ids'] = empty($data['usergroup_ids']) ? '' : implode(',', $data['usergroup_ids']);
fn_set_hook('update_shipping', $data, $shipping_id, $lang_code);
if (!empty($shipping_id)) {
db_query("UPDATE ?:shippings SET ?u WHERE shipping_id = ?i", $data, $shipping_id);
db_query("UPDATE ?:shipping_descriptions SET ?u WHERE shipping_id = ?i AND lang_code = ?s", $data, $shipping_id, $lang_code);
} else {
$shipping_id = $data['shipping_id'] = db_query("INSERT INTO ?:shippings ?e", $data);
foreach ((array) Registry::get('languages') as $data['lang_code'] => $_v) {
db_query("INSERT INTO ?:shipping_descriptions ?e", $data);
}
}
if ($shipping_id) {
fn_attach_image_pairs('shipping', 'shipping', $shipping_id, $lang_code);
}
return $shipping_id;
}
示例13: fn_create_logo
/**
* Adds logo
* @param array $logo_data logo data (layout_id, image path, type)
* @param integer $company_id company ID
* @return integer ID of created logo
*/
function fn_create_logo($logo_data, $company_id = null)
{
$condition = '';
if (!empty($logo_data['layout_id'])) {
$condition .= db_quote(" AND layout_id = ?i", $logo_data['layout_id']);
}
if (!empty($company_id)) {
$condition .= db_quote(" AND company_id = ?i", $company_id);
}
$logo_id = db_get_field("SELECT logo_id FROM ?:logos WHERE type = ?s ?p", $logo_data['type'], $condition);
if (empty($logo_id)) {
$logo_id = db_query("INSERT INTO ?:logos ?e", array('type' => $logo_data['type'], 'layout_id' => !empty($logo_data['layout_id']) ? $logo_data['layout_id'] : 0, 'company_id' => $company_id));
}
if (!empty($logo_data['image_path'])) {
if (file_exists($logo_data['image_path'])) {
$_REQUEST['logotypes_image_data'] = array(array('type' => 'M', 'object_id' => $logo_id));
$_REQUEST['type_logotypes_image_icon'] = array('server');
$_REQUEST['file_logotypes_image_icon'] = array($logo_data['image_path']);
fn_attach_image_pairs('logotypes', 'logos');
}
}
return $logo_id;
}
示例14: _saveUploadedLogos
/**
* Save uploaded logo and favicon and return array of their urls
* @return Array of Strings
*/
private static function _saveUploadedLogos()
{
$logo_names = array('logo', 'favicon');
$options = array();
foreach ($logo_names as $logo_name) {
$pair_ids = fn_attach_image_pairs($logo_name, 'twg_logos');
if (!empty($pair_ids)) {
$image_id = TwigmoImage::getImageId(array('pair_id' => reset($pair_ids), 'object_type' => 'twg_logos'));
$image_data = fn_get_image($image_id, 'twg_logos');
$options[$logo_name . '_url'] = $image_data['http_image_path'];
}
}
return $options;
}
示例15: fn_update_store_location
function fn_update_store_location($store_location_data, $store_location_id, $lang_code = DESCR_SL)
{
$store_location_data['localization'] = empty($store_location_data['localization']) ? '' : fn_implode_localizations($store_location_data['localization']);
if (empty($store_location_id)) {
if (empty($store_location_data['position'])) {
$store_location_data['position'] = db_get_field('SELECT MAX(position) FROM ?:store_locations');
$store_location_data['position'] += 10;
}
$store_location_id = db_query('INSERT INTO ?:store_locations ?e', $store_location_data);
$store_location_data['store_location_id'] = $store_location_id;
foreach (fn_get_translation_languages() as $store_location_data['lang_code'] => $v) {
db_query("INSERT INTO ?:store_location_descriptions ?e", $store_location_data);
}
} else {
db_query('UPDATE ?:store_locations SET ?u WHERE store_location_id = ?i', $store_location_data, $store_location_id);
db_query('UPDATE ?:store_location_descriptions SET ?u WHERE store_location_id = ?i AND lang_code = ?s', $store_location_data, $store_location_id, $lang_code);
}
// Update main images pair
fn_attach_image_pairs('store_locations', 'store_locations', $store_location_id, $lang_code);
// Update additional images
fn_attach_image_pairs('store_locations_additional', 'store_locations', $store_location_id, $lang_code);
// Adding new additional images
fn_attach_image_pairs('store_locations_add_additional', 'store_locations', $store_location_id, $lang_code);
//die($store_location_id);
return $store_location_id;
}