本文整理汇总了PHP中tag::addindextag方法的典型用法代码示例。如果您正苦于以下问题:PHP tag::addindextag方法的具体用法?PHP tag::addindextag怎么用?PHP tag::addindextag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tag
的用法示例。
在下文中一共展示了tag::addindextag方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: die
$query = "UPDATE {$alias_table} SET status='accepted' WHERE tag='{$tag}' AND alias='{$alias}'";
$db->query($query);
//Convert all current posts from the AKA to the tag.
$query = "SELECT * FROM {$post_table} WHERE tags LIKE '% " . str_replace('%', '\\%', str_replace('_', '\\_', $alias)) . " %'";
$result = $db->query($query) or die($db->error);
while ($row = $result->fetch_assoc()) {
$tags = explode(" ", $row['tags']);
foreach ($tags as $current) {
$tagc->deleteindextag($current);
}
$tmp = str_replace(' ' . $alias . ' ', ' ' . $tag . ' ', $row['tags']);
$tags = implode(" ", $tagc->filter_tags($tmp, $tag, explode(" ", $tmp)));
$tags = mb_trim(str_replace(" ", "", $tags));
$tags2 = explode(" ", $tags);
foreach ($tags2 as $current) {
$tagc->addindextag($current);
}
$tags = " {$tags} ";
$query = "UPDATE {$post_table} SET tags='{$tags}' WHERE id='" . $row['id'] . "'";
$db->query($query);
}
} else {
if ($_POST['accept'] == 2) {
$query = "UPDATE {$alias_table} SET status='rejected' WHERE tag='{$tag}' AND alias='{$alias}'";
$db->query($query);
}
}
print '<meta http-equiv="refresh" content="2;url=' . $site_url . 'admin/?page=alias">';
exit;
}
echo '<form method="post" action=""><table><tr><td>
示例2: implode
$tags = implode(" ", $ttags);
foreach ($ttags as $current) {
if ($current != "" && $current != " ") {
$ttags = $tclass->filter_tags($tags, $current, $ttags);
if (is_dir("{$main_cache_dir}" . "" . "search_cache/" . $misc->windows_filename_fix($current) . "/")) {
$cache->destroy_page_cache("search_cache/" . $misc->windows_filename_fix($current) . "/");
} else {
if (is_dir("{$main_cache_dir}" . "" . "search_cache/{$current}/")) {
$cache->destroy_page_cache("search_cache/{$current}/");
}
}
}
}
asort($ttags);
foreach ($ttags as $current) {
$tclass->addindextag($current);
}
$tags = implode(" ", $ttags);
if (substr($tags, 0, 1) != " ") {
$tags = " {$tags}";
}
if (substr($tags, -1, 1) != " ") {
$tags = "{$tags} ";
}
$date = date("Y-m-d H:i:s");
$new_tags = str_replace($row['tags'], "", $tags);
$ret = "SELECT tags_version FROM {$post_table} WHERE id='{$id}'";
$set = $db->query($ret);
$retme = $set->fetch_assoc();
$version = $retme['tags_version'];
$version = $version + 1;
示例3: foreach
}
$result->free_result();
foreach ($tmp_arr as $r) {
//Replace all occurances of the old tag with the new one
$newtag = substr($r, $l);
//Don't touch posts that contain the new tag already
$query = "UPDATE {$post_table} SET tags = REPLACE(tags, ' {$r} ', ' {$newtag} ') WHERE tags LIKE '% {$r} %' AND tags NOT LIKE '% {$newtag} %'";
//Include posts that already have the new tag
//$query = "UPDATE $post_table SET tags = REPLACE(tags, ' $r ', ' $newtag ') WHERE tags LIKE '% $r %' AND tags NOT LIKE '% $newtag %'";
echo "{$r} ==> {$newtag}<br/>{$query}<br/>";
$db->query($query) or die($db->error);
$qt = $db->affected_rows;
echo "Affected rows: {$qt}<br/>";
if ($qt > 0) {
$tclass->deleteindextag($r, $qt);
$tclass->addindextag($newtag, $qt);
$query = "UPDATE {$tag_index_table} SET category = '{$t}' WHERE tag = '{$newtag}' AND category != '{$t}'";
echo "Setting category to '{$t}' for new tag '{$newtag}'<br/><br/>";
$db->query($query) or die($db->error);
if ($db->affected_rows > 0) {
$query = "UPDATE {$tag_category_table} SET tag_count = tag_count + 1 WHERE category_name='{$t}'";
$db->query($query) or die($db->error);
$query = "UPDATE {$tag_category_table} SET tag_count = tag_count - 1 WHERE category_name='generic'";
$db->query($query) or die($db->error);
}
//delete the old tag from any post that still has it
$without = substr($r, $l);
$query = "UPDATE {$post_table} SET tags = REPLACE(tags, ' {$r} ', ' ') WHERE tags LIKE '% {$r} %' AND tags LIKE '% {$without} %'";
$db->query($query) or die($db->error);
$tclass->deleteindextag($r, $db->affected_rows);
}
示例4: foreach
foreach ($image_set as $cur_id) {
if ($cur_id === end($image_set)) {
$query .= "id = {$cur_id});";
} else {
$query .= "id = {$cur_id} OR ";
}
}
}
//Execute Query (if we're not in debug mode)
if ($debug) {
echo "<strong>Update Query:</strong>{$query}<br/><br/>";
} else {
$db->query($query);
$qt = $db->affected_rows;
print "\"{$cur_tag}\" tag added to " . $qt . " posts<br/><a href=\"index.php?page=tag_ops\">Go Back</a>";
$tclass->addindextag($cur_tag, $qt);
}
}
} else {
if ($_GET['action'] == "remove") {
$losetags = explode(" ", $db->real_escape_string($_GET['remove_tags']));
if ($debug) {
echo "<h4>Removing the following tags</h4>";
print_r($losetags);
echo "<br/><br/>";
}
foreach ($losetags as $cur_tag) {
//Build update query
$query = "UPDATE {$post_table} SET tags = REPLACE(tags, '{$cur_tag} ', '') WHERE tags LIKE '% {$cur_tag} %'";
if ($all_posts) {
$query .= ";";