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

PHP get_current_language函数代码示例

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

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



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

示例1: translation_editor_plugins_boot_event

/**
 * This function is executed during the 'plugins_boot' event, before most plugins are initialized
 *
 * @return void
 */
function translation_editor_plugins_boot_event()
{
    // add the custom_keys_locations to language paths
    $custom_keys_path = elgg_get_data_path() . 'translation_editor' . DIRECTORY_SEPARATOR . 'custom_keys' . DIRECTORY_SEPARATOR;
    if (is_dir($custom_keys_path)) {
        register_translations($custom_keys_path);
    }
    // force creation of static to prevent reload of unwanted translations
    reload_all_translations();
    if (elgg_in_context('translation_editor') || elgg_in_context('settings') || elgg_in_context('admin')) {
        translation_editor_reload_all_translations();
    }
    translation_editor_load_custom_languages();
    if (!elgg_in_context('translation_editor')) {
        // remove disabled languages
        translation_editor_unregister_translations();
    }
    // load custom translations
    $user_language = get_current_language();
    $elgg_default_language = 'en';
    $load_languages = [$user_language, $elgg_default_language];
    $load_languages = array_unique($load_languages);
    $disabled_languages = translation_editor_get_disabled_languages();
    foreach ($load_languages as $language) {
        if (empty($disabled_languages) || !in_array($language, $disabled_languages)) {
            // add custom translations
            translation_editor_load_translations($language);
        }
    }
}
开发者ID:coldtrick,项目名称:translation_editor,代码行数:35,代码来源:start.php


示例2: profile_fields_setup

/**
 * This function loads a set of default fields into the profile, then triggers a hook letting other plugins to edit
 * add and delete fields.
 *
 * Note: This is a secondary system:init call and is run at a super low priority to guarantee that it is called after all
 * other plugins have initialised.
 */
