本文整理汇总了PHP中addTag函数的典型用法代码示例。如果您正苦于以下问题:PHP addTag函数的具体用法?PHP addTag怎么用?PHP addTag使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addTag函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addLessonTag
function addLessonTag($lesson_id, $reference_string, $bible_code = 'kjv', $relevant_words = '')
{
# Add tag object
$tag_object = addTag($reference_string, $bible_code, $relevant_words);
# Add lesson tag object (if applicable)
if ($tag_object) {
$lesson_tag_object = new LessonTag();
$lesson_tag_object->setLessonId($lesson_id)->setTag($tag_object)->save();
}
}
示例2: start
function start($action)
{
global $action, $userId, $tag;
switch ($action) {
case "addTag":
return addTag($userId, $tag);
break;
case "removeTag":
return removeTag($userId, $tag);
break;
case "getTagId":
return getTagId($tag);
break;
}
}
示例3: getTags
function getTags()
{
global $tags;
$who = 'jbum';
if (isset($_GET['who'])) {
$who = $_GET['who'];
}
$who = preg_replace('/\\W/', '', $who);
// remove troublesome characters from name
if ($who == '') {
return;
}
$delURL = "http://del.icio.us/rss/{$who}";
require 'magpierss/rss_fetch.inc';
$rss = fetch_rss($delURL);
foreach ($rss->items as $item) {
$tagstrings = preg_split('/ /', $item[dc][subject]);
foreach ($tagstrings as $tagstring) {
addTag($tagstring, "http://del.icio.us/{$who}/{$tagstring}");
}
}
}
示例4: getTags
function getTags()
{
global $tags;
$url = 'http://www.gutenberg.org/dirs/etext05/bib0110.txt';
$ch = curl_init();
$timeout = 30;
// set to zero for no timeout
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$txt = curl_exec($ch);
curl_close($ch);
$searches = array('/^.*\\*\\*\\* START OF THE PROJECT GUTENBERG[^\\n]*\\n/s', '/^.*(\\nBook 01)/s', '/\\*\\*\\* END OF THE PROJECT GUTENBERG.*$/s', '/[^\\w\'\\-]/s');
$replaces = array('', '$1', '', ' ');
$txt = preg_replace($searches, $replaces, $txt);
$words = preg_split('/\\s+/', $txt);
foreach ($words as $w) {
if ($w == '' || preg_match('/[0-9]/', $w)) {
continue;
}
addTag($w, 'http://dictionary.reference.com/search?q=' . $w);
}
}
示例5: getTags
function getTags($post)
{
if ($post->attributes()->type) {
echo "<category><![CDATA[" . $post->attributes()->type . "]]></category>\n";
echo "\t\t<category domain=\"category\" nicename=\"" . $post->attributes()->type . "\"><![CDATA[" . $post->attributes()->type . "]]></category>\n";
} else {
echo "<category><![CDATA[Uncategorized]]></category>\n";
echo "\t\t<category domain=\"category\" nicename=\"uncategorized\"><![CDATA[Uncategorized]]></category>\n";
}
if ($post->tag) {
foreach ($post->tag as $tag) {
echo "\t\t<category domain=\"tag\"><![CDATA[{$tag}]]></category>\n";
echo "\t\t<category domain=\"tag\" nicename=\"" . removeWeirdChars($tag) . "\"><![CDATA[{$tag}]]></category>\n";
addTag((string) $tag);
}
}
}
示例6: switch
- 6 : Update personal data.
- 7 : List all the tags
- 8 : Meta search
**********************************************/
switch ($_POST["action"]) {
case '0':
login($link);
break;
case '1':
register($link);
break;
case '2':
logout();
break;
case '3':
addTag($link);
break;
case '4':
modifyTag($link);
break;
case '5':
deleteTag($link);
break;
case '6':
updateData($link);
break;
case '7':
listAllTags($link);
break;
case '8':
// metaSearch();
示例7: renameTag
function renameTag($blogid, $id, $name)
{
// 1. If tag with new name already exists, skip the tag creation process.
// 2. If tag with new name does not exist in this service, create new tag.
// 3. Modify the tag relation information
// 4. If older tag is not used anymore, drop the tag.
$oldTagId = $id;
$newTagId = addTag($blogid, $name);
$query = DBModel::getInstance();
$query->reset("TagRelations");
$query->setAttribute('tag', $newTagId);
$query->setQualifier('blogid', 'equals', $blogid);
$query->setQualifier('tag', 'equals', $oldTagId);
$query->update();
deleteTagById($blogid, $oldTagId);
return $newTagId;
}
示例8: optional_param
$includegroups = optional_param('includegroups', false, PARAM_BOOL);
$query = optional_param('q', "", PARAM_TEXT);
$response = getUsersByGlobal($includegroups, $start, $max, $o, $s, $style, $query);
break;
/** TAGS **/
/** TAGS **/
case "gettag":
$tagid = required_param('tagid', PARAM_ALPHANUMEXT);
$response = getTag($tagid);
break;
case "getusertags":
$response = getUserTags();
break;
case "addtag":
$tagname = required_param('tagname', PARAM_TEXT);
$response = addTag($tagname);
break;
case "edittag":
$tagid = required_param('tagid', PARAM_ALPHANUMEXT);
$tagname = required_param('tagname', PARAM_TEXT);
$response = editTag($tagid, $tagname);
break;
case "deletetag":
$tagid = required_param('tagid', PARAM_ALPHANUMEXT);
$response = deleteTag($tagid);
break;
case "gettagsbyfirstcharacters":
$query = required_param('q', PARAM_TEXT);
$scope = optional_param('scope', 'my', PARAM_ALPHANUMEXT);
$response = getTagsByFirstCharacters($query, $scope);
break;
示例9: GalleryFooter
GalleryFooter();
break;
case 'cancel':
echo $app->enqueueMessage(JText::_('COM_DATSOGALLERY_MSG_AFTER_CANCELED_ORDER'));
GalleryHeader();
echo dgCategories($catid);
GalleryFooter();
break;
case 'notify':
ppIpn();
break;
case 'vote':
recordVote();
break;
case 'addtag':
addTag();
break;
case 'removetag':
removeTag();
break;
case 'showtags':
showTags($id);
break;
case 'addtofavorites':
addToFavorites();
break;
case 'editpic':
GalleryHeader();
editPic($uid);
GalleryFooter();
break;
示例10: addTagsToExperiment
function addTagsToExperiment($eid, $tag_list)
{
global $db;
$zipped_list = array();
foreach ($tag_list as $t) {
if (!array_key_exists($t['value'], $zipped_list)) {
$zipped_list[$t['value']] = $t['weight'];
} else {
// If the tag is already present with a lower weight, then replace with higher weight
if ($zipped_list[$t['value']] < $t['weight']) {
$zipped_list[$t['value']] = $t['weight'];
}
}
}
$tag_cache = array();
foreach ($zipped_list as $k => $v) {
$id = -1;
if (!array_key_exists($k, $tag_cache)) {
$id = getTagId($k);
if ($id == -1) {
$id = addTag($k, $v > 0 ? 1 : 0);
}
$tag_cache[$k] = $id;
} else {
$id = $tag_cache[$k];
}
addTagToExperiment($eid, $id, $v);
}
updateTimeModifiedForExperiment($eid);
return true;
}
示例11: addTag
} else {
$bool = true;
}
if (!$bool) {
addTag($tag);
}
}
$tags_en = explode(",", $tags_en);
foreach ($tags_en as $tag) {
if ($tag) {
$bool = getTag($tag, 'en');
} else {
$bool = true;
}
if (!$bool) {
addTag($tag, '', 'en');
}
}
// bet items must not be overwritten if coins have already been betted on the game
// so we need to prevent it by checking if total_placed_coin is 0
if (!$total_placed_coins) {
$cachefile = $basedir . '/temp/bet_items_active.php';
$cachedata = false;
if (file_exists($cachefile)) {
$temp = json_decode(file_get_contents($cachefile), true);
// remove all bet items from this game
foreach ($temp as $c) {
if ($c['bi_game_id'] != $game_id) {
$cachedata[] = $c;
}
}
示例12: rateComment
$response = rateComment($_REQUEST['comment_id'], $_REQUEST['up']);
break;
case "register_new_user":
$response = registerNewUser($_REQUEST['user'], $_REQUEST['password'], $_REQUEST['email']);
break;
case "update_page_rating":
$response = updatePageRating($_REQUEST['url'], $_REQUEST['url_parameter'], $_REQUEST['username'], $_REQUEST['title'], $_REQUEST['rating']);
break;
case "get_page_rating":
$response = getPageRating($_REQUEST['url'], $_REQUEST['url_parameter']);
break;
case "get_page_rating_bulk":
$response = getPageRatingBulk($_REQUEST['url_string'], $_REQUEST['params_string'], $_REQUEST['username']);
break;
case "add_tag":
$response = addTag($_REQUEST['url'], $_REQUEST['url_parameter'], $_REQUEST['tag']);
break;
case "get_page_tags":
$response = getPageTags($_REQUEST['url'], $_REQUEST['url_parameter']);
break;
case "get_recommended_page_tags":
$response = getRecommendedPageTags($_POST['url'], $_POST['url_parameter']);
break;
case "rate_tag":
$response = rateTag($_REQUEST['url'], $_REQUEST['url_parameter'], $_REQUEST['tag'], $_REQUEST['up']);
break;
case "delete_tag":
$response = deleteTag($_REQUEST['url'], $_REQUEST['url_parameter'], $_REQUEST['tag']);
break;
case "get_pages_with_tag":
$response = getPagesWithTag($_REQUEST['tag']);
示例13: preg_split
$name = preg_split("[\\s+]", $exp['name']);
$desc = preg_split("[\\s+]", $exp['description']);
foreach ($name as $n) {
if (strlen($n) > 1) {
$tid = getTagId(safeString($n));
if ($tid == -1) {
$tid = addTag(safeString($n), 1);
}
addTagToExperiment($eid, $tid, 1);
}
}
foreach ($desc as $n) {
if (strlen($n) > 1) {
$tid = getTagId(safeString($n));
if ($tid == -1) {
$tid = addTag(safeString($n), 1);
}
addTagToExperiment($eid, $tid, 1);
}
}
}
break;
case "migrateimgs":
$s3 = new S3(AWS_ACCESS_KEY, AWS_SECRET_KEY);
$url = "http://s3.amazonaws.com/isenseimgs/";
$img_dir = PIC_DIR . 's3/';
$dir = opendir($img_dir);
while (($file = readdir($dir)) !== false) {
$id = substr($file, 0, strpos($file, ".") + 1);
$ext = substr($file, strpos($file, ".") + 1, 3);
if (strlen($ext) < 3) {
示例14: get_last_rc
// add tag
$result = get_last_rc();
if (mysqli_num_rows($result) == 1) {
$news = mysqli_fetch_array($result, MYSQLI_ASSOC);
$news_id = $news['news_id'];
}
// split tag
$tags = explode(',', $tag);
for ($i = 0; $i < count($tags); $i++) {
$tag = trim($tags[$i]);
// check tag exist
$rs = get_tag_item_by_key($tag);
// tag not exist
if (mysqli_num_rows($rs) == 0) {
// add tag
$rsadd = addTag($tag);
if (mysqli_affected_rows($dbc) == 1) {
// add tag success
// get tag id by last record
$result = get_last_rc_tag();
$last_tag = mysqli_fetch_array($result, MYSQLI_ASSOC);
$tag_id = $last_tag['tag_id'];
// add tag data
$query = add_tag_data($news_id, $tag_id);
if (mysqli_affected_rows($dbc) == 1) {
} else {
$errors[] = 'tag_error';
}
} else {
// add tag failed
$errors[] = 'tag_error';
示例15: updateTags
function updateTags($b_id, $strTags)
{
$strTags = trim($strTags);
$tags = split(" ", $strTags);
// Get each single tag
//Remove tags if not there anymore
//Get old tags
$strOldTags = returnAllTags($b_id);
$oldTags = split(" ", $strOldTags);
// Get each single tag
foreach ($oldTags as $old_tag) {
$found = false;
foreach ($tags as $new_tag) {
if ($old_tag == $new_tag) {
$found = true;
break;
}
}
if (!$found) {
// Not there anymore, remove the link
$result = unstoreTag($b_id, $old_tag);
}
}
$nbChars = 0;
//Add new tags if any
foreach ($tags as $current_tag) {
if (tagExists($current_tag)) {
$tagID = returnTagID($current_tag);
if (!returnTagLinked($b_id, $tagID)) {
$result = storeTag($b_id, $current_tag);
}
} else {
// Check max length (30) and if 150 chars have been added
$nbChars += strlen($current_tag);
if ($nbChars <= 150 && strlen(trim($current_tag)) <= 30) {
$result = addTag($current_tag);
$tagID = returnTagID($current_tag);
$result2 = storeTag($b_id, $current_tag);
}
}
}
}