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

PHP fn_put_contents函数代码示例

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

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



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

示例1: fn_settings_actions_addons_webmail

function fn_settings_actions_addons_webmail(&$new_value, $old_value)
{
    if ($new_value == 'A') {
        // Copy data directory to "var"
        $dir_data = DIR_ROOT . '/var/webmail';
        if (fn_copy(DIR_ADDONS . 'webmail/lib/webmail/data', $dir_data) == false) {
            $msg = fn_get_lang_var('text_cannot_write_directory');
            fn_set_notification('E', fn_get_lang_var('error'), str_replace('[directory]', $dir_data, $msg));
            $new_value = 'D';
            return false;
        }
        $config = Registry::get('config');
        $_settings = $dir_data . '/settings/settings.xml';
        // 1 step, generate config file
        $xml = simplexml_load_file($_settings);
        $xml->Common->DBLogin = $config['db_user'];
        $xml->Common->DBPassword = $config['db_password'];
        $xml->Common->DBName = $config['db_name'];
        $xml->Common->DBHost = $config['db_host'];
        if (fn_put_contents($_settings, $xml->asXML()) == false) {
            $msg = fn_get_lang_var('cannot_write_file');
            fn_set_notification('E', fn_get_lang_var('error'), str_replace('[file]', $_settings, $msg));
            $new_value = 'D';
            return false;
        }
        include DIR_ADDONS . 'webmail/lib/webmail/web/class_settings.php';
        include DIR_ADDONS . 'webmail/lib/webmail/web/class_dbstorage.php';
        // Init mailbee core
        $null = null;
        $settings =& Settings::CreateInstance();
        $dbStorage =& DbStorageCreator::CreateDatabaseStorage($null);
        $dbStorage->Connect();
        $dbStorage->CreateTables($settings->DbPrefix);
    }
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:35,代码来源:actions.post.php


示例2: put

 /**
  * Put file to storage
  *
  * @param  string $file   file path in storage
  * @param  array  $params uploaded data and options
  * @return array  file size and file name
  */
 public function put($file, $params)
 {
     if (empty($params['overwrite'])) {
         $file = $this->generateName($file);
         // check if name is unique and generate new if not
     }
     $file = $this->prefix($file);
     if (!empty($params['compress'])) {
         if (!empty($params['contents'])) {
             $params['contents'] = gzencode($params['contents']);
         }
     }
     if (!fn_mkdir(dirname($file))) {
         return false;
     }
     if (!empty($params['file'])) {
         fn_copy($params['file'], $file);
     } else {
         fn_put_contents($file, $params['contents']);
     }
     if (!file_exists($file)) {
         return false;
     }
     $filesize = filesize($file);
     if (!empty($params['file']) && empty($params['keep_origins'])) {
         fn_rm($params['file']);
     }
     return array($filesize, str_replace($this->prefix(), '', $file));
 }
开发者ID:ambient-lounge,项目名称:site,代码行数:36,代码来源:File.php


示例3: smarty_function_script

/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */
function smarty_function_script($params, &$smarty)
{
    static $scripts = array();
    static $packer_loaded = false;
    /*if (!empty($params['include'])) {
    		return implode("\n", $scripts);
    	}*/
    if (!isset($scripts[$params['src']])) {
        $path = Registry::get('config.current_path');
        if (Registry::get('config.tweaks.js_compression') == true && strpos($params['src'], 'lib/') === false) {
            if (!file_exists(DIR_CACHE . $params['src'])) {
                if ($packer_loaded == false) {
                    include_once DIR_LIB . 'packer/class.JavaScriptPacker.php';
                    $packer_loaded = true;
                }
                fn_mkdir(dirname(DIR_CACHE . $params['src']));
                $packer = new JavaScriptPacker(fn_get_contents(DIR_ROOT . '/' . $params['src']));
                fn_put_contents(DIR_CACHE . $params['src'], $packer->pack());
            }
            $path = Registry::get('config.cache_path');
        }
        $scripts[$params['src']] = '<script type="text/javascript" src="' . $path . '/' . $params['src'] . '"></script>';
        // If output is captured, don't print script tag in the buffer, it will be printed directly to the screen
        if (!empty($smarty->_in_capture)) {
            $buff = array_pop($smarty->_in_capture);
            $smarty->_in_capture[] = $buff;
            $smarty->_scripts[$buff][] = $scripts[$params['src']];
            return '';
        }
        return $scripts[$params['src']];
    }
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:37,代码来源:function.script.php


示例4: fn_replace_rewrite_condition

function fn_replace_rewrite_condition($file_name, $condition, $comment)
{
    if (!empty($condition)) {
        $condition = "\n" . "# {$comment}\n" . "<IfModule mod_rewrite.c>\n" . "RewriteEngine on\n" . $condition . "</IfModule>\n" . "# /{$comment}";
    }
    $content = fn_get_contents($file_name);
    if ($content === false) {
        $content = '';
    } elseif (!empty($content)) {
        // remove old instructions
        $data = explode("\n", $content);
        $remove_start = false;
        foreach ($data as $k => $line) {
            if (preg_match("/# {$comment}/", $line)) {
                $remove_start = true;
            }
            if ($remove_start) {
                unset($data[$k]);
            }
            if (preg_match("/# \\/{$comment}/", $line)) {
                $remove_start = false;
            }
        }
        $content = implode("\n", $data);
    }
    $content .= $condition;
    return fn_put_contents($file_name, $content);
}
开发者ID:askzap,项目名称:ultimate,代码行数:28,代码来源:func.php


示例5: fn_hidpi_update_image

/**
 * Hook: generates low-resolution image from HiDPI one
 * @param array &$image_data
 * @param int &$image_id
 * @param string &$image_type
 * @param string &$images_path
 * @param array &$_data
 */
function fn_hidpi_update_image(&$image_data, &$image_id, &$image_type, &$images_path, &$_data)
{
    // Save original image
    $filename = fn_hdpi_form_name($image_data['name']);
    Storage::instance('images')->put($images_path . $filename, array('file' => $image_data['path'], 'keep_origins' => true));
    // Resize original image to non-hidpi resolution
    $_data['image_x'] = intval($_data['image_x'] / 2);
    $_data['image_y'] = intval($_data['image_y'] / 2);
    fn_put_contents($image_data['path'], fn_resize_image($image_data['path'], $_data['image_x'], $_data['image_y']));
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:18,代码来源:func.php


示例6: updateViaFtp

 public function updateViaFtp($content, $settings)
 {
     $this->saveBackup();
     $tmp_file = fn_create_temp_file();
     fn_put_contents($tmp_file, $content);
     $ftp_copy_result = fn_copy_by_ftp($tmp_file, $this->path, $settings);
     fn_rm($tmp_file);
     $status = $ftp_copy_result === true;
     return array($status, $ftp_copy_result);
 }
开发者ID:askzap,项目名称:ultimate,代码行数:10,代码来源:Robots.php


示例7: create

 /**
  * Generates new snapshot
  * @param array $params params list
  */
 public static function create($params)
 {
     if (empty($params['dir_root'])) {
         $params['dir_root'] = Registry::get('config.dir.root');
     }
     if (empty($params['dist'])) {
         $params['dist'] = false;
     }
     $dir_root = $params['dir_root'];
     $dist = $params['dist'];
     $folders = array('app', 'js', $params['theme_rel_backend']);
     if ($dist) {
         $themes_dir = $params['themes_repo'];
         $themes_dir_to = $params['themes_frontend'];
     } else {
         $themes_dir = $params['themes_frontend'];
     }
     $themes = fn_get_dir_contents($themes_dir);
     $snapshot = array('time' => time(), 'files' => array(), 'dirs' => array(), 'themes' => array());
     if ($dist) {
         $snapshot['db_scheme'] = fn_get_contents($dir_root . '/install/database/scheme.sql');
         // remove myslqdump comments
         $snapshot['db_scheme'] = preg_replace('|/\\*!.+\\*/;\\n|imSU', '', $snapshot['db_scheme']);
         // form list of tables
         preg_match_all('/create table `(.+)`/imSU', $snapshot['db_scheme'], $tables);
         $snapshot['db_tables'] = !empty($tables[1]) ? $tables[1] : array();
     }
     $new_snapshot = self::make($dir_root, $folders, array('config.local.php'));
     self::arrayMerge($snapshot, $new_snapshot);
     foreach ($folders as $folder_name) {
         $path = $dir_root . '/' . $folder_name;
         $new_snapshot = self::make($path);
         self::arrayMerge($snapshot, $new_snapshot);
     }
     foreach ($themes as $theme_name) {
         if (is_numeric($theme_name) && $theme_name === strval($theme_name + 0)) {
             continue;
             // this is company subfolder
         }
         $path = "{$themes_dir}/{$theme_name}";
         if ($dist) {
             $new_snapshot = self::make($path, array(), array(), array($themes_dir => $themes_dir_to), true);
         } else {
             $new_snapshot = self::make($path, array(), array(), array(), true);
         }
         $snapshot['themes'][$theme_name]['files'] = $snapshot['themes'][$theme_name]['dirs'] = array();
         self::arrayMerge($snapshot['themes'][$theme_name], $new_snapshot);
     }
     $snapshot['addons'] = fn_get_dir_contents(Registry::get('config.dir.addons'));
     fn_mkdir(Registry::get('config.dir.snapshots'));
     $snapshot_filename = fn_strtolower(PRODUCT_VERSION . '_' . (PRODUCT_STATUS ? PRODUCT_STATUS . '_' : '') . PRODUCT_EDITION . ($dist ? '_dist' : ''));
     $snapshot_filecontent = '<?php $snapshot' . ($dist ? '_dist' : '') . ' = ' . var_export($snapshot, true) . '; ?>';
     fn_put_contents(Registry::get('config.dir.snapshots') . "{$snapshot_filename}.php", $snapshot_filecontent);
 }
开发者ID:askzap,项目名称:ultimate,代码行数:58,代码来源:Snapshot.php


示例8: acquireLock

 public function acquireLock($key, $cache_level)
 {
     $fname = $this->_mapTags('locks') . '/' . $key . $cache_level;
     if (file_exists($fname)) {
         $ttl = fn_get_contents($fname);
         if ($ttl < time()) {
             // lock expired
             return fn_put_contents($fname, time() + Registry::LOCK_EXPIRY);
         }
     } else {
         return fn_put_contents($fname, time() + Registry::LOCK_EXPIRY);
     }
     return false;
 }
开发者ID:ambient-lounge,项目名称:site,代码行数:14,代码来源:File.php


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


示例10: fn_hidpi_update_image

/**
 * Hook: generates low-resolution image from HiDPI one
 * @param array &$image_data
 * @param int &$image_id
 * @param string &$image_type
 * @param string &$images_path
 * @param array &$_data
 */
function fn_hidpi_update_image(&$image_data, &$image_id, &$image_type, &$images_path, &$_data)
{
    // Save original image
    $filename = fn_hdpi_form_name($image_data['name']);
    Storage::instance('images')->put($images_path . $filename, array('file' => $image_data['path'], 'keep_origins' => true));
    $ext = fn_get_file_ext($filename);
    // We should not process ICO files
    if ($ext == 'ico') {
        return false;
    }
    // Resize original image to non-hidpi resolution
    $_data['image_x'] = intval($_data['image_x'] / 2);
    $_data['image_y'] = intval($_data['image_y'] / 2);
    fn_put_contents($image_data['path'], fn_resize_image($image_data['path'], $_data['image_x'], $_data['image_y'], Registry::get('settings.Thumbnails.thumbnail_background_color')));
}
开发者ID:askzap,项目名称:ultimate,代码行数:23,代码来源:func.php


示例11: downloadPackage

 /**
  * Downloads upgrade package from the Upgade server
  *
  * @param  array  $schema       Package schema
  * @param  string $package_path Path where the upgrade pack must be saved
  * @return bool   True if upgrade package was successfully downloaded, false otherwise
  */
 public function downloadPackage($schema, $package_path)
 {
     $data = fn_get_contents(Registry::get('config.resources.updates_server') . '/index.php?dispatch=product_updates.get_package&package_id=' . $schema['package_id'] . '&edition=' . PRODUCT_EDITION . '&license_number=' . $this->uc_settings['license_number']);
     if (!empty($data)) {
         fn_put_contents($package_path, $data);
         if (md5_file($package_path) == $schema['md5']) {
             $result = array(true, '');
         } else {
             fn_rm($package_path);
             $result = array(false, __('text_uc_broken_package'));
         }
     } else {
         $result = array(false, __('text_uc_cant_download_package'));
     }
     return $result;
 }
开发者ID:arpad9,项目名称:bygmarket,代码行数:23,代码来源:Connector.php


示例12: downloadPackage

 public function downloadPackage($schema, $package_path)
 {
     if (!empty($schema['download_key'])) {
         $upgrade_path = $this->settings['packages_server'] . $this->settings['addon'] . '/' . $schema['file'];
         $addon_upgrades_dir = Registry::get('config.dir.addons') . $this->settings['addon'] . '/upgrades/';
         $addon_upgrades_path = $addon_upgrades_dir . $schema['file'];
         if (!file_exists($addon_upgrades_path)) {
             fn_mkdir($addon_upgrades_dir);
             $addon_upgrade_data = fn_get_contents($upgrade_path);
             fn_put_contents($addon_upgrades_path, $addon_upgrade_data);
         }
         $result = fn_copy($addon_upgrades_path, $package_path);
         if ($result) {
             fn_rm($addon_upgrades_path);
         }
         //cleanup
         $message = $result ? '' : __('failed') . '-' . $addon_upgrades_path;
         return array($result, $message);
     } else {
         return array(false, __($schema['error_message']));
     }
 }
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:22,代码来源:Connector.php


示例13: fn_generate_thumbnail

function fn_generate_thumbnail($image_path, $width, $height = 0, $make_box = false, $force = null)
{
    if (empty($image_path)) {
        return '';
    }
    if (strpos($image_path, '://') === false) {
        if (strpos($image_path, '/') !== 0) {
            // relative path
            $image_path = Registry::get('config.current_path') . '/' . $image_path;
        }
        $image_path = (defined('HTTPS') ? 'https://' . Registry::get('config.https_host') : 'http://' . Registry::get('config.http_host')) . $image_path;
    }
    $_path = str_replace(Registry::get('config.current_location') . '/', '', $image_path);
    $image_url = explode('/', $_path);
    $image_name = array_pop($image_url);
    $image_dir = array_pop($image_url);
    $image_dir .= '/' . $width . (empty($height) ? '' : '/' . $height);
    $filename = $image_dir . '/' . $image_name;
    $real_path = htmlspecialchars_decode(DIR_ROOT . '/' . $_path, ENT_QUOTES);
    $th_path = htmlspecialchars_decode(DIR_THUMBNAILS . $filename, ENT_QUOTES);
    if (!fn_mkdir(DIR_THUMBNAILS . $image_dir)) {
        return '';
    }
    if (!file_exists($th_path) || $force != null) {
        if (fn_get_image_size($real_path)) {
            $image = fn_get_contents($real_path);
            fn_put_contents($th_path, $image);
            if ($force == "new") {
                fn_place_new($th_path);
            }
            fn_resize_image($th_path, $th_path, $width, $height, $make_box);
        } else {
            return '';
        }
    }
    return Registry::get('config.thumbnails_path') . $filename;
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:37,代码来源:fn.images.php


示例14: fn_sdek_get_ticket_order

function fn_sdek_get_ticket_order($data_auth, $order_id, $chek_id)
{
    unset($data_auth['Number']);
    $xml = '            ' . RusSdek::arraySimpleXml('OrdersPrint', $data_auth, 'open');
    $order_sdek = array('Number' => $order_id . '_' . $chek_id, 'Date' => $data_auth['Date']);
    $xml .= '            ' . RusSdek::arraySimpleXml('Order', $order_sdek);
    $xml .= '            ' . '</OrdersPrint>';
    $response = RusSdek::xmlRequest('http://gw.edostavka.ru:11443/orders_print.php', $xml, $data_auth);
    $download_file_dir = fn_get_files_dir_path() . '/sdek' . '/' . $chek_id . '/';
    fn_rm($download_file_dir);
    fn_mkdir($download_file_dir);
    $name = $order_id . '.pdf';
    $download_file_path = $download_file_dir . $name;
    if (!fn_is_empty($response)) {
        fn_put_contents($download_file_path, $response);
    }
}
开发者ID:ambient-lounge,项目名称:site,代码行数:17,代码来源:orders.post.php


示例15: logMessage

 /**
  * Add a new record to LOG file.
  *
  * @param  string $type    notification type (E - error, W - warning, N - notice)
  * @param  string $title   notification title
  * @param  string $message notification message
  * @return bool   true if record was added
  */
 public function logMessage($type, $title, $message)
 {
     $log_wrote = false;
     $file_path = Registry::get('config.dir.root') . '/' . self::LOG_FILE;
     // Create file if not exists
     if (!file_exists($file_path)) {
         fn_put_contents($file_path, '');
     }
     if (is_file($file_path) && is_writable($file_path)) {
         file_put_contents($file_path, $this->_formatLogMessage($type, $title, $message), FILE_APPEND);
         $log_wrote = true;
     }
     return $log_wrote;
 }
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:22,代码来源:App.php


示例16: array

    $_SESSION['show_active_skins_only'] = 'Y';
}
$view->assign('show_active_skins_only', $_SESSION['show_active_skins_only']);
// Disable debug console
$view->debugging = false;
$message = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if ($mode == 'edit') {
        fn_trusted_vars('file_content');
        if (defined('DEVELOPMENT')) {
            exit;
        }
        $file = basename($_REQUEST['file']);
        $fname = fn_normalize_path(DIR_SKINS . $current_path . $file);
        if (strpos($fname, DIR_SKINS) !== false && @is_writable($fname) && !in_array(fn_get_file_ext($fname), Registry::get('config.forbidden_file_extensions'))) {
            fn_put_contents($fname, $_REQUEST['file_content']);
            $_msg = fn_get_lang_var('text_file_saved');
            $_msg = str_replace('[file]', $file, $_msg);
            fn_set_notification('N', fn_get_lang_var('notice'), $_msg);
        } else {
            $_msg = fn_get_lang_var('cannot_write_file');
            $_msg = str_replace('[file]', $file, $_msg);
            fn_set_notification('E', fn_get_lang_var('error'), $_msg);
        }
        exit;
    }
    if ($mode == 'upload_file') {
        $uploaded_data = fn_filter_uploaded_data('uploaded_data');
        $pname = fn_normalize_path(DIR_SKINS . $current_path);
        foreach ((array) $uploaded_data as $udata) {
            if (!(strpos($pname, DIR_SKINS) !== false && @fn_copy($udata['path'], $pname . $udata['name']))) {
开发者ID:diedsmiling,项目名称:busenika,代码行数:31,代码来源:template_editor.php


示例17: fn_find_file

function fn_find_file($prefix, $file)
{
    $file = fn_strip_slashes($file);
    // Absolute path
    if (is_file($file)) {
        return realpath($file);
    }
    // Path is relative to prefix
    if (is_file($prefix . '/' . $file)) {
        return realpath($prefix . '/' . $file);
    }
    // Url
    if (strpos($file, '://') !== false) {
        $content = fn_get_contents($file);
        if (!empty($content)) {
            $fname = basename($file);
            if (empty($fname) || strpos($fname, '?') !== false) {
                $fname = basename(fn_create_temp_file());
            }
            if (fn_put_contents(DIR_COMPILED . $fname, $content)) {
                return DIR_COMPILED . $fname;
            }
        }
    }
    return false;
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:26,代码来源:exim.php


示例18: db_import_sql_file

/**
 * Fuctnions parses SQL file and import data from it
 *
 * @param string $file File for import
 * @param integer $buffer Buffer size for fread function
 * @param bool $show_status Show or do not show process by printing ' .'
 * @param integer $show_create_table 0 - Do not print the name of created table, 1 - Print name and get lang_var('create_table'), 2 - Print name without getting lang_var
 * @param bool $check_prefix Check table prefix and replace it with the installed in config.php
 * @param bool $track Use queries cache. Do not execute queries that already are executed.
 * @param bool $skip_errors Skip errors or not
 * @param bool $move_progress_bar Move COMET progress bar or not on show progress
 * @return bool false, if file is not accessible
 */
function db_import_sql_file($file, $buffer = 16384, $show_status = true, $show_create_table = 1, $check_prefix = false, $track = false, $skip_errors = false, $move_progress_bar = true)
{
    if (file_exists($file)) {
        $path = dirname($file);
        $file_name = fn_basename($file);
        $tmp_file = $path . "/{$file_name}.tmp";
        $executed_queries = array();
        if ($track && file_exists($tmp_file)) {
            $executed_queries = unserialize(fn_get_contents($tmp_file));
        }
        if ($skip_errors) {
            $_skip_errors = Registry::get('runtime.database.skip_errors');
            Registry::set('runtime.database.skip_errors', true);
        }
        $fd = fopen($file, 'r');
        if ($fd) {
            $ret = array();
            $rest = '';
            $fs = filesize($file);
            if ($show_status && $move_progress_bar) {
                fn_set_progress('step_scale', ceil($fs / $buffer));
            }
            while (!feof($fd)) {
                $str = $rest . fread($fd, $buffer);
                $rest = fn_parse_queries($ret, $str);
                if ($show_status) {
                    fn_set_progress('echo', '<br />' . __('importing_data'), $move_progress_bar);
                }
                if (!empty($ret)) {
                    foreach ($ret as $query) {
                        if (!in_array($query, $executed_queries)) {
                            if ($show_create_table && preg_match('/CREATE\\s+TABLE\\s+`?(\\w+)`?/i', $query, $matches)) {
                                if ($show_create_table == 1) {
                                    $_text = __('creating_table');
                                } elseif ($show_create_table == 2) {
                                    $_text = 'Creating table';
                                }
                                $table_name = $check_prefix ? fn_check_db_prefix($matches[1], Registry::get('config.table_prefix')) : $matches[1];
                                if ($show_status) {
                                    fn_set_progress('echo', '<br />' . $_text . ': <b>' . $table_name . '</b>', $move_progress_bar);
                                }
                            }
                            if ($check_prefix) {
                                $query = fn_check_db_prefix($query);
                            }
                            Database::query($query);
                            if ($track) {
                                $executed_queries[] = $query;
                                fn_put_contents($tmp_file, serialize($executed_queries));
                            }
                            if ($show_status) {
                                fn_echo(' .');
                            }
                        }
                    }
                    $ret = array();
                }
            }
            fclose($fd);
            return true;
        }
        if ($skip_errors) {
            Registry::set('runtime.database.skip_errors', $_skip_errors);
        }
    }
    return false;
}
开发者ID:askzap,项目名称:ultimate,代码行数:80,代码来源:fn.database.php


示例19: die

if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
$_SESSION['current_path'] = empty($_SESSION['current_path']) ? '' : preg_replace('/^\\//', '', $_SESSION['current_path']);
$current_path = $_SESSION['current_path'];
// Disable debug console
Tygh::$app['view']->debugging = false;
$message = array();
$root_dir = fn_te_get_root('full');
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if ($mode == 'edit') {
        fn_trusted_vars('file_content');
        $file_path = fn_te_normalize_path($_REQUEST, $root_dir);
        $is_forbidden_ext = in_array(fn_strtolower(fn_get_file_ext($file_path)), Registry::get('config.forbidden_file_extensions'));
        if (fn_te_check_path($file_path) && @is_writable($file_path) && !$is_forbidden_ext) {
            fn_put_contents($file_path, $_REQUEST['file_content']);
            fn_set_notification('N', __('notice'), __('text_file_saved', array('[file]' => fn_basename($file_path))));
            Tygh::$app['ajax']->assign('saved', true);
            // Clear template cache of updated template for the customer front-end
            $view = Tygh::$app['view'];
            $view->setArea('C', '', Registry::get('runtime.company_id'));
            $updated_template_path = str_replace($view->getTemplateDir(0), '', $file_path);
            $view->clearCompiledTemplate($updated_template_path);
            $view->setArea(AREA, '', Registry::get('runtime.company_id'));
        } else {
            fn_set_notification('E', __('error'), __('cannot_write_file', array('[file]' => fn_get_rel_dir($file_path))));
        }
        exit;
    }
    if ($mode == 'upload_file') {
        $uploaded_data = fn_filter_uploaded_data('uploaded_data');
开发者ID:askzap,项目名称:ultimate,代码行数:31,代码来源:templates.php


示例20: tryImport

 protected function tryImport($importPath, $parentBlock, $out)
 {
     if ($importPath[0] == "function" && $importPath[1] == "url") {
         $importPath = $this->flattenList($importPath[2]);
     }
     $str = $this->coerceString($importPath);
     if ($str === null) {
         return false;
     }
     $url = $this->compileValue($this->lib_e($str));
     // don't import if it ends in css
     if (substr_compare($url, '.css', -4, 4) === 0) {
         return false;
     }
     $realPath = $this->findImport($url);
     if ($realPath === null) {
         return false;
     }
     if ($this->importDisabled) {
         return array(false, "/* import disabled */");
     }
     if (isset($this->allParsedFiles[realpath($realPath)])) {
         return array(false, null);
     }
     $this->addParsedFile($realPath);
     $hash = md5($realPath);
     $cache_file = Registry::get('config.dir.cache_static') . '/less/' . $hash;
     $parser = $this->makeParser($realPath);
     $root = null;
     if (file_exists($cache_file) && filemtime($realPath) < filemtime($cache_file)) {
         $root = unserialize(fn_get_contents($cache_file));
     }
     if (!is_object($root)) {
         $root = $parser->parse(fn_get_contents($realPath));
         fn_mkdir(dirname($cache_file));
         fn_put_contents($cache_file, serialize($root));
     }
     // set the parents of all the block props
     foreach ($root->props as $prop) {
         if ($prop[0] == "block") {
             $prop[1]->parent = $parentBlock;
         }
     }
     // copy mixins into scope, set their parents
     // bring blocks from import into current block
     // TODO: need to mark the source parser these came from this file
     foreach ($root->children as $childName => $child) {
         if (isset($parentBlock->children[$childName])) {
             $parentBlock->children[$childName] = array_merge($parentBlock->children[$childName], $child);
         } else {
             $parentBlock->children[$childName] = $child;
         }
     }
     $pi = pathinfo($realPath);
     $dir = $pi["dirname"];
     list($top, $bottom) = $this->sortProps($root->props, true);
     $this->compileImportedProps($top, $parentBlock, $out, $parser, $dir);
     return array(true, $bottom, $parser, $dir);
 }
开发者ID:askzap,项目名称:ask-zap,代码行数:59,代码来源:Less.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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