本文整理汇总了PHP中fn_set_progress函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_set_progress函数的具体用法?PHP fn_set_progress怎么用?PHP fn_set_progress使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_set_progress函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: actionNextStep
/**
* Setup next_step action
*
* @param array $cart_settings Cart settings
* @param array $database_settings Database settings
* @param array $server_settings Server settings
* @return bool Always true
*/
public function actionNextStep($cart_settings, $database_settings, $server_settings)
{
$app = App::instance();
$validator = new Validator();
if ($validator->validateAll(array_merge($cart_settings, $server_settings, $database_settings))) {
fn_set_progress('parts', 14);
set_time_limit(0);
if ($app->connectToDB($database_settings['host'], $database_settings['name'], $database_settings['user'], $database_settings['password'], $database_settings['table_prefix'], $database_settings['database_backend'])) {
$app->setToStorage('database_settings', $database_settings);
define('CART_LANGUAGE', $cart_settings['main_language']);
define('DESCR_SL', $cart_settings['main_language']);
define('CART_SECONDARY_CURRENCY', 'NULL');
// Need for cache_level
$sCart = new Setup($cart_settings, $server_settings, $database_settings, $this->isDemoInstall($cart_settings));
$sAddons = new AddonsSetup();
/* Setup Scheme */
fn_set_progress('title', $app->t('setup_scheme'));
fn_set_progress('echo', $app->t('processing'), true);
fn_set_progress('step_scale', 2000);
$sCart->setupScheme();
/* Setup Scheme Data */
fn_set_progress('step_scale', 1);
fn_set_progress('title', $app->t('setup_data'));
fn_set_progress('echo', $app->t('processing'), true);
fn_set_progress('step_scale', 5000);
$sCart->setupData();
$sCart->setSimpleMode();
/* Setup Demo */
if ($this->isDemoInstall($cart_settings)) {
fn_set_progress('step_scale', 1);
fn_set_progress('title', $app->t('setup_demo'));
fn_set_progress('echo', $app->t('installing_demo_catalog'), true);
fn_set_progress('step_scale', 5000);
$sCart->setupDemo();
} else {
fn_set_progress('step_scale', 1);
fn_set_progress('echo', $app->t('cleaning'), true);
$sCart->clean();
}
$sCart->setupUsers();
/* Setup companies */
fn_set_progress('step_scale', 1);
fn_set_progress('title', $app->t('setup_companies'));
fn_set_progress('echo', $app->t('processing'), true);
$sCart->setupCompanies();
/* Setup Languages */
fn_set_progress('step_scale', 1);
fn_set_progress('title', $app->t('setup_languages'));
fn_set_progress('echo', $app->t('processing'), true);
fn_set_progress('step_scale', 1000);
$sCart->setupLanguages($this->isDemoInstall($cart_settings));
$sCart->setupThemes();
/* Setup Add-ons */
fn_set_progress('title', $app->t('setup_addons'));
fn_set_progress('echo', $app->t('processing'), true);
fn_set_progress('step_scale', 100);
$sAddons->setup($this->isDemoInstall($cart_settings), array());
/* Write config */
fn_set_progress('step_scale', 1);
fn_set_progress('echo', $app->t('writing_config'), true);
$sCart->writeConfig();
$this->_prepareHttpData();
$redirect_url = Registry::get('config.http_location') . '/install/index.php?dispatch=setup.complete';
if (Registry::get('runtime.comet')) {
Registry::get('ajax')->assign('force_redirection', $redirect_url);
} else {
fn_redirect($redirect_url);
}
exit;
}
} else {
if (Registry::get('runtime.comet')) {
exit;
} else {
$params['dispatch'] = 'setup.index';
$params['cart_settings'] = $cart_settings;
$params['database_settings'] = $database_settings;
$params['server_settings'] = $server_settings;
$app->run($params);
}
}
return true;
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:91,代码来源:SetupController.php
示例2: generate
public function generate($force = false)
{
$filename = $this->getFileName();
if (!is_dir(dirname($filename))) {
fn_mkdir(dirname($filename));
}
if ($force) {
fn_rm($filename);
}
if (!file_exists($filename)) {
fn_set_progress('echo', __('generating_xls'), false);
$header = $data = array();
$currencies = Registry::get('currencies');
$currency = $currencies[CART_SECONDARY_CURRENCY];
$currency_format = '#' . $currency['thousands_separator'] . '##0.' . str_repeat('0', $currency['decimals']);
$currency_format = $currency['after'] == 'Y' ? $currency_format . $currency['symbol'] : $currency['symbol'] . $currency_format;
foreach ($this->selected_fields as $field_id => $field_value) {
$header[$this->price_schema['fields'][$field_id]['title']] = $field_id == 'price' ? $currency_format : 'string';
}
$this->writer->writeSheetHeader($this->sheet, $header);
$this->render();
$this->writer->writeToFile($filename);
}
return $filename;
}
开发者ID:ambient-lounge,项目名称:site,代码行数:25,代码来源:Xlsx.php
示例3: processProducts
/**
* Gets products for printing and print them
* @param array $params product search params
*/
protected function processProducts($params)
{
$total = static::ITEMS_PER_PAGE;
while (static::ITEMS_PER_PAGE * ($params['page'] - 1) <= $total) {
list($products, $search) = fn_get_products($params, static::ITEMS_PER_PAGE);
$total = $search['total_items'];
if ($params['page'] == 1) {
fn_set_progress('parts', $total);
}
$get_images = !empty($this->selected_fields['image']);
$_params = array('get_icon' => $get_images, 'get_detailed' => $get_images, 'get_options' => Registry::get('addons.price_list.include_options') == 'Y' ? true : false, 'get_discounts' => false);
fn_gather_additional_products_data($products, $_params);
$params['page']++;
$this->printProductsBatch(true);
foreach ($products as $product) {
fn_set_progress('echo');
if (Registry::get('addons.price_list.include_options') == 'Y' && $product['has_options']) {
$product = fn_price_list_get_combination($product);
foreach ($product['combinations'] as $c_id => $c_value) {
$product['price'] = $product['combination_prices'][$c_id];
$product['weight'] = $product['combination_weight'][$c_id];
$product['amount'] = $product['combination_amount'][$c_id];
$product['product_code'] = $product['combination_code'][$c_id];
$this->printProductRow($product, $c_value);
}
} else {
$this->printProductRow($product);
}
}
$this->printProductsBatch();
}
}
开发者ID:ambient-lounge,项目名称:site,代码行数:36,代码来源:AGenerator.php
示例4: setup
/**
* Installs addons
*
* @param bool $install_demo
* @param array $addons List of addons to be installed, if empty will be installed addons according <auto_install> tag
* @return bool Always true
*/
public function setup($install_demo = true, $addons = array())
{
$app = App::instance();
Registry::set('customer_theme_path', Registry::get('config.dir.install_themes') . '/' . App::THEME_NAME);
$addons = empty($addons) ? $this->_getAddons() : $addons;
foreach ($addons as $addon_name) {
if (fn_install_addon($addon_name, false, $install_demo)) {
fn_set_progress('echo', $app->t('addon_installed', array('addon' => $addon_name)) . '<br/>', true);
}
Registry::set('runtime.database.errors', '');
}
return true;
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:20,代码来源:AddonsSetup.php
示例5: fn_delete_localization
function fn_delete_localization($localization_ids)
{
$loc_objects = fn_get_localization_objects();
fn_set_progress('parts', sizeof($localization_ids) * sizeof($loc_objects));
foreach ($localization_ids as $loc_id) {
foreach ($loc_objects as $table) {
fn_set_progress('echo', __('converting_data_in_table', array('[table]' => $table)));
db_query("UPDATE ?:{$table} SET localization = ?p", fn_remove_from_set('localization', $loc_id));
}
db_query("DELETE FROM ?:localizations WHERE localization_id = ?i", $loc_id);
db_query("DELETE FROM ?:localization_descriptions WHERE localization_id = ?i", $loc_id);
db_query("DELETE FROM ?:localization_elements WHERE localization_id = ?i", $loc_id);
}
fn_set_notification('N', __('notice'), __('done'));
}
开发者ID:askzap,项目名称:ultimate,代码行数:15,代码来源:localizations.php
示例6: display
/**
* Displays message to appropriate output screen (console/display)
*
* @param string $message Message text
* @param string $title Title text
* @param bool $next_step Move progress to next step
*/
public static function display($message, $title = '', $next_step = true)
{
if (self::isConsole()) {
if (!empty($title)) {
echo $title . PHP_EOL . '================================================' . PHP_EOL;
}
echo $message . PHP_EOL;
if ($next_step) {
echo 'Step ' . self::$current_step . '/' . self::$steps . ' completed' . PHP_EOL;
}
} else {
if (!empty($title)) {
fn_set_progress('title', $title);
}
fn_set_progress('echo', $message, $next_step);
}
if ($next_step) {
self::$current_step++;
}
}
开发者ID:askzap,项目名称:ultimate,代码行数:27,代码来源:Output.php
示例7: generate
public function generate($force = false)
{
$filename = $this->getFileName();
if (!is_dir(dirname($filename))) {
fn_mkdir(dirname($filename));
}
if ($force) {
fn_rm($filename);
}
// Min column width in percent
$min_width = array('product' => 50, 'product_code' => 13, 'image' => 10);
if (!file_exists($filename)) {
$max_perc = 100;
$field_count = count($this->selected_fields);
// First step. Check for the min width.
$perc = intval($max_perc / $field_count);
foreach ($this->selected_fields as $field_name => $active) {
if (isset($min_width[$field_name])) {
if ($min_width[$field_name] > $perc) {
$max_perc -= $min_width[$field_name];
$field_count--;
}
}
}
// Second step. Set up the new width values.
$perc = intval($max_perc / $field_count);
foreach ($this->selected_fields as $field_name => $active) {
if (!isset($min_width[$field_name]) || $min_width[$field_name] < $perc) {
$this->price_schema['fields'][$field_name]['min_width'] = $perc;
} else {
$this->price_schema['fields'][$field_name]['min_width'] = $min_width[$field_name];
}
}
fn_set_progress('echo', __('generating_pdf'), false);
$this->render();
}
return $filename;
}
开发者ID:ambient-lounge,项目名称:site,代码行数:38,代码来源:Pdf.php
示例8: fn_google_sitemap_check_counter
function fn_google_sitemap_check_counter(&$file, &$link_counter, &$file_counter, $links, $header, $footer, $type)
{
$stat = fstat($file);
if (count($links) + $link_counter > MAX_URLS_IN_MAP || $stat['size'] >= MAX_SIZE_IN_KBYTES * 1024) {
fwrite($file, $footer);
fclose($file);
$file_counter++;
$filename = fn_get_files_dir_path() . 'google_sitemap/sitemap' . $file_counter . '.xml';
$file = fopen($filename, "wb");
$link_counter = count($links);
fwrite($file, $header);
} else {
$link_counter += count($links);
fn_set_progress('echo', __($type));
}
}
开发者ID:askzap,项目名称:ultimate,代码行数:16,代码来源:func.php
示例9: synchronizationObjects
/**
* Sync ebay objects
* @param int $site_id
* @param int $category_id
* @return bool
*/
public static function synchronizationObjects($site_id, $category_id)
{
@set_time_limit(600);
$start_time = fn_get_storage_data('ebay_synchronization_start_time');
if (!empty($start_time) && $start_time > strtotime('-10 minutes')) {
$time = time();
$current_step = fn_get_storage_data('ebay_synchronization_step');
$count_steps = fn_get_storage_data('ebay_synchronization_step_count');
fn_set_progress('title', __('ebay_synchronization_title'));
fn_set_progress('parts', $count_steps);
for ($i = 1; $i < $current_step; $i++) {
fn_set_progress('echo', '.');
}
fn_set_progress('echo', fn_get_storage_data('ebay_synchronization_step_title'), false);
while (true) {
//TODO move logic to same function fn_get_storage_data
Registry::del('storage_data.ebay_synchronization_step');
Registry::del('storage_data.ebay_synchronization_step_title');
$step = fn_get_storage_data('ebay_synchronization_step');
if (empty($step)) {
return true;
}
if ($step != $current_step) {
fn_set_progress('echo', '.');
fn_set_progress('echo', fn_get_storage_data('ebay_synchronization_step_title'), false);
$current_step = $step;
}
if ($time < strtotime('-10 minutes')) {
return true;
}
sleep(1);
}
return true;
}
$objects = fn_ebay_get_objects_needed_synchronization($site_id, $category_id);
if (!empty($objects)) {
$current_step = 1;
register_shutdown_function(function () {
fn_set_storage_data('ebay_synchronization_start_time', null);
fn_set_storage_data('ebay_synchronization_step_title', null);
fn_set_storage_data('ebay_synchronization_step', null);
fn_set_storage_data('ebay_synchronization_step_count', null);
});
fn_set_storage_data('ebay_synchronization_start_time', time());
fn_set_storage_data('ebay_synchronization_step_count', count($objects));
fn_set_storage_data('ebay_synchronization_step', $current_step);
fn_set_progress('title', __('ebay_synchronization_title'));
fn_set_progress('parts', count($objects));
if (in_array('Site', $objects)) {
fn_set_progress('echo', __('ebay_synchronization_regions'), false);
fn_set_storage_data('ebay_synchronization_step_title', __('ebay_synchronization_regions'));
Site::synchronization();
fn_set_storage_data('ebay_synchronization_step', ++$current_step);
fn_set_progress('echo', '.');
}
if (in_array('Category', $objects)) {
fn_set_progress('echo', __('ebay_synchronization_categories'), false);
fn_set_storage_data('ebay_synchronization_step_title', __('ebay_synchronization_categories'));
Category::synchronization($site_id);
fn_set_storage_data('ebay_synchronization_step', ++$current_step);
fn_set_progress('echo', '.');
}
if (in_array('Shipping', $objects)) {
fn_set_progress('echo', __('ebay_synchronization_shipping_services'), false);
fn_set_storage_data('ebay_synchronization_step_title', __('ebay_synchronization_shipping_services'));
Shipping::synchronization($site_id);
fn_set_storage_data('ebay_synchronization_step', ++$current_step);
fn_set_progress('echo', '.');
}
if (in_array('CategoryFeature', $objects)) {
fn_set_progress('echo', __('ebay_synchronization_category_features'), false);
fn_set_storage_data('ebay_synchronization_step_title', __('ebay_synchronization_category_features'));
CategoryFeature::synchronization($site_id, $category_id);
fn_set_storage_data('ebay_synchronization_step', ++$current_step);
fn_set_progress('echo', '.');
}
}
return true;
}
开发者ID:ambient-lounge,项目名称:site,代码行数:85,代码来源:Controller.php
示例10: fn_set_notification
if (fn_copy($dump['path'], Registry::get('config.dir.backups') . $dump['name'])) {
fn_set_notification('N', __('notice'), __('done'));
} else {
fn_set_notification('E', __('error'), __('cant_create_backup_file'));
}
} else {
fn_set_notification('E', __('error'), __('cant_upload_file'));
}
}
if ($mode == 'optimize') {
// Log database optimization
fn_log_event('database', 'optimize');
$all_tables = db_get_fields("SHOW TABLES");
fn_set_progress('parts', sizeof($all_tables));
foreach ($all_tables as $table) {
fn_set_progress('echo', __('optimizing_table') . " <b>{$table}</b>...<br />");
db_query("OPTIMIZE TABLE {$table}");
db_query("ANALYZE TABLE {$table}");
$fields = db_get_hash_array("SHOW COLUMNS FROM {$table}", 'Field');
if (!empty($fields['is_global'])) {
// Sort table by is_global field
fn_echo('.');
db_query("ALTER TABLE {$table} ORDER BY is_global DESC");
} elseif (!empty($fields['position'])) {
// Sort table by position field
fn_echo('.');
db_query("ALTER TABLE {$table} ORDER BY position");
}
}
fn_set_notification('N', __('notice'), __('done'));
}
开发者ID:askzap,项目名称:ultimate,代码行数:31,代码来源:datakeeper.php
示例11: fn_copy
/**
* Recursively copy directory (or just a file)
*
* @param string $source
* @param string $dest
* @param bool $silent
* @param array $exclude_files
* @return bool True on success, false otherwise
*/
function fn_copy($source, $dest, $silent = true, $exclude_files = array())
{
/**
* Ability to forbid file copy or change parameters
*
* @param string $source source file/directory
* @param string $dest destination file/directory
* @param boolean $silent silent flag
* @param array $exclude files to exclude
*/
fn_set_hook('copy_file', $source, $dest, $silent, $exclude_files);
if (empty($source)) {
return false;
}
// Simple copy for a file
if (is_file($source)) {
$source_file_name = fn_basename($source);
if (in_array($source_file_name, $exclude_files)) {
return true;
}
if (@is_dir($dest)) {
$dest .= '/' . $source_file_name;
}
if (filesize($source) == 0) {
$fd = fopen($dest, 'w');
fclose($fd);
$res = true;
} else {
$res = @copy($source, $dest);
}
@chmod($dest, DEFAULT_FILE_PERMISSIONS);
clearstatcache(true, $dest);
return $res;
}
// Make destination directory
if ($silent == false) {
$_dir = strpos($dest, Registry::get('config.dir.root')) === 0 ? str_replace(Registry::get('config.dir.root') . '/', '', $dest) : $dest;
fn_set_progress('echo', $_dir . '<br/>');
}
if (!fn_mkdir($dest)) {
return false;
}
// Loop through the folder
if (@is_dir($source)) {
$dir = dir($source);
while (false !== ($entry = $dir->read())) {
// Skip pointers
if ($entry == '.' || $entry == '..') {
continue;
}
// Deep copy directories
if ($dest !== $source . '/' . $entry) {
if (fn_copy($source . '/' . $entry, $dest . '/' . $entry, $silent, $exclude_files) == false) {
return false;
}
}
}
// Clean up
$dir->close();
return true;
} else {
return false;
}
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:73,代码来源:fn.fs.php
示例12: fn_restore_dump
function fn_restore_dump($files)
{
if (empty($files)) {
return false;
}
fn_set_progress('parts', sizeof($files));
foreach ($files as $file) {
$is_archive = false;
$list = array($file);
if (in_array(fn_get_file_ext($file), array('zip', 'tgz'))) {
$is_archive = true;
fn_decompress_files(Registry::get('config.dir.database') . $file, Registry::get('config.dir.database') . '_tmp');
$list = fn_get_dir_contents(Registry::get('config.dir.database') . '_tmp', false, true, 'sql', '_tmp/');
}
foreach ($list as $_file) {
db_import_sql_file(Registry::get('config.dir.database') . $_file);
}
if ($is_archive) {
fn_rm(Registry::get('config.dir.database') . '_tmp');
}
}
// Log database restore
fn_log_event('database', 'restore');
fn_set_hook('database_restore', $files);
fn_clear_cache();
return true;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:27,代码来源:database.php
示例13: putList
/**
* Puts list of local files to storage
*
* @param array $list files list (relative path)
* @param string $prefix absolute path prefix
* @param array $params additional parameters list
* @return boolean true on success, false if at least one put was failed
*/
public function putList($list, $prefix, $params = array())
{
if (!empty($list)) {
fn_set_progress('step_scale', sizeof($list));
foreach ($list as $item) {
fn_set_progress('echo', '.');
if (strpos($prefix, '://') !== false) {
$params['contents'] = fn_get_contents($prefix . $item);
} else {
$params['file'] = $prefix . $item;
$params['keep_origins'] = true;
}
if (!$this->put($item, $params)) {
return false;
}
}
}
return true;
}
开发者ID:ambient-lounge,项目名称:site,代码行数:27,代码来源:ABackend.php
示例14: fn_install_theme_files
/**
* Installs theme files
*
* @param string $source_theme source theme name
* @param string $dest_theme destination theme name
* @param boolean $from_repo flag, if set to true, theme files are copied from themes_repository
* @return boolean true if theme was installed, false otherwise
*/
function fn_install_theme_files($source_theme, $dest_theme, $from_repo = true)
{
$path_dest = fn_get_theme_path('[themes]/' . $dest_theme, 'C');
if (!fn_is_theme_installed($dest_theme)) {
if (!fn_mkdir($path_dest)) {
fn_set_notification('E', __('error'), __('text_cannot_create_directory', array('[directory]' => fn_get_rel_dir($path_dest))));
return false;
}
$path_repo_base = '';
if ($from_repo) {
$path_repo = fn_get_theme_path('[repo]/' . $source_theme, 'C');
$manifest = Themes::factory($source_theme)->getRepoManifest();
$parent_theme = isset($manifest['parent_theme']) ? $manifest['parent_theme'] : Registry::get('config.base_theme');
if (!empty($parent_theme) && $source_theme != $parent_theme) {
$path_repo_base = fn_get_theme_path('[repo]/' . $parent_theme, 'C');
}
} else {
$path_repo = fn_get_theme_path('[themes]/' . $source_theme, 'C');
}
fn_set_progress('parts', fn_dirs_count($path_repo_base) + fn_dirs_count($path_repo) + 1);
// FIXME: Backward compatibility. Create manifest.json if theme only has manifest.ini
if (file_exists($path_repo . '/' . THEME_MANIFEST_INI) && !file_exists($path_repo . '/' . THEME_MANIFEST)) {
$content = parse_ini_file($path_repo . '/' . THEME_MANIFEST_INI);
fn_put_contents($path_repo . '/' . THEME_MANIFEST, json_encode($content));
}
if (!empty($path_repo_base)) {
fn_copy($path_repo_base, $path_dest, false);
// Clear layouts and styles data
fn_rm($path_dest . '/styles');
fn_rm($path_dest . '/layouts');
// FIXME: Backward compatibility
fn_rm($path_dest . '/presets');
}
fn_copy($path_repo, $path_dest, false);
}
// Re-install add-ons template files
list($installed_addons) = fn_get_addons(array('type' => 'installed'));
foreach ($installed_addons as $addon) {
fn_install_addon_templates($addon['addon']);
}
return true;
}
开发者ID:arpad9,项目名称:bygmarket,代码行数:50,代码来源:fn.common.php
示例15: putDir
/**
* Put directory to storage
*
* @param string $dir directory to get files from
* @param array $params additional parameters
* @return boolean true of success, false on fail
*/
public function putDir($dir, $params = array())
{
$s3 = $this->s3();
// get object to initialize class and get access to contstants below
$i = 0;
$max_batch = 10;
$files = fn_get_dir_contents($dir, false, true, '', '', true);
fn_set_progress('step_scale', sizeof($files));
foreach ($files as $source_file) {
fn_set_progress('echo', '.');
$i++;
$data = array('acl' => \AmazonS3::ACL_PUBLIC, 'headers' => array());
// File can not be accessible via direct link
if ($this->getOption('secured')) {
$data['headers']['Content-disposition'] = 'attachment; filename="' . fn_basename($source_file) . '"';
$data['acl'] = \AmazonS3::ACL_PRIVATE;
}
$data['contentType'] = fn_get_file_type($source_file);
$data['fileUpload'] = $dir . '/' . $source_file;
$res = $s3->batch()->create_object($this->getOption('bucket'), $this->prefix($source_file), $data);
if ($i == $max_batch) {
$s3->batch()->send();
$i = 0;
}
}
if (!empty($i)) {
$s3->batch()->send();
// send the rest of the batch
}
return true;
}
开发者ID:ambient-lounge,项目名称:site,代码行数:38,代码来源:Amazon.php
示例16: fn_export_ebay_products
function fn_export_ebay_products($template, $product_ids, $auth)
{
$parts = floor(count($product_ids) / 5) + 1;
fn_set_progress('parts', $parts);
$data = array();
$i = 1;
$j = 0;
$success = true;
foreach ($product_ids as $product_id) {
fn_echo(' .');
$data[$product_id] = fn_get_product_data($product_id, $auth, CART_LANGUAGE);
fn_gather_additional_product_data($data[$product_id], true, true);
$data[$product_id]['ebay_item_id'] = db_get_field('SELECT ebay_item_id FROM ?:ebay_template_products WHERE product_id = ?i AND template_id = ?i', $product_id, $template['template_id']);
if ($data[$product_id]['ebay_item_id']) {
fn_set_progress('echo', '<br />' . __('exporting_images_to_ebay'));
$images_data = Ebay::instance()->UploadImages(array($data[$product_id]));
list($transaction_id, $result, $error_code) = Ebay::instance()->ReviseItem($data[$product_id], $template, $images_data);
if (!empty($result)) {
if (!$error_code) {
$_data = array('ebay_item_id' => $data[$product_id]['ebay_item_id'], 'template_id' => $template['template_id'], 'product_id' => $product_id, 'product_hash' => fn_ebay_calculate_item_hash($data[$product_id]));
db_query('REPLACE INTO ?:ebay_template_products ?e', $_data);
} elseif ($error_code == 291) {
//listing time is over, we should relist item.
list($transaction_id, $result, $error_code) = Ebay::instance()->RelistItem($data[$product_id], $template, $images_data);
if (!$error_code) {
//Since the RelistItem return new ItemId we should remove old data.
db_query("DELETE FROM ?:ebay_template_products WHERE ebay_item_id = ?i", $data[$product_id]['ebay_item_id']);
$_data = array('ebay_item_id' => (int) $result->ItemID, 'template_id' => $template['template_id'], 'product_id' => $product_id, 'product_hash' => fn_ebay_calculate_item_hash($data[$product_id]));
db_query('REPLACE INTO ?:ebay_template_products ?e', $_data);
} else {
$success = false;
}
} else {
$success = false;
}
}
unset($data[$product_id]);
continue;
}
}
if (!empty($data)) {
fn_set_progress('echo', '<br />' . __('exporting_images_to_ebay'));
$images_data = Ebay::instance()->UploadImages($data);
fn_set_progress('echo', '<br />' . __('exporting_products_to_ebay'));
$_data = array_chunk($data, 5);
foreach ($_data as $products_data) {
list($transaction_id, $result) = Ebay::instance()->AddItems($products_data, $template, $images_data);
if (!empty($result)) {
foreach ($result as $item_key => $item) {
$_data = array('ebay_item_id' => $item['ItemID'], 'template_id' => $template['template_id'], 'product_id' => $products_data[$item_key]['product_id'], 'product_hash' => $item['product_hash']);
db_query('REPLACE INTO ?:ebay_template_products ?e', $_data);
}
} else {
$success = false;
}
}
}
if ($success) {
fn_set_notification('N', __('successful'), __('ebay_success_products_notice'));
}
return $success;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:62,代码来源:func.php
示例17: import
public static function import($store_data, $actualize_data = false)
{
set_time_limit(0);
ini_set('memory_limit', '1024M');
fn_define('STORE_IMPORT', true);
fn_define('DISABLE_HOOK_CACHE', true);
$log_dir = Registry::get('config.dir.store_import');
fn_mkdir($log_dir);
$logger = \Tygh\Logger::instance();
$logger->logfile = $log_dir . date('Y-m-d_H-i') . '.log';
if ($actualize_data) {
$logos = self::_backupLogos();
}
$import_classes_cascade = self::getImportClassesCascade($store_data);
$db_already_cloned = false;
Registry::set('runtime.skip_sharing_selection', true);
self::_removeTempTables();
self::_setUnavailableLangVars();
if (!$actualize_data) {
self::_uninstallAllAddons();
}
fn_set_progress('parts', count($import_classes_cascade) * 6 + 2);
$result = !empty($import_classes_cascade) ? true : false;
self::setDefaultLanguage($store_data);
$store_data['skin_name'] = self::setDefaultSkinName($store_data);
$theme_to_be_installed = db_get_field("SELECT value FROM ?:settings_vendor_values WHERE object_id = (SELECT object_id FROM ?:settings_objects WHERE name = 'theme_name')");
if (empty($theme_to_be_installed)) {
$theme_to_be_installed = db_get_field("SELECT value FROM ?:settings_objects WHERE name = 'theme_name'");
}
$style_id_to_be_installed = db_get_field("SELECT style_id FROM ?:bm_layouts WHERE is_default = '1'");
foreach ($import_classes_cascade as $class_name) {
if ($result) {
if (class_exists($class_name)) {
$obj = new $class_name($store_data);
$result = $db_already_cloned = $obj->import($db_already_cloned);
Settings::instance()->reloadSections();
} else {
$result = false;
fn_set_notification('E', __('error'), __('store_import.class_not_found'));
break;
}
} else {
fn_set_notification('E', __('error'), __('store_import.import_failed'));
break;
}
}
Registry::set('runtime.skip_sharing_selection', false);
if ($result) {
if (fn_allowed_for('ULTIMATE')) {
General::setForcedCompanyId();
}
General::setLicenseData();
//First, we should install all addons from old version in the new version that all templates, etc were installed in the new version
self::installAddons();
//Next, we should install all tabs in the upgraded database (mostly for the old version, 2.2.x)
self::installAddonsTabs();
if (fn_allowed_for('ULTIMATE')) {
General::ultProcessImages($store_data);
} else {
General::mveProcessImages($store_data);
}
General::processFiles($store_data, 'downloads');
General::processFiles($store_data, 'attachments');
General::processFiles($store_data, 'custom_files');
fn_clear_cache();
if (!$actualize_data) {
self::_removeRussianServices($store_data);
General::uninstallAddons(array('twigmo', 'searchanise', 'live_help', 'exim_store', 'webmail'));
/*
if (fn_allowed_for('ULTIMATE')) {
$company_ids = db_get_fields("SELECT company_id FROM ?:companies");
foreach ($company_ids as $company_id) {
self::_installTheme($company_id);
}
} else {
self::_installTheme();
}
*/
db_query("UPDATE ?:settings_objects SET value = '{$theme_to_be_installed}' WHERE name = 'theme_name'");
db_query("UPDATE ?:settings_vendor_values SET value = '{$theme_to_be_installed}' WHERE object_id = (SELECT object_id FROM ?:settings_objects WHERE name = 'theme_name')");
db_query("UPDATE ?:bm_layouts SET style_id = '{$style_id_to_be_installed}'");
db_query("UPDATE ?:bm_layouts SET theme_name = '{$theme_to_be_installed}'");
}
self::replaceOriginalDB($store_data, $actualize_data);
fn_install_addon('store_import', false);
fn_uninstall_addon('twigmo', false);
self::_removeTempTables();
if (defined('AJAX_REQUEST')) {
Registry::get('ajax')->assign('non_ajax_notifications', true);
Registry::get('ajax')->assign('force_redirection', fn_url('index.index'));
}
if ($actualize_data) {
self::_restoreLogos($logos);
}
fn_set_progress('step_scale', '1');
fn_set_progress('echo', __('store_import.done'), true);
return true;
}
return false;
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:100,代码来源:General.php
示例18: import
public static function import($store_data, $actualize_data = false)
{
set_time_limit(0);
ini_set('memory_limit', '1024M');
fn_define('STORE_IMPORT', true);
$log_dir = Registry::get('config.dir.store_import');
fn_mkdir($log_dir);
$logger = \Tygh\Logger::instance();
$logger->logfile = $log_dir . date('Y-m-d_H-i') . '.log';
if ($actualize_data) {
$logos = self::_backupLogos();
}
$import_classes_cascade = self::getImportClassesCascade($store_data);
$db_already_cloned = false;
Registry::set('runtime.skip_sharing_selection', true);
self::_removeTempTables();
self::_setUnavailableLangVars();
if (!$actualize_data) {
self::_uninstallAllAddons();
}
fn_set_progress('parts', count($import_classes_cascade) * 6 + 2);
$result = !empty($import_classes_cascade) ? true : false;
self::setDefaultLanguage($store_data);
foreach ($import_classes_cascade as $class_name) {
if ($result) {
if (class_exists($class_name)) {
$obj = new $class_name($store_data);
$result = $db_already_cloned = $obj->import($db_already_cloned);
Settings::instance()->reloadSections();
} else {
$result = false;
fn_set_notification('E', __('error'), __('store_import.class_not_found'));
break;
}
} else {
fn_set_notification('E', __('error'), __('store_import.import_failed'));
break;
}
}
Registry::set('runtime.skip_sharing_selection', false);
if ($result) {
General::setLicenseData();
//First, we should install all addons from old version in the new version that all templates, etc were installed in the new version
self::installAddons();
//Next, we should install all tabs in the upgraded database (mostly for the old version, 2.2.x)
self::installAddonsTabs();
fn_clear_cache();
if (!$actualize_data) {
self::_removeRussianServices($store_data);
if (fn_allowed_for('ULTIMATE')) {
$company_ids = db_get_fields("SELECT company_id FROM ?:companies");
foreach ($company_ids as $company_id) {
self::_installTheme($company_id);
}
} else {
self::_installTheme();
}
}
self::replaceOriginalDB($store_data, $actualize_data);
fn_install_addon('store_import', false);
self::_removeTempTables();
if (defined('AJAX_REQUEST')) {
Registry::get('ajax')->assign('non_ajax_notifications', true);
Registry::get('ajax')->assign('force_redirection', fn_url('index.index'));
}
if ($actualize_data) {
self::_restoreLogos($logos);
}
fn_set_progress('step_scale', '1');
fn_set_progress('echo', __('store_import.done'), true);
return true;
}
return false;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:74,代码来源:General.php
示例19: fn_print_order_invoices
}
}
}
}
$suffix = ".details?order_id={$_REQUEST['order_id']}";
}
if ($mode == 'bulk_print' && !empty($_REQUEST['order_ids'])) {
fn_print_order_invoices($_REQUEST['order_ids'], Registry::get('runtime.dispatch_extra') == 'pdf');
exit;
}
if ($mode == 'packing_slip' && !empty($_REQUEST['order_ids'])) {
fn_print_order_packing_slips($_REQUEST['order_ids'], Registry::get('runtime.dispatch_extra') == 'pdf');
exit;
}
if ($mode == 'remove_cc_info' && !empty($_REQUEST['order_ids'])) {
fn_set_progress('parts', sizeof($_REQUEST['order_ids']));
foreach ($_REQUEST['order_ids'] as $v) {
$paym
|
请发表评论