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


PHP string_to_tag_array函数代码示例

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


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

示例1: group_tools_join_site_handler

function group_tools_join_site_handler($event, $type, $relationship)
{
    if (!empty($relationship) && $relationship instanceof ElggRelationship) {
        $user_guid = $relationship->guid_one;
        $site_guid = $relationship->guid_two;
        if ($user = get_user($user_guid)) {
            // ignore access
            $ia = elgg_set_ignore_access(true);
            // add user to the auto join groups
            if ($auto_joins = elgg_get_plugin_setting("auto_join", "group_tools")) {
                $auto_joins = string_to_tag_array($auto_joins);
                foreach ($auto_joins as $group_guid) {
                    if (($group = get_entity($group_guid)) && $group instanceof ElggGroup) {
                        if ($group->site_guid == $site_guid) {
                            // join the group
                            $group->join($user);
                        }
                    }
                }
            }
            // auto detect email invited groups
            if ($groups = group_tools_get_invited_groups_by_email($user->email, $site_guid)) {
                foreach ($groups as $group) {
                    // join the group
                    $group->join($user);
                }
            }
            // restore access settings
            elgg_set_ignore_access($ia);
        }
    }
}
开发者ID:socialweb,项目名称:PiGo,代码行数:32,代码来源:events.php

示例2: language_selector_get_allowed_translations