function profile_fields_setup()
{
    global $CONFIG;
    $profile_defaults = array('description' => 'longtext', 'briefdescription' => 'text', 'location' => 'tags', 'interests' => 'tags', 'skills' => 'tags', 'contactemail' => 'email', 'phone' => 'text', 'mobile' => 'text', 'website' => 'url');
    // TODO: Have an admin interface for this
    $n = 0;
    $loaded_defaults = array();
    while ($translation = get_plugin_setting("admin_defined_profile_{$n}", 'profile')) {
        // Add a translation
        add_translation(get_current_language(), array("profile:admin_defined_profile_{$n}" => $translation));
        // Detect type
        $type = get_plugin_setting("admin_defined_profile_type_{$n}", 'profile');
        if (!$type) {
            $type = 'text';
        }
        // Set array
        $loaded_defaults["admin_defined_profile_{$n}"] = $type;
        $n++;
    }
    if (count($loaded_defaults)) {
        $CONFIG->profile_using_custom = true;
        $profile_defaults = $loaded_defaults;
    }
    $CONFIG->profile = trigger_plugin_hook('profile:fields', 'profile', NULL, $profile_defaults);
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:32,代码来源:start.php


示例3: translation_editor_plugins_boot_event

function translation_editor_plugins_boot_event()
{
    global $CONFIG;
    run_function_once("translation_editor_version_053");
    // add the custom_keys_locations to language paths
    $custom_keys_path = $CONFIG->dataroot . "translation_editor" . DIRECTORY_SEPARATOR . "custom_keys" . DIRECTORY_SEPARATOR;
    if (is_dir($custom_keys_path)) {
        $CONFIG->language_paths[$custom_keys_path] = true;
    }
    // force creation of static to prevent reload of unwanted translations
    reload_all_translations();
    translation_editor_load_custom_languages();
    if (elgg_get_context() != "translation_editor") {
        // remove disabled languages
        translation_editor_unregister_translations();
    }
    // load custom translations
    $user_language = get_current_language();
    $elgg_default_language = "en";
    $load_languages = array($user_language, $elgg_default_language);
    $load_languages = array_unique($load_languages);
    $disabled_languages = translation_editor_get_disabled_languages();
    foreach ($load_languages as $language) {
        if (empty($disabled_languages) || !in_array($language, $disabled_languages)) {
            // add custom translations
            translation_editor_load_translations($language);
        }
    }
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:29,代码来源:start.php


示例4: search_advanced_init

/**
 * Initializes the plugin
 *
 * @return void
 */
function search_advanced_init()
{
    // page handler for search actions and results
    elgg_register_page_handler("search_advanced", "search_advanced_page_handler");
    elgg_register_page_handler("search", "search_advanced_search_page_handler");
    // search hooks
    search_advanced_unregister_default_search_hooks();
    search_advanced_register_search_hooks();
    // unregister object:page from search
    elgg_unregister_entity_type("object", "page_top");
    // views
    elgg_extend_view("css/elgg", "css/search_advanced/site");
    elgg_extend_view("js/elgg", "js/search_advanced/site");
    // widgets
    elgg_register_widget_type("search", elgg_echo("search"), elgg_echo("search"), array("profile", "dashboard", "index", "groups"), true);
    elgg_register_widget_type("search_user", elgg_echo("search_advanced:widgets:search_user:title"), elgg_echo("search_advanced:widgets:search_user:description"), array("dashboard", "index"));
    if (elgg_is_active_plugin("categories")) {
        // make universal categories searchable
        add_translation(get_current_language(), array("tag_names:universal_categories" => elgg_echo("categories")));
        elgg_register_tag_metadata_name("universal_categories");
    }
    // hooks and events to clear cache
    // register hooks
    elgg_register_plugin_hook_handler("action", "admin/plugins/activate", "search_advanced_clear_keywords_cache");
    elgg_register_plugin_hook_handler("action", "admin/plugins/deactivate", "search_advanced_clear_keywords_cache");
    elgg_register_plugin_hook_handler("action", "admin/plugins/activate_all", "search_advanced_clear_keywords_cache");
    elgg_register_plugin_hook_handler("action", "admin/plugins/deactivate_all", "search_advanced_clear_keywords_cache");
    elgg_register_plugin_hook_handler("action", "plugins/settings/save", "search_advanced_clear_keywords_cache");
    elgg_register_plugin_hook_handler("register", "menu:search_type_selection", "search_advanced_register_menu_type_selection");
    // register events
    elgg_register_event_handler("upgrade", "system", "search_advanced_clear_keywords_cache");
    // actions
    elgg_register_action("search_advanced/settings/save", dirname(__FILE__) . "/actions/plugins/settings/save.php", "admin");
}
开发者ID:pleio,项目名称:search_advanced,代码行数:39,代码来源:start.php


示例5: profile_manager_profile_override

/**
 * Hook to replace the profile fields
 * 
 * @param $hook_name
 * @param $entity_type
 * @param $return_value
 * @param $parameters
 * @return unknown_type
 */
function profile_manager_profile_override($hook_name, $entity_type, $return_value, $parameters)
{
    global $CONFIG;
    // Get all the custom profile fields
    $options = array("type" => "object", "subtype" => CUSTOM_PROFILE_FIELDS_PROFILE_SUBTYPE, "limit" => false, "owner_guid" => $CONFIG->site_guid);
    if ($entities = elgg_get_entities($options)) {
        $result = array();
        $translations = array();
        $context = elgg_get_context();
        // Make new result
        foreach ($entities as $entity) {
            if ($entity->admin_only != "yes" || elgg_is_admin_logged_in()) {
                $result[$entity->metadata_name] = $entity->metadata_type;
                // should it be handled as tags? TODO: is this still needed? Yes it is, it handles presentation of these fields in listing mode
                if ($context == "search" && ($entity->output_as_tags == "yes" || $entity->metadata_type == "multiselect")) {
                    $result[$entity->metadata_name] = "tags";
                }
            }
            $translations["profile:" . $entity->metadata_name] = $entity->getTitle();
        }
        add_translation(get_current_language(), $translations);
        if (count($result) > 0) {
            $result["custom_profile_type"] = "non_editable";
        }
    }
    return $result;
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:36,代码来源:hooks.php


示例6: content_subscriptions_prepare_comment_notification

/**
 * Change the default notification message for comments
 *
 * @param string                          $hook         the name of the hook
 * @param stirng                          $type         the type of the hook
 * @param Elgg_Notifications_Notification $return_value the current return value
 * @param array                           $params       supplied values
 *
 * @return Elgg_Notifications_Notification
 */
function content_subscriptions_prepare_comment_notification($hook, $type, $return_value, $params)
{
    if (empty($return_value) || !$return_value instanceof \Elgg\Notifications\Notification) {
        return $return_value;
    }
    if (empty($params) || !is_array($params)) {
        return $return_value;
    }
    $event = elgg_extract("event", $params);
    if (empty($event) || !$event instanceof \Elgg\Notifications\Event) {
        return $return_value;
    }
    // ignore access for now
    $ia = elgg_set_ignore_access(true);
    $comment = $event->getObject();
    $actor = $event->getActor();
    $object = $comment->getContainerEntity();
    $language = elgg_extract("language", $params, get_current_language());
    $recipient = elgg_extract("recipient", $params);
    $return_value->subject = elgg_echo("content_subscriptions:create:comment:subject", array($object->title), $language);
    $return_value->body = elgg_echo("content_subscriptions:create:comment:message", array($recipient->name, $actor->name, $object->title, $comment->description, $object->getURL()), $language);
    $return_value->summary = elgg_echo("content_subscriptions:create:comment:summary", array($object->title), $language);
    // restore access
    elgg_set_ignore_access($ia);
    return $return_value;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:36,代码来源:hooks.php


示例7: prototyper_group_get_prototype_fields

/**
 * Returns prototyped fields
 *
 * @param string $hook   "prototype"
 * @param string $type   "groups/edit"
 * @param array  $return Fields
 * @param array  $params Hook params
 * @return array
 */
function prototyper_group_get_prototype_fields($hook, $type, $return, $params)
{
    $entity = elgg_extract('entity', $params);
    $subtype = $entity->getSubtype() ?: 'default';
    $prototype = elgg_get_plugin_setting("prototype:{$subtype}", 'prototyper_group');
    if (!$prototype && $subtype != 'default') {
        $prototype = elgg_get_plugin_setting('prototype:default', 'prototyper_group');
    }
    if ($prototype) {
        $prototype_fields = unserialize($prototype);
        $return = array_merge($return, $prototype_fields);
    } else {
        $fields = elgg_get_config('group');
        $return['icon'] = ['type' => 'icon', 'data_type' => 'file', 'label' => [get_current_language() => elgg_echo('groups:icon')], 'help' => false];
        $return['description'] = ['type' => 'description', 'data_type' => 'attribute', 'label' => [get_current_language() => elgg_echo('groups:description')], 'help' => false];
        foreach ($fields as $shortname => $input_type) {
            $return[$shortname] = ['type' => $input_type, 'data_type' => 'metadata', 'label' => [get_current_language() => elgg_echo("groups:{$shortname}")], 'help' => false];
        }
    }
    // Not adding these above, as we want them to persist, even if they are deleted from the UI
    $return['name'] = ['type' => 'name', 'data_type' => 'attribute', 'class_name' => \hypeJunction\Prototyper\Groups\NameField::class, 'label' => [get_current_language() => elgg_echo('groups:name')], 'help' => false, 'priority' => 1];
    $return['membership'] = ['type' => 'membership', 'data_type' => 'metadata', 'id' => 'groups-membership', 'input_view' => 'input/groups/membership', 'output_view' => false, 'class_name' => hypeJunction\Prototyper\Groups\MembershipField::class, 'label' => [get_current_language() => elgg_echo("groups:membership")], 'help' => false, 'priority' => 900];
    // treating this as metadata so that it gets handled after the entity has been saved once and group_acl has been created
    $return['vis'] = ['type' => 'access', 'data_type' => 'metadata', 'id' => 'groups-vis', 'input_view' => 'input/groups/visibility', 'output_view' => false, 'class_name' => hypeJunction\Prototyper\Groups\VisibilityField::class, 'label' => [get_current_language() => elgg_echo("groups:visibility")], 'help' => false, 'priority' => 900];
    $return['content_access_mode'] = ['type' => 'content_access_mode', 'data_type' => 'metadata', 'id' => 'groups-content-access-mode', 'input_view' => 'input/groups/content_access_mode', 'output_view' => false, 'class_name' => hypeJunction\Prototyper\Groups\ContentAccessModeField::class, 'label' => [get_current_language() => elgg_echo("groups:content_access_mode")], 'help' => false, 'priority' => 900];
    $return['owner_guid'] = ['type' => 'select', 'data_type' => 'attribute', 'input_view' => 'input/groups/owner', 'output_view' => false, 'class_name' => hypeJunction\Prototyper\Groups\OwnerField::class, 'label' => [get_current_language() => elgg_echo("groups:owner")], 'help' => false, 'priority' => 900];
    $return['tools'] = ['type' => 'checkboxes', 'data_type' => 'metadata', 'input_view' => 'input/groups/tools', 'output_view' => false, 'class_name' => hypeJunction\Prototyper\Groups\ToolsField::class, 'label' => false, 'help' => false, 'priority' => 900];
    return $return;
}
开发者ID:hypeJunction,项目名称:Elgg-prototyper_group,代码行数:38,代码来源:start.php


示例8: extended_tinymce_get_user_language

function extended_tinymce_get_user_language()
{
    $user_language = get_current_language();
    $path = elgg_get_plugins_path() . "extended_tinymce/vendor/tinymce/js/tinymce/langs";
    if (!file_exists("{$path}/{$user_language}.js")) {
        return extended_tinymce_get_site_language();
    }
    return $user_language;
}
开发者ID:epsylon,项目名称:Hydra-dev,代码行数:9,代码来源:start.php


示例9: recaptcha_init

function recaptcha_init()
{
    if (!is_recaptcha_enabled()) {
        return;
    }
    elgg_register_js('recaptcha', 'https://www.google.com/recaptcha/api.js?hl=' . get_current_language());
    elgg_register_plugin_hook_handler('actionlist', 'captcha', 'image_captcha_actionlist_hook');
    $actions = array('register', 'user/requestnewpassword');
    foreach ($actions as $action) {
        elgg_register_plugin_hook_handler('action', $action, 'recaptcha_action_hook');
    }
}
开发者ID:pleio,项目名称:recaptcha,代码行数:12,代码来源:start.php


示例10: init

/**
 * Initialize the plugin
 * @return void
 */
function init()
{
    // Register actions
    $actions_path = dirname(__FILE__) . "/actions/db_explorer/";
    elgg_register_action('db_explorer/entities', $actions_path . 'entities.php', 'admin');
    elgg_register_action('db_explorer/users_entity', $actions_path . 'users_entity.php', 'admin');
    elgg_register_action('db_explorer/objects_entity', $actions_path . 'objects_entity.php', 'admin');
    elgg_register_action('db_explorer/groups_entity', $actions_path . 'groups_entity.php', 'admin');
    elgg_register_action('db_explorer/sites_entity', $actions_path . 'sites_entity.php', 'admin');
    elgg_register_action('db_explorer/owned_entities', $actions_path . 'owned_entities.php', 'admin');
    elgg_register_action('db_explorer/contained_entities', $actions_path . 'contained_entities.php', 'admin');
    elgg_register_action('db_explorer/river_items', $actions_path . 'river_items.php', 'admin');
    elgg_register_action('db_explorer/metadata', $actions_path . 'metadata.php', 'admin');
    elgg_register_action('db_explorer/metadata_ownership', $actions_path . 'metadata_ownership.php', 'admin');
    elgg_register_action('db_explorer/annotations', $actions_path . 'annotations.php', 'admin');
    elgg_register_action('db_explorer/annotations_ownership', $actions_path . 'annotations_ownership.php', 'admin');
    elgg_register_action('db_explorer/private_settings', $actions_path . 'private_settings.php', 'admin');
    elgg_register_action('db_explorer/access_collections_ownership', $actions_path . 'access_collections_ownership.php', 'admin');
    elgg_register_action('db_explorer/access_collections_membership', $actions_path . 'access_collections_membership.php', 'admin');
    elgg_register_action('db_explorer/entity_relationships', $actions_path . 'entity_relationships.php', 'admin');
    elgg_register_action('db_explorer/batch', $actions_path . 'batch.php');
    elgg_register_action('db_explorer/user/validate', $actions_path . 'user/validate.php');
    elgg_register_action('db_explorer/user/ban', $actions_path . 'user/ban.php');
    elgg_register_action('db_explorer/user/unban', $actions_path . 'user/unban.php');
    elgg_register_action('db_explorer/user/enable', $actions_path . 'user/enable.php');
    elgg_register_action('db_explorer/user/disable', $actions_path . 'user/disable.php');
    elgg_register_action('db_explorer/user/delete', $actions_path . 'user/delete.php');
    elgg_register_action('db_explorer/content/enable', $actions_path . 'content/enable.php');
    elgg_register_action('db_explorer/content/disable', $actions_path . 'content/disable.php');
    elgg_register_action('db_explorer/content/delete', $actions_path . 'content/delete.php');
    // Register javascripts
    elgg_define_js('jqgrid', array('src' => '/mod/hypeDBExplorer/vendors/jqgrid/js/minified/jquery.jqGrid.min.js', 'deps' => array('jquery', 'jqgrid.locale')));
    $locale = get_current_language();
    elgg_define_js('jqgrid.locale', array('src' => "/mod/hypeDBExplorer/vendors/jqgrid/js/i18n/grid.locale-{$locale}.js", 'deps' => array('jquery')));
    // Register stylesheets
    //elgg_register_css('jquery.jqgrid', '/mod/hypeDBExplorer/vendor/jqgrid/css/ui.jqgrid.css');
    elgg_register_css('db_explorer.jquery-ui', '/mod/hypeDBExplorer/vendors/jquery-ui/themes/smoothness/jquery-ui.min.css');
    elgg_register_css('db_explorer.stylesheet', elgg_get_simplecache_url('css', 'framework/db_explorer/stylesheet.css'));
    if (elgg_is_admin_logged_in()) {
        if (elgg_get_config('debug')) {
            // Register menu items to quickly navigate to the DB explorer for the given user/entity
            elgg_register_plugin_hook_handler('register', 'menu:user_hover', __NAMESPACE__ . '\\user_hover_menu_setup');
            elgg_register_plugin_hook_handler('register', 'menu:entity', __NAMESPACE__ . '\\entity_menu_setup');
        }
        // Register ajax views
        elgg_register_ajax_view('admin/developers/db_explorer');
        // Add an admin menu item
        elgg_register_menu_item('page', array('name' => 'db_explorer', 'href' => 'admin/developers/db_explorer', 'text' => elgg_echo('admin:developers:db_explorer'), 'context' => 'admin', 'section' => 'develop'));
    }
}
开发者ID:hypejunction,项目名称:hypedbexplorer,代码行数:54,代码来源:start.php


示例11: widget_manager_extra_contexts_page_handler

/**
 * Handles the extra contexts page
 *
 * @param array  $page    page elements
 * @param string $handler handler of the current page
 * 
 * @return boolean
 */
function widget_manager_extra_contexts_page_handler($page, $handler)
{
    $result = false;
    $extra_contexts = elgg_get_plugin_setting("extra_contexts", "widget_manager");
    if (widget_manager_is_extra_context($handler)) {
        $result = true;
        // make nice lightbox popup title
        add_translation(get_current_language(), array("widget_manager:widgets:lightbox:title:" . strtolower($handler) => $handler));
        // backwards compatibility
        set_input("handler", $handler);
        include dirname(dirname(__FILE__)) . "/pages/extra_contexts.php";
    }
    return $result;
}
开发者ID:n8b,项目名称:VMN,代码行数:22,代码来源:page_handlers.php


示例12: zhgroups_fields_setup

function zhgroups_fields_setup()
{
    $profile_defaults = array('description' => 'longtext', 'interests' => 'tags', 'country' => 'dropdown', 'state' => 'dropdown', 'city' => 'text');
    $profile_defaults = elgg_trigger_plugin_hook('profile:fields', 'group', NULL, $profile_defaults);
    elgg_set_config('group', $profile_defaults);
    // register any tag metadata names
    foreach ($profile_defaults as $name => $type) {
        if ($type == 'tags') {
            elgg_register_tag_metadata_name($name);
            // only shows up in search but why not just set this in en.php as doing it here
            // means you cannot override it in a plugin
            add_translation(get_current_language(), array("tag_names:{$name}" => elgg_echo("groups:{$name}")));
        }
    }
}
开发者ID:pingwangcs,项目名称:51zhaohu,代码行数:15,代码来源:start.php


示例13: format_friendlytime

/**
 * Format the friendly time
 * 
 * @param type $hook
 * @param type $type
 * @param type $return
 * @param type $params
 * @return type
 */
function format_friendlytime($hook, $type, $return, $params)
{
    $language = get_current_language();
    // get our language dependent settings
    $format1 = elgg_get_plugin_setting('format1' . $language, PLUGIN_ID);
    $format1override = elgg_get_plugin_setting('format1override' . $language, PLUGIN_ID);
    $format2 = elgg_get_plugin_setting('format2' . $language, PLUGIN_ID);
    $format2override = elgg_get_plugin_setting('format2override' . $language, PLUGIN_ID);
    $breaktime = (int) elgg_get_plugin_setting('breaktime' . $language, PLUGIN_ID);
    $offset = (int) elgg_get_plugin_setting('offset' . $language, PLUGIN_ID);
    // use regular time for elgg default, modtime otherwise
    $time = $params['time'];
    $modtime = $time + 60 * 60 * $offset;
    $format = 1;
    if (!empty($breaktime) && $params['time'] < time() - 60 * 60 * $breaktime) {
        $format = 2;
    }
    if ($format == 1) {
        if (empty($format1override)) {
            $check = $format1;
        } else {
            return translate_friendlytime($format1override, $modtime);
        }
    }
    if ($format == 2) {
        if (empty($format2override)) {
            $check = $format2;
        } else {
            return translate_friendlytime($format2override, $modtime);
        }
    }
    // nothing set, keep as elgg default
    if (empty($check)) {
        $check = 1;
    }
    switch ($check) {
        case 1:
            // default, leave $return alone
            break;
        case 2:
            $return = elgg_echo('flexible_friendlytime:format:1', array(translate_friendlytime('M j, Y', $modtime), translate_friendlytime('g:ia', $modtime)));
            break;
        default:
            $return = translate_friendlytime($check, $modtime);
            break;
    }
    return $return;
}
开发者ID:beck24,项目名称:flexible_friendlytime,代码行数:57,代码来源:start.php


示例14: set_new_notification_message

/**
 * When an (admin) user is updating any customized email message,
 * this function is doing the work
 * 
 * @param $message_key: The key for the language file (e.g. email:validate:body )
 * @param $message_value: The new value for that key
 * @param $plugin_name: The plugin name of which we are updating the language file
 */
function set_new_notification_message($message_key, $message_value, $plugin_name)
{
    //If the $message_key is invalid, nothing to do
    if ($message_key === null || $message_key == "") {
        error_log("dreamfish_admin::start.php::set_new_notification_message: message_key invalid!");
        return false;
    }
    //Not going to update an entry with an invalid message
    if ($message_value === null || $message_value == "") {
        error_log("dreamfish_admin::start.php::set_new_notification_message: message_value invalid!");
        return false;
    }
    // Load configuration
    global $CONFIG;
    //get the current language, exchanging values in language file dependent on language
    $language = get_current_language();
    //construct the path to the language file
    //if there is a plugin name prepend /mod/<plugin-name>/ to the language file name
    $root = $CONFIG->path;
    if ($plugin_name !== null) {
        $root = $CONFIG->pluginspath . $plugin_name . "/";
    }
    $language_file = $root . "languages/" . $language . ".php";
    if (!file_exists($language_file)) {
        error_log(elgg_echo('dreamfish_admin:file_not_saved'));
        error_log(elgg_echo('dreamfish_admin:lang_not_found'));
        register_error(elgg_echo('dreamfish_admin:file_not_saved'));
        register_error(elgg_echo('dreamfish_admin:lang_not_found'));
        forward($_SERVER['HTTP_REFERER']);
        return false;
    }
    //read the file into a string
    $content = file_get_contents($language_file, FILE_TEXT);
    //the message value shall not contain undesired characters
    $message_value = df_sanitize_string($message_value);
    //we exchange the values through a regular expression
    $pattern = "/" . $message_key . "(.*?)(\"|'),/s";
    $replacement = $message_key . "' => \"" . $message_value . "\",";
    //error_log("pattern: " .$pattern . " replacement: " . $replacement);
    //apply the regex
    $new_file = preg_replace($pattern, $replacement, $content);
    //write new language file
    file_put_contents($language_file, $new_file);
    return true;
}
开发者ID:eokyere,项目名称:elgg,代码行数:53,代码来源:start.php


示例15: init

function init()
{
    /**
     * Pages and URLs
     */
    elgg_register_page_handler(PAGEHANDLER, __NAMESPACE__ . '\\page_handler');
    /**
     * Actions
     */
    elgg_register_action(PLUGIN_ID . '/settings/save', __DIR__ . '/actions/settings/maps.php', 'admin');
    elgg_register_action('maps/geopositioning/update', __DIR__ . '/actions/geopositioning/update.php', 'public');
    /**
     * JS and CSS
     */
    $libs = array_filter(elgg_get_config('google_maps_libraries'));
    $gmaps_lib = elgg_http_add_url_query_elements('//maps.googleapis.com/maps/api/js', array('key' => elgg_get_plugin_setting('google_api_key', PLUGIN_ID), 'libraries' => implode(',', $libs), 'language' => get_current_language(), 'output' => 'svembed'));
    elgg_register_js('google.maps', $gmaps_lib);
    elgg_register_simplecache_view('css/framework/maps/stylesheet');
    elgg_register_css('maps', elgg_get_simplecache_url('css', 'framework/maps/stylesheet'));
    $plugin_root = __DIR__;
    if (file_exists("{$plugin_root}/vendor/autoload.php")) {
        $path = '/mod/' . PLUGIN_ID;
    } else {
        $path = '';
    }
    elgg_register_js('jquery.sticky-kit', $path . '/vendor/bower-asset/sticky-kit/jquery.sticky-kit.min.js', 'footer', 500);
    elgg_register_simplecache_view('js/framework/maps/mapbox');
    elgg_register_js('maps.mapbox', elgg_get_simplecache_url('js', 'framework/maps/mapbox'), 'footer', 550);
    // Add User Location to config
    elgg_extend_view('js/initialize_elgg', 'js/framework/maps/config');
    /**
     * Hooks
     */
    elgg_register_plugin_hook_handler('search:site', 'maps', __NAMESPACE__ . '\\setup_site_search_maps');
    // Replace a list with a map when ?list_type=mapbox
    elgg_register_plugin_hook_handler('view', 'page/components/list', __NAMESPACE__ . '\\list_type_map_view');
    elgg_register_plugin_hook_handler('view', 'page/components/gallery', __NAMESPACE__ . '\\list_type_map_view');
    // Filter out views when loading map items via ajax
    elgg_register_plugin_hook_handler('view', 'all', __NAMESPACE__ . '\\ajax_list_view');
    // Map Markers
    elgg_register_plugin_hook_handler('entity:icon:url', 'user', __NAMESPACE__ . '\\get_marker_url', 600);
    elgg_register_plugin_hook_handler('entity:icon:url', 'object', __NAMESPACE__ . '\\get_marker_url', 600);
    elgg_register_widget_type('staticmap', elgg_echo('maps:widget:staticmap'), elgg_echo('maps:widget:staticmap:desc'), array('all'), true);
}
开发者ID:hypejunction,项目名称:hypemaps,代码行数:44,代码来源:start.php


示例16: calculate_price

 public function calculate_price()
 {
     $paypals = $this->fee_price_model->fetch_all_paypal_cost();
     $pay_options = object_to_key_value_array($paypals, 'formula', 'name');
     $eshop_code_object = $this->fee_price_model->fetch_all_eshop_code();
     $eshop_codes = object_to_key_value_array($eshop_code_object, 'code', 'name');
     $sale_mode_object = $this->fee_price_model->fetch_all_sale_mode();
     $sale_modes = object_to_key_value_array($sale_mode_object, 'mode', 'name');
     $shipping_code_object = $this->shipping_code_model->fetch_all_shipping_codes();
     $shipping_types = array();
     $field = get_current_language() == 'english' ? 'name_en' : 'name_cn';
     foreach ($shipping_code_object as $item) {
         $shipping_types[$item->code] = $item->{$field};
     }
     $data = array('pay_options' => $pay_options, 'eshop_codes' => $eshop_codes, 'sale_modes' => $sale_modes, 'shipping_types' => $shipping_types);
     $this->template->write_view('content', 'sale/price/calculate_price', $data);
     $this->template->add_js('static/js/ajax/sale.js');
     $this->template->render();
 }
开发者ID:ohjack,项目名称:mallerp_standard,代码行数:19,代码来源:price.php


示例17: translationEditor

 /**
  * The page handler for the nice url's of this plugin
  *
  * @param array $segments the url elements
  *
  * @return bool
  */
 public static function translationEditor($segments)
 {
     $page = array_shift($segments);
     switch ($page) {
         case 'search':
             echo elgg_view_resource('translation_editor/search');
             return true;
         default:
             if (empty($page)) {
                 $language = get_current_language();
                 $plugin_id = null;
             } else {
                 $language = $page;
                 $plugin_id = array_shift($segments);
                 set_input('current_language', $language);
                 set_input('plugin', $plugin_id);
             }
             echo elgg_view_resource('translation_editor/index', ['current_language' => $language, 'plugin_id' => $plugin_id]);
             return true;
     }
 }
开发者ID:coldtrick,项目名称:translation_editor,代码行数:28,代码来源:PageHandler.php


示例18: cur_lang

function cur_lang($arr, $key)
{
    if (!is_array($arr)) {
        return '';
    }
    $current_language = get_current_language();
    if (isset($arr[$key . '_' . $current_language]) && $arr[$key . '_' . $current_language] != '') {
        return $arr[$key . '_' . $current_language];
    }
    $ci = get_instance();
    $master_language = $ci->config->item('default_language');
    if (isset($arr[$key . '_' . $master_language]) && $arr[$key . '_' . $master_language] != '') {
        return $arr[$key . '_' . $master_language];
    }
    $languages = $ci->config->item('languages');
    foreach ($languages as $language) {
        if (isset($arr[$key . '_' . $language]) && $arr[$key . '_' . $language] != '') {
            return $arr[$key . '_' . $language];
        }
    }
    return '';
}
开发者ID:bantyroy,项目名称:acs_dev_prj,代码行数:22,代码来源:my_language_helper.php


示例19: ws_pack_get_lang_file

function ws_pack_get_lang_file()
{
    $result = false;
    $user = elgg_get_logged_in_user_entity();
    $api_application = ws_pack_get_current_api_application();
    if (!empty($user) && !empty($api_application)) {
        $translations = [];
        //kinds of translations
        $fields = ['members', 'search', 'groups', 'friends', 'notifications', 'messages', 'messageboard', 'likes', 'invitefriends', 'discussion', 'profile', 'user', 'usersettings', 'date', 'email'];
        global $_ELGG;
        $elgg_translations = $_ELGG->translations['en'];
        $user_lang = get_current_language();
        if ($user_lang !== 'en') {
            if (array_key_exists($user_lang, $_ELGG->translations)) {
                $elgg_translations = array_merge($elgg_translations, $_ELGG->translations[$user_lang]);
            }
        }
        //load and iterate the language cached by the site
        foreach ($elgg_translations as $k => $v) {
            if (strpos($k, ':')) {
                $parts = explode(':', $k);
                $new_key = $parts[1];
                foreach ($fields as $field) {
                    if ($parts[0] == $field) {
                        $translations[$field][$new_key] = $v;
                    }
                }
            } else {
                $translations['general'][$k] = $v;
            }
        }
        $translations = json_encode($translations);
        $result = new SuccessResult($translations);
    }
    if ($result === false) {
        $result = new ErrorResult(elgg_echo('ws_pack:error:notfound'));
    }
    return $result;
}
开发者ID:coldtrick,项目名称:ws_pack,代码行数:39,代码来源:languages.php


示例20: prototyper_profile_get_prototype_fields

/**
 * Returns prototyped fields
 *
 * @param string $hook   "prototype"
 * @param string $type   "profile/edit"
 * @param array  $return Fields
 * @param array  $params Hook params
 * @return array
 */
function prototyper_profile_get_prototype_fields($hook, $type, $return, $params)
{
    $entity = elgg_extract('entity', $params);
    $role = false;
    if (elgg_is_active_plugin('roles')) {
        $role = roles_get_role($entity);
    }
    $role_name = $role ? $role->name : 'default';
    $prototype = elgg_get_plugin_setting("prototype:{$role_name}", 'prototyper_profile');
    if (!$prototype && $role_name != 'default') {
        $prototype = elgg_get_plugin_setting('prototype:default', 'prototyper_profile');
    }
    if ($prototype) {
        $prototype_fields = unserialize($prototype);
        $return = array_merge($return, $prototype_fields);
    } else {
        $fields = elgg_get_config('profile_fields');
        $return['name'] = ['type' => 'name', 'data_type' => 'attribute', 'label' => [get_current_language() => elgg_echo('user:name:label')], 'help' => false, 'validation_rules' => ['maxlength' => 50]];
        foreach ($fields as $shortname => $input_type) {
            $return[$shortname] = ['type' => $input_type, 'data_type' => 'metadata', 'label' => [get_current_language() => elgg_echo("profile:{$shortname}")], 'help' => false];
        }
    }
    return $return;
}
开发者ID:hypeJunction,项目名称:Elgg-prototyper_profile,代码行数:33,代码来源:start.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP get_current_nodeid函数代码示例发布时间:2022-05-15
下一篇:
PHP get_current_lang函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap