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

PHP tag_exists函数代码示例

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

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



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

示例1: tag_ensure_exists

/**
 * Ensure a tag exists with the given ID.
 * @param integer Tag ID
 */
function tag_ensure_exists($p_tag_id)
{
    if (!tag_exists($p_tag_id)) {
        error_parameters($p_tag_id);
        trigger_error(ERROR_TAG_NOT_FOUND, ERROR);
    }
}
开发者ID:Kirill,项目名称:mantisbt,代码行数:11,代码来源:tag_api.php


示例2: action_attach_tags_validate

/**
 * Validates the Attach Tags group action.
 * Gets called for every bug, but performs the real tag validation only
 * the first time.  Any invalid tags will be skipped, as there is no simple
 * or clean method of presenting these errors to the user.
 * @param integer Bug ID
 * @return boolean True
 */
function action_attach_tags_validate($p_bug_id)
{
    global $g_action_attach_tags_valid;
    if (!isset($g_action_attach_tags_valid)) {
        $f_tag_string = gpc_get_string('tag_string');
        $f_tag_select = gpc_get_string('tag_select');
        global $g_action_attach_tags_attach, $g_action_attach_tags_create, $g_action_attach_tags_failed;
        $g_action_attach_tags_attach = array();
        $g_action_attach_tags_create = array();
        $g_action_attach_tags_failed = array();
        $t_tags = tag_parse_string($f_tag_string);
        $t_can_create = access_has_global_level(config_get('tag_create_threshold'));
        foreach ($t_tags as $t_tag_row) {
            if (-1 == $t_tag_row['id']) {
                if ($t_can_create) {
                    $g_action_attach_tags_create[] = $t_tag_row;
                } else {
                    $g_action_attach_tags_failed[] = $t_tag_row;
                }
            } elseif (-2 == $t_tag_row['id']) {
                $g_action_attach_tags_failed[] = $t_tag_row;
            } else {
                $g_action_attach_tags_attach[] = $t_tag_row;
            }
        }
        if (0 < $f_tag_select && tag_exists($f_tag_select)) {
            $g_action_attach_tags_attach[] = tag_get($f_tag_select);
        }
    }
    global $g_action_attach_tags_attach, $g_action_attach_tags_create, $g_action_attach_tags_failed;
    return true;
}
开发者ID:jin255ff,项目名称:company_website,代码行数:40,代码来源:bug_actiongroup_attach_tags_inc.php


示例3: convert_them

 function convert_them()
 {
     global $wpdb;
     if ((!isset($_POST['cats_to_convert']) || !is_array($_POST['cats_to_convert'])) && empty($this->categories_to_convert)) {
         echo '<div class="narrow">';
         echo '<p>' . sprintf(__('Uh, oh. Something didn&#8217;t work. Please <a href="%s">try again</a>.'), 'admin.php?import=wp-cat2tag') . '</p>';
         echo '</div>';
         return;
     }
     if (empty($this->categories_to_convert)) {
         $this->categories_to_convert = $_POST['cats_to_convert'];
     }
     $hier = _get_term_hierarchy('category');
     echo '<ul>';
     foreach ((array) $this->categories_to_convert as $cat_id) {
         $cat_id = (int) $cat_id;
         echo '<li>' . sprintf(__('Converting category #%s ... '), $cat_id);
         if (!$this->_category_exists($cat_id)) {
             _e('Category doesn\'t exist!');
         } else {
             $category =& get_category($cat_id);
             if (tag_exists($wpdb->escape($category->name))) {
                 _e('Category is already a tag.');
                 echo '</li>';
                 continue;
             }
             // If the category is the default, leave category in place and create tag.
             if (get_option('default_category') == $category->term_id) {
                 $id = wp_insert_term($category->name, 'post_tag', array('slug' => $category->slug));
                 $id = $id['term_taxonomy_id'];
                 $posts = get_objects_in_term($category->term_id, 'category');
                 foreach ($posts as $post) {
                     if (!$wpdb->get_var("SELECT object_id FROM {$wpdb->term_relationships} WHERE object_id = '{$post}' AND term_taxonomy_id = '{$id}'")) {
                         $wpdb->query("INSERT INTO {$wpdb->term_relationships} (object_id, term_taxonomy_id) VALUES ('{$post}', '{$id}')");
                     }
                     clean_post_cache($post);
                 }
             } else {
                 $tt_ids = $wpdb->get_col("SELECT term_taxonomy_id FROM {$wpdb->term_taxonomy} WHERE term_id = '{$category->term_id}' AND taxonomy = 'category'");
                 if ($tt_ids) {
                     $posts = $wpdb->get_col("SELECT object_id FROM {$wpdb->term_relationships} WHERE term_taxonomy_id IN (" . join(',', $tt_ids) . ") GROUP BY object_id");
                     foreach ((array) $posts as $post) {
                         clean_post_cache($post);
                     }
                 }
                 // Change the category to a tag.
                 $wpdb->query("UPDATE {$wpdb->term_taxonomy} SET taxonomy = 'post_tag' WHERE term_id = '{$category->term_id}' AND taxonomy = 'category'");
                 $terms = $wpdb->get_col("SELECT term_id FROM {$wpdb->term_taxonomy} WHERE parent = '{$category->term_id}' AND taxonomy = 'category'");
                 foreach ((array) $terms as $term) {
                     clean_category_cache($term);
                 }
                 // Set all parents to 0 (root-level) if their parent was the converted tag
                 $wpdb->query("UPDATE {$wpdb->term_taxonomy} SET parent = 0 WHERE parent = '{$category->term_id}' AND taxonomy = 'category'");
             }
             // Clean the cache
             clean_category_cache($category->term_id);
             _e('Converted successfully.');
         }
         echo '</li>';
     }
     echo '</ul>';
     echo '<p>' . sprintf(__('We&#8217;re all done here, but you can always <a href="%s">convert more</a>.'), 'admin.php?import=wp-cat2tag') . '</p>';
 }
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:63,代码来源:wp-cat2tag.php


示例4: mc_tag_delete

/**
 * 
 * Deletes a tag
 * 
 * @param string   $p_username        The user's username
 * @param string   $p_password        The user's password * @param unknown_type $p_tag_id
 * @param int      $p_tag_id          The id of the tag
 * @return soap_fault|boolean
 */
function mc_tag_delete($p_username, $p_password, $p_tag_id)
{
    $t_user_id = mci_check_login($p_username, $p_password);
    if ($t_user_id === false) {
        return mci_soap_fault_login_failed();
    }
    if (!access_has_global_level(config_get('tag_edit_threshold'))) {
        return mci_soap_fault_access_denied($t_user_id);
    }
    if (!tag_exists($p_tag_id)) {
        return SoapObjectsFactory::newSoapFault('Client', 'No tag with id ' . $p_tag_id);
    }
    return tag_delete($p_tag_id);
}
开发者ID:fur81,项目名称:zofaxiopeu,代码行数:23,代码来源:mc_tag_api.php


示例5: test_query_tag__in_but__not_in

 function test_query_tag__in_but__not_in()
 {
     $tag_a = tag_exists('tag-a');
     $tag_b = tag_exists('tag-b');
     $posts = $this->q->query("tag__in[]=" . $tag_a['term_id'] . "&tag__not_in[]=" . $tag_b['term_id']);
     // there are 4 posts with Tag A, only 2 when we exclude Tag B
     $this->assertCount(2, $posts);
     $this->assertEquals('tags-a-and-c', $posts[0]->post_name);
     $this->assertEquals('tag-a', $posts[1]->post_name);
 }
开发者ID:Benrajalu,项目名称:philRaj,代码行数:10,代码来源:results.php


示例6: wp_create_tag