function language_selector_get_allowed_translations()
{
    $configured_allowed = elgg_get_plugin_setting("allowed_languages", "language_selector");
    if (empty($configured_allowed)) {
        $allowed = array("en");
        $installed_languages = get_installed_translations();
        $min_completeness = (int) elgg_get_plugin_setting("min_completeness", "language_selector");
        if ($min_completeness > 0) {
            $update_completeness = false;
            if (elgg_is_active_plugin("translation_editor")) {
                if (elgg_is_admin_logged_in()) {
                    $update_completeness = true;
                }
                $completeness_function = "translation_editor_get_language_completeness";
            } else {
                $completeness_function = "get_language_completeness";
            }
            foreach ($installed_languages as $lang_id => $lang_description) {
                if ($lang_id != "en") {
                    if (($completeness = $completeness_function($lang_id)) >= $min_completeness) {
                        $allowed[] = $lang_id;
                    }
                }
            }
        }
        elgg_set_plugin_setting("allowed_languages", implode(",", $allowed), "language_selector");
    } else {
        $allowed = string_to_tag_array($configured_allowed);
    }
    return $allowed;
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:31,代码来源:functions.php

示例3: user_save_profile

/**
 * Web service to update profile information
 *
 * @param string $username username to update profile information
 *
 * @param $profile
 * @return bool
 * @throws InvalidParameterException
 */
function user_save_profile($username, $profile)
{
    if (!$username) {
        $user = elgg_get_logged_in_user_entity();
    } else {
        $user = get_user_by_username($username);
    }
    if (!$user) {
        throw new InvalidParameterException('registration:usernamenotvalid');
    }
    $owner = get_entity($user->guid);
    $profile_fields = elgg_get_config('profile_fields');
    foreach ($profile_fields as $shortname => $valuetype) {
        $value = $profile[$shortname];
        $value = html_entity_decode($value, ENT_COMPAT, 'UTF-8');
        if ($valuetype != 'longtext' && elgg_strlen($value) > 250) {
            $error = elgg_echo('profile:field_too_long', array(elgg_echo("profile:{$shortname}")));
            return $error;
        }
        if ($valuetype == 'tags') {
            $value = string_to_tag_array($value);
        }
        $input[$shortname] = $value;
    }
    $name = strip_tags($profile['name']);
    if ($name) {
        if (elgg_strlen($name) > 50) {
            return elgg_echo('user:name:fail');
        } elseif ($owner->name != $name) {
            $owner->name = $name;
            return $owner->save();
        }
    }
    if (sizeof($input) > 0) {
        foreach ($input as $shortname => $value) {
            $options = array('guid' => $owner->guid, 'metadata_name' => $shortname);
            elgg_delete_metadata($options);
            if (isset($accesslevel[$shortname])) {
                $access_id = (int) $accesslevel[$shortname];
            } else {
                // this should never be executed since the access level should always be set
                $access_id = ACCESS_DEFAULT;
            }
            if (is_array($value)) {
                $i = 0;
                foreach ($value as $interval) {
                    $i++;
                    $multiple = $i > 1 ? TRUE : FALSE;
                    create_metadata($owner->guid, $shortname, $interval, 'text', $owner->guid, $access_id, $multiple);
                }
            } else {
                create_metadata($owner->guid, $shortname, $value, 'text', $owner->guid, $access_id);
            }
        }
    }
    return "Success";
}
开发者ID:manlui,项目名称:elgg_with_rest_api,代码行数:66,代码来源:user.php

示例4: getOptions

 public function getOptions()
 {
     $field_options = array();
     if (!empty($this->fieldoptions)) {
         $field_options = string_to_tag_array($this->fieldoptions);
         $field_options = array_combine(array_values($field_options), $field_options);
         // input radio and checkbox require non-numeric keys
     }
     return $field_options;
 }
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:10,代码来源:EventRegistrationQuestion.php

示例5: test_panel_get_group_guids

/**
 * Get the configured group guids
 *
 * @return array
 */
function test_panel_get_group_guids()
{
    static $result;
    if (!isset($result)) {
        $result = [];
        $setting = elgg_get_plugin_setting('group_guids', 'test_panel');
        if (!empty($setting)) {
            $result = string_to_tag_array($setting);
        }
    }
    return $result;
}
开发者ID:coldtrick,项目名称:test_panel,代码行数:17,代码来源:functions.php

示例6: white_list_admin

function white_list_admin($hook, $type, $value, $params)
{
    $pluginId = get_input('plugin_id');
    if ($pluginId != 'white_list') {
        return $value;
    }
    $company_emails = get_input('company_email');
    $company_emails = string_to_tag_array($company_emails);
    $site = elgg_get_site_entity();
    $site->company_emails = $company_emails;
    system_message(elgg_echo("filters:save:success"));
    forward(REFERER);
}
开发者ID:elainenaomi,项目名称:labxp2014,代码行数:13,代码来源:start.php

示例7: addExtraContextsAsAvailableWidgetsContext

 /**
  * Register new widget contexts for use on custom widget pages
  *
  * @param string $hook_name    name of the hook
  * @param string $entity_type  type of the hook
  * @param string $return_value current return value
  * @param array  $params       hook parameters
  *
  * @return string
  */
 public static function addExtraContextsAsAvailableWidgetsContext($hook_name, $entity_type, $return_value, $params)
 {
     if (empty($return_value)) {
         return;
     }
     $setting = strtolower(elgg_get_plugin_setting('extra_contexts', 'widget_manager'));
     if (empty($setting)) {
         return;
     }
     $contexts = string_to_tag_array($setting);
     if ($contexts && in_array($return_value, $contexts)) {
         return 'index';
     }
 }
开发者ID:coldtrick,项目名称:widget_manager,代码行数:24,代码来源:Context.php

示例8: categories_save_site_categories

/**
 * Saves the site categories.
 *
 * @param type $hook
 * @param type $type
 * @param type $value
 * @param type $params
 */
function categories_save_site_categories($hook, $type, $value, $params)
{
    $plugin_id = get_input('plugin_id');
    if ($plugin_id != 'categories') {
        return $value;
    }
    $categories = get_input('categories');
    $categories = string_to_tag_array($categories);
    $site = elgg_get_site_entity();
    $site->categories = $categories;
    system_message(elgg_echo("categories:save:success"));
    elgg_delete_admin_notice('categories_admin_notice_no_categories');
    forward(REFERER);
}
开发者ID:ibou77,项目名称:elgg,代码行数:22,代码来源:start.php

示例9: menus_entity_setup

/**
 * Reorganize entity menu
 *
 * @param string         $hook   "register"
 * @param string         $type   "menu:entity"
 * @param ElggMenuItem[] $return Menu
 * @param array          $params Hook params
 * @return ElggMenuItem[]
 */
function menus_entity_setup($hook, $type, $return, $params)
{
    $setting_primary = elgg_get_plugin_setting('primary_actions', 'menus_entity', '');
    $primary_actions = (array) string_to_tag_array($setting_primary);
    $setting_remove = elgg_get_plugin_setting('remove_actions', 'menus_entity', '');
    $remove_actions = (array) string_to_tag_array($setting_remove);
    $ellipsis = false;
    foreach ($return as &$item) {
        if (!$item instanceof ElggMenuItem) {
            continue;
        }
        if (in_array($item->getName(), $remove_actions)) {
            $item = null;
            continue;
        }
        if (in_array($item->getName(), $primary_actions) || !$item->getHref()) {
            continue;
        }
        $ellipsis = true;
        $item->setParentName('ellipsis');
        // combine all menus into one section
        // subsection data is used by menus_api, if enabled
        $item->setData('subsection', $item->getSection());
        $item->setSection('default');
        switch ($item->getName()) {
            case 'edit':
                $item->setText(elgg_echo('edit'));
                $item->setData('icon', 'pencil');
                $item->setData('subsection', 'admin');
                break;
            case 'delete':
                $item->setText(elgg_echo('delete'));
                $item->setData('icon', 'remove');
                $item->setData('subsection', 'admin');
                break;
        }
    }
    if ($ellipsis) {
        $icon = elgg_get_plugin_setting('icon', 'menus_entity');
        if (!$icon) {
            $icon = 'ellipsis-v';
        }
        $return[] = ElggMenuItem::factory(array('name' => 'ellipsis', 'href' => '#', 'text' => elgg_view_icon($icon), 'item_class' => 'elgg-menu-item-has-dropdown', 'data-my' => 'right top', 'data-at' => 'right bottom+5px', 'priority' => 9999, 'section' => 'default'));
    }
    return array_filter($return);
}
开发者ID:hypeJunction,项目名称:Elgg-menus_entity,代码行数:55,代码来源:start.php

示例10: follow_tags_save_follow_tags

/**
 * Save FollowTags
 *
 */
function follow_tags_save_follow_tags($input, $id, $notify)
{
    // Get FollowTagObject and Clear all Tag Relationships
    $user = elgg_get_logged_in_user_entity();
    $followTags = get_entity($id);
    $followTags->clearRelationships();
    $followTags->description = $input;
    $followTags->title = $user->name;
    $followTags->access_id = 1;
    $followTags->notify = $notify;
    // Convert the Taginput string to array and save to FollowTagObj
    $tagarray = string_to_tag_array($input);
    $followTags->tags = $tagarray;
    $saved = $followTags->save();
    if (!$saved) {
        return false;
    }
    return true;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:23,代码来源:functions.php

示例11: follow_tags_save_follow_tags

/**
 * Save FollowTags
 *
 */
function follow_tags_save_follow_tags($input, $id, $notify)
{
    // Get FollowTagObject and Delete all Tag Relationships
    $user = elgg_get_logged_in_user_entity();
    $access_id = get_default_access($user);
    $followTags = get_entity($id);
    if ($followTags->getSubtype() == 'FollowTags') {
        $followTags->deleteRelationships();
        $followTags->description = $input;
        $followTags->title = $user->name;
        $followTags->access_id = $access_id;
        // Convert the Taginput string to array and save to FollowTagObj
        $tagarray = string_to_tag_array($input);
        $followTags->tags = $tagarray;
        $saved = $followTags->save();
    }
    if (!$saved) {
        return false;
    }
    return true;
}
开发者ID:centillien,项目名称:follow_tags,代码行数:25,代码来源:functions.php

示例12: elgg_stars_init

function elgg_stars_init()
{
    // Register valid annotaiton names
    $criteria = elgg_get_plugin_setting('criteria', 'elgg_stars');
    if (!$criteria) {
        elgg_stars_register_rating_annotation_name('starrating');
    } else {
        $criteria = string_to_tag_array($criteria);
        foreach ($criteria as $criterion) {
            elgg_stars_register_rating_annotation_name($criterion);
        }
    }
    $root = dirname(__FILE__);
    // Register actions
    elgg_register_action('elgg_stars/settings/save', "{$root}/actions/settings/elgg_stars.php", 'admin');
    elgg_register_action('stars/rate', "{$root}/actions/stars/rate.php");
    elgg_register_action('stars/delete', "{$root}/actions/stars/delete.php");
    // Stars JS and CSS
    elgg_extend_view('css/elgg', 'stars/css');
    elgg_register_js('jquery.rateit', '/mod/elgg_stars/vendors/rateit/jquery.rateit.min.js', 'footer', 600);
    elgg_register_simplecache_view('js/stars/js');
    elgg_register_js('elgg.rateit', elgg_get_simplecache_url('js', 'stars/js'), 'footer', 700);
    // Setup menus
    elgg_register_plugin_hook_handler('register', 'menu:entity', 'elgg_stars_menu_setup');
    elgg_register_plugin_hook_handler('register', 'menu:annotation', 'elgg_stars_annotation_menu_setup');
    // Permissions
    elgg_register_plugin_hook_handler('permissions_check:annotate', 'all', 'elgg_stars_can_annotate');
    // Add an annotation view for registered ratings
    elgg_register_plugin_hook_handler('view', 'annotation/default', 'elgg_stars_annotation_view_replacement');
    // Extend the sidebar with the ratings module
    elgg_register_plugin_hook_handler('view', 'page/elements/comments', 'elgg_stars_comments_rating_addon', 900);
    elgg_register_plugin_hook_handler('comments', 'all', 'elgg_stars_comments_rating_addon', 900);
    // Get rating criteria that applies to an entity
    elgg_register_plugin_hook_handler('criteria', 'stars', 'elgg_stars_rating_criteria_hook');
    // Setup widgets
    elgg_register_widget_type('highestrating', elgg_echo('stars:widget:highestrating'), elgg_echo('stars:widget:highestrating:desc'), 'all', false);
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:37,代码来源:start.php

示例13: ElggObject

    $topic = new ElggObject();
    $topic->subtype = 'groupforumtopic';
} else {
    // load original file object
    $topic = get_entity($guid);
    if (!elgg_instanceof($topic, 'object', 'groupforumtopic') || !$topic->canEdit()) {
        register_error(elgg_echo('discussion:topic:notfound'));
        forward(REFERER);
    }
}
$topic->title = $title;
$topic->description = $desc;
$topic->status = $status;
$topic->access_id = $access_id;
$topic->container_guid = $container_guid;
$topic->tags = string_to_tag_array($tags);
$result = $topic->save();
if (!$result) {
    register_error(elgg_echo('discussion:error:notsaved'));
    forward(REFERER);
}
// topic saved so clear sticky form
elgg_clear_sticky_form('topic');
// handle results differently for new topics and topic edits
if ($new_topic) {
    system_message(elgg_echo('discussion:topic:created'));
    elgg_create_river_item(array('view' => 'river/object/groupforumtopic/create', 'action_type' => 'create', 'subject_guid' => elgg_get_logged_in_user_guid(), 'object_guid' => $topic->guid));
} else {
    system_message(elgg_echo('discussion:topic:updated'));
}
forward($topic->getURL());
开发者ID:ibou77,项目名称:elgg,代码行数:31,代码来源:save.php

示例14: profile_array_decoder

function profile_array_decoder(&$v)
{
    $v = _elgg_html_decode($v);
}
// Get group fields
$input = array();
foreach (elgg_get_config('group') as $shortname => $valuetype) {
    $input[$shortname] = get_input($shortname);
    // @todo treat profile fields as unescaped: don't filter, encode on output
    if (is_array($input[$shortname])) {
        array_walk_recursive($input[$shortname], 'profile_array_decoder');
    } else {
        $input[$shortname] = _elgg_html_decode($input[$shortname]);
    }
    if ($valuetype == 'tags') {
        $input[$shortname] = string_to_tag_array($input[$shortname]);
    }
}
$input['name'] = htmlspecialchars(get_input('name', '', false), ENT_QUOTES, 'UTF-8');
$user = elgg_get_logged_in_user_entity();
$group_guid = (int) get_input('group_guid');
$is_new_group = $group_guid == 0;
if ($is_new_group && elgg_get_plugin_setting('limited_groups', 'groups') == 'yes' && !$user->isAdmin()) {
    register_error(elgg_echo("groups:cantcreate"));
    forward(REFERER);
}
$group = new ElggGroup($group_guid);
// load if present, if not create a new group
if ($group_guid && !$group->canEdit()) {
    register_error(elgg_echo("groups:cantedit"));
    forward(REFERER);
开发者ID:duanhv,项目名称:mdg-social,代码行数:31,代码来源:edit.php

示例15: hypeCategories

    $vars['categories'] = hypeCategories()->categories->getItemCategories($vars['entity']);
    unset($vars['entity']);
}
if (!empty($vars['type'])) {
    $type = "&type=" . rawurlencode($vars['type']);
} else {
    $type = "";
}
if (!empty($vars['subtype'])) {
    $subtype = "&subtype=" . rawurlencode($vars['subtype']);
} else {
    $subtype = "";
}
if (empty($vars['categories']) && !empty($vars['value'])) {
    if (!is_array($vars['value'])) {
        $vars['value'] = string_to_tag_array($vars['value']);
    }
    foreach ($vars['value'] as $guid) {
        $vars['categories'][] = get_entity($guid);
    }
}
if (empty($vars['categories'])) {
    return;
}
$list_class = "elgg-categories";
if (isset($vars['list_class'])) {
    $list_class = "{$list_class} {$vars['list_class']}";
}
$item_class = "elgg-category";
if (isset($vars['item_class'])) {
    $item_class = "{$item_class} {$vars['item_class']}";
开发者ID:hypejunction,项目名称:hypecategories,代码行数:31,代码来源:category.php


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