本文整理汇总了PHP中string_to_tag_array函数的典型用法代码示例。如果您正苦于以下问题:PHP string_to_tag_array函数的具体用法?PHP string_to_tag_array怎么用?PHP string_to_tag_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了string_to_tag_array函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: Poll
$new = true;
// Initialise a new Poll
$poll = new Poll();
// Set its owner to the current user
$poll->owner_guid = $user->guid;
$poll->container_guid = $container_guid;
// Success message
$message = elgg_echo("poll:added");
}
$poll->access_id = $access_id;
$poll->question = $question;
$poll->title = $question;
$poll->description = $description;
$poll->open_poll = $open_poll ? 1 : 0;
$poll->close_date = empty($close_date) ? null : $close_date;
$poll->tags = string_to_tag_array($tags);
if (!$poll->save()) {
register_error(elgg_echo("poll:error"));
forward(REFERER);
}
$poll->setChoices($new_choices);
poll_manage_front_page($poll, $front_page);
elgg_clear_sticky_form('poll');
if ($new) {
$poll_create_in_river = elgg_get_plugin_setting('create_in_river', 'poll');
if ($poll_create_in_river != 'no') {
elgg_create_river_item(array('view' => 'river/object/poll/create', 'action_type' => 'create', 'subject_guid' => $user->guid, 'object_guid' => $poll->guid));
}
}
system_message($message);
// Forward to the poll page
开发者ID:lorea,项目名称:Hydra-dev,代码行数:31,代码来源:edit.php
示例17: register_error
// Make sure the title / description aren't blank
if (empty($title)) {
register_error(elgg_echo('answers:question:blank'));
forward(REFERER);
}
// Otherwise, save the question
if ($guid) {
$question = get_entity($guid);
$new = false;
} else {
$question = new ElggObject();
$question->subtype = 'question';
$new = true;
}
$question->access_id = $access_id;
$question->title = $title;
$question->description = $description;
$question->tags = string_to_tag_array($tags);
$question->container_guid = $container_guid;
if ($question->save()) {
elgg_clear_sticky_form('question');
system_message(elgg_echo('answers:question:posted') . $sysmsg);
if ($new) {
// only add river item when this is a new question
add_to_river('river/object/question/create', 'create', $user_guid, $question->guid);
}
forward($question->getURL());
} else {
register_error(elgg_echo('answers:error'));
forward(REFERER);
}
开发者ID:hejosadi,项目名称:PiGo-LMS,代码行数:31,代码来源:save.php
示例18: get_input
<?php
/**
* Add a language without the need for a plugin to provide a part
*/
$code = get_input('code');
if (empty($code)) {
forward(REFERER);
}
// check for existing custom languages
$custom_languages = elgg_get_plugin_setting('custom_languages', 'translation_editor');
if (!empty($custom_languages)) {
$custom_languages = string_to_tag_array($custom_languages);
$custom_languages[] = $code;
$code = implode(',', array_unique($custom_languages));
}
elgg_set_plugin_setting('custom_languages', $code, 'translation_editor');
// invalidate cache
elgg_flush_caches();
system_message(elgg_echo('translation_editor:action:add_language:success'));
forward(REFERER);
开发者ID:coldtrick,项目名称:translation_editor,代码行数:21,代码来源:add_language.php
示例19: elgg_view
echo elgg_view('input/text', array('name' => 'params[criteria]', 'value' => $entity->criteria));
echo '</div>';
echo '</div>';
$registered_entities = elgg_get_config('registered_entities');
foreach ($registered_entities as $type => $subtypes) {
if (sizeof($subtypes) == 0) {
$str = elgg_echo("item:{$type}");
$subtype_options[$str] = "{$type}:default";
} else {
foreach ($subtypes as $subtype) {
$str = elgg_echo("item:{$type}:{$subtype}");
$subtype_options[$str] = "{$type}:{$subtype}";
}
}
}
$criteria = $entity->criteria ? string_to_tag_array($entity->criteria) : array();
foreach ($criteria as $criterion) {
$criteria_options[$criterion] = $criterion;
}
$type_subtype_pairs_setting = isset($entity->type_subtype_pairs) ? unserialize($entity->type_subtype_pairs) : array();
$granular_criteria = isset($entity->granular_criteria) ? unserialize($entity->granular_criteria) : array();
echo '<div>';
echo '<h3>' . elgg_echo('stars:settings:type_subtype_pairs') . '</h3>';
echo elgg_view('input/hidden', array('name' => 'params[type_subtype_pairs]', 'value' => ''));
echo '<table class="elgg-table-alt">';
echo '<thead>';
echo '<tr>';
echo '<th>' . elgg_echo('stars:settings:type_subtype_pairs') . '</th>';
if ($criteria) {
echo '<th>' . elgg_echo('stars:settings:granular_criteria') . '</th>';
}
开发者ID:hypejunction,项目名称:elgg_stars,代码行数:31,代码来源:settings.php
示例20: group_tools_get_suggested_groups
/**
* Returns suggested groups
*
* @param ElggUser $user (optional) the user to get the groups for, defaults to the current user
* @param int $limit (optional) the number of suggested groups to return, default = 10
*
* @return ElggGroup[] all the suggested groups
*/
function group_tools_get_suggested_groups($user = null, $limit = null)
{
$result = array();
if (!elgg_instanceof($user, "user")) {
$user = elgg_get_logged_in_user_entity();
}
if (is_null($limit)) {
$limit = get_input("limit", 10);
}
$limit = sanitize_int($limit, false);
if ($user && $limit > 0) {
$dbprefix = elgg_get_config("dbprefix");
$group_membership_where = "e.guid NOT IN (SELECT er.guid_two FROM {$dbprefix}entity_relationships er where er.guid_one = {$user->getGUID()} and er.relationship IN ('member', 'membership_request'))";
if (elgg_get_plugin_setting("auto_suggest_groups", "group_tools") !== "no") {
$tag_names = elgg_get_registered_tag_metadata_names();
if (!empty($tag_names)) {
$user_metadata_options = array("guid" => $user->getGUID(), "limit" => false, "metadata_names" => $tag_names);
// get metadata
$user_values = elgg_get_metadata($user_metadata_options);
if (!empty($user_values)) {
// transform to values
$user_values = metadata_array_to_values($user_values);
// find group with these metadatavalues
$group_options = array("type" => "group", "metadata_names" => $tag_names, "metadata_values" => $user_values, "wheres" => $group_membership_where, "group_by" => "e.guid", "order_by" => "count(msn.id) DESC", "limit" => $limit);
$groups = elgg_get_entities_from_metadata($group_options);
if (!empty($groups)) {
foreach ($groups as $group) {
$result[$group->getGUID()] = $group;
$limit--;
}
}
}
}
}
// get admin defined suggested groups
$group_guids = string_to_tag_array(elgg_get_plugin_setting("suggested_groups", "group_tools"));
if (!empty($group_guids) && $limit > 0) {
$group_options = array("guids" => $group_guids, "type" => "group", "wheres" => array($group_membership_where), "limit" => $limit);
if (!empty($result)) {
$suggested_guids = array_keys($result);
$group_options["wheres"][] = "e.guid NOT IN (" . implode(",", $suggested_guids) . ")";
}
$groups = elgg_get_entities($group_options);
if (!empty($groups)) {
foreach ($groups as $group) {
$result[$group->getGUID()] = $group;
}
}
}
}
return $result;
}
开发者ID:pleio,项目名称:group_tools,代码行数:60,代码来源:functions.php
注:本文中的string_to_tag_array函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论