function wp_create_tag($tag_name) {
	if ( $id = tag_exists($tag_name) )
		return $id;

	return wp_insert_term($tag_name, 'post_tag');
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:6,代码来源:taxonomy.php


示例7: tag_name_from_string

            }
        }
        if ($changed) {
            $str_changed = tag_name_from_string(implode($changed, ','));
            $str_changed = str_replace(',', ', ', $str_changed);
            $notice = $str_changed . ' --  ' . get_string('typechanged', 'tag');
        }
        break;
    case 'changename':
        if (!data_submitted or !confirm_sesskey()) {
            break;
        }
        $tags_names_changed = array();
        foreach ($tagschecked as $tag_id) {
            if ($newnames[$tag_id] != '') {
                if (tag_exists($newnames[$tag_id])) {
                    $err_notice .= $newnames[$tag_id] . '-- ' . get_string('namesalreadybeeingused', 'tag') . '<br />';
                } else {
                    $tags_names_changed[$tag_id] = $newnames[$tag_id];
                }
            }
        }
        $tags_names_updated = tag_update_name($tags_names_changed);
        //notice to inform what tags had their names effectively updated
        if ($tags_names_updated) {
            $notice = implode($tags_names_updated, ', ');
            $notice .= ' -- ' . get_string('updated', 'tag');
        }
        break;
}
echo '<br/>';
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:31,代码来源:manage.php


示例8: tag_attach_many

/**
 * Attaches a bunch of tags to the specified issue.
 *
 * @param int    $p_bug_id     The bug id.
 * @param string $p_tag_string String of tags separated by configured separator.
 * @param int    $p_tag_id     Tag id to add or 0 to skip.
 * @return array|bool true for success, otherwise array of failures.  The array elements follow the tag_parse_string()
 *                    format.
 */
function tag_attach_many($p_bug_id, $p_tag_string, $p_tag_id = 0)
{
    # If no work, then there is no need to do access check.
    if ($p_tag_id === 0 && is_blank($p_tag_string)) {
        return true;
    }
    access_ensure_bug_level(config_get('tag_attach_threshold'), $p_bug_id);
    $t_tags = tag_parse_string($p_tag_string);
    $t_can_create = access_has_global_level(config_get('tag_create_threshold'));
    $t_tags_create = array();
    $t_tags_attach = array();
    $t_tags_failed = array();
    foreach ($t_tags as $t_tag_row) {
        if (-1 == $t_tag_row['id']) {
            if ($t_can_create) {
                $t_tags_create[] = $t_tag_row;
            } else {
                $t_tags_failed[] = $t_tag_row;
            }
        } else {
            if (-2 == $t_tag_row['id']) {
                $t_tags_failed[] = $t_tag_row;
            } else {
                $t_tags_attach[] = $t_tag_row;
            }
        }
    }
    if (0 < $p_tag_id && tag_exists($p_tag_id)) {
        $t_tags_attach[] = tag_get($p_tag_id);
    }
    # failed to attach at least one tag
    if (count($t_tags_failed) > 0) {
        return $t_tags_failed;
    }
    foreach ($t_tags_create as $t_tag_row) {
        $t_tag_row['id'] = tag_create($t_tag_row['name']);
        $t_tags_attach[] = $t_tag_row;
    }
    foreach ($t_tags_attach as $t_tag_row) {
        if (!tag_bug_is_attached($t_tag_row['id'], $p_bug_id)) {
            tag_bug_attach($t_tag_row['id'], $p_bug_id);
        }
    }
    event_signal('EVENT_TAG_ATTACHED', array($p_bug_id, $t_tags_attach));
    return true;
}
开发者ID:spring,项目名称:spring-website,代码行数:55,代码来源:tag_api.php


示例9: tag_get_by_item

<?php

