本文整理汇总了PHP中Tag::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::get方法的具体用法?PHP Tag::get怎么用?PHP Tag::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tag
的用法示例。
在下文中一共展示了Tag::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Tag
function test_should_store_zero_strings_as_intergers()
{
$Tag = new Tag(array('name' => 'Ticket #21'));
$this->assertTrue($Tag->save());
$this->assertEqual($Tag->get('score'), 100);
$Tag->setAttributes(array('score' => '0'));
$this->assertTrue($Tag->save());
$Tag =& $Tag->find($Tag->id);
$this->assertIdentical($Tag->get('score'), 0);
}
示例2: allPagesToCache
public function allPagesToCache()
{
// Get each page type to define its sub-urls
$urls = array();
// memory intensive depending on number of pages
$pages = SiteTree::get()->where("ClassName != 'BlogEntry'");
//remove Blog pages from cache due to Form SecurityID issue
foreach ($pages as $page) {
array_push($urls, $page->Link());
if ($page->ClassName == 'ProjectPage') {
//add ajax pages for each projectpage
array_push($urls, $page->Link() . 'ajax');
}
}
//add tag pages
$tags = Tag::get()->filter(array('HasTagPage' => 1));
foreach ($tags as $tag) {
array_push($urls, '/tag/' . $tag->Slug);
}
//add location pages
$locations = Location::get();
foreach ($locations as $location) {
array_push($urls, '/location/' . $location->Slug);
}
return $urls;
}
示例3: getCMSFields
public function getCMSFields()
{
$fields = FieldList::create(TabSet::create('Root'))->text('Title')->text('Code', 'Code', '', 5)->textarea('Description')->numeric('SessionCount', 'Number of sessions')->numeric('AlternateCount', 'Number of alternates')->checkbox('VotingVisible', "This category is visible to voters")->checkbox('ChairVisible', "This category is visible to track chairs")->hidden('SummitID', 'SummitID');
if ($this->ID > 0) {
//tags
$config = new GridFieldConfig_RelationEditor(100);
$config->removeComponentsByType(new GridFieldDataColumns());
$config->removeComponentsByType(new GridFieldDetailForm());
$completer = $config->getComponentByType('GridFieldAddExistingAutocompleter');
$completer->setResultsFormat('$Tag');
$completer->setSearchFields(array('Tag'));
$completer->setSearchList(Tag::get());
$editconf = new GridFieldDetailForm();
$editconf->setFields(FieldList::create(TextField::create('Tag', 'Tag'), DropdownField::create('ManyMany[Group]', 'Group', array('topics' => 'Topics', 'speaker' => 'Speaker', 'openstack projects mentioned' => 'OpenStack Projects Mentioned'))));
$summaryfieldsconf = new GridFieldDataColumns();
$summaryfieldsconf->setDisplayFields(array('Tag' => 'Tag', 'Group' => 'Group'));
$config->addComponent($editconf);
$config->addComponent($summaryfieldsconf, new GridFieldFilterHeader());
$tags = new GridField('AllowedTags', 'Tags', $this->AllowedTags(), $config);
$fields->addFieldToTab('Root.Main', $tags);
// extra questions for call-for-presentations
$config = new GridFieldConfig_RelationEditor();
$config->removeComponentsByType('GridFieldAddNewButton');
$multi_class_selector = new GridFieldAddNewMultiClass();
$multi_class_selector->setClasses(array('TrackTextBoxQuestionTemplate' => 'TextBox', 'TrackCheckBoxQuestionTemplate' => 'CheckBox', 'TrackCheckBoxListQuestionTemplate' => 'CheckBoxList', 'TrackRadioButtonListQuestionTemplate' => 'RadioButtonList', 'TrackDropDownQuestionTemplate' => 'ComboBox', 'TrackLiteralContentQuestionTemplate' => 'Literal'));
$config->addComponent($multi_class_selector);
$questions = new GridField('ExtraQuestions', 'Track Specific Questions', $this->ExtraQuestions(), $config);
$fields->addFieldToTab('Root.Main', $questions);
}
return $fields;
}
示例4: __str__
protected function __str__()
{
if ($this->none()) {
return "";
}
$result = new Tag("content");
foreach ($this->access_members() as $name => $value) {
if (!empty($value)) {
switch ($name) {
case "type":
case "mode":
$result->param($name, $value);
break;
case "lang":
case "base":
$result->param("xml:" . $name, $value);
break;
case "value":
$result->value($value);
break;
}
}
}
return $result->get();
}
示例5: test_get_tag
public function test_get_tag()
{
$this->tag->insert();
$t = Tag::get($this->text);
$this->assertEquals($t->tag_text, $this->tag->tag_text);
$t->delete();
}
示例6: post_diary
public function post_diary($title, $summary)
{
$tag = new Tag("entry");
$tag->param("xmlns", "http://www.w3.org/2007/app");
$tag->add(new Tag("title", $title));
$tag->add(new Tag("summary", $summary));
$this->raw($tag->get("utf-8"));
$this->do_post("http://mixi.jp/atom/diary/member_id=" . $this->member_id);
}
示例7: getPresentationFields
protected function getPresentationFields()
{
$categorySource = Summit::get_active()->Categories()->map('ID', 'FormattedTitleAndDescription')->toArray();
$categorySource['other'] = '<h4 class="category-label">Other topic...</h4>';
$fields = FieldList::create()->text('Title', 'Proposed Presentation Title')->configure()->setAttribute('autofocus', 'TRUE')->end()->dropdown('Level', 'Please select the level of your presentation content')->configure()->setEmptyString('-- Select one --')->setSource(Presentation::create()->dbObject('Level')->enumValues())->end()->tinyMCEEditor('Description', 'Abstract')->configure()->setRows(20)->end()->literal('ShortDescriptionHelp', '<hr/><p>YouTube and other services limit the length of your presentation\'s description. Please provide a shorter, YouTube-friendly summary below.</p>')->literal('ShortDescriptionWordCount', '<p id="word-count"></p>')->tinyMCEEditor('ShortDescription', 'Short Description (450 Word Max)')->configure()->setRows(7)->setWordCount(450)->end()->literal('HR', '<hr/>')->optionset('CategoryID', 'What is the general topic of the presentation?')->configure()->setSource($categorySource)->end()->text('OtherTopic', 'Other topic (if one above does not match)')->configure()->displayIf('CategoryID')->isEqualTo('other')->end()->end()->literal('TagHelp', '<p>You can optionally add tags help attendees find presentations that interest them. Examples: <i>nova, ubuntu, ldap.</i></p>')->bootstrapTag('Tags', 'Presentation Tags (Optional)')->configure()->setLabelField('Tag')->setSource(Tag::get())->setPrefetch(Tag::get()->leftJoin('Presentation_Tags', 'TagID = Tag.ID')->sort('COUNT(Tag.ID)', 'DESC')->limit(10)->alterDataQuery(function ($query) {
$query->groupby('Tag.ID');
}))->setFreeInput(true)->end();
return $fields;
}
示例8: getCMSFields
public function getCMSFields()
{
$fields = FieldList::create(TabSet::create('Root'));
if ($this->SchedID) {
return $fields->tab('SchedData')->readonly('Title')->readonly('Description')->readonly('EventStart')->readonly('EventEnd')->readonly('EventKey')->readonly('EventType')->readonly('Goers')->readonly('SchedID')->readonly('InviteOnly')->readonly('Seats')->readonly('Venue')->readonly('VenueID')->tab('EditableData')->checkbox('DisplayOnSite')->text('YouTubeID')->dropdown('CategoryID', 'Category', PresentationCategory::get()->map('ID', 'Title'))->listbox('PresentationSpeakers')->configure()->setSource(PresentationSpeaker::get()->map('ID', 'Title')->toArray())->setMultiple(true)->end()->imageUpload('VideoThumbnail')->upload('RelatedMedia')->tag('Tags', 'Tags', Tag::get(), $this->Tags());
} else {
return $fields->text('Title')->dropdown('CategoryID', 'Category', PresentationCategory::get()->map('ID', 'Title'))->tag('Tags', 'Tags', Tag::get(), $this->Tags())->date('EventStart')->configure()->setConfig('showcalendar', true)->end()->date('EventEnd')->configure()->setConfig('showcalendar', true)->end()->htmlEditor('Description')->checkbox('InviteOnly')->numeric('Seats')->text('Venue')->text('YouTubeID')->imageUpload('VideoThumbnail')->upload('RelatedMedia')->checkbox('DisplayOnSite');
}
}
示例9: registerTags
/**
* @param string[] $tags
* @return void
*/
public function registerTags($tags)
{
$tags = explode(',', $tags);
foreach ($tags as $tag_name) {
$tag = Tag::get("Tag", "Tag = '" . $tag_name . "'")->first();
if (!$tag) {
$tag = new Tag();
$tag->Tag = $tag_name;
$tag->write();
}
$this->addTag($tag);
}
}
示例10: __str__
protected function __str__()
{
$result = new Tag("source");
foreach ($this->access_members() as $name => $value) {
if (!empty($value)) {
switch ($name) {
case "url":
case "value":
$result->param($name, $value);
break;
}
}
}
return $result->get();
}
示例11: new_recipe
public function new_recipe() {
// Get data
$tag = new Tag();
$data['page_title'] = "- Create a Recipe";
$data['tags'] = $tag->get()->all;
// Header
$this->load->view("header", $data);
// Body of page
$this->load->view('recipes/new_recipe');
// Footer
$this->load->view('footer');
}
示例12: saveInto
public function saveInto(DataObjectInterface $record)
{
if ($this->name) {
$tags = explode(',', $this->dataValue());
if (!$record instanceof SummitEvent) {
return;
}
$record->Tags()->removeAll();
foreach ($tags as $t) {
$tag = Tag::get()->filter('Tag', $t)->first();
if (is_null($tag)) {
$tag = Tag::create(array('Tag' => $t));
$tag->write();
}
$record->Tags()->add($tag);
}
}
}
示例13: __str__
protected function __str__()
{
if ($this->none()) {
return "";
}
$result = new Tag("link");
foreach ($this->access_members() as $name => $value) {
if (!empty($value)) {
switch ($name) {
case "href":
case "rel":
case "type":
$result->param($name, $value);
break;
}
}
}
return $result->get();
}
示例14: __str__
protected function __str__()
{
if ($this->none()) {
return "";
}
$result = new Tag("author");
foreach ($this->access_members() as $name => $value) {
if (!empty($value)) {
switch ($name) {
case "name":
case "url":
case "email":
$result->add(new Tag($name, $value));
$bool = true;
break;
}
}
}
return $result->get();
}
示例15: sourceRecords
/**
* Setup the list of records to show.
* @param type $params array of filter-rules.
* @param type $sort
* @param type $limit
* @return \ArrayList with the records.
*/
public function sourceRecords($params, $sort, $limit)
{
if ($sort) {
$parts = explode(' ', $sort);
$field = $parts[0];
$direction = $parts[1];
}
$where = null;
if (isset($params['Title']) && $params['Title'] != '') {
$where = 'Title LIKE \'%' . $params['Title'] . '%\'';
}
$ret = Tag::get()->where($where);
$returnSet = new ArrayList();
if ($ret) {
foreach ($ret as $record) {
$record->Itemcount = $record->News()->count();
$returnSet->push($record);
}
}
return $returnSet;
}