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


PHP Tag::setName方法代码示例

本文整理汇总了PHP中Tag::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::setName方法的具体用法?PHP Tag::setName怎么用?PHP Tag::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tag的用法示例。


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

示例1: newTag

 /**
  * @param sfGuardUser $user
  * @param integer $element_id
  * @param string $name
  * @param string $type
  */
 public static function newTag($user, $element_id, $name, $type)
 {
     $tag = TagTable::getInstance()->findOneByNameAndUserId($name, $user->id);
     if (!$tag) {
         $tag = new Tag();
         $tag->setName(substr($name, 0, self::MAX_LENGTH));
         $tag->setUserId($user->id);
         $tag->save();
     }
     if ($type == 'decision') {
         $tagDecision = new TagDecision();
         $tagDecision->setDecisionId($element_id);
         $tagDecision->setTagId($tag->id);
         $tagDecision->save();
     } else {
         if ($type == 'release') {
             $tagRelease = new TagRelease();
             $tagRelease->setReleaseId($element_id);
             $tagRelease->setTagId($tag->id);
             $tagRelease->save();
         } else {
             $tagAlternative = new TagAlternative();
             $tagAlternative->setAlternativeId($element_id);
             $tagAlternative->setTagId($tag->id);
             $tagAlternative->save();
             Doctrine_Query::create()->delete('Graph')->where('decision_id = ?', $tagAlternative->Alternative->decision_id)->execute();
         }
     }
     return;
 }
开发者ID:sensorsix,项目名称:app,代码行数:36,代码来源:Tag.class.php

示例2: executeTag

 public function executeTag()
 {
     $this->forwardUnless($this->getUser()->getBlog()->getApproved(), 'ucp', 'index');
     if ($this->getRequest()->getMethod() == sfRequest::POST) {
         $tag = new Tag();
         $tag->setName(Tag::tagize($this->getRequestParameter('name')));
         $tag->save();
         $this->setFlash('updated', 'Tag został zgłoszony do dodania.');
         return $this->redirect('ucp/index');
     }
 }
开发者ID:noose,项目名称:Planeta,代码行数:11,代码来源:actions.class.php

示例3: createFromResponse

 public static function createFromResponse(\SimpleXMLElement $response)
 {
     $tag = new Tag();
     $tag->setName((string) $response->name);
     $tag->setCount((int) $response->count);
     $tag->setUrl((string) $response->url);
     $tag->setReach((int) $response->reach);
     $tag->setTaggings((int) $response->taggings);
     $tag->setStreamable((int) $response->streamable);
     $tag->setPublished((string) $response->wiki->published);
     $tag->setSummary((string) $response->wiki->summary);
     $tag->setContent((string) $response->wiki->content);
     return $tag;
 }
开发者ID:kyaroslav,项目名称:BinaryThinkingLastfmBundle,代码行数:14,代码来源:Tag.php

