当前位置: 首页>>代码示例>>PHP>>正文


PHP fn_get_contents函数代码示例

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


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

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

示例2: process_sbrf_currencies

 public static function process_sbrf_currencies($primary_currency = CART_PRIMARY_CURRENCY)
 {
     $date = date('d/m/Y');
     $link = 'http://www.cbr.ru/scripts/XML_daily.asp?date_req=' . $date;
     $xml = @simplexml_load_string(fn_get_contents($link));
     $sbrf_currencies = self::format_sbrf_currensies($xml);
     if (empty($sbrf_currencies) || $primary_currency != CURRENCY_RUB && !isset($sbrf_currencies[$primary_currency])) {
         return false;
     }
     $currencies = Registry::get('currencies');
     if ($primary_currency != CURRENCY_RUB) {
         if (isset($sbrf_currencies[$primary_currency]) && isset($currencies[CURRENCY_RUB])) {
             $primary_coefficient = $sbrf_currencies[$primary_currency]['nominal'] / $sbrf_currencies[$primary_currency]['value'];
             $currency_data = array('coefficient' => $primary_coefficient);
             db_query("UPDATE ?:currencies SET ?u WHERE  currency_code = ?s", $currency_data, CURRENCY_RUB);
         }
         unset($sbrf_currencies[$primary_currency]);
         foreach ($currencies as $curr_code => $curr_data) {
             if (isset($sbrf_currencies[$curr_code])) {
                 $coefficient_rub = $sbrf_currencies[$curr_code]['nominal'] / $sbrf_currencies[$curr_code]['value'];
                 $currency_data = array('coefficient' => $primary_coefficient / $coefficient_rub);
                 db_query("UPDATE ?:currencies SET ?u WHERE currency_code = ?s ", $currency_data, $curr_code);
             }
         }
     } else {
         foreach ($currencies as $curr_code => $curr_data) {
             if (isset($sbrf_currencies[$curr_code])) {
                 $currency_data = array('coefficient' => $sbrf_currencies[$curr_code]['value'] / $sbrf_currencies[$curr_code]['nominal']);
                 db_query("UPDATE ?:currencies SET ?u WHERE currency_code = ?s ", $currency_data, $curr_code);
             }
         }
     }
     return true;
 }
开发者ID:ambient-lounge,项目名称:site,代码行数:34,代码来源:RusCurrency.php

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

示例4: smarty_block_scripts

