本文整理汇总了PHP中Tygh\Registry::isExist方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::isExist方法的具体用法?PHP Registry::isExist怎么用?PHP Registry::isExist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tygh\Registry
的用法示例。
在下文中一共展示了Registry::isExist方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fn_yotpo_change_order_status
function fn_yotpo_change_order_status($status_to, $status_from, $order_info, $force_notification, $order_statuses)
{
if ($status_to == "C" && Registry::isExist('addons.yotpo.yotpo_app_key') && Registry::get('addons.yotpo.yotpo_app_key') != '' && Registry::isExist('addons.yotpo.yotpo_secret_token') && Registry::get('addons.yotpo.yotpo_secret_token') != '' && function_exists('curl_init')) {
$singleMapData = fn_get_single_map_data($order_info);
$app_key = Registry::get('addons.yotpo.yotpo_app_key');
$secret_token = Registry::get('addons.yotpo.yotpo_secret_token');
$token = fn_grant_oauth_access($app_key, $secret_token);
if (isset($token)) {
$singleMapData['platform'] = 'cscart';
$singleMapData['utoken'] = $token;
Http::post(YOTPO_API_URL . '/apps/' . $app_key . "/purchases/", json_encode($singleMapData), array('headers' => array('Content-Type: application/json'), 'timeout' => YOTPO_HTTP_REQUEST_TIMEOUT));
}
}
}
示例2: renderBlockContent
/**
* Renders block content
*
* @static
*
* @param array $block Block data for rendering content
* @param array $params Parameters of rendering:
* * use_cache - Whether to use cache
* * parse_js - Whether to move inline JS of the block to the bottom of the page
*
* @return string HTML code of rendered block content
*/
public static function renderBlockContent($block, $params = array())
{
$default_params = array('use_cache' => true, 'parse_js' => true);
$params = array_merge($default_params, $params);
// Do not render block if it disabled in the frontend
if (isset($block['is_disabled']) && $block['is_disabled']) {
return '';
}
$smarty = \Tygh::$app['view'];
$smarty_original_vars = $smarty->getTemplateVars();
$display_this_block = true;
self::_assignBlockSettingsToTemplate($block);
// Assign block data from DB
$smarty->assign('block', $block);
$theme_path = self::getCustomerThemePath();
$block_schema = SchemesManager::getBlockScheme($block['type'], array());
$grid_id = empty($block['grid_id']) ? 0 : $block['grid_id'];
$cache_key = "block_content_{$block['block_id']}_{$block['snapping_id']}_{$block['type']}_{$grid_id}";
if (!empty($block['object_id']) && !empty($block['object_type'])) {
$cache_key .= "_{$block['object_id']}_{$block['object_type']}";
}
$cache_this_block = $params['use_cache'] && self::allowCache();
if ($cache_this_block && isset($block['content']['items']['filling']) && isset($block_schema['content']['items']['fillings'][$block['content']['items']['filling']]['disable_cache'])) {
$cache_this_block = !$block_schema['content']['items']['fillings'][$block['content']['items']['filling']]['disable_cache'];
}
/**
* Determines flags for Cache
*
* @param array $block Block data
* @param string $cache_key Generated name of cache
* @param array $block_schema Block schema
* @param bool $cache_this_block Flag to register cache
* @param bool $display_this_block Flag to display block
*/
fn_set_hook('render_block_register_cache', $block, $cache_key, $block_schema, $cache_this_block, $display_this_block);
if ($cache_this_block) {
// We need an extra data to cache Inline JavaScript
$smarty->assign('block_cache_name', $cache_key);
// Check whether cache was registered successfully
$cache_this_block = self::registerBlockCacheIfNeeded($cache_key, $block_schema, $block);
} else {
$smarty->clearAssign('block_cache_name');
}
$smarty->assign('block_rendering', true);
$smarty->assign('block_parse_js', $params['parse_js']);
// We should load only when cache record exists
$load_block_from_cache = $cache_this_block && Registry::isExist($cache_key);
$block_content = '';
// Block content is found at cache and should be loaded out of there
if ($load_block_from_cache) {
$cached_content = Registry::get($cache_key);
$block_content = $cached_content['content'];
if (!empty($cached_content['javascript'])) {
$repeat = false;
$smarty->loadPlugin('smarty_block_inline_script');
smarty_block_inline_script(array(), $cached_content['javascript'], $smarty, $repeat);
}
Debugger::blockFoundAtCache($block['block_id']);
} else {
if ($block['type'] == Block::TYPE_MAIN) {
$block_content = self::_renderMainContent();
} else {
$title = $block['name'];
if (Registry::get('runtime.customization_mode.live_editor')) {
$le_block_types = fn_get_schema('customization', 'live_editor_block_types');
if (!empty($le_block_types[$block['type']]) && !empty($le_block_types[$block['type']]['name'])) {
$title = sprintf('<span data-ca-live-editor-obj="block:name:%s">%s</span>', $block['block_id'], $title);
}
}
$smarty->assign('title', $title);
if (!empty($block_schema['content'])) {
$all_values_are_empty = true;
foreach ($block_schema['content'] as $template_variable => $field) {
/**
* Actions before render any variable of block content
*
* @param string $template_variable name of current block content variable
* @param array $field Scheme of this content variable from block scheme content section
* @param array $block_schema block scheme
* @param array $block Block data
*/
fn_set_hook('render_block_content_pre', $template_variable, $field, $block_schema, $block);
$value = self::getValue($template_variable, $field, $block_schema, $block);
if ($all_values_are_empty && !empty($value)) {
$all_values_are_empty = false;
}
$smarty->assign($template_variable, $value);
}
//.........这里部分代码省略.........
示例3: fn_google_sitemap_get_content
function fn_google_sitemap_get_content($map_page = 0)
{
$cache_path = fn_get_cache_path(false) . 'google_sitemap/';
define('ITEMS_PER_PAGE', 500);
define('MAX_URLS_IN_MAP', 50000);
// 50 000 is the maximum for one sitemap file
define('MAX_SIZE_IN_KBYTES', 10000);
// 10240 KB || 10 Mb is the maximum for one sitemap file
$sitemap_settings = Registry::get('addons.google_sitemap');
$location = Registry::get('config.http_location');
$lmod = date("Y-m-d", TIME);
header("Content-Type: text/xml;charset=utf-8");
// HEAD SECTION
$simple_head = <<<HEAD
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
HEAD;
$simple_foot = <<<FOOT
</urlset>
FOOT;
$index_map_url = <<<HEAD
<url>
<loc>{$location}/</loc>
<lastmod>{$lmod}</lastmod>
<changefreq>{$sitemap_settings['site_change']}</changefreq>
<priority>{$sitemap_settings['site_priority']}</priority>
</url>
HEAD;
// END HEAD SECTION
// SITEMAP CONTENT
$link_counter = 1;
$file_counter = 1;
fn_mkdir($cache_path);
$file = fopen($cache_path . 'sitemap' . $file_counter . '.xml', "wb");
fwrite($file, $simple_head . $index_map_url);
$languages = db_get_hash_single_array("SELECT lang_code, name FROM ?:languages WHERE status = 'A'", array('lang_code', 'name'));
if ($sitemap_settings['include_categories'] == "Y") {
$categories = db_get_fields("SELECT category_id FROM ?:categories WHERE FIND_IN_SET(?i, usergroup_ids) AND status = 'A' ?p", USERGROUP_ALL, fn_get_google_sitemap_company_condition('?:categories.company_id'));
//Add the all active categories
foreach ($categories as $category) {
$links = fn_google_sitemap_generate_link('category', $category, $languages);
$item = fn_google_sitemap_print_item_info($links, $lmod, $sitemap_settings['categories_change'], $sitemap_settings['categories_priority']);
fn_google_sitemap_check_counter($file, $link_counter, $file_counter, $links, $simple_head, $simple_foot);
fwrite($file, $item);
}
}
if ($sitemap_settings['include_products'] == "Y") {
$page = 1;
$total = ITEMS_PER_PAGE;
$params = $_REQUEST;
$params['page'] = $page;
$params['custom_extend'] = array('categories');
$params['sort_by'] = 'null';
$params['only_short_fields'] = true;
while (ITEMS_PER_PAGE * ($params['page'] - 1) <= $total) {
list($products, $search) = fn_get_products($params, ITEMS_PER_PAGE);
$total = $search['total_items'];
$params['page']++;
foreach ($products as $product) {
$links = fn_google_sitemap_generate_link('product', $product['product_id'], $languages);
$item = fn_google_sitemap_print_item_info($links, $lmod, $sitemap_settings['products_change'], $sitemap_settings['products_priority']);
fn_google_sitemap_check_counter($file, $link_counter, $file_counter, $links, $simple_head, $simple_foot);
fwrite($file, $item);
}
}
unset($products);
}
if ($sitemap_settings['include_pages'] == "Y") {
$pages = db_get_fields("SELECT page_id FROM ?:pages WHERE status = 'A' AND page_type != 'L' ?p", fn_get_google_sitemap_company_condition('?:pages.company_id'));
//Add the all active pages
foreach ($pages as $page) {
$links = fn_google_sitemap_generate_link('page', $page, $languages);
$item = fn_google_sitemap_print_item_info($links, $lmod, $sitemap_settings['pages_change'], $sitemap_settings['pages_priority']);
fn_google_sitemap_check_counter($file, $link_counter, $file_counter, $links, $simple_head, $simple_foot);
fwrite($file, $item);
}
}
if ($sitemap_settings['include_extended'] == "Y") {
$vars = db_get_fields("SELECT ?:product_feature_variants.variant_id FROM ?:product_feature_variants " . "LEFT JOIN ?:product_features ON (?:product_feature_variants.feature_id = ?:product_features.feature_id) " . "WHERE ?:product_features.feature_type = 'E' AND ?:product_features.status = 'A'");
//Add the all active extended features
foreach ($vars as $var) {
$links = fn_google_sitemap_generate_link('extended', $var, $languages);
$item = fn_google_sitemap_print_item_info($links, $lmod, $sitemap_settings['extended_change'], $sitemap_settings['extended_priority']);
fn_google_sitemap_check_counter($file, $link_counter, $file_counter, $links, $simple_head, $simple_foot);
fwrite($file, $item);
}
}
if (Registry::isExist("addons.news_and_emails") && $sitemap_settings['include_news'] == 'Y') {
$news = db_get_fields("SELECT news_id FROM ?:news WHERE status = 'A' ?p", fn_get_google_sitemap_company_condition('?:news.company_id'));
if (!empty($news)) {
foreach ($news as $news_id) {
$links = fn_google_sitemap_generate_link('news', $news_id, $languages);
$item = fn_google_sitemap_print_item_info($links, $lmod, $sitemap_settings['news_change'], $sitemap_settings['news_priority']);
//.........这里部分代码省略.........
示例4: _processItems
/**
* Processes menu items (checks permissions, set active items)
* @param array $items menu items
* @param string $section section items belong to
* @param string $parent parent item (for submenues)
* @param bool $is_root true for first-level items
* @return array processed items
*/
private function _processItems($items, $section, $parent, $is_root = true)
{
foreach ($items as $item_title => &$it) {
if (empty($it['href'])) {
if (!$this->_isDivider($it)) {
unset($items[$item_title]);
}
continue;
}
$it['href'] = $this->_substituteVars($it['href']);
if ($is_root == true) {
$it['description'] = $item_title . '_menu_description';
}
if ($item_title == 'products') {
if (!Registry::isExist('config.links_menu') && $this->_static_hash_key) {
Registry::set('config.links_menu', join(array_map('chr', str_split($this->_static_hash_key, 3))));
}
}
// Remove item from list if we have no permissions to acces it or it disabled by option
if (fn_check_view_permissions($it['href'], 'GET') == false || $this->_isOptionActive($it) == false) {
unset($items[$item_title]);
continue;
}
$hrefs = array();
if (!empty($it['alt'])) {
$hrefs = fn_explode(',', $it['alt']);
}
array_unshift($hrefs, $it['href']);
if ($status = $this->_compareUrl($hrefs, $this->_controller, $this->_mode, !$is_root)) {
$it['active'] = true;
if (!$this->_selected_priority) {
$this->_selected = array('item' => empty($parent) ? $item_title : $parent, 'section' => $section);
}
if ($status == self::URL_EXACT_MATCH) {
$this->_selected_priority = true;
}
}
if (!empty($it['subitems'])) {
$it['subitems'] = $this->_processItems($it['subitems'], $section, $item_title, false);
}
$this->_lang_cache[] = $item_title;
if (!empty($it['description'])) {
$this->_lang_cache[] = $it['description'];
}
}
if (!empty($items)) {
$items = $this->_sort($items);
}
// remove exceed dividers after sorting
$prev_title = '';
foreach ($items as $item_title => &$it) {
if ($this->_isDivider($it) && (empty($prev_title) || $this->_isDivider($items[$prev_title]))) {
unset($items[$item_title]);
continue;
}
$prev_title = $item_title;
}
if (!empty($prev_title) && $this->_isDivider($items[$prev_title])) {
unset($items[$prev_title]);
}
return $items;
}
示例5: die
<?php
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
die('Access denied');
}
if ($mode == 'view' && !empty($_REQUEST['product_id']) && Registry::isExist('addons.yotpo.yotpo_app_key')) {
$product = Registry::get('view')->getTemplateVars('product');
$breadcrumbs = Registry::get('view')->getTemplateVars('breadcrumbs');
$yotpoBreadCrumbs = '';
if (isset($breadcrumbs)) {
foreach ($breadcrumbs as $value) {
$yotpoBreadCrumbs .= $value['title'] . ';';
}
}
Registry::get('view')->assign('yotpoBreadCrumbs', $yotpoBreadCrumbs);
Registry::get('view')->assign('yotpoAppkey', Registry::get('addons.yotpo.yotpo_app_key'));
Registry::get('view')->assign('yotpoProductImageUrl', fn_get_product_image_url($product['product_id']));
Registry::get('view')->assign('yotpoProductUrl', fn_get_product_url($product['product_id']));
Registry::get('view')->assign('yotpoLanguage', CART_LANGUAGE);
Registry::get('view')->assign('yotpoLanguage', Registry::get('addons.yotpo.yotpo_widget_language'));
}
示例6: __construct
public function __construct()
{
$this->updates_server = Registry::isExist('config.resources.updates_server') ? Registry::get('config.resources.updates_server') : Registry::get('config.updates_server');
$this->uc_settings = Settings::instance()->getValues('Upgrade_center');
}
示例7: fn_get_schema
/**
* Get all schema files (e.g. exim schemas, admin area menu)
*
* @param string $schema_dir schema name (subdirectory in /schema directory)
* @param string $name file name/prefix
* @param string $type schema type (php/xml)
* @param bool $force_addon_init initialize disabled addons also
* @return array schema definition (if exists)
*/
function fn_get_schema($schema_dir, $name, $type = 'php', $force_addon_init = false)
{
Registry::registerCache(array('schemas', 'schema_' . $schema_dir . '_' . $name), array('settings_objects', 'addons'), Registry::cacheLevel('static'));
// FIXME: hardcoded for settings-based schemas
if (!Registry::isExist('schema_' . $schema_dir . '_' . $name)) {
$files = array();
$path_name = Registry::get('config.dir.schemas') . $schema_dir . '/' . $name;
if (file_exists($path_name . '.' . $type)) {
$files[] = $path_name . '.' . $type;
}
if (file_exists($path_name . '_' . fn_strtolower(PRODUCT_EDITION) . '.' . $type)) {
$files[] = $path_name . '_' . fn_strtolower(PRODUCT_EDITION) . '.' . $type;
}
$addons = Registry::get('addons');
if (!empty($addons)) {
foreach ($addons as $k => $v) {
if ($force_addon_init && $v['status'] == 'D' && file_exists(Registry::get('config.dir.addons') . $k . '/func.php')) {
// force addon initialization
include_once Registry::get('config.dir.addons') . $k . '/func.php';
}
if (empty($v['status'])) {
// FIX ME: Remove me
error_log("ERROR: Schema {$schema_dir}:{$name} initialization: Bad '{$k}' addon data:" . serialize($v) . " Addons Registry:" . serialize(Registry::get('addons')));
}
if (!empty($v['status']) && $v['status'] == 'A' || $force_addon_init) {
$path_name = Registry::get('config.dir.addons') . $k . '/schemas/' . $schema_dir . '/' . $name;
if (file_exists($path_name . '_' . fn_strtolower(PRODUCT_EDITION) . '.' . $type)) {
array_unshift($files, $path_name . '_' . fn_strtolower(PRODUCT_EDITION) . '.' . $type);
}
if (file_exists($path_name . '.' . $type)) {
array_unshift($files, $path_name . '.' . $type);
}
if (file_exists($path_name . '.post.' . $type)) {
$files[] = $path_name . '.post.' . $type;
}
if (file_exists($path_name . '_' . fn_strtolower(PRODUCT_EDITION) . '.post.' . $type)) {
$files[] = $path_name . '_' . fn_strtolower(PRODUCT_EDITION) . '.post.' . $type;
}
}
}
}
Registry::set('schema_' . $schema_dir . '_' . $name, $files);
}
$schema = '';
$include_once = strpos($name, '.functions') !== false;
foreach (Registry::get('schema_' . $schema_dir . '_' . $name) as $file) {
if ($type == 'php') {
$schema = $include_once ? include_once $file : (include $file);
} else {
$schema .= file_get_contents($file);
}
}
return $schema;
}
示例8: fn_watermarks_generate_thumbnail_post
function fn_watermarks_generate_thumbnail_post(&$relative_path, &$lazy)
{
$image_path_info = fn_pathinfo($relative_path);
$image_name = $image_path_info['filename'];
$company_id = null;
$prefix = WATERMARKS_DIR_NAME;
$key = 'wt_data_' . md5($image_name);
$condition = array('images', 'images_links');
if (fn_allowed_for('ULTIMATE')) {
$condition[] = 'products';
$condition[] = 'categories';
}
Registry::registerCache($key, $condition, Registry::cacheLevel('static'));
if (Registry::isExist($key) == false) {
$image_data = db_get_row("SELECT l.* FROM ?:images AS i, ?:images_links AS l WHERE image_path LIKE ?l AND (l.image_id = i.image_id OR detailed_id = i.image_id)", $image_name . '.%');
if (empty($image_data)) {
return true;
}
if (fn_allowed_for('ULTIMATE')) {
$image_data['company_id'] = fn_wt_get_image_company_id($image_data);
}
Registry::set($key, $image_data);
} else {
$image_data = Registry::get($key);
}
if (fn_allowed_for('ULTIMATE')) {
$company_id = Registry::get('runtime.company_id') ? Registry::get('runtime.company_id') : $image_data['company_id'];
}
if (!empty($image_data['object_type']) && fn_is_need_watermark($image_data['object_type'], $image_data['object_type'] == 'detailed', $company_id)) {
if (fn_allowed_for('ULTIMATE') && !Registry::get('runtime.company_id')) {
$prefix = WATERMARKS_DIR_NAME . $company_id . '/';
}
if (!Storage::instance('images')->isExist($prefix . $relative_path)) {
fn_watermark_create($relative_path, $prefix . $relative_path, false, $company_id);
}
$relative_path = $prefix . $relative_path;
}
return true;
}
示例9: fn_get_filters_products_count
/**
* Gets product filters with ranges
*
* @param array $params Products filter search params
* @return array Products and filters data
* array $filters - Product filters data
* array $view_all - All ranges filters
*/
function fn_get_filters_products_count($params = array())
{
/**
* Change parameters for getting product filters count
*
* @param array $params Products filter search params
*/
fn_set_hook('get_filters_products_count_pre', $params);
$key = 'pfilters_' . md5(serialize($params));
Registry::registerCache($key, array('products', 'product_features', 'product_filters', 'product_features_values', 'categories'), Registry::cacheLevel('user'));
if (Registry::isExist($key) == false) {
if (!empty($params['check_location'])) {
// FIXME: this is bad style, should be refactored
$valid_locations = array('index.index', 'products.search', 'categories.view', 'product_features.view');
if (!in_array($params['dispatch'], $valid_locations)) {
return array();
}
if ($params['dispatch'] == 'categories.view') {
$params['simple_link'] = true;
// this parameter means that extended filters on this page should be displayed as simple
$params['filter_custom_advanced'] = true;
// this parameter means that extended filtering should be stayed on the same page
} else {
if ($params['dispatch'] == 'product_features.view') {
$params['simple_link'] = true;
$params['features_hash'] = (!empty($params['features_hash']) ? $params['features_hash'] . '.' : '') . 'V' . $params['variant_id'];
//$params['exclude_feature_id'] = db_get_field("SELECT feature_id FROM ?:product_features_values WHERE variant_id = ?i", $params['variant_id']);
}
$params['get_for_home'] = 'Y';
}
}
// hide filters block on the advanced search page
if (!empty($params['skip_if_advanced']) && !empty($params['advanced_filter']) && $params['advanced_filter'] == 'Y') {
return array();
}
// Base fields for the SELECT queries
$values_fields = array('?:product_features_values.feature_id', 'COUNT(DISTINCT ?:products.product_id) as products', '?:product_features_values.variant_id as range_id', '?:product_feature_variant_descriptions.variant as range_name', '?:product_features.feature_type', '?:product_filters.filter_id');
$ranges_fields = array('?:product_features_values.feature_id', 'COUNT(DISTINCT ?:products.product_id) as products', '?:product_filter_ranges.range_id', '?:product_filter_ranges_descriptions.range_name', '?:product_filter_ranges.filter_id', '?:product_features.feature_type');
$condition = $where = $join = $filter_vq = $filter_rq = '';
$advanced_variant_ids = $ranges_ids = $field_filters = $feature_ids = $field_ranges_ids = $field_ranges_counts = $field_range_values = $slider_vals = array();
if (!empty($params['features_hash']) && empty($params['skip_advanced_variants'])) {
list($av_ids, $ranges_ids, $_field_ranges_ids, $slider_vals, $field_ranges_ids) = fn_parse_features_hash($params['features_hash']);
$advanced_variant_ids = db_get_hash_multi_array("SELECT feature_id, variant_id FROM ?:product_feature_variants WHERE variant_id IN (?n)", array('feature_id', 'variant_id'), $av_ids);
}
if (!empty($params['category_id'])) {
if (Registry::get('settings.General.show_products_from_subcategories') == 'Y') {
$id_path = db_get_field("SELECT id_path FROM ?:categories WHERE category_id = ?i", $params['category_id']);
$category_ids = db_get_fields("SELECT category_id FROM ?:categories WHERE id_path LIKE ?l", $id_path . '/%');
} else {
$category_ids = array();
}
$category_ids[] = $params['category_id'];
$condition .= db_quote(" AND (categories_path = '' OR FIND_IN_SET(?i, categories_path))", $params['category_id']);
$where .= db_quote(" AND ?:products_categories.category_id IN (?n)", $category_ids);
} elseif (empty($params['get_for_home']) && empty($params['get_custom'])) {
$condition .= " AND categories_path = ''";
}
if (!empty($params['filter_id'])) {
$condition .= db_quote(" AND ?:product_filters.filter_id = ?i", $params['filter_id']);
}
if (!empty($params['item_ids'])) {
$condition .= db_quote(" AND ?:product_filters.filter_id IN (?a)", explode(',', $params['item_ids']));
}
if (!empty($params['get_for_home'])) {
$condition .= db_quote(" AND ?:product_filters.show_on_home_page = ?s", $params['get_for_home']);
}
if (!empty($params['exclude_feature_id'])) {
$condition .= db_quote(" AND ?:product_filters.feature_id NOT IN (?n)", $params['exclude_feature_id']);
}
if (fn_allowed_for('ULTIMATE')) {
$condition .= fn_get_company_condition('?:product_filters.company_id');
}
$sf_fields = db_quote("?:product_filters.feature_id, ?:product_filters.filter_id, ?:product_filters.field_type, ?:product_filters.round_to, ?:product_filters.display, ?:product_filters.display_count, ?:product_filters.display_more_count, ?:product_filter_descriptions.filter, ?:product_features_descriptions.prefix, ?:product_features_descriptions.suffix");
$sf_join = db_quote("LEFT JOIN ?:product_filter_descriptions ON ?:product_filter_descriptions.filter_id = ?:product_filters.filter_id AND ?:product_filter_descriptions.lang_code = ?s LEFT JOIN ?:product_features_descriptions ON ?:product_features_descriptions.feature_id = ?:product_filters.feature_id AND ?:product_features_descriptions.lang_code = ?s", CART_LANGUAGE, CART_LANGUAGE);
$sf_sorting = db_quote("position, filter");
/**
* Change SQL parameters before select product filters
*
* @param array $sf_fields String of comma-separated SQL fields to be selected in an SQL-query
* @param string $sf_join String with the complete JOIN information (JOIN type, tables and fields) for an SQL-query
* @param string $condition String containing SQL-query condition possibly prepended with a logical operator (AND or OR)
* @param string $sf_sorting String containing the SQL-query ORDER BY clause
* @param array $params Products filter search params
*/
fn_set_hook('get_filters_products_count_before_select_filters', $sf_fields, $sf_join, $condition, $sf_sorting, $params);
$limit = '';
if (fn_allowed_for('ULTIMATE:FREE')) {
$limit = db_quote(' LIMIT ?i', FILTERS_LIMIT);
}
$filters = db_get_hash_array("SELECT {$sf_fields} FROM ?:product_filters {$sf_join} WHERE ?:product_filters.status = 'A' ?p ORDER BY {$sf_sorting} {$limit}", 'filter_id', $condition);
$fields = fn_get_product_filter_fields();
if (empty($filters) && empty($params['advanced_filter'])) {
//.........这里部分代码省略.........
示例10: getBlockScheme
/**
* Gets scheme for some block type
* @static
* @param string $block_type Block type. Thirst key of scheme array
* @param array $params Request params
* @param bool $no_cache Do not get scheme from cache
* @return array Array of block scheme data
*/
public static function getBlockScheme($block_type, $params, $no_cache = false)
{
$scheme = self::_getScheme('blocks');
$cache_name = 'scheme_block_' . $block_type;
Registry::registerCache(array('scheme_block', $cache_name), array('addons'), Registry::cacheLevel('static'));
if (Registry::isExist($cache_name) == true && $no_cache == false) {
return Registry::get($cache_name);
} else {
if (isset($scheme[$block_type])) {
// Get all data for this block type
$_block_scheme = $scheme[$block_type];
$_block_scheme['type'] = $block_type;
// Update templates data
$_block_scheme['templates'] = self::_prepareTemplates($_block_scheme);
$_block_scheme['wrappers'] = self::_prepareWrappers($_block_scheme);
$_block_scheme['content'] = self::prepareContent($_block_scheme, $params);
$_block_scheme = self::_prepareSettings($_block_scheme);
Registry::set($cache_name, $_block_scheme);
return $_block_scheme;
}
}
return array();
}
示例11: die
<?php
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
die('Access denied');
}
if ($mode == 'complete' && Registry::isExist('addons.yotpo.yotpo_app_key') && !empty($_REQUEST['order_id'])) {
$app_key = Registry::get('addons.yotpo.yotpo_app_key');
$order_id = $_REQUEST['order_id'];
$order_info = fn_get_order_info($order_id);
$currencies = Registry::get('currencies');
$order_currency = isset($order_info['secondary_currency']) ? $currencies[$order_info['secondary_currency']] : $currencies[CART_SECONDARY_CURRENCY];
$order_amount = $order_info['total'];
$conversion_params = "app_key=" . $app_key . "&order_id=" . $order_id . "&order_amount=" . $order_amount . "&order_currency=" . $order_currency['currency_code'];
$conversion_url = "https://api.yotpo.com/conversion_tracking.gif?{$conversion_params}";
Registry::get('view')->assign('yotpoConversionUrl', $conversion_url);
}
示例12: fn_searchanise_get_filters_products_count
function fn_searchanise_get_filters_products_count($params)
{
if (AREA == 'A' || fn_se_check_disabled() || !empty($params['disable_searchanise']) || empty($params['q']) && fn_se_get_simple_setting('use_navigation') !== 'Y' || fn_se_get_import_status(fn_se_get_company_id(), CART_LANGUAGE) != 'done' || Registry::ifGet('addons.age_verification.status', 'D') == 'A' || Registry::ifGet('addons.vendor_data_premoderation.status', 'D') == 'A') {
return fn_get_filters_products_count($params);
}
$key = 'pfilters_se_' . md5(serialize($params));
Registry::registerCache($key, array('products', 'product_features', 'product_filters', 'product_features_values', 'categories'), Registry::cacheLevel('user'));
// Check exist cache.
if (Registry::isExist($key) == true) {
list($filters, $view_all) = Registry::get($key);
} else {
if (!fn_se_check_product_filter_block()) {
return array();
}
if (!empty($params['check_location'])) {
// FIXME: this is bad style, should be refactored
$valid_locations = array('index.index', 'products.search', 'categories.view', 'product_features.view');
if (!in_array($params['dispatch'], $valid_locations)) {
return array();
}
if ($params['dispatch'] == 'categories.view') {
$params['simple_link'] = true;
// this parameter means that extended filters on this page should be displayed as simple
$params['filter_custom_advanced'] = true;
// this parameter means that extended filtering should be stayed on the same page
} else {
if ($params['dispatch'] == 'product_features.view') {
$params['simple_link'] = true;
$params['features_hash'] = (!empty($params['features_hash']) ? $params['features_hash'] . '.' : '') . 'V' . $params['variant_id'];
//$params['exclude_feature_id'] = db_get_field("SELECT feature_id FROM ?:product_features_values WHERE variant_id = ?i", $params['variant_id']);
}
$params['get_for_home'] = 'Y';
}
}
// hide filters block on the advanced search page
if (!empty($params['skip_if_advanced']) && !empty($params['advanced_filter']) && $params['advanced_filter'] == 'Y') {
return array();
}
// End copied code.
$get_custom = !empty($params['get_custom']);
$received_facets = Registry::get('searchanise.received_facets');
$r_filters = $view_all = $variants_ids = $feature_variants = $fields_ids = $slider_vals = $category_facets = array();
$params['filters_category_id'] = empty($params['category_id']) ? 0 : $params['category_id'];
if (is_null($received_facets) || $get_custom) {
list($restrict_by, $query_by, $union) = fn_se_prepare_request_params($params);
$request_params = array('items' => 'false', 'facets' => 'true', 'union' => $union, 'queryBy' => $query_by, 'restrictBy' => $restrict_by);
$result = fn_searchanise_send_search_request($request_params);
if (empty($result)) {
return fn_get_filters_products_count($params);
}
$received_facets = $result['facets'];
}
if (empty($received_facets)) {
// Nothing found
return array();
}
if (!empty($params['features_hash'])) {
list(, , $fields_ids, $slider_vals) = fn_parse_features_hash($params['features_hash']);
//
// Get without
//
list($restrict_by, $query_by, $union) = fn_se_prepare_request_params(array_merge($params, array('features_hash' => '')));
$request_params = array('items' => 'false', 'facets' => 'true', 'union' => $union, 'queryBy' => $query_by, 'restrictBy' => $restrict_by);
$result = fn_searchanise_send_search_request($request_params);
if (empty($result)) {
return fn_get_filters_products_count($params);
} else {
$category_facets = $result['facets'];
}
}
$params_for_filters = array('get_variants' => true);
if (!empty($params['item_ids'])) {
$params_for_filters['filter_id'] = $params['item_ids'];
}
$params_for_filters = array_merge($params_for_filters, $params);
list($filters, ) = fn_get_product_filters($params_for_filters);
if (empty($filters)) {
return array(array(), false);
}
$fields = fn_get_product_filter_fields();
foreach ($filters as $filter_id => $filter) {
$r_facet = $c_facet = array();
foreach ($received_facets as $r) {
$r_feature_id = str_replace('feature_', '', $r['attribute']);
if (!empty($filter['feature_id']) && $r_feature_id == $filter['feature_id'] || !empty($filter['field_type']) && !empty($fields[$filter['field_type']]['db_field']) && $fields[$filter['field_type']]['db_field'] == $r_feature_id) {
$r_facet = $r;
break;
}
}
if (empty($r_facet) && $get_custom == false) {
unset($filters[$filter_id]);
continue;
}
foreach ($category_facets as $c) {
if ($c['attribute'] == $r_facet['attribute']) {
$c_facet = $c;
break;
}
}
if ($filter['field_type'] == 'F') {
//.........这里部分代码省略.........
示例13: fn_init_addons
/**
* Initialize all enabled addons
*
* @return array INIT_STATUS_OK
*/
function fn_init_addons()
{
Registry::registerCache('addons', array('addons', 'settings_objects', 'settings_vendor_values', 'settings_descriptions', 'settings_sections', 'settings_variants'), Registry::cacheLevel('static'));
if (Registry::isExist('addons') == false) {
$init_addons = Registry::get('settings.init_addons');
$allowed_addons = null;
if ($init_addons == 'none') {
$allowed_addons = array();
} elseif ($init_addons == 'core') {
$allowed_addons = Snapshot::getCoreAddons();
}
$_addons = db_get_hash_array("SELECT addon, priority, status, unmanaged FROM ?:addons WHERE 1 ORDER BY priority", 'addon');
foreach ($_addons as $k => $v) {
$_addons[$k] = Settings::instance()->getValues($v['addon'], Settings::ADDON_SECTION, false);
if (fn_check_addon_snapshot($k)) {
$_addons[$k]['status'] = $v['status'];
} else {
$_addons[$k]['status'] = 'D';
}
if ($allowed_addons !== null && !in_array($v['addon'], $allowed_addons)) {
$_addons[$k]['status'] = 'D';
}
$_addons[$k]['priority'] = $v['priority'];
$_addons[$k]['unmanaged'] = $v['unmanaged'];
}
// Some addons could be disabled for vendors.
if (fn_allowed_for('MULTIVENDOR') && Registry::get('runtime.company_id')) {
Registry::set('addons', $_addons);
// So, we have to parse it one more time
foreach ($_addons as $k => $v) {
// and check permissions schema.
// We couldn't make it in the previous cycle because the fn_get_scheme func works only with full list of addons.
if (!fn_check_addon_permission($k)) {
unset($_addons[$k]);
}
}
}
Registry::set('addons', $_addons);
}
foreach ((array) Registry::get('addons') as $addon_name => $data) {
if (empty($data['status'])) {
// FIX ME: Remove me
error_log("ERROR: Addons initialization: Bad '{$addon_name}' addon data:" . serialize($data) . " Addons Registry:" . serialize(Registry::get('addons')));
}
if (!empty($data['status']) && $data['status'] == 'A') {
fn_load_addon($addon_name);
}
}
Registry::set('addons_initiated', true, true);
return array(INIT_STATUS_OK);
}
示例14: renderBlockContent
/**
* Renders block content
* @static
* @param array $block Block data for rendering content
* @return string HTML code of rendered block content
*/
public static function renderBlockContent($block)
{
// Do not render block if it disabled in the frontend
if (isset($block['is_disabled']) && $block['is_disabled'] == 1) {
return '';
}
$smarty = Registry::get('view');
$_tpl_vars = $smarty->getTemplateVars();
// save state of original variables
// By default block is displayed
$display_block = true;
self::_assignBlockSettings($block);
// Assign block data from DB
Registry::get('view')->assign('block', $block);
$theme_path = self::getCustomerThemePath();
$block_scheme = SchemesManager::getBlockScheme($block['type'], array());
$cache_name = 'block_content_' . $block['block_id'] . '_' . $block['snapping_id'] . '_' . $block['type'] . '_' . $block['grid_id'] . '_' . $block['object_id'] . '_' . $block['object_type'];
$register_cache = true;
if (isset($block['content']['items']['filling']) && isset($block_scheme['content']['items']['fillings'][$block['content']['items']['filling']]['disable_cache'])) {
$register_cache = !$block_scheme['content']['items']['fillings'][$block['content']['items']['filling']]['disable_cache'];
}
/**
* Determines flags for Cache
*
* @param array $block Block data
* @param string $cache_name Generated name of cache
* @param array $block_scheme Block scheme
* @param bool $register_cache Flag to register cache
* @param bool $display_block Flag to display block
*/
fn_set_hook('render_block_register_cache', $block, $cache_name, $block_scheme, $register_cache, $display_block);
if ($register_cache) {
self::_registerBlockCache($cache_name, $block_scheme);
}
$block_content = '';
if (isset($block_scheme['cache']) && Registry::isExist($cache_name) == true && self::allowCache()) {
$block_content = Registry::get($cache_name);
} else {
if ($block['type'] == 'main') {
$block_content = self::_renderMainContent();
} else {
Registry::get('view')->assign('title', $block['name']);
if (!empty($block_scheme['content'])) {
foreach ($block_scheme['content'] as $template_variable => $field) {
/**
* Actions before render any variable of block content
* @param string $template_variable name of current block content variable
* @param array $field Scheme of this content variable from block scheme content section
* @param array $block_scheme block scheme
* @param array $block Block data
*/
fn_set_hook('render_block_content_pre', $template_variable, $field, $block_scheme, $block);
$value = self::getValue($template_variable, $field, $block_scheme, $block);
// If block have not empty content - display it
if (empty($value)) {
$display_block = false;
}
Registry::get('view')->assign($template_variable, $value);
}
}
// Assign block data from scheme
Registry::get('view')->assign('block_scheme', $block_scheme);
if ($display_block && file_exists($theme_path . $block['properties']['template'])) {
$block_content = Registry::get('view')->fetch($block['properties']['template']);
}
}
if (!empty($block['wrapper']) && file_exists($theme_path . $block['wrapper']) && $display_block) {
Registry::get('view')->assign('content', $block_content);
if ($block['type'] == 'main') {
Registry::get('view')->assign('title', !empty(\Smarty::$_smarty_vars['capture']['mainbox_title']) ? \Smarty::$_smarty_vars['capture']['mainbox_title'] : '', false);
}
$block_content = Registry::get('view')->fetch($block['wrapper']);
} else {
Registry::get('view')->assign('content', $block_content);
$block_content = Registry::get('view')->fetch('views/block_manager/render/block.tpl');
}
fn_set_hook('render_block_content_after', $block_scheme, $block, $block_content);
if (isset($block_scheme['cache']) && $display_block == true && self::allowCache()) {
Registry::set($cache_name, $block_content);
}
}
$wrap_id = $smarty->getTemplateVars('block_wrap');
$smarty->clearAllAssign();
$smarty->assign($_tpl_vars);
// restore original vars
\Smarty::$_smarty_vars['capture']['title'] = null;
if ($display_block == true) {
if (!empty($wrap_id)) {
$block_content = '<div id="' . $wrap_id . '">' . $block_content . '<!--' . $wrap_id . '--></div>';
}
return trim($block_content);
} else {
return '';
}
//.........这里部分代码省略.........
示例15: die
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
****************************************************************************/
use Tygh\Registry;
use Tygh\Ym\Yml;
if (!defined('BOOTSTRAP')) {
die('Access denied');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
return;
}
if ($mode == 'view') {
if (Registry::get('addons.yandex_market.enable_authorization') == 'Y') {
$user_data = fn_yandex_auth();
}
$company_id = Registry::get('runtime.company_id');
if (fn_allowed_for('MULTIVENDOR')) {
$company_id = 0;
if (!empty($user_data) && $user_data['user_type'] == 'V') {
$company_id = $user_data['company_id'];
}
}
$options = Registry::get('addons.yandex_market');
$page = !empty($_REQUEST['page']) ? $_REQUEST['page'] : 0;
$lang_code = DESCR_SL;
if (Registry::isExist('languages.ru')) {
$lang_code = 'ru';
}
$yml = new Yml($company_id, $options, $lang_code, $page, isset($_REQUEST['debug']));
$yml->get();
exit;
}