本文整理汇总了PHP中fn_get_storage_data函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_get_storage_data函数的具体用法?PHP fn_get_storage_data怎么用?PHP fn_get_storage_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_get_storage_data函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public static function init($reinit = false, $config = array())
{
self::$active_debug_mode = false;
self::$allow_backtrace_sql = isset($_REQUEST['sql_backtrace']);
self::$debugger_cookie = !empty($_COOKIE['debugger']) ? $_COOKIE['debugger'] : '';
if ($reinit) {
Registry::registerCache('debugger', SESSION_ALIVE_TIME, Registry::cacheLevel('time'), true);
self::$actives = fn_get_storage_data('debugger_active');
self::$actives = !empty(self::$actives) ? unserialize(self::$actives) : array();
$active_in_registry = !empty(self::$actives[self::$debugger_cookie]) && time() - self::$actives[self::$debugger_cookie] < 0 ? true : false;
}
$debugger_token = !empty($config) ? $config['debugger_token'] : Registry::get('config.debugger_token');
switch (true) {
case defined('AJAX_REQUEST') && substr($_REQUEST['dispatch'], 0, 8) !== 'debugger':
break;
case defined('DEBUG_MODE') && DEBUG_MODE == true:
case !$reinit && (!empty(self::$debugger_cookie) || isset($_REQUEST[$debugger_token])):
self::$active_debug_mode = true;
break;
case !$reinit:
break;
// next if reinit
// next if reinit
case !empty(self::$debugger_cookie) && !empty($active_in_registry):
self::$active_debug_mode = true;
break;
case isset($_REQUEST[$debugger_token]):
$salt = '';
if ($_SESSION['auth']['user_type'] == 'A' && $_SESSION['auth']['is_root'] == 'Y') {
$user_admin = db_get_row('SELECT email, password FROM ?:users WHERE user_id = ?i', $_SESSION['auth']['user_id']);
$salt = $user_admin['email'] . $user_admin['password'];
}
if ($debugger_token != self::DEFAULT_TOKEN || !empty($salt)) {
// for non-default token allow full access
self::$debugger_cookie = substr(md5(SESSION::getId() . $salt), 0, 8);
$active_in_registry = true;
self::$active_debug_mode = true;
}
if (AREA == 'C' && !empty($_REQUEST[$debugger_token])) {
if (!empty(self::$actives[$_REQUEST[$debugger_token]]) && time() - self::$actives[$_REQUEST[$debugger_token]] < 0) {
$active_in_registry = true;
self::$debugger_cookie = $_REQUEST[$debugger_token];
self::$active_debug_mode = true;
}
}
fn_set_cookie('debugger', self::$debugger_cookie, SESSION_ALIVE_TIME);
break;
}
if ($reinit && self::$active_debug_mode && !empty(self::$debugger_cookie)) {
self::$actives[self::$debugger_cookie] = time() + self::EXPIRE_DEBUGGER;
fn_set_storage_data('debugger_active', serialize(self::$actives));
$active_in_registry = true;
}
if ($reinit && !empty(self::$debugger_cookie) && empty($active_in_registry)) {
fn_set_cookie('debugger', '', 0);
unset(self::$actives[self::$debugger_cookie]);
fn_set_storage_data('debugger_active', serialize(self::$actives));
}
return self::$active_debug_mode;
}
示例2: 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;
}
示例3: getLastSynchronizationTimes
protected static function getLastSynchronizationTimes()
{
$result = fn_get_storage_data('ebay_shipping_synchronization_time');
$result = json_decode($result, true);
if (!is_array($result)) {
$result = array();
}
return $result;
}
示例4: read
/**
* Reads development mode settings
*/
private static function read()
{
if (is_null(self::$modes)) {
$modes = fn_get_storage_data('dev_mode');
if (!empty($modes)) {
$modes = unserialize($modes);
} else {
$modes = array();
}
self::$modes = $modes;
}
}
示例5: fn_rus_payments_uninstall
function fn_rus_payments_uninstall()
{
$payments = fn_get_schema('rus_payments', 'processors');
fn_rus_payments_disable_payments($payments, true);
foreach ($payments as $payment) {
db_query("DELETE FROM ?:payment_processors WHERE admin_template = ?s", $payment['admin_template']);
}
$statuses = fn_get_schema('rus_payments', 'statuses', 'php', true);
if (!empty($statuses)) {
foreach ($statuses as $status_name => $status_data) {
fn_delete_status(fn_get_storage_data($status_name), 'O');
}
}
}
示例6: check
/**
* Validate specified data by schema
*
* @param array $schema Incoming validator schema
* @param array $request Request data
* @return array Validation result and Data to be displayed
*/
public function check($schema, $request)
{
$result = true;
$data = array();
$files = array();
if (empty($schema['files'])) {
return array($result, $data);
}
$files_hash = md5(serialize($schema['files']));
if (!empty($request['skip_collisions'])) {
fn_set_storage_data('collisions_hash', $files_hash);
}
$collisions_hash = fn_get_storage_data('collisions_hash');
if ($files_hash == $collisions_hash) {
$request['skip_collisions'] = true;
}
if (!empty($schema['files']) && !isset($request['skip_collisions'])) {
foreach ($schema['files'] as $path => $file_data) {
$original_path = $this->config['dir']['root'] . '/' . $path;
switch ($file_data['status']) {
case 'changed':
if (!file_exists($original_path) || file_exists($original_path) && md5_file($original_path) != $file_data['hash']) {
$data['changed'][] = $path;
$result = false;
$files[] = $path;
}
break;
case 'deleted':
if (file_exists($original_path) && md5_file($original_path) != $file_data['hash']) {
$data['deleted'][] = $path;
$result = false;
$files[] = $path;
}
break;
case 'new':
if (file_exists($original_path)) {
$data['new'][] = $path;
$result = false;
$files[] = $path;
}
break;
}
}
fn_set_storage_data('collision_files', serialize($files));
}
return array($result, $data);
}
示例7: 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;
}
示例8: fn_settings_actions_upgrade_center_license_number
function fn_settings_actions_upgrade_center_license_number(&$new_value, &$old_value)
{
if (empty($new_value)) {
$new_value = $old_value;
fn_set_notification('E', __('error'), __('license_number_cannot_be_empty'));
return false;
}
$mode = fn_get_storage_data('store_mode');
$data = Helpdesk::getLicenseInformation($new_value);
list($license_status, $updates, $messages) = Helpdesk::parseLicenseInformation($data, $_SESSION['auth'], true);
if ($license_status == 'ACTIVE' && ($mode != 'full' || empty($old_value))) {
fn_set_storage_data('store_mode', 'full');
$_SESSION['mode_recheck'] = true;
} else {
if ($license_status != 'ACTIVE') {
$new_value = $old_value;
}
}
}
示例9: fn_merge_styles
/**
* Merges css and less files
*
* @param array $files Array with style files
* @param string $styles Style code
* @param string $prepend_prefix Prepend prefix
* @param array $params additional params
*/
function fn_merge_styles($files, $styles = '', $prepend_prefix = '', $params = array(), $area = AREA)
{
$prefix = !empty($prepend_prefix) ? 'embedded' : 'standalone';
$make_rtl = false;
if (fn_is_rtl_language()) {
$prefix .= '-rtl';
$make_rtl = true;
}
$output = '';
$less_output = '';
$less_reflection = array();
$compiled_less = '';
$compiled_css = '';
$relative_path = fn_get_theme_path('[relative]/[theme]/css', $area);
$hashes = array();
$names = array_map(function ($v) {
return !empty($v['relative']) ? $v['relative'] : false;
}, $files);
// Check file changes
if (Development::isEnabled('compile_check') || Debugger::isActive()) {
$dir_root = Registry::get('config.dir.root');
foreach ($names as $index => $name) {
if (file_exists($dir_root . '/' . $name)) {
$hashes[] = $name . filemtime($dir_root . '/' . $name);
}
}
}
$hashes[] = md5(implode('|', $names));
$hashes[] = md5($styles);
if ($area == 'C') {
$hashes[] = Registry::get('runtime.layout.layout_id');
$hashes[] = Registry::get('runtime.layout.style_id');
}
arsort($hashes);
$hash = md5(implode(',', $hashes) . PRODUCT_VERSION) . fn_get_storage_data('cache_id');
$filename = $prefix . '.' . $hash . '.css';
$theme_manifest = Themes::factory(fn_get_theme_path('[theme]', 'C'))->getManifest();
if (!Storage::instance('assets')->isExist($relative_path . '/' . $filename)) {
Debugger::checkpoint('Before styles compilation');
foreach ($files as $src) {
$m_prefix = '';
$m_suffix = '';
if (!empty($src['media'])) {
$m_prefix = "\n@media " . $src['media'] . " {\n";
$m_suffix = "\n}\n";
}
if (strpos($src['file'], '.css') !== false) {
$output .= "\n" . $m_prefix . fn_get_contents($src['file']) . $m_suffix;
} elseif ($area != 'C' || empty($theme_manifest['converted_to_css'])) {
$less_output_chunk = '';
if (file_exists($src['file'])) {
if ($area == 'C' && (empty($theme_manifest['parent_theme']) || $theme_manifest['parent_theme'] == 'basic')) {
$less_output_chunk = "\n" . $m_prefix . fn_get_contents($src['file']) . $m_suffix;
} else {
$less_output_chunk = "\n" . $m_prefix . '@import "' . str_replace($relative_path . '/', '', $src['relative']) . '";' . $m_suffix;
}
}
if (!empty($params['reflect_less'])) {
if (preg_match('{/addons/([^/]+)/}is', $src['relative'], $m)) {
$less_reflection['output']['addons'][$m[1]] .= $less_output_chunk;
} else {
$less_reflection['output']['main'] .= $less_output_chunk;
}
}
$less_output .= $less_output_chunk;
}
}
$header = str_replace('[files]', implode("\n", $names), Registry::get('config.js_css_cache_msg'));
if (!empty($styles)) {
$less_output .= $styles;
}
// Prepend all styles with prefix
if (!empty($prepend_prefix)) {
$less_output = $output . "\n" . $less_output;
$output = '';
}
if (!empty($output)) {
$compiled_css = Less::parseUrls($output, Storage::instance('assets')->getAbsolutePath($relative_path), fn_get_theme_path('[themes]/[theme]/media', $area));
}
if (!empty($theme_manifest['converted_to_css']) && $area == 'C') {
$theme_css_path = fn_get_theme_path('[themes]/[theme]', $area) . '/css';
$pcl_filepath = $theme_css_path . '/' . Themes::$compiled_less_filename;
if (file_exists($pcl_filepath)) {
$compiled_css .= fn_get_contents($pcl_filepath);
}
list($installed_addons) = fn_get_addons(array('type' => 'active'));
foreach ($installed_addons as $addon) {
$addon_pcl_filpath = $theme_css_path . "/addons/{$addon['addon']}/" . Themes::$compiled_less_filename;
if (file_exists($pcl_filepath)) {
$compiled_css .= fn_get_contents($addon_pcl_filpath);
}
}
//.........这里部分代码省略.........
示例10: fn_simple_decode_str
$_SESSION[$description] = LIC_STAT_TR;
break;
case fn_simple_decode_str('gsff'):
case fn_simple_decode_str('gvmm'):
$_SESSION[$prefix . '_' . $description] = fn_simple_decode_str('BDUJWF');
if ($mode == fn_simple_decode_str('gvmm')) {
fn_set_notification('I', __(fn_simple_decode_str('tupsf`npef`dibohfe')), __(fn_simple_decode_str('ufyu`tupsf`npef`dibohfe`up`gvmm')));
fn_clean_up_addons();
fn_clear_cache();
Mailer::sendMail(array('to' => Registry::get(fn_simple_decode_str('tfuujoht/Dpnqboz/dpnqboz`tjuf`benjojtusbups')), 'from' => Registry::get(fn_simple_decode_str('tfuujoht/Dpnqboz/dpnqboz`tjuf`benjojtusbups')), 'subj' => __(fn_simple_decode_str('tupsf`npef`dibohfe')), 'body' => __(fn_simple_decode_str('ufyu`tupsf`npef`dibohfe`up`gvmm')), 'data' => array(), 'company_id' => Registry::get('runtime.company_id')), 'A', CART_LANGUAGE);
fn_redirect(Registry::get('config.current_url'));
}
}
unset($_SESSION[$description]);
}
$mode = fn_get_storage_data(fn_simple_decode_str('tupsf`npef'));
if (!isset($_SESSION[$description])) {
if ($mode == fn_simple_decode_str('gsff')) {
$_SESSION[$description] = LIC_STAT_FR;
} elseif ($mode == fn_simple_decode_str('usjbm')) {
$_SESSION[$description] = LIC_STAT_TR;
} elseif ($mode == fn_simple_decode_str('gvmm')) {
$_SESSION[$description] = LIC_STAT_FL;
}
}
if (isset($_SESSION[$prefix . '_' . $description])) {
$data = $_SESSION[$prefix . '_' . $description];
} else {
$data = '';
}
if ($data == fn_simple_decode_str('MJDFOTF`JT`JOWBMJE')) {
示例11: die
* and use this program. *
* *
****************************************************************************
* PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
****************************************************************************/
use Tygh\Registry;
use Tygh\Settings;
use Tygh\Helpdesk;
if (!defined('BOOTSTRAP')) {
die('Access denied');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($mode == 'validate_request' && !empty($_REQUEST['token'])) {
$result = 'invalid';
if (fn_get_storage_data('hd_request_code') == trim($_REQUEST['token'])) {
$result = 'valid';
}
echo $result;
exit(0);
} elseif ($mode == 'messages') {
if (!empty($_REQUEST['token'])) {
$uc_settings = Settings::instance()->getValues('Upgrade_center');
$is_valid = fn_get_contents(Registry::get('config.resources.updates_server') . '/index.php?dispatch=validators.validate_request&token=' . $_REQUEST['token'] . '&license_key=' . $uc_settings['license_number']);
if ($is_valid == 'valid') {
$data = simplexml_load_string(urldecode($_REQUEST['request']));
Helpdesk::processMessages($data->Messages);
echo 'OK';
exit(0);
} else {
return array(CONTROLLER_STATUS_NO_PAGE);
示例12: getCategoryVersions
protected static function getCategoryVersions()
{
$result = fn_get_storage_data('ebay_category_version');
$result = json_decode($result, true);
if (!is_array($result)) {
$result = array();
}
return $result;
}
示例13: 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;
}
示例14: fn_clean_up_addons
/**
* Cleans up addons with incorrect snaphost
*
* @return bool Always true
*/
function fn_clean_up_addons()
{
$_addons = db_get_hash_single_array("SELECT addon, status FROM ?:addons", array('addon', 'status'));
$skipped_snapshots = fn_get_storage_data('skipped_snapshots');
$skipped_snapshots = !empty($skipped_snapshots) ? explode(',', $skipped_snapshots) : array();
foreach ($_addons as $addon => $status) {
$snaphost = md5(str_rot13($addon));
if (!fn_check_addon_snapshot($addon)) {
if ($status == 'A') {
fn_update_addon_status($addon, 'D');
$skipped_snapshots[] = $snaphost;
}
} elseif (in_array($snaphost, $skipped_snapshots)) {
fn_update_addon_status($addon, 'A');
$skipped_snapshots = array_diff($skipped_snapshots, array($snaphost));
}
}
$skipped_snapshots = array_unique($skipped_snapshots);
fn_set_storage_data('skipped_snapshots', implode(',', $skipped_snapshots));
return true;
}
示例15: fn_is_expired_storage_data
/**
* Checks is some key is expired (value of given key should be timestamp).
*
* @param string $key Key name
* @param int $time_period Time period (in seconds), that should be added to the current timestamp for the future check.
* @return boolean True, if saved timestamp is less than current timestamp, false otherwise.
*/
function fn_is_expired_storage_data($key, $time_period = null)
{
$time = fn_get_storage_data($key);
if ($time < TIME && $time_period) {
fn_set_storage_data($key, TIME + $time_period);
}
return $time < TIME;
}