require '../include/core/common.php';
require PATHS_INCLUDE . 'libraries/forum.php';
// NOTE: if(false)! (This file is deprecated)
if (false) {
    if ($_GET['action'] == 'update_tags') {
        /* Remove all old tags */
        $tags = tag_get_by_item('discussion', $_GET['discussion_id']);
        foreach ($tags as $tag) {
            $tag_ids[] = $tag['tag_id'];
        }
        tag_remove($_GET['discussion_id'], 'discussion', $tag_ids);
        /* Set the new tags */
        $tags = explode(' ', str_replace(',', ' ', $_GET['tags']));
        foreach ($tags as $key => $tag) {
            $tags[$key] = trim($tag);
        }
        $tags = array_unique($tags);
        foreach ($tags as $tag_label) {
            $return = tag_exists($tag_label);
            if ($return['status'] == 'exists') {
                $set_tag_ids[] = array('tag_id' => $return['tag_id']);
            } else {
                $set_tag_ids[] = array('tag_id' => tag_create($taglabel));
            }
        }
        tag_set($_GET['discussion_id'], 'discussion', $set_tag_ids);
        // Äntligen kan vi börja sätta de nya taggarna
    }
}
开发者ID:Razze,项目名称:hamsterpaj,代码行数:31,代码来源:discussions.php


示例10: filter_get_bug_rows


