本文整理汇总了PHP中fn_get_schema函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_get_schema函数的具体用法?PHP fn_get_schema怎么用?PHP fn_get_schema使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_get_schema函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fn_yandex_metrika_sync_goals
/**
* Common functions
*/
function fn_yandex_metrika_sync_goals()
{
$oauth_token = Settings::instance()->getValue('auth_token', 'rus_yandex_metrika');
$counter_number = Settings::instance()->getValue('counter_number', 'rus_yandex_metrika');
if (empty($oauth_token) || empty($counter_number)) {
return false;
}
$goals_scheme = fn_get_schema('rus_yandex_metrika', 'goals');
$selected_goals = Settings::instance()->getValue('collect_stats_for_goals', 'rus_yandex_metrika');
$client = new RestClient('https://api-metrika.yandex.ru/');
$ext_goals = array();
$res = $client->get("/counter/{$counter_number}/goals.json", array('oauth_token' => $oauth_token));
if (!empty($res['goals'])) {
foreach ($res['goals'] as $goal) {
$ext_goals[$goal['name']] = $goal;
}
}
foreach ($goals_scheme as $goal_name => $goal) {
$ext_goal_name = '[auto] ' . $goal['name'];
if (!empty($ext_goals[$ext_goal_name])) {
if (empty($selected_goals[$goal_name]) || $selected_goals[$goal_name] == 'N') {
$client->delete("/counter/{$counter_number}/goal/" . $ext_goals[$ext_goal_name]['id'] . "?oauth_token={$oauth_token}");
}
} else {
if (!empty($selected_goals[$goal_name]) && $selected_goals[$goal_name] == 'Y') {
$goal['name'] = $ext_goal_name;
$client->post("/counter/{$counter_number}/goals?oauth_token={$oauth_token}", array('goal' => $goal));
}
}
}
return true;
}
示例2: generate
/**
* Generates menu items from scheme
* @param array $request request params
* @return array menu items
*/
public function generate($request)
{
$menu = fn_get_schema('menu', 'menu', 'php');
$this->_request = $request;
$actions = array();
foreach ($menu as $group => &$menu_data) {
// Get static section
foreach ($menu_data as $root => &$items) {
$items['items'] = $this->_processItems($items['items'], $root, '');
if (empty($items['items'])) {
unset($menu[$group][$root]);
continue;
}
}
}
unset($items, $menu_data);
$menu['top'] = $this->_sort($menu['top']);
$menu['central'] = $this->_sort($menu['central']);
$menu = $this->_getSettingsSections($menu);
fn_preload_lang_vars($this->_lang_cache);
$selected = $this->_selected;
/**
* Changes generated menu items
*
* @param array $request request params
* @param array $menu items
* @param array $actions items Action value, if exists. See: fn_get_route
* @param array $this->selected Menu item, selected by the dispatch
*/
fn_set_hook('backend_menu_generate_post', $request, $menu, $actions, $this->_selected);
return array($menu, $actions, $this->_selected);
}
示例3: updateLangObjects
/**
* @param $tpl_var
* @param $value
* @return bool true
*/
public static function updateLangObjects($tpl_var, &$value)
{
static $translation_mode, $init = false, $schema;
if (!$init) {
$translation_mode = Registry::get('runtime.customization_mode.translation');
$init = true;
}
if ($translation_mode) {
if (empty($schema)) {
$schema = fn_get_schema('translate', 'schema');
}
$controller = Registry::get('runtime.controller');
$mode = Registry::get('runtime.mode');
if (!empty($schema[$controller][$mode])) {
foreach ($schema[$controller][$mode] as $var_name => $var) {
if ($tpl_var == $var_name && self::isAllowToTranslateLanguageObject($var)) {
self::prepareLangObjects($value, $var['dimension'], $var['fields'], $var['table_name'], $var['where_fields'], isset($var['inner']) ? $var['inner'] : '', isset($var['unescape']) ? $var['unescape'] : '');
}
}
}
foreach ($schema['any']['any'] as $var_name => $var) {
if ($tpl_var == $var_name && self::isAllowToTranslateLanguageObject($var)) {
self::prepareLangObjects($value, $var['dimension'], $var['fields'], $var['table_name'], $var['where_fields'], isset($var['inner']) ? $var['inner'] : '', isset($var['unescape']) ? $var['unescape'] : '');
}
}
}
return true;
}
示例4: sanitizeObjectData
/**
* Performs securing object data basing on rule list related to object type. Rule list is specified at schema file.
* Note that this function checks setting about whether HTML should be sanitized or not.
* If no, field rule "ACTION_SANITIZE_HTML" will be omitted and no modifications to field data will be made.
*
* @param string $object_type Object type specified at schema file
* @param array &$object_data Array with object data passed by reference
*
* @return void
*/
public static function sanitizeObjectData($object_type, array &$object_data)
{
$schema = fn_get_schema('security', 'object_sanitization');
if (isset($schema[$object_type][self::SCHEMA_SECTION_FIELD_RULES])) {
$object_data = self::sanitizeData($object_data, $schema[$object_type][self::SCHEMA_SECTION_FIELD_RULES], self::shouldSanitizeUserHtml() ? array() : array(self::ACTION_SANITIZE_HTML));
}
}
示例5: fn_settings_variants_addons_rus_yandex_metrika_collect_stats_for_goals
/**
* Get predefined goals
*/
function fn_settings_variants_addons_rus_yandex_metrika_collect_stats_for_goals()
{
$goals_scheme = fn_get_schema('rus_yandex_metrika', 'goals');
$goals = array();
foreach ($goals_scheme as $goal_key => $goal) {
$goals[$goal_key] = $goal['name'];
}
return $goals;
}
示例6: __construct
/**
* Create new last view instance object
*
* @param string $area Area identifier
* @return void
*/
public function __construct($area = AREA)
{
$schema_name = fn_get_area_name($area);
$this->_controller = Registry::get('runtime.controller');
$this->_mode = Registry::get('runtime.mode');
$this->_action = Registry::get('runtime.action');
$common_schema = fn_get_schema('last_view', $schema_name);
$this->_schema = !empty($common_schema[$this->_controller]) ? $common_schema[$this->_controller] : array();
$this->_auth =& $_SESSION['auth'];
}
示例7: fn_br_get_static_data_owner_link
/**
* Gets static data owner link
*
* @param string $section Static data section
* @return array breadcrumb link data
*/
function fn_br_get_static_data_owner_link($section)
{
$result = array();
$section = empty($section) ? 'C' : $section;
$schema = fn_get_schema('static_data', 'schema');
$section_data = $schema[$section];
if (!empty($section_data['owner_object']['return_url']) && !empty($section_data['owner_object']['return_url_text'])) {
$result = array('link' => $section_data['owner_object']['return_url'], 'title' => __($section_data['owner_object']['return_url_text']));
}
return $result;
}
示例8: fn_rus_edost_install
function fn_rus_edost_install()
{
$services = fn_get_schema('edost', 'services', 'php', true);
foreach ($services as $service) {
$service_id = db_query('INSERT INTO ?:shipping_services ?e', $service);
$service['service_id'] = $service_id;
foreach (Languages::getAll() as $service['lang_code'] => $lang_data) {
db_query('INSERT INTO ?:shipping_service_descriptions ?e', $service);
}
}
}
示例9: sanitizeObjectData
/**
* Performs securing object data basing on rule list related to object type. Rule list is specified at schema file.
* Note that this function checks setting about whether HTML should be sanitized or not.
* If no, field rule "ACTION_SANITIZE_HTML" will be omitted and no modifications to field data will be made.
*
* @param string $object_type Object type specified at schema file
* @param array &$object_data Array with object data passed by reference
*
* @return void
*/
public static function sanitizeObjectData($object_type, array &$object_data)
{
$schema = fn_get_schema('security', 'object_sanitization');
$auth =& \Tygh::$app['session']['auth'];
if (isset($schema[$object_type][self::SCHEMA_SECTION_FIELD_RULES])) {
$object_data = self::sanitizeData($object_data, $schema[$object_type][self::SCHEMA_SECTION_FIELD_RULES], self::shouldSanitizeUserHtml() ? array() : array(self::ACTION_SANITIZE_HTML), $changed);
if ($changed && self::shouldSanitizeUserHtml() && $auth['area'] == 'A') {
fn_set_notification('N', __('notice'), __('text_entered_html_was_sanitized'), 'K');
}
}
}
示例10: fn_settings_variants_addons_price_list_price_list_sorting
function fn_settings_variants_addons_price_list_price_list_sorting()
{
$schema = fn_get_schema('price_list', 'schema');
if (!empty($schema['fields'])) {
foreach ($schema['fields'] as $field => $field_info) {
if (!empty($field_info['sort_by'])) {
$fields[$field] = $field_info['title'];
}
}
}
return $fields;
}
示例11: 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');
}
}
}
示例12: fn_import_yml2_option
function fn_import_yml2_option($yml_option_type)
{
static $options_type_codes = null;
if (!isset($options_type_codes)) {
$options_type = fn_get_schema('yml', 'options_type');
foreach ($options_type as $type_code => $type_data) {
$options_type_codes[$type_data['value']] = $type_code;
}
}
$option_type_code = false;
if (isset($options_type_codes[$yml_option_type])) {
$option_type_code = $options_type_codes[$yml_option_type];
}
return $option_type_code;
}
示例13: fn_price_list_info
function fn_price_list_info()
{
$schema = fn_get_schema('price_list', 'schema');
if (empty($schema)) {
// workaround to avoid notices when installing addon
return;
}
$storefront_url = fn_get_storefront_url(fn_get_storefront_protocol());
if (fn_allowed_for('ULTIMATE')) {
if (Registry::get('runtime.company_id') || Registry::get('runtime.simple_ultimate')) {
} else {
$storefront_url = '';
}
}
if (!empty($storefront_url)) {
return __('price_list.text_regenerate', array('[buttons]' => fn_price_list_generate_buttons($schema), '[links]' => fn_price_list_generate_links($schema, $storefront_url)));
} else {
return __('price_list.text_select_storefront');
}
}
示例14: fn_search_get_customer_objects
function fn_search_get_customer_objects()
{
$schema = fn_get_schema('search', 'schema');
$data = array();
$objects = Registry::get('settings.General.search_objects');
fn_set_hook('customer_search_objects', $schema, $objects);
if (AREA == 'A') {
$objects['orders'] = 'Y';
$objects['users'] = 'Y';
$objects['pages'] = 'Y';
}
foreach ($schema as $object => $object_data) {
if (!empty($object_data['default']) && $object_data['default'] == true) {
continue;
}
if (!empty($objects[$object]) && $objects[$object] == 'Y') {
$data[$object] = $object_data['title'];
}
}
return $data;
}
示例15: _getDestinationCode
/**
* Gets numeric representation of Country/Region/City
*
* @param array $destination Country, Region, City of geographic place
* @return int Numeric representation
*/
private function _getDestinationCode($destination)
{
$cities = fn_get_schema('edost', 'cities');
$regions = fn_get_schema('edost', 'regions');
$countries = fn_get_schema('edost', 'countries');
$origination = $this->_shipping_info['package_info']['origination']['country'];
$result = '';
if ($destination['country'] != 'RU' || $origination != 'RU') {
$result = !empty($countries[$destination['country']]) ? $countries[$destination['country']] : '';
} else {
if (Registry::get('addons.rus_cities.status') == 'A') {
if (preg_match('/^[a-zA-Z]+$/', $destination['city'])) {
$lang_code = 'en';
} else {
$lang_code = 'ru';
}
$condition = db_quote(" d.lang_code = ?s AND d.city = ?s AND c.status = ?s", $lang_code, $destination['city'], 'A');
if (!empty($destination['state'])) {
$condition .= db_quote(" AND c.state_code = ?s", $destination['state']);
}
if (!empty($destination['country'])) {
$condition .= db_quote(" AND c.country_code = ?s", $destination['country']);
}
$result = db_get_field("SELECT c.city_code FROM ?:rus_city_descriptions as d LEFT JOIN ?:rus_cities as c ON c.city_id = d.city_id WHERE ?p", $condition);
}
if (empty($result)) {
$result = !empty($cities[$destination['city']]) ? $cities[$destination['city']] : '';
if ($result == '') {
$alt_city = $destination['city'] . ' (' . fn_get_state_name($destination['state'], $destination['country'], 'RU') . ')';
if (!empty($cities[$alt_city])) {
$result = $cities[$alt_city];
}
}
if ($result == '') {
$result = !empty($regions[$destination['state']]) ? $regions[$destination['state']] : '';
}
}
}
return $result;
}