/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */
function smarty_block_scripts($params, $content, &$smarty, &$repeat)
{
    if ($repeat == true) {
        Registry::set('runtime.inside_scripts', 1);
        return;
    }
    if (Registry::get('config.tweaks.dev_js')) {
        $content .= smarty_helper_inline_scripts($params, $content, $smarty, $repeat);
        return $content;
    }
    $scripts = array();
    $external_scripts = array();
    $dir_root = Registry::get('config.dir.root');
    $return = '';
    $current_location = Registry::get('config.current_location');
    if (preg_match_all('/\\<script(.*?)\\>(.*?)\\<\\/script\\>/s', $content, $m)) {
        $contents = '';
        foreach ($m[1] as $src) {
            if (!empty($src) && preg_match('/src ?= ?"([^"]+)"/', $src, $_m)) {
                if (strpos($_m[1], $current_location) !== false) {
                    $scripts[] = str_replace($current_location, '', preg_replace('/\\?.*?$/', '', $_m[1]));
                } else {
                    $external_scripts[] = $_m[1];
                }
            }
        }
        // Check file changes in dev mode
        $names = $scripts;
        if (Development::isEnabled('compile_check')) {
            foreach ($names as $index => $name) {
                if (is_file($dir_root . '/' . $name)) {
                    $names[$index] .= filemtime($dir_root . '/' . $name);
                }
            }
        }
        $filename = 'js/tygh/scripts-' . md5(implode(',', $names)) . fn_get_storage_data('cache_id') . '.js';
        if (!Storage::instance('statics')->isExist($filename)) {
            foreach ($scripts as $src) {
                $contents .= fn_get_contents(Registry::get('config.dir.root') . $src);
            }
            $contents = str_replace('[files]', implode("\n", $scripts), Registry::get('config.js_css_cache_msg')) . $contents;
            $contents = Minifier::minify($contents, array('flaggedComments' => false));
            Storage::instance('statics')->put($filename, array('contents' => $contents, 'compress' => false, 'caching' => true));
        }
        $return = '<script type="text/javascript" src="' . Storage::instance('statics')->getUrl($filename) . '?ver=' . PRODUCT_VERSION . '"></script>' . "\n";
        if (!empty($external_scripts)) {
            foreach ($external_scripts as $sc) {
                $return .= '<script type="text/javascript" src="' . $sc . '"></script>' . "\n";
            }
        }
        foreach ($m[2] as $sc) {
            if (!empty($sc)) {
                $return .= '<script type="text/javascript">' . $sc . '</script>' . "\n";
            }
        }
        $return .= smarty_helper_inline_scripts($params, $content, $smarty, $repeat);
    }
    return $return;
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:64,代码来源:block.scripts.php

示例5: init

 static function init()
 {
     if (!is_dir(DIR_CACHE)) {
         fn_mkdir(DIR_CACHE);
     }
     $ch = fn_get_contents(DIR_CACHE . self::$_handlers_name);
     self::$_cache_handlers = !empty($ch) ? @unserialize($ch) : array();
     return true;
 }
开发者ID:diedsmiling,项目名称:busenika,代码行数:9,代码来源:class.cache_backend_file.php

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

示例7: fn_get_google_categories

function fn_get_google_categories($lang_code = DEFAULT_LANGUAGE)
{
    $urls = fn_google_export_available_categories();
    if (empty($urls[$lang_code])) {
        return false;
    }
    $url = $urls[$lang_code];
    $content = fn_get_contents($url);
    if ($content) {
        $result = explode("\n", $content);
        $result = array_diff($result, array(''));
        return array_slice($result, 1);
    }
    return false;
}
开发者ID:askzap,项目名称:ultimate,代码行数:15,代码来源:func.php

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

示例9: smarty_block_scripts

/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */
function smarty_block_scripts($params, $content, &$smarty, &$repeat)
{
    if ($repeat == true) {
        return;
    }
    if (Registry::get('config.tweaks.dev_js')) {
        return $content;
    }
    $scripts = array();
    $dir_root = Registry::get('config.dir.root');
    $return = '';
    if (preg_match_all('/\\<script(.*?)\\>(.*?)\\<\\/script\\>/s', $content, $m)) {
        $contents = '';
        foreach ($m[1] as $src) {
            if (!empty($src) && preg_match('/src ?= ?"([^"]+)"/', $src, $_m)) {
                $scripts[] = str_replace(Registry::get('config.current_location'), '', preg_replace('/\\?.*?$/', '', $_m[1]));
            }
        }
        // Check file changes in dev mode
        $names = $scripts;
        if (Development::isEnabled('compile_check')) {
            foreach ($names as $index => $name) {
                if (is_file($dir_root . '/' . $name)) {
                    $names[$index] .= filemtime($dir_root . '/' . $name);
                }
            }
        }
        $gz_suffix = Registry::get('config.tweaks.gzip_css_js') ? '.gz' : '';
        $filename = 'js/tygh/scripts-' . md5(implode(',', $names)) . fn_get_storage_data('cache_id') . '.js';
        if (!Storage::instance('statics')->isExist($filename . $gz_suffix)) {
            foreach ($scripts as $src) {
                $contents .= fn_get_contents(Registry::get('config.dir.root') . $src);
            }
            $contents = str_replace('[files]', implode("\n", $scripts), Registry::get('config.js_css_cache_msg')) . $contents;
            Storage::instance('statics')->put($filename . $gz_suffix, array('contents' => $contents, 'compress' => Registry::get('config.tweaks.gzip_css_js'), 'caching' => true));
        }
        $return = '<script type="text/javascript" src="' . Storage::instance('statics')->getUrl($filename) . '?ver=' . PRODUCT_VERSION . '"></script>';
        foreach ($m[2] as $sc) {
            if (!empty($sc)) {
                $return .= '<script type="text/javascript">' . $sc . '</script>' . "\n";
            }
        }
    }
    return $return;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:50,代码来源:block.scripts.php

示例10: updateUaRules

 public static function updateUaRules()
 {
     $update_needed = false;
     if (!file_exists(TWIGMO_UA_RULES_FILE)) {
         $update_needed = true;
     } else {
         $rules_serialized = fn_get_contents(TWIGMO_UA_RULES_FILE);
         $md5_on_twigmo = Http::get(TWG_CHECK_UA_UPDATES);
         if (md5($rules_serialized) != $md5_on_twigmo) {
             $update_needed = true;
         }
     }
     if (!$update_needed) {
         return;
     }
     $rules_on_twigmo = Http::get(TWG_UA_RULES);
     fn_twg_write_to_file(TWIGMO_UA_RULES_FILE, $rules_on_twigmo, false);
 }
开发者ID:askzap,项目名称:ultimate,代码行数:18,代码来源:UserAgent.php

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

示例12: get_data

 function get_data($url)
 {
     if (is_numeric($url)) {
         return new FetchedDataURL($this->content[$url], array(), "");
     } else {
         if (substr($url, 0, 8) == 'file:///') {
             $url = substr($url, 10);
             if (defined('IS_WINDOWS')) {
                 $url = substr($url, 1);
             }
         }
         if (strpos($url, Registry::get('config.http_location')) === 0) {
             $file = str_replace(Registry::get('config.http_location'), DIR_ROOT, $url);
         } elseif (strpos($url, Registry::get('config.https_location')) === 0) {
             $file = str_replace(Registry::get('config.https_location'), DIR_ROOT, $url);
         }
         if (!empty($file) && file_exists($file)) {
             $result = fn_get_contents($file);
         } else {
             list(, $result) = fn_http_request('GET', $url);
         }
         return new FetchedDataURL($result, array(), "");
     }
 }
开发者ID:diedsmiling,项目名称:busenika,代码行数:24,代码来源:class.pdf_converter.php

示例13: fn_get_url_data

/**
 * Get data from url
 *
 * @param string $val
 * @return array $val
 */
function fn_get_url_data($val)
{
    if (!preg_match('/:\\/\\//', $val)) {
        $val = 'http://' . $val;
    }
    $result = false;
    $_data = fn_get_contents($val);
    if (!empty($_data)) {
        $result = array('name' => fn_basename($val));
        // Check if the file is dynamically generated
        if (strpos($result['name'], '&') !== false || strpos($result['name'], '?') !== false) {
            $result['name'] = 'url_uploaded_file_' . uniqid(TIME);
        }
        $result['path'] = fn_create_temp_file();
        $result['size'] = strlen($_data);
        $fd = fopen($result['path'], 'wb');
        fwrite($fd, $_data, $result['size']);
        fclose($fd);
        @chmod($result['path'], DEFAULT_FILE_PERMISSIONS);
        $cache = Registry::get('temp_fs_data');
        if (!isset($cache[$result['path']])) {
            // cache file to allow multiple usage
            $cache[$result['path']] = $result['path'];
            Registry::set('temp_fs_data', $cache);
        }
    }
    return $result;
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:34,代码来源:fn.fs.php

示例14: checkStoreImportAvailability

 public static function checkStoreImportAvailability($license_number, $version, $edition = PRODUCT_EDITION)
 {
     $request = array('dispatch' => 'product_updates.check_storeimport_available', 'license_key' => $license_number, 'ver' => $version, 'edition' => $edition);
     $data = Http::get(Registry::get('config.resources.updates_server'), $request, array('timeout' => 10));
     if (empty($data)) {
         $data = fn_get_contents(Registry::get('config.resources.updates_server') . '/index.php?' . http_build_query($request));
     }
     $result = false;
     if (!empty($data)) {
         // Check if we can parse server response
         if (strpos($data, '<?xml') !== false) {
             $xml = simplexml_load_string($data);
             $result = (string) $xml == 'Y' ? true : false;
         }
     }
     return $result;
 }
开发者ID:askzap,项目名称:ultimate,代码行数:17,代码来源:Helpdesk.php

示例15: fn_get_lang_var

 // Set system notifications
 if (Registry::get('config.demo_mode') != true && AREA == 'A' && !defined('DEVELOPMENT')) {
     // If username equals to the password
     if ($password == $user_data['user_login']) {
         $msg = fn_get_lang_var('warning_insecure_password');
         $msg = str_replace('[link]', fn_url('profiles.update'), $msg);
         fn_set_notification('E', fn_get_lang_var('warning'), $msg, true, 'insecure_password');
     }
     // Insecure admin script
     if (Registry::get('config.admin_index') == 'admin.php') {
         fn_set_notification('E', fn_get_lang_var('warning'), fn_get_lang_var('warning_insecure_admin_script'), true);
     }
     if (Registry::get('settings.General.auto_check_updates') == 'Y' && fn_check_user_access($auth['user_id'], 'upgrade_store')) {
         // If upgrades available
         $uc_settings = fn_get_settings('Upgrade_center');
         $data = fn_get_contents($uc_settings['updates_server'] . '/index.php?target=product_updates&mode=check_available&ver=' . PRODUCT_VERSION);
         /* NULLED BY FLIPMODE! @ 2010/09/06 */
         // $data = fn_get_contents($uc_settings['updates_server'] . '/index.php?target=product_updates&mode=check_available&ver=' . PRODUCT_VERSION . '&license_number=' . $uc_settings['license_number']);
         if ($data == 'AVAILABLE') {
             $msg = fn_get_lang_var('text_upgrade_available');
             $msg = str_replace('[link]', fn_url('upgrade_center.manage'), $msg);
             fn_set_notification('W', fn_get_lang_var('notice'), $msg, true, 'upgrade_center');
         }
     }
 }
 if (!empty($_REQUEST['remember_me'])) {
     fn_set_cookie(AREA_NAME . '_user_id', $user_data['user_id'], COOKIE_ALIVE_TIME);
     fn_set_cookie(AREA_NAME . '_password', $user_data['password'], COOKIE_ALIVE_TIME);
 }
 // Set last login time
 db_query("UPDATE ?:users SET ?u WHERE user_id = ?i", array('last_login' => TIME), $user_data['user_id']);
开发者ID:diedsmiling,项目名称:busenika,代码行数:31,代码来源:auth.php


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