示例4: saveTag

 public function saveTag($tag, $foreignId, $foreignTable, $memberId, $communityId = null)
 {
     if ($tag != "") {
         $obj = $this->createQuery()->where("member_id=?", $memberId)->addWhere("foreign_table=?", $foreignTable)->addWhere("foreign_id=?", $foreignId)->addWhere("name=?", $tag)->fetchOne();
         if (!$obj) {
             $obj = new Tag();
             $obj->setMemberId($memberId);
             if ($communityId) {
                 $obj->setCommunityId($communityId);
             }
             $obj->setForeignTable($foreignTable);
             $obj->setForeignId($foreignId);
             $obj->setName($tag);
             $obj->save();
         }
     }
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:17,代码来源:PluginTagTable.class.php

示例5: getForCloud

 public static function getForCloud()
 {
     $connection = Propel::getConnection(self::DATABASE_NAME);
     $query = 'SELECT %5$s as name, COUNT(%3$s) AS count FROM `%1$s` ';
     $query .= 'LEFT JOIN `%2$s` ON %3$s = %4$s GROUP BY %4$s ORDER BY %5$s ASC';
     $query = sprintf($query, self::TABLE_NAME, PostTagPeer::TABLE_NAME, PostTagPeer::TAG_ID, self::ID, self::NAME);
     $statement = $connection->prepareStatement($query);
     $rs = $statement->executeQuery();
     $tags = array();
     while ($rs->next()) {
         $tag = new Tag();
         $tag->setName($rs->getString('name'));
         $tag->setCount($rs->getInt('count'));
         $tags[] = $tag;
     }
     return $tags;
 }
开发者ID:noose,项目名称:Planeta,代码行数:17,代码来源:TagPeer.php

示例6: newTagInstance

 public static function newTagInstance($sTagName, $sModelName, $iTaggedItemId)
 {
     $sTagName = StringUtil::normalize($sTagName);
     $oTag = TagPeer::retrieveByName($sTagName);
     if ($oTag === null) {
         $oTag = new Tag();
         $oTag->setName($sTagName);
         $oTag->save();
     }
     $oTagInstance = self::retrieveByPK($oTag->getId(), $iTaggedItemId, $sModelName);
     if ($oTagInstance !== null) {
         throw new Exception("Instance of this tag does already exist");
     }
     $oTagInstance = new TagInstance();
     $oTagInstance->setTag($oTag);
     $oTagInstance->setModelName($sModelName);
     $oTagInstance->setTaggedItemId($iTaggedItemId);
     $oTagInstance->save();
     return $oTagInstance;
 }
开发者ID:rapila,项目名称:cms-base,代码行数:20,代码来源:TagInstancePeer.php

示例7: realpath

# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
require realpath(dirname(__FILE__)) . '/../../../common/Loader.php';
require realpath(dirname(__FILE__)) . '/../Html.php';
// Instantiate the HTML module
$html = new HtmlModule($pakiti);
/* TEMPORARY SENT FORM */
if (Utils::getHttpPostVar("tag-create-form") == "sent") {
    $cveName = Utils::getHttpPostVar("cve-name");
    $tagName = Utils::getHttpPostVar("cve-tag");
    $tagReason = Utils::getHttpPostVar("tag-reason");
    $tag = new Tag();
    $tag->setName($tagName);
    $tag->setReason($tagReason);
    $cves = $pakiti->getManager("CveDefsManager")->getCvesByName($cveName);
    try {
        foreach ($cves as $cve) {
            $pakiti->getManager("TagsManager")->assignTagToCve($cve, $tag);
        }
        $html->setMessage(sprintf("Tag %s has been associated to %s.", $tagName, $cveName));
    } catch (Exception $e) {
        $html->setMessage(sprintf("%s", $e->getMessage()));
    }
}
$html->addHtmlAttribute("title", "CVE Tags overview");
$html->printHeader();
$cveNames = $pakiti->getManager("CveDefsManager")->getCveNames();
$cvesWithTags = $pakiti->getManager("CveDefsManager")->getCvesWithTags();
开发者ID:basvandervlies,项目名称:pakiti3,代码行数:31,代码来源:cve_tags.php

示例8: addTagTo

 /**
  * Add a tag to the Page given by the id
  */
 public static function addTagTo($sPageId, $mTag)
 {
     if ($mTag instanceof TagInstance) {
         $mTag = $mTag->getTag();
     }
     if ($mTag instanceof Tag) {
         $mTag = $mTag->getName();
     }
     $sTagName = StringUtil::normalize($mTag);
     $oTag = TagQuery::create()->findOneByName($sTagName);
     if ($oTag === null) {
         $oTag = new Tag();
         $oTag->setName($sTagName);
         $oTag->save();
     }
     $oTagInstance = TagInstanceQuery::create()->findPk(array($oTag->getId(), $sPageId, "Page"));
     if ($oTagInstance !== null) {
         return $oTagInstance;
     }
     $oTagInstance = new TagInstance();
     $oTagInstance->setTag($oTag);
     $oTagInstance->setModelName("Page");
     $oTagInstance->setTaggedItemId($sPageId);
     $oTagInstance->save();
     return $oTagInstance;
 }
开发者ID:rapila,项目名称:cms-base,代码行数:29,代码来源:BasePage.php

示例9: onCheckNewTag

 protected function onCheckNewTag($data)
 {
     $tag = new Tag();
     $tag->setName($data['tag']);
     $tag->saveIfNotExist();
 }
开发者ID:reedboat,项目名称:TagProject,代码行数:6,代码来源:ArticleTags.inc.php

示例10: retrieveOrCreateByTagname

 /**
  * Retrieves a tag by his name. If it does not exist, creates it (but does not
  * save it)
  *
  * @param      String      $tagname
  * @return     Tag
  */
 public static function retrieveOrCreateByTagname($tagname)
 {
     // retrieve or create the tag
     $tag = TagPeer::retrieveByTagName($tagname);
     if (!$tag) {
         $tag = new Tag();
         $tag->setName($tagname);
         $triple = sfPropelActAsTaggableToolkit::extractTriple($tagname);
         list($tagname, $triple_namespace, $triple_key, $triple_value) = $triple;
         $tag->setTripleNamespace($triple_namespace);
         $tag->setTripleKey($triple_key);
         $tag->setTripleValue($triple_value);
         $tag->setIsTriple(!is_null($triple_namespace));
     }
     return $tag;
 }
开发者ID:adatta02,项目名称:comp190-code,代码行数:23,代码来源:TagPeer.php

示例11: executeUpdate

 public function executeUpdate()
 {
     $id = $this->getRequestParameter('id');
     if (!$id) {
         $snippet = new Snippet();
     } else {
         $snippet = SnippetPeer::retrieveByPk($id);
         $this->forward404Unless($snippet);
         if ($snippet->getUserId() != $this->getUser()->getGuardUser()->getId()) {
             $this->forward('default', 'secure');
         }
         foreach ($snippet->getTags() as $tag) {
             $tag->delete();
         }
         $snippet = SnippetPeer::retrieveByPk($id);
     }
     if ($this->getUser()->isAuthenticated()) {
         $snippet->setUserId($this->getUser()->getGuardUser()->getId());
     } else {
         $snippet->setName($this->getRequestParameter('name'));
         $snippet->setEmail($this->getRequestParameter('email'));
     }
     $snippet->setTitle($this->getRequestParameter('title'));
     $snippet->setRawBody($this->getRequestParameter('raw_body'));
     $snippet->setBody(null);
     $tag_names = explode(',', $this->getRequestParameter('tags'));
     foreach ($tag_names as $tag_name) {
         if (!($tag_name = strtolower(trim($tag_name)))) {
             continue;
         }
         $tag = new Tag();
         $tag->setName($tag_name);
         $snippet->addTag($tag);
     }
     if ($this->getUser()->hasGroup('EDITOR')) {
         if ($this->getRequestParameter('managed_content')) {
             $snippet->setManagedContent(1);
         } else {
             $snippet->setManagedContent(0);
         }
     }
     $draft = $this->getRequestParameter('draft');
     if (!isset($draft)) {
         $snippet->setDraft(false);
     } else {
         $snippet->setDraft($draft);
     }
     $snippet->save();
     return $this->redirect('snippet/show?id=' . $snippet->getFriendlyUrl());
 }
开发者ID:hoydaa,项目名称:snippets.hoydaa.org,代码行数:50,代码来源:actions.class.php

示例12: HandleTags

 /**
  * Handles
  * a) the adding of new Tags to the database,
  * b) the deleting of all existing Tag2All for this Model|Set|Image|Video and
  * c) inserting the appropriate Tag2All records for this Model|Set|Image|Video
  * @param array(string) $newTags
  * @param array(Tag2All) $Tag2AllsThisItem
  * @param array(Tag) $TagsInDB, passed by reference
  * @param User $CurrentUser
  * @param int $ModelID
  * @param int $SetID
  * @param int $ImageID
  * @param int $VideoID
  * @param bool $DeleteOldTag2Alls determines whether to delete or merge existing Tag2Alls
  */
 public static function HandleTags($newTags, $Tag2AllsThisItem, &$TagsInDB, $CurrentUser, $ModelID = NULL, $SetID = NULL, $ImageID = NULL, $VideoID = NULL, $DeleteOldTag2Alls = TRUE)
 {
     global $db;
     foreach (array_unique($newTags) as $string) {
         $tInDB = Tag::Filter($TagsInDB, NULL, $string);
         if (!$tInDB) {
             $tNew = new Tag();
             $tNew->setName(trim($string));
             if (Tag::Insert($tNew, $CurrentUser)) {
                 $TagsInDB[] = $tNew;
             }
         }
     }
     if ($DeleteOldTag2Alls) {
         self::DeleteMulti($Tag2AllsThisItem, $CurrentUser);
     }
     foreach (array_unique($newTags) as $string) {
         $tInDB = Tag::Filter($TagsInDB, NULL, $string);
         if (!$DeleteOldTag2Alls) {
             $ttits = self::Filter($Tag2AllsThisItem, $tInDB[0]->getID(), $ModelID, $SetID, $ImageID, $VideoID);
             if ($ttits) {
                 continue;
             }
         }
         $t2a = new Tag2All();
         $t2a->setTag($tInDB[0]);
         if (!is_null($ModelID)) {
             $t2a->setModelID($ModelID);
         }
         if (!is_null($SetID)) {
             $t2a->setSetID($SetID);
         }
         if (!is_null($ImageID)) {
             $t2a->setImageID($ImageID);
         }
         if (!is_null($VideoID)) {
             $t2a->setVideoID($VideoID);
         }
         if ($t2a->getModelID() || $t2a->getSetID() || $t2a->getImageID() || $t2a->getVideoID()) {
             Tag2All::Insert($t2a, $CurrentUser);
         }
     }
 }
开发者ID:laiello,项目名称:candydolldb,代码行数:58,代码来源:class.tag2all.php

示例13: assignTagToCve

 public function assignTagToCve(Cve &$cve, Tag &$tag)
 {
     if ($cve == null || $cve->getId() == -1 || $tag == null) {
         Utils::log(LOG_DEBUG, "Exception", __FILE__, __LINE__);
         throw new Exception("Cve object is not valid or Cve.id is not set");
     }
     # Check if the tag name is valid
     if ($tag->getName() == "") {
         $tag->setName(Constants::$NA);
     }
     $tagId = $this->getTagIdByName($tag->getName());
     if ($tagId == -1) {
         $this->getPakiti()->getDao("Tag")->create($tag);
     } else {
         $tag->setId($tagId);
     }
     Utils::log(LOG_DEBUG, "Assinging the tag to the cve [cveId=" . $cve->getId() . ",tag=" . $tag->getName() . "]", __FILE__, __LINE__);
     # Check if the already assigned
     $isAssigned = $this->getPakiti()->getManager("DbManager")->queryToSingleValue("select 1 from CveTag where\n      \t \t\tcveId=" . $this->getPakiti()->getManager("DbManager")->escape($cve->getId()) . " and\n      \t \t\ttagId=" . $this->getPakiti()->getManager("DbManager")->escape($tag->getId()));
     if ($isAssigned != null) {
         throw new Exception($cve->getName() . " is already associated with " . $tag->getName() . " tag!");
     } else {
         # Association between cve and cveTag doesn't exist, so create it
         $this->getPakiti()->getManager("DbManager")->query("\n      \t\tinsert into CveTag set\n      \t\t\tcveId=" . $this->getPakiti()->getManager("DbManager")->escape($cve->getId()) . ",\n      \t \t\ttagId=" . $this->getPakiti()->getManager("DbManager")->escape($tag->getId()) . ",\n      \t \t\t`reason`='" . $this->getPakiti()->getManager("DbManager")->escape($tag->getReason()) . "'");
     }
 }
开发者ID:basvandervlies,项目名称:pakiti3,代码行数:26,代码来源:TagsManager.php

示例14: edit

 /**
  * @param Tag $tag
  * @param $values
  * @return Tag
  */
 protected function edit(Tag $tag, $values)
 {
     $tag->setName($values->name)->setSlug($values->slug);
     $this->tagFacade->save($tag);
     return $tag;
 }
开发者ID:flame-cms,项目名称:post-bundle,代码行数:11,代码来源:TagManager.php

示例15: prepareReport

 public function prepareReport()
 {
     Utils::log(LOG_DEBUG, "Preparing the report", __FILE__, __LINE__);
     $tag = null;
     $hostGroup = null;
     switch ($this->_version) {
         case "4":
             Utils::log(LOG_DEBUG, "Client in version 4", __FILE__, __LINE__);
             # Get the rest of HTTP variables
             # host, os, arch, kernel, site, version, type, pkgs
             $this->_host->setOsName($this->_report_os);
             $this->_host->setArchName($this->_report_arch);
             $this->_host->setKernel($this->_report_kernel);
             $this->_host->setType($this->_report_type);
             break;
         case "cern_1":
             Utils::log(LOG_DEBUG, "Client in version CERN 1", __FILE__, __LINE__);
             # Get the rest of HTTP variables
             # host, os, arch, kernel, site, version, type, pkgs
             $this->_host->setOsName($this->_report_os);
             $this->_host->setArchName($this->_report_arch);
             $this->_host->setKernel($this->_report_kernel);
             $this->_host->setType($this->_report_type);
             break;
     }
     # Parse the packages list
     $this->_pkgs = $this->parsePkgs($this->_report_pkgs);
     # Set the initial information about the report
     $this->_report->setReceivedOn(time());
     # Get the host object from the DB, if the host doesn't exist in the DB, this routine will create it
     $this->_host = $this->getPakiti()->getManager("HostsManager")->getHostFromReport($this->_host, $this->_pkgs);
     # Get the host group
     $hostGroup = new HostGroup();
     $hostGroup->setName($this->_report_site);
     # If the host is already member of the host group, no operation is done
     $this->getPakiti()->getManager("HostGroupsManager")->assignHostToHostGroup($this->_host, $hostGroup);
     # Get the host tag and assign it to the host
     $tag = new Tag();
     $tag->setName($this->_report_tag);
     # If the tag is already assigned, no operation is done
     $this->getPakiti()->getManager("TagsManager")->assignTagToHost($this->_host, $tag);
     $this->_report->setNumOfInstalledPkgs(sizeof($this->_pkgs));
 }
开发者ID:basvandervlies,项目名称:pakiti3,代码行数:43,代码来源:FeederModule.php


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