//.........这里部分代码省略.........
        # use the complementary type
        $t_comp_type = relationship_get_complementary_type($c_rel_type);
        $t_clauses = array();
        $t_table_name = 'relationship';
        array_push($t_from_clauses, $t_bug_relationship_table);
        array_push($t_join_clauses, "LEFT JOIN {$t_bug_relationship_table} {$t_table_name} ON {$t_table_name}.destination_bug_id = {$t_bug_table}.id");
        array_push($t_join_clauses, "LEFT JOIN {$t_bug_relationship_table} {$t_table_name}2 ON {$t_table_name}2.source_bug_id = {$t_bug_table}.id");
        // get reverse relationships
        array_push($t_clauses, "({$t_table_name}.relationship_type='{$t_comp_type}' AND {$t_table_name}.source_bug_id='{$c_rel_bug}')");
        array_push($t_clauses, "({$t_table_name}" . "2.relationship_type='{$c_rel_type}' AND {$t_table_name}" . "2.destination_bug_id='{$c_rel_bug}')");
        array_push($t_where_clauses, '(' . implode(' OR ', $t_clauses) . ')');
    }
    # tags
    $c_tag_string = trim($t_filter['tag_string']);
    if (!is_blank($c_tag_string)) {
        $t_tags = tag_parse_filters($c_tag_string);
        if (count($t_tags)) {
            $t_tags_all = array();
            $t_tags_any = array();
            $t_tags_none = array();
            foreach ($t_tags as $t_tag_row) {
                switch ($t_tag_row['filter']) {
                    case 1:
                        $t_tags_all[] = $t_tag_row;
                        break;
                    case 0:
                        $t_tags_any[] = $t_tag_row;
                        break;
                    case -1:
                        $t_tags_none[] = $t_tag_row;
                        break;
                }
            }
            if (0 < $t_filter['tag_select'] && tag_exists($t_filter['tag_select'])) {
                $t_tags_any[] = tag_get($t_filter['tag_select']);
            }
            $t_bug_tag_table = config_get('mantis_bug_tag_table');
            if (count($t_tags_all)) {
                $t_clauses = array();
                foreach ($t_tags_all as $t_tag_row) {
                    array_push($t_clauses, "{$t_bug_table}.id IN ( SELECT bug_id FROM {$t_bug_tag_table} WHERE {$t_bug_tag_table}.tag_id = {$t_tag_row['id']} )");
                }
                array_push($t_where_clauses, '(' . implode(' AND ', $t_clauses) . ')');
            }
            if (count($t_tags_any)) {
                $t_clauses = array();
                foreach ($t_tags_any as $t_tag_row) {
                    array_push($t_clauses, "{$t_bug_tag_table}.tag_id = {$t_tag_row['id']}");
                }
                array_push($t_where_clauses, "{$t_bug_table}.id IN ( SELECT bug_id FROM {$t_bug_tag_table} WHERE ( " . implode(' OR ', $t_clauses) . ') )');
            }
            if (count($t_tags_none)) {
                $t_clauses = array();
                foreach ($t_tags_none as $t_tag_row) {
                    array_push($t_clauses, "{$t_bug_tag_table}.tag_id = {$t_tag_row['id']}");
                }
                array_push($t_where_clauses, "{$t_bug_table}.id NOT IN ( SELECT bug_id FROM {$t_bug_tag_table} WHERE ( " . implode(' OR ', $t_clauses) . ') )');
            }
        }
    }
    # custom field filters
    if (ON == config_get('filter_by_custom_fields')) {
        # custom field filtering
        # @@@ At the moment this gets the linked fields relating to the current project
        #     It should get the ones relating to the project in the filter or all projects
        #     if multiple projects.
开发者ID:amjadtbssm,项目名称:website,代码行数:67,代码来源:filter_api.php


示例11: foreach

foreach ($t_tags as $t_tag_row) {
    if (-1 == $t_tag_row['id']) {
        if ($t_can_create) {
            $t_tags_create[] = $t_tag_row;
        } else {
            $t_tags_failed[] = $t_tag_row;
        }
    } else {
        if (-2 == $t_tag_row['id']) {
            $t_tags_failed[] = $t_tag_row;
        } else {
            $t_tags_attach[] = $t_tag_row;
        }
    }
}
if (0 < $f_tag_select && tag_exists($f_tag_select)) {
    $t_tags_attach[] = tag_get($f_tag_select);
}
// failed to attach at least one tag
if (count($t_tags_failed) > 0) {
    html_page_top(lang_get('tag_attach_long') . ' ' . bug_format_summary($f_bug_id, SUMMARY_CAPTION));
    ?>
<br/>
<table class="width75">
	<tr class="row-category">
	<td colspan="2"><?php 
    echo lang_get('tag_attach_failed');
    ?>
</td>
	</tr>
	<tr class="spacer"><td colspan="2"></td></tr>
开发者ID:N0ctrnl,项目名称:mantisbt,代码行数:31,代码来源:tag_attach.php


示例12: save_tags

function save_tags($tag1, $tag2, $tag3, $uid, $lid, $cid)
{
    global $connection;
    $save = 0;
    // First checking if the tags already exist in the respective tables
    //category table
    $ctagarray = array();
    $utagarray = array();
    $i = 0;
    $j = 0;
    $tagscore = 0;
    if (!empty($tag1) && strlen($tag1) >= 3) {
        if (tag_exists($tag1, $cid, 0, "category") == 0) {
            $ctagarray[$i] = $tag1;
            $i += 1;
        }
        if (tag_exists($tag1, 0, $uid, "user") == 0) {
            $utagarray[$j] = $tag1;
            $j += 1;
        }
    }
    if (!empty($tag2 && strlen($tag2) >= 3)) {
        if (tag_exists($tag2, $cid, 0, "category") == 0) {
            $ctagarray[$i] = $tag2;
            $i += 1;
        }
        if (tag_exists($tag2, 0, $uid, "user") == 0) {
            $utagarray[$j] = $tag2;
            $j += 1;
        }
    }
    if (!empty($tag3 && strlen($tag3) >= 3)) {
        if (tag_exists($tag3, $cid, 0, "category") == 0) {
            $ctagarray[$i] = $tag3;
            $i += 1;
        }
        if (tag_exists($tag3, 0, $uid, "user") == 0) {
            $utagarray[$j] = $tag3;
            $j += 1;
        }
    }
    //print_r($ctagarray);
    //print_r($utagarray);
    //updating to category table
    if (!empty($ctagarray)) {
        //first fetch the existing tag string for this category and then append
        $query1 = "SELECT tags from category WHERE cid={$cid}";
        $result1 = mysqli_query($connection, $query1);
        confirm_query($result1);
        $row = mysqli_fetch_assoc($result1);
        if (!empty($row['tags'])) {
            $ctagstring = $row['tags'] . "," . implode(",", $ctagarray);
        } else {
            $ctagstring = implode(",", $ctagarray);
        }
        $query2 = "UPDATE category SET tags ='{$ctagstring}' WHERE cid={$cid}";
        //  echo "<br>".$query2;
        $result2 = mysqli_query($connection, $query2);
        confirm_query($result2);
        $save = 1;
    }
    if (!empty($utagarray)) {
        //first fetch teh existing tag cloud string for this user and then append
        $query3 = "SELECT tag_cloud from user WHERE uid={$uid}";
        $result3 = mysqli_query($connection, $query3);
        confirm_query($result3);
        $row = mysqli_fetch_assoc($result3);
        if (!empty($row['tag_cloud'])) {
            $utagstring = $row['tag_cloud'] . "," . implode(",", $utagarray);
        } else {
            $utagstring = implode(",", $utagarray);
        }
        $query4 = "UPDATE user SET tag_cloud ='{$utagstring}' WHERE uid={$uid}";
        //  echo "<br>".$query4;
        $result4 = mysqli_query($connection, $query4);
        confirm_query($result4);
        //update the user tag score
        $tagarray = explode(",", $utagstring);
        $tagscore = count($tagarray);
        $query5 = "UPDATE user_category_popularity SET u_tag_score = {$tagscore} WHERE uid = {$uid}";
        //  echo "scoring..".$query5;
        $result5 = mysqli_query($connection, $query5);
        confirm_query($result5);
        $save = 1;
    }
    if ($save == 1) {
        return "<br/><span class=\"label label-success\" style=\"font-size: 1.5em;\">Your tags are saved!</span>";
    }
    //need to update 3 tables after
    //user_category_popularity
}
开发者ID:GangaNitya,项目名称:VideoRecommender,代码行数:91,代码来源:functions.php


示例13: clean_chaser_id

    $runner_id = clean_chaser_id($_POST['runner_id']);
    $loc_lat = $_POST['latitude'];
    $loc_long = $_POST['longitude'];
    $loc_addr = $_POST['address'];
    if (empty($loc_lat)) {
        $loc_lat = 0;
    }
    if (empty($loc_long)) {
        $loc_long = 0;
    }
    print '<p><span style="color:red;">Chaser ' . get_runner_name($tagger_id) . '</span> tagged <span style="color:blue;">Runner ' . get_runner_name($runner_id) . '</span> at ' . $loc_lat . ',' . $loc_long . '.<br />';
    if (is_valid_runner($tagger_id) && is_valid_runner($runner_id)) {
        if (register_tag($tagger_id, $runner_id, $loc_lat, $loc_long, $loc_addr)) {
            print '<div style="font-size:14em;color:green;text-align: center;">&#10003;</div><h3>Your tag is checked in!</h3>';
        } else {
            if (tag_exists($tagger_id, $runner_id)) {
                print '<h3>You\'ve already tagged this runner!</h3><div style="font-size:14em;color:red;text-align: center;">X</div>';
            } else {
                print '<h3>Oops, something is broken</h3><div style="font-size:14em;color:red;text-align: center;">X</div>';
            }
        }
    } else {
        if (DEBUG) {
            print '<h3>Invalid tagger or runner</h3><div style="font-size:14em;color:red;text-align: center;">X</div>';
        }
    }
} else {
    ?>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script>
	navigator.geolocation.getCurrentPosition(foundLocation, noLocation);
开发者ID:rubin110,项目名称:journey-log-webapp,代码行数:31,代码来源:_tag.php


示例14: discussion_create

function discussion_create($options)
{
    /* Required info 
    			title
    			author
    			discussion_type
    			
    			category (A tag label)
    			Optional info
    			timestamp
    			owner (Mainly for group-discussions where the group owns the discussion and the user id is stored as author)
    			handle (This will be generated from the title if omitted)
    			parent_discussion
    			tags (Must be an array)
    			desired_quality (range -1 to +1)
    		*/
    $category = tag_exists($options['category']);
    if ($category['status'] != 'exists') {
        $category['id'] = 0;
    } else {
        $options['tags'][] = $options['category'];
    }
    $handle = isset($options['handle']) ? $options['handle'] : discussions_create_handle($options['title']);
    $timestamp = isset($options['timestamp']) ? $options['timestamp'] : time();
    $title = htmlspecialchars(shorten_string($options['title']));
    $query = 'INSERT INTO discussions (timestamp, author, owner, title, handle, discussion_type, parent_discussion, category_tag, desired_quality)';
    $query .= ' VALUES("' . $timestamp . '", "' . $options['author'] . '", "' . $options['owner'] . '", "' . $options['title'] . '"';
    $query .= ', "' . $handle . '", "' . $options['discussion_type'] . '", "' . $options['parent_discussion'] . '", "' . $category['id'] . '", "' . $options['desired_quality'] . '")';
    mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
    $discussion_id = mysql_insert_id();
    tag_set_wrap(array('tag_label' => $options['tags'], 'object_type' => 'discussion', 'item_id' => $discussion_id));
    unset($return);
    $return['id'] = $discussion_id;
    $return['handle'] = $handle;
    $return['category_handle'] = $category['handle'];
    return $return;
}
开发者ID:Razze,项目名称:hamsterpaj,代码行数:37,代码来源:discussions.php


示例15: create_hashtag

function create_hashtag($dbh, $tagname)
{
    $tagname = pg_escape_string($tagname);
    // check whether the tag exists
    $exists_tag = tag_exists($dbh, $tagname);
    if ($exists_tag["status"] == 0 || $exists_tag["exists"]) {
        return array("status" => 0);
    }
    $sql = pg_prepare($dbh, "create_hashtag", 'INSERT INTO hashtag
			VALUES ($1)');
    $sql = pg_execute($dbh, "create_hashtag", array($tagname));
    if ($sql) {
        return array("status" => 1);
    } else {
        return array("status" => 0);
    }
}
开发者ID:CodingDancerSky,项目名称:Courses,代码行数:17,代码来源:functions.php


示例16: print_filter_tag_string

/**
 * print tag fields
 * @return void
 */
function print_filter_tag_string()
{
    if (!access_has_global_level(config_get('tag_view_threshold'))) {
        return;
    }
    global $g_filter;
    $t_tag_string = $g_filter[FILTER_PROPERTY_TAG_STRING];
    if ($g_filter[FILTER_PROPERTY_TAG_SELECT] != 0 && tag_exists($g_filter[FILTER_PROPERTY_TAG_SELECT])) {
        $t_tag_string .= is_blank($t_tag_string) ? '' : config_get('tag_separator');
        $t_tag_string .= tag_get_field($g_filter[FILTER_PROPERTY_TAG_SELECT], 'name');
    }
    ?>
		<input type="hidden" id="tag_separator" value="<?php 
    echo config_get('tag_separator');
    ?>
" />
		<input type="text" name="<?php 
    echo FILTER_PROPERTY_TAG_STRING;
    ?>
" id="<?php 
    echo FILTER_PROPERTY_TAG_STRING;
    ?>
" size="40" value="<?php 
    echo string_attribute($t_tag_string);
    ?>
" />
		<select <?php 
    echo helper_get_tab_index();
    ?>
 name="<?php 
    echo FILTER_PROPERTY_TAG_SELECT;
    ?>
" id="<?php 
    echo FILTER_PROPERTY_TAG_SELECT;
    ?>
">
			<?php 
    print_tag_option_list();
    ?>
		</select>
		<?php 
}
开发者ID:vipjaven,项目名称:mantisbt,代码行数:46,代码来源:filter_api.php


示例17: tag_update_name

/**
 * Function that updates tags names.
 * Updates only if the new name suggested for a tag doesn´t exist already.
 *
 * @param Array $tags_names_changed array of new tag names indexed by tag ids.
 * @return Array array of tags names that were effectively updated, indexed by tag ids.
 */
function tag_update_name($tags_names_changed)
{
    $tags_names_updated = array();
    foreach ($tags_names_changed as $id => $newname) {
        $norm_newname = tag_normalize($newname);
        if (!tag_exists($norm_newname) && is_tag_name_valid($norm_newname)) {
            $tag = tag_by_id($id);
            $tags_names_updated[$id] = $tag->name;
            // rawname keeps the original casing of the string
            $tag->rawname = tag_normalize($newname, false);
            // name lowercases the string
            $tag->name = $norm_newname;
            $tag->timemodified = time();
            update_record('tag', $tag);
        }
    }
    return $tags_names_updated;
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:25,代码来源:lib.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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