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

PHP fn_basename函数代码示例

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

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



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

示例1: fn_settings_variants_appearance_default_image_previewer

function fn_settings_variants_appearance_default_image_previewer()
{
    $previewers_path = Registry::get('config.dir.root') . '/js/tygh/previewers';
    $previewers = fn_get_dir_contents($previewers_path, false, true, 'js');
    $return = array();
    foreach ($previewers as $previewer) {
        $previewer_description = fn_get_file_description($previewers_path . '/' . $previewer, 'previewer-description');
        $return[fn_basename($previewer, '.previewer.js')] = $previewer_description;
    }
    return $return;
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:11,代码来源:variants.functions.php


示例2: fn_update_attachments

function fn_update_attachments($attachment_data, $attachment_id, $object_type, $object_id, $type = 'M', $files = null, $lang_code = DESCR_SL)
{
    $object_id = intval($object_id);
    $directory = $object_type . '/' . $object_id;
    if ($files != null) {
        $uploaded_data = $files;
    } else {
        $uploaded_data = fn_filter_uploaded_data('attachment_files');
    }
    if (!empty($attachment_id)) {
        $rec = array('usergroup_ids' => empty($attachment_data['usergroup_ids']) ? '0' : implode(',', $attachment_data['usergroup_ids']), 'position' => $attachment_data['position']);
        db_query("UPDATE ?:attachment_descriptions SET description = ?s WHERE attachment_id = ?i AND lang_code = ?s", $attachment_data['description'], $attachment_id, $lang_code);
        db_query("UPDATE ?:attachments SET ?u WHERE attachment_id = ?i AND object_type = ?s AND object_id = ?i AND type = ?s", $rec, $attachment_id, $object_type, $object_id, $type);
        fn_set_hook('attachment_update_file', $attachment_data, $attachment_id, $object_type, $object_id, $type, $files, $lang_code, $uploaded_data);
    } elseif (!empty($uploaded_data)) {
        $rec = array('object_type' => $object_type, 'object_id' => $object_id, 'usergroup_ids' => empty($attachment_data['usergroup_ids']) ? '0' : implode(',', $attachment_data['usergroup_ids']), 'position' => $attachment_data['position']);
        if ($type !== null) {
            $rec['type'] = $type;
        } elseif (!empty($attachment_data['type'])) {
            $rec['type'] = $attachment_data['type'];
        }
        $attachment_id = db_query("INSERT INTO ?:attachments ?e", $rec);
        if ($attachment_id) {
            // Add file description
            foreach (fn_get_translation_languages() as $lang_code => $v) {
                $rec = array('attachment_id' => $attachment_id, 'lang_code' => $lang_code, 'description' => is_array($attachment_data['description']) ? $attachment_data['description'][$lang_code] : $attachment_data['description']);
                db_query("INSERT INTO ?:attachment_descriptions ?e", $rec);
            }
            $uploaded_data[$attachment_id] = $uploaded_data[0];
            unset($uploaded_data[0]);
        }
        fn_set_hook('attachment_add_file', $attachment_data, $object_type, $object_id, $type, $files, $attachment_id, $uploaded_data);
    }
    if ($attachment_id && !empty($uploaded_data[$attachment_id]) && $uploaded_data[$attachment_id]['size']) {
        $filename = $uploaded_data[$attachment_id]['name'];
        $old_filename = db_get_field("SELECT filename FROM ?:attachments WHERE attachment_id = ?i", $attachment_id);
        if ($old_filename) {
            Storage::instance('attachments')->delete($directory . '/' . $old_filename);
        }
        list($filesize, $filename) = Storage::instance('attachments')->put($directory . '/' . $filename, array('file' => $uploaded_data[$attachment_id]['path']));
        if ($filesize) {
            $filename = fn_basename($filename);
            db_query("UPDATE ?:attachments SET filename = ?s, filesize = ?i WHERE attachment_id = ?i", $filename, $filesize, $attachment_id);
        }
    }
    return $attachment_id;
}
开发者ID:ambient-lounge,项目名称:site,代码行数:47,代码来源:func.php


示例3: fn_price_list_pdf_url_info

function fn_price_list_pdf_url_info()
{
    $return_url = fn_url('addons.manage', 'A', defined('HTTPS') ? 'https' : 'http');
    if (fn_allowed_for('ULTIMATE') && !Registry::get('runtime.company_id')) {
        $text = __('ult_pdf_info') . '<br />';
    } else {
        $text = __('pdf_info') . '<br />';
    }
    $modes = fn_price_list_get_pdf_layouts();
    if (!empty($modes['pdf'])) {
        foreach ($modes['pdf'] as $mode) {
            $mode = fn_basename($mode, '.php');
            $text .= fn_build_link_on_price('price_list.view?display=', $mode, $return_url);
        }
    }
    $text .= '<br />';
    return $text;
}
开发者ID:askzap,项目名称:ultimate,代码行数:18,代码来源:func.php


示例4: urlToCss

 /**
  * Converts URL (http://e.com/a.png) to CSS property ( url("../a.png") )
  * @param  string $style_id   style ID
  * @param  array  $style_data style data (fields)
  * @return array  modified style data
  */
 private function urlToCss($style_id, $style_data)
 {
     $patterns_url = Patterns::instance($this->params)->getUrl($style_id, true);
     if (!empty($this->schema['backgrounds']['fields'])) {
         foreach ($this->schema['backgrounds']['fields'] as $field) {
             if (!empty($field['properties']['pattern'])) {
                 $var_name = $field['properties']['pattern'];
                 if (!empty($style_data[$var_name]) && strpos($style_data[$var_name], '//') !== false) {
                     $url = preg_replace('/url\\([\'"]?(.*?)[\'"]?\\)/', '$1', $style_data[$var_name]);
                     if (strpos($url, '//') === 0) {
                         $url = 'http:' . $url;
                     }
                     $url = fn_normalize_path($url);
                     if (strpos($url, $patterns_url) !== false) {
                         $url = str_replace($patterns_url, '..', $url);
                         if (strpos($url, '?') !== false) {
                             // URL is parsed by Less::parseUrls method, so remove everything after ?
                             list($url) = explode('?', $url);
                         }
                     } elseif ($style_id) {
                         // external url
                         $tmp_file = fn_create_temp_file();
                         fn_put_contents($tmp_file, fn_get_contents($url));
                         $_style = Patterns::instance($this->params)->save($style_id, array('data' => $style_data), array($var_name => array('name' => fn_basename($url), 'path' => $tmp_file)));
                         $style_data = $_style['data'];
                         continue;
                         // assignment done in save method
                     }
                     $style_data[$var_name] = 'url(' . $url . ')';
                 }
             }
         }
     }
     return $style_data;
 }
开发者ID:askzap,项目名称:ask-zap,代码行数:41,代码来源:Styles.php


示例5: fn_echo

                // Sort table by position field
                fn_echo('.');
                db_query("ALTER TABLE {$table} ORDER BY position");
            }
        }
        fn_set_notification('N', __('notice'), __('done'));
    }
    if ($mode == 'delete') {
        if (!empty($_REQUEST['backup_file'])) {
            fn_rm(Registry::get('config.dir.backups') . fn_basename($_REQUEST['backup_file']));
        }
    }
    return array(CONTROLLER_STATUS_OK, 'datakeeper.manage');
}
if ($mode == 'getfile' && !empty($_REQUEST['file'])) {
    fn_get_file(Registry::get('config.dir.backups') . fn_basename($_REQUEST['file']));
} elseif ($mode == 'manage') {
    $view = Tygh::$app['view'];
    // Calculate database size and fill tables array
    $status_data = db_get_array("SHOW TABLE STATUS");
    $database_size = 0;
    $all_tables = array();
    foreach ($status_data as $k => $v) {
        $database_size += $v['Data_length'] + $v['Index_length'];
        $all_tables[] = $v['Name'];
    }
    $view->assign('database_size', $database_size);
    $view->assign('all_tables', $all_tables);
    $files = fn_get_dir_contents(Registry::get('config.dir.backups'), false, true, array('.sql', '.tgz', '.zip'), '', true);
    sort($files, SORT_STRING);
    $backup_files = array();
开发者ID:askzap,项目名称:ultimate,代码行数:31,代码来源:datakeeper.php


示例6: fn_ftp_chmod_file

function fn_ftp_chmod_file($filename, $perm = DEFAULT_FILE_PERMISSIONS, $recursive = false)
{
    $result = false;
    $ftp = Registry::get('ftp_connection');
    if (is_resource($ftp)) {
        $dest = dirname($filename);
        $dest = rtrim($dest, '/') . '/';
        // force adding trailing slash to path
        $rel_path = str_replace(Registry::get('config.dir.root') . '/', '', $dest);
        $cdir = ftp_pwd($ftp);
        if (empty($rel_path)) {
            // if rel_path is empty, assume it's root directory
            $rel_path = $cdir;
        }
        if (@ftp_chdir($ftp, $rel_path)) {
            $result = @ftp_site($ftp, 'CHMOD ' . sprintf('0%o', $perm) . ' ' . fn_basename($filename));
            if ($recursive) {
                $path = fn_normalize_path($cdir . '/' . $rel_path . fn_basename($filename));
                if (is_dir($path)) {
                    $_files = fn_get_dir_contents($path, true, true, '', '', true);
                    if (!empty($_files)) {
                        foreach ($_files as $_file) {
                            fn_ftp_chmod_file($path . '/' . $_file, $perm, false);
                        }
                    }
                }
            }
            ftp_chdir($ftp, $cdir);
        }
    }
    return $result;
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:32,代码来源:fn.fs.php


示例7: fn_te_normalize_path

    $file_path = fn_te_normalize_path($_REQUEST, $root_dir);
    if (fn_te_check_path($file_path)) {
        $repo_path = str_replace($root_dir, fn_te_get_root('repo'), $file_path);
        if (!file_exists($repo_path) && fn_get_theme_path('[theme]') != Registry::get('config.base_theme') && is_dir(fn_get_theme_path('[repo]/[theme]'))) {
            $repo_path = preg_replace("/\\/themes_repository\\/(\\w+)\\//", "/themes_repository/" . Registry::get('config.base_theme') . "/", $repo_path);
        }
        $object_base = is_file($repo_path) ? 'file' : (is_dir($repo_path) ? 'directory' : '');
        if (!empty($object_base) && fn_copy($repo_path, $file_path)) {
            fn_set_notification('N', __('notice'), __("text_{$object_base}_restored", array("[{$object_base}]" => fn_basename($file_path))));
            Tygh::$app['ajax']->assign('content', fn_get_contents($file_path));
            $copied = true;
        }
    }
    if (!$copied) {
        $object_base = empty($object_base) ? 'file' : $object_base;
        fn_set_notification('E', __('error'), __("text_cannot_restore_{$object_base}", array("[{$object_base}]" => fn_basename($file_path))));
    }
    return array(CONTROLLER_STATUS_REDIRECT, 'templates.init_view?dir=' . $_REQUEST['file_path'] . '/' . $_REQUEST['file']);
}
/**
 * Checks if working path is inside root directory
 * @param string $path working path
 * @return boolean true of success, false - otherwise
 */
function fn_te_check_path($path)
{
    $path = fn_normalize_path($path);
    $base_dir = fn_te_get_root('full');
    return strpos($path, $base_dir) === 0 && !fn_te_filter_path($path);
}
/**
开发者ID:askzap,项目名称:ultimate,代码行数:31,代码来源:templates.php


示例8: getRelPath

 /**
  * Gets patterns relative (to css files) path
  * @param  string $style_id style ID
  * @return string patterns relative path
  */
 public static function getRelPath($style_id)
 {
     return '../media/images/patterns/' . fn_basename($style_id);
 }
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:9,代码来源:Patterns.php


示例9: fn_exim_1c_import_products

function fn_exim_1c_import_products($catalog, $user_data, $company_id, $lang_code, $cml)
{
    if (isset($catalog->{$cml}['products'])) {
        $images = $products = array();
        list($dir_1c, $dir_1c_url, $dir_1c_images) = fn_rus_exim_1c_get_dir_1c();
        $_categories = Registry::get('rus_exim_1c.categories_1c');
        $settings_1c = Registry::get('addons.rus_exim_1c');
        $only_import_offers = $settings_1c['exim_1c_only_import_offers'];
        $import_product_name = $settings_1c['exim_1c_import_product_name'];
        $import_product_code = $settings_1c['exim_1c_import_product_code'];
        $allow_import_categories = $settings_1c['exim_1c_allow_import_categories'];
        $allow_import_features = $settings_1c['exim_1c_allow_import_features'];
        $import_full_description = $settings_1c['exim_1c_import_full_description'];
        $import_short_description = $settings_1c['exim_1c_import_short_description'];
        $import_page_title = $settings_1c['exim_1c_page_title'];
        $property_for_promo_text = trim($settings_1c['exim_1c_property_product']);
        $category_link_type = $settings_1c['exim_1c_category_link_type'];
        $all_images_is_additional = $settings_1c['exim_1c_all_images_is_additional'];
        $add_tax = $settings_1c['exim_1c_add_tax'];
        $hide_product = $settings_1c['exim_1c_add_out_of_stock'];
        $schema_version = $settings_1c['exim_1c_schema_version'];
        $type_option = $settings_1c['exim_1c_type_option'];
        $standart_option_name = $settings_1c['exim_1c_import_option_name'];
        $features_1c = array();
        if (Registry::isExist('rus_exim_1c.features_1c')) {
            $features_1c = Registry::get('rus_exim_1c.features_1c');
        }
        foreach ($catalog->{$cml}['products']->{$cml}['product'] as $_product) {
            if (empty($_product->{$cml}['name']) || empty($_product->{$cml}['groups']->{$cml}['id'])) {
                continue;
            }
            $ids = fn_explode('#', $_product->{$cml}['id']);
            $guid_product = array_shift($ids);
            $product_id = db_get_field("SELECT product_id FROM ?:products WHERE external_id = ?s", $guid_product);
            $product_id = empty($product_id) ? 0 : $product_id;
            if ($product_id != 0 && $only_import_offers == 'Y') {
                continue;
            }
            $product = array();
            $product['external_id'] = $guid_product;
            $full_name = $product_code = $html_description = '';
            foreach ($_product->{$cml}['value_fields']->{$cml}['value_field'] as $reckvizit) {
                if (strval($reckvizit->{$cml}['name']) == $cml['full_name']) {
                    $full_name = strval($reckvizit->{$cml}['value']);
                }
                if (strval($reckvizit->{$cml}['name']) == $cml['code']) {
                    $product_code = strval($reckvizit->{$cml}['value']);
                }
                if (strval($reckvizit->{$cml}['name']) == $cml['html_description']) {
                    $html_description = strval($reckvizit->{$cml}['value']);
                }
            }
            if ($schema_version == '2.07' && !empty($_product->{$cml}['image'])) {
                foreach ($_product->{$cml}['image'] as $file_description) {
                    $filename = fn_basename(strval($file_description));
                    if (fn_exim_1c_file_is_file($filename)) {
                        $html_description = file_get_contents($dir_1c . $filename);
                    }
                }
            }
            // Import product name
            $product['product'] = strval($_product->{$cml}['name']);
            if ($import_product_name == 'full_name' && !empty($full_name)) {
                $product['product'] = $full_name;
            }
            // Import product code
            $article = strval($_product->{$cml}['article']);
            $product['product_code'] = !empty($article) ? $article : '';
            if ($import_product_code == 'code') {
                $product['product_code'] = $product_code;
            }
            if ($import_product_code == 'bar') {
                $product['product_code'] = strval($_product->{$cml}['bar']);
            }
            // Import product full description
            if ($import_full_description != 'not_import') {
                $product['full_description'] = $_product->{$cml}['description'];
            }
            if ($import_full_description == 'html_description') {
                $product['full_description'] = $html_description;
            } elseif ($import_full_description == 'full_name') {
                $product['full_description'] = $full_name;
            }
            // Import product short description
            if ($import_short_description != 'not_import') {
                $product['short_description'] = $_product->{$cml}['description'];
            }
            if ($import_short_description == 'html_description') {
                $product['short_description'] = $html_description;
            } elseif ($import_short_description == 'full_name') {
                $product['short_description'] = $full_name;
            }
            // Import page title
            if ($import_page_title == 'name') {
                $product['page_title'] = trim($_product->{$cml}['name'], " -");
            } elseif ($import_page_title == 'full_name') {
                $product['page_title'] = trim($full_name, " -");
            }
            // Import promo text
            if (!empty($property_for_promo_text)) {
//.........这里部分代码省略.........
开发者ID:askzap,项目名称:ask-zap,代码行数:101,代码来源:func.php


示例10: 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


示例11: fn_get_contents

                 }
             }
             // Update manifest
             if (file_exists($theme_path . '/' . THEME_MANIFEST)) {
                 $manifest_content = fn_get_contents($theme_path . '/' . THEME_MANIFEST);
                 $manifest = json_decode($manifest_content, true);
             } else {
                 $manifest = parse_ini_file($theme_path . '/' . THEME_MANIFEST_INI);
             }
             $manifest['title'] = $_REQUEST['theme_data']['title'];
             $manifest['description'] = $_REQUEST['theme_data']['description'];
             // Put logos of current layout to manifest
             $logos = fn_get_logos(Registry::get('runtime.company_id'));
             foreach ($logos as $type => $logo) {
                 if (!empty($logo['image'])) {
                     $filename = fn_basename($logo['image']['relative_path']);
                     Storage::instance('images')->export($logo['image']['relative_path'], $theme_path . '/media/images/' . $filename);
                     $manifest[$type] = 'media/images/' . $filename;
                 }
             }
             fn_put_contents($theme_path . '/' . THEME_MANIFEST, json_encode($manifest));
             fn_install_theme($theme_dest, Registry::get('runtime.company_id'), false);
         }
     } else {
         fn_set_notification('W', __('warning'), __('warning_theme_clone_dir_exists'));
     }
 } elseif ($mode == 'upload') {
     $theme_pack = fn_filter_uploaded_data('theme_pack', Registry::get('config.allowed_pack_exts'));
     if (empty($theme_pack[0])) {
         fn_set_notification('E', __('error'), __('text_allowed_to_upload_file_extension', array('[ext]' => implode(',', Registry::get('config.allowed_pack_exts')))));
     } else {
开发者ID:askzap,项目名称:ultimate,代码行数:31,代码来源:themes.php


示例12: die

if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
//
// Delete image
//
if ($mode == 'create') {
    $result_image = '';
    if (!empty($_SERVER['REQUEST_URI'])) {
        $path = defined('HTTPS') ? Registry::get('config.https_path') : Registry::get('config.http_path');
        $image_file = str_replace($path . '/images/', '', $_SERVER['REQUEST_URI']);
        $watermarked_file = WATERMARKS_DIR_NAME . $image_file;
        if (Storage::instance('images')->isExist($watermarked_file)) {
            $result_image = Storage::instance('images')->getUrl($watermarked_file);
        } elseif (Storage::instance('images')->isExist($image_file)) {
            $image_name = fn_basename($image_file);
            $image_id = db_get_field("SELECT image_id FROM ?:images WHERE image_path LIKE ?l", "%{$image_name}%");
            $image_link = db_get_row("SELECT * FROM ?:images_links WHERE image_id = ?i OR detailed_id = ?i", $image_id, $image_id);
            if (!empty($image_link)) {
                $is_detailed = $image_link['detailed_id'] == $image_id;
                $image_type = $is_detailed ? 'detailed' : 'icons';
                $generate_watermark = fn_is_need_watermark($image_link['object_type'], $is_detailed, Registry::get('runtime.company_id'));
                if (fn_watermark_create($image_file, $watermarked_file, $is_detailed, Registry::get('runtime.company_id'), $generate_watermark)) {
                    $result_image = Storage::instance('images')->getUrl($watermarked_file);
                }
            }
        }
    }
    if (!empty($result_image)) {
        header('Location: ' . $result_image);
    }
开发者ID:askzap,项目名称:ultimate,代码行数:31,代码来源:watermark.php


示例13: _copyImages

 private function _copyImages()
 {
     $images_dirs = fn_get_dir_contents($this->store_data['path'] . '/images', true, false, '', $this->store_data['path'] . '/images/');
     $img_path_info = Registry::get('config.storage.images');
     foreach ($images_dirs as $dir) {
         fn_copy($dir, $img_path_info['dir'] . fn_basename($dir), true);
     }
     return true;
 }
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:9,代码来源:F225T301.php


示例14: elseif

             $base_price_1c .= $price['price_1c'] . ',';
         } elseif ($price['type'] == 'list') {
             $list_price_1c .= $price['price_1c'] . ',';
         } else {
             $prices[] = $price;
         }
     }
     Tygh::$app['view']->assign('list_price_1c', trim($list_price_1c, ','));
     Tygh::$app['view']->assign('base_price_1c', trim($base_price_1c, ','));
     Tygh::$app['view']->assign('prices_data', $prices);
     if ($s_commerceml['exim_1c_check_prices'] == 'Y') {
         list($path_commerceml, $url_commerceml, $url_images) = RusEximCommerceml::getDirCommerceML();
         $result = array();
         $file_offers = glob($path_commerceml . "offers*");
         if (!empty($file_offers)) {
             $filename = fn_basename(reset($file_offers));
             $xml = RusEximCommerceml::getFileCommerceml($filename);
             if (isset($xml->{$cml}['packages']->{$cml}['offers']->{$cml}['offer'])) {
                 $result = RusEximCommerceml::checkPricesOffers($xml->{$cml}['packages']);
             }
         } else {
             fn_set_notification('W', __('warning'), __('offers_not_found'));
         }
         Tygh::$app['view']->assign('resul_test', $result);
     }
 }
 if ($s_commerceml['exim_1c_add_tax'] == 'Y') {
     $taxes = fn_get_taxes();
     $taxes_data = db_get_array("SELECT * FROM ?:rus_exim_1c_taxes");
     Tygh::$app['view']->assign('taxes_data', $taxes_data);
     Tygh::$app['view']->assign('taxes', $taxes);
开发者ID:ambient-lounge,项目名称:site,代码行数:31,代码来源:1c.php


示例15: fn_copy_product_files

function fn_copy_product_files($file_id, $file, $product_id, $var_prefix = 'file')
{
    /**
     * Changes params before copying product files
     *
     * @param int    $file_id    File identifier
     * @param array  $file       File data
     * @param int    $product_id Product identifier
     * @param string $var_prefix Prefix of file variables
     */
    fn_set_hook('copy_product_files_pre', $file_id, $file, $product_id, $var_prefix);
    $filename = $product_id . '/' . $file['name'];
    $_data = array();
    list($_data[$var_prefix . '_size'], $_data[$var_prefix . '_path']) = Storage::instance('downloads')->put($filename, array('file' => $file['path'], 'overwrite' => true));
    $_data[$var_prefix . '_path'] = fn_basename($_data[$var_prefix . '_path']);
    db_query('UPDATE ?:product_files SET ?u WHERE file_id = ?i', $_data, $file_id);
    /**
     * Adds additional actions after product files were copied
     *
     * @param int    $file_id    File identifier
     * @param array  $file       File data
     * @param int    $product_id Product identifier
     * @param string $var_prefix Prefix of file variables
     */
    fn_set_hook('copy_product_files_post', $file_id, $file, $product_id, $var_prefix);
    return true;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:27,代码来源:fn.catalog.php


示例16: array

        }
        return array(CONTROLLER_STATUS_REDIRECT, $_REQUEST['current_url']);
    }
    if ($mode == 'restore_template') {
        $copied = false;
        $full_path = fn_get_theme_path('[themes]/[theme]', 'C') . '/templates/' . $_REQUEST['file'];
        if (fn_check_path($full_path)) {
            $c_name = fn_normalize_path($full_path);
            $r_name = fn_normalize_path(Registry::get('config.dir.themes_repository') . Registry::get('config.base_theme') . '/templates/' . $_REQUEST['file']);
            if (is_file($r_name)) {
                $copied = fn_copy($r_name, $c_name);
            }
            if ($copied) {
                fn_set_notification('N', __('notice'), __('text_file_restored', array('[file]' => fn_basename($_REQUEST['file']))));
            } else {
                fn_set_notification('E', __('error'), __('text_cannot_restore_file', array('[file]' => fn_basename($_REQUEST['file']))));
            }
            if ($copied) {
                if (defined('AJAX_REQUEST')) {
                    Registry::get('ajax')->assign('force_redirection', fn_url($_REQUEST['current_url']));
                    Registry::get('ajax')->assign('non_ajax_notifications', true);
                }
                return array(CONTROLLER_STATUS_OK, $_REQUEST['current_url']);
            }
        }
        exit;
    }
}
if ($mode == 'get_content') {
    $ext = fn_strtolower(fn_get_file_ext($_REQUEST['file']));
    if ($ext == 'tpl') {
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:31,代码来源:design_mode.php


示例17: fn_uninstall_addon

/**
 * Uninstalles addon
 *
 * @param string $addon_name Addon name to be uninstalled
 * @param bool $show_message If defined as true, additionally show notification
 * @return bool True if addons uninstalled successfully, false otherwise
 */
function fn_uninstall_addon($addon_name, $show_message = true)
{
    $addon_scheme = SchemesManager::getScheme($addon_name);
    if ($addon_scheme != false) {
        // Unmanaged addons can be uninstalled via console only
        if ($addon_scheme->getUnmanaged() && !defined('CONSOLE')) {
            return false;
        }
        // Check dependencies
        $dependencies = SchemesManager::getUninstallDependencies($addon_name);
        if (!empty($dependencies)) {
            fn_set_notification('W', __('warning'), __('text_addon_uninstall_dependencies', array('[addons]' => implode(',', $dependencies))));
            return false;
        }
        // Execute custom functions for uninstall
        $addon_scheme->callCustomFunctions('uninstall');
        $addon_description = db_get_field("SELECT name FROM ?:addon_descriptions WHERE addon = ?s and lang_code = ?s", $addon_name, CART_LANGUAGE);
        // Delete options
        db_query("DELETE FROM ?:addons WHERE addon = ?s", $addon_name);
        db_query("DELETE FROM ?:addon_descriptions WHERE addon = ?s", $addon_name);
        // Delete settings
        $section = Settings::instance()->getSectionByName($addon_name, Settings::ADDON_SECTION);
        if (isset($section['section_id'])) {
            Settings::instance()->removeSection($section['section_id']);
        }
        // Delete language variables
        $addon_scheme->uninstallLanguageValues();
        // Revert database structure
        $addon_scheme->processQueries('uninstall', Registry::get('config.dir.addons') . $addon_name);
        // Remove product tabs
        ProductTabs::instance()->deleteAddonTabs($addon_name);
        fn_uninstall_addon_templates(fn_basename($addon_name));
        if (file_exists(Registry::get('config.dir.addons') . $addon_name . '/layouts.xml')) {
            $xml = simplexml_load_file(Registry::get('config.dir.addons') . $addon_name . '/layouts.xml', '\\Tygh\\ExSimpleXmlElement', LIBXML_NOCDATA);
            foreach ($xml->location as $location) {
                if (fn_allowed_for('ULTIMATE')) {
                    foreach (fn_get_all_companies_ids() as $company) {
                        $layouts = Layout::instance($company)->getList();
                        foreach ($layouts as $layout_id => $layout) {
                            Location::instance($layout_id)->removeByDispatch((string) $location['dispatch']);
                        }
                    }
                } else {
                    $layouts = Layout::instance()->getList();
                    foreach ($layouts as $layout_id => $layout) {
                        Location::instance($layout_id)->removeByDispatch((string) $location['dispatch']);
                    }
                }
            }
        }
        if ($show_message) {
            fn_set_notification('N', __('notice'), __('text_addon_uninstalled', array('[addon]' => $addon_scheme->getName())));
        }
        //Clean Registry
        Registry::del('addons.' . $addon_name);
        $hooks = Registry::get('hooks');
        Registry::del('hooks');
        if (!empty($hooks)) {
            foreach ($hooks as $hook_name => $hooks_data) {
                foreach ($hooks_data as $key => $hook_data) {
                    if ($hook_data['addon'] === $addon_name) {
                        unset($hooks[$hook_name][$key]);
                    }
                }
            }
        }
        Registry::set('hooks', $hooks);
        // Clean cache
        fn_clear_cache();
        return true;
    } else {
        return false;
    }
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:81,代码来源:fn.addons.php


示例18: copyPresetImages

 public static function copyPresetImages()
 {
     $theme_name = Registry::get('config.base_theme');
     $presets_path = fn_get_theme_path('[themes]/' . $theme_name . '/presets/data', 'C');
     $preset_images_path = fn_get_theme_path('[themes]/' . $theme_name . '/media/images/patterns', 'C');
     $files = fn_get_dir_contents($presets_path, false, true);
     foreach ($files as $file) {
         $content = fn_get_contents($presets_path . '/' . $file);
         if (preg_match('/@general_bg_image\\: url\\(["]?(.*?)["]?\\)/', $content, $m)) {
             $image_name = fn_basename($m[1]);
             if (strpos($image_name, '?') !== false) {
                 list($image_name) = explode('?', $image_name);
             }
             if (file_exists($preset_images_path . '/' . $image_name)) {
                 $preset_dir = str_replace('.less', '', $file);
                 $new_path = $preset_images_path . '/' . $preset_dir;
                 fn_mkdir($new_path);
                 fn_copy($preset_images_path . '/' . $image_name, $new_path);
                 $content = str_replace($image_name, $preset_dir . '/' . $image_name, $content);
                 fn_put_contents($presets_path . '/' . $file, $content);
             }
         }
     }
     return true;
 }
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:25,代码来源:General.php


示例19: fn_theme_editor_set_style

function fn_theme_editor_set_style($style_id)
{
    $style_id = fn_basename($style_id);
    $theme_name = Registry::get('runtime.layout.theme_name');
    $layout_id = Registry::get('runtime.layout.layout_id');
    Styles::factory($theme_name)->setStyle($layout_id, $style_id);
    Registry::set('runtime.layout.style_id', $style_id);
    fn_clear_cache('assets', 'design/');
    return true;
}
开发者ID:askzap,项目名称:ultimate,代码行数:10,代码来源:theme_editor.php


示例20: fn_filter_uploaded_data

 if ($mode == 'install_from_po') {
     $uploaded_data = fn_filter_uploaded_data('language_data', array('po', 'zip'));
     if (!empty($uploaded_data['po_file']['path'])) {
         $ext = fn_get_file_ext($uploaded_data['po_file']['name']);
         if ($ext == 'po') {
             $result = Languages::installLanguagePack($uploaded_data['po_file']['path']);
         } else {
             $result = Languages::installZipPack($uploaded_data['po_file']['path']);
         }
         if (!$result) {
             fn_delete_notification('changes_saved');
         }
     }
 }
 if ($mode == 'install' && !empty($_REQUEST['pack'])) {
     $pack_path = Registry::get('config.dir.lang_packs') . fn_basename($_REQUEST['pack']);
     if (Languages::installCrowdinPack($pack_path, array())) {
         return array(CONTROLLER_STATUS_OK, 'languages.manage');
     } else {
         return array(CONTROLLER_STATUS_OK, 'languages.manage?selected_section=available_languages');
     }
 }
 if ($mode == 'delete_variable') {
     LanguageValues::deleteVariables($_REQUEST['name']);
     return array(CONTROLLER_STATUS_REDIRECT);
 }
 if ($mode == 'update_status') {
     if (fn_allowed_for('ULTIMATE:FREE')) {
         if ($_REQUEST['status'] == 'H') {
             fn_set_notification('E', __('error'), __('language_hidden_status_free'));
             return array(CONTROLLER_STATUS_REDIRECT, 'languages.manage');
开发者ID:askzap,项目名称:ultimate,代码行数:31,代码来源:languages.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP fn_calculate_cart_content函数代码示例发布时间:2022-05-15
下一篇:
PHP fn_baigoEncrypt函数代码示例发布时间: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