本文整理汇总了PHP中tag_get_related_tags_csv函数的典型用法代码示例。如果您正苦于以下问题:PHP tag_get_related_tags_csv函数的具体用法?PHP tag_get_related_tags_csv怎么用?PHP tag_get_related_tags_csv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tag_get_related_tags_csv函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_content
function get_content()
{
global $CFG, $USER;
//note: do NOT include files at the top of this file
require_once $CFG->dirroot . '/tag/lib.php';
require_once $CFG->libdir . '/filelib.php';
if ($this->content !== NULL) {
return $this->content;
}
$tagid = optional_param('id', 0, PARAM_INT);
// tag id - for backware compatibility
$tag = optional_param('tag', '', PARAM_TAG);
// tag
if ($tag) {
$tagobject = tag_get('name', $tag);
} else {
if ($tagid) {
$tagobject = tag_get('id', $tagid);
}
}
if (empty($tagobject)) {
$this->content = new stdClass();
$this->content->text = '';
$this->content->footer = '';
return $this->content;
}
//include related tags in the photo query ?
$tagscsv = $tagobject->name;
if (!empty($this->config->includerelatedtags)) {
$tagscsv .= ',' . tag_get_related_tags_csv(tag_get_related_tags($tagobject->id), TAG_RETURN_TEXT);
}
$tagscsv = urlencode($tagscsv);
//number of photos to display
$numberofphotos = DEFAULT_NUMBER_OF_PHOTOS;
if (!empty($this->config->numberofphotos)) {
$numberofphotos = $this->config->numberofphotos;
}
//sort search results by
$sortby = 'relevance';
if (!empty($this->config->sortby)) {
$sortby = $this->config->sortby;
}
//pull photos from a specific photoset
if (!empty($this->config->photoset)) {
$request = 'http://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos';
$request .= '&api_key=' . FLICKR_DEV_KEY;
$request .= '&photoset_id=' . $this->config->photoset;
$request .= '&per_page=' . $numberofphotos;
$request .= '&format=php_serial';
$response = $this->fetch_request($request);
$search = unserialize($response);
foreach ($search['photoset']['photo'] as $p) {
$p['owner'] = $search['photoset']['owner'];
}
$photos = array_values($search['photoset']['photo']);
} else {
$request = 'http://api.flickr.com/services/rest/?method=flickr.photos.search';
$request .= '&api_key=' . FLICKR_DEV_KEY;
$request .= '&tags=' . $tagscsv;
$request .= '&per_page=' . $numberofphotos;
$request .= '&sort=' . $sortby;
$request .= '&format=php_serial';
$response = $this->fetch_request($request);
$search = unserialize($response);
$photos = array_values($search['photos']['photo']);
}
if (strcmp($search['stat'], 'ok') != 0) {
return;
}
//if no results were returned, exit...
//Accessibility: render the list of photos
$text = '<ul class="inline-list">';
foreach ($photos as $photo) {
$text .= '<li><a href="http://www.flickr.com/photos/' . $photo['owner'] . '/' . $photo['id'] . '/" title="' . s($photo['title']) . '">';
$text .= '<img alt="' . s($photo['title']) . '" class="flickr-photos" src="' . $this->build_photo_url($photo, 'square') . "\" /></a></li>\n";
}
$text .= "</ul>\n";
$this->content = new stdClass();
$this->content->text = $text;
$this->content->footer = '';
return $this->content;
}
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:82,代码来源:block_tag_flickr.php
示例2: tag_print_description_box
/**
* Prints a box with the description of a tag and its related tags
*
* @package core_tag
* @access public
* @todo MDL-31149 create a system setting for $max_tags_displayed, instead of using an in code literal
* @param stdClass $tag_object
* @param bool $return if true the function will return the generated tag cloud instead of displaying it.
* @return string/null a HTML box showing a description of the tag object and it's relationsips or null if output is done directly
* in the function.
*/
function tag_print_description_box($tag_object, $return = false)
{
global $USER, $CFG, $OUTPUT;
$max_tags_displayed = 10;
$tagname = tag_display_name($tag_object);
$related_tags = tag_get_related_tags($tag_object->id, TAG_RELATED_ALL, $max_tags_displayed + 1);
// this gets one more than we want
$content = !empty($tag_object->description) || $related_tags;
$output = '';
if ($content) {
$output .= $OUTPUT->box_start('generalbox', 'tag-description');
}
if (!empty($tag_object->description)) {
$options = new stdClass();
$options->para = false;
$options->overflowdiv = true;
$tag_object->description = file_rewrite_pluginfile_urls($tag_object->description, 'pluginfile.php', get_context_instance(CONTEXT_SYSTEM)->id, 'tag', 'description', $tag_object->id);
$output .= format_text($tag_object->description, $tag_object->descriptionformat, $options);
}
if ($related_tags) {
$more_links = false;
if (count($related_tags) > $max_tags_displayed) {
array_pop($related_tags);
$more_links = true;
}
$output .= '<br /><br /><strong>' . get_string('relatedtags', 'tag') . ': </strong>' . tag_get_related_tags_csv($related_tags);
if ($more_links) {
$output .= ' ...';
}
}
if ($content) {
$output .= $OUTPUT->box_end();
}
if ($return) {
return $output;
} else {
echo $output;
}
}
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:50,代码来源:locallib.php
示例3: tag_print_description_box
/**
* Prints a box with the description of a tag and its related tags
*
* @param unknown_type $tag_object
* @param $return if true return html string
*/
function tag_print_description_box($tag_object, $return = false)
{
global $USER, $CFG;
$max_tags_displayed = 10;
// todo: turn this into a system setting
$tagname = tag_display_name($tag_object);
$related_tags = tag_get_related_tags($tag_object->id, TAG_RELATED_ALL, $max_tags_displayed + 1);
// this gets one more than we want
$content = !empty($tag_object->description) || $related_tags;
$output = '';
if ($content) {
$output .= print_box_start('generalbox', 'tag-description', true);
}
if (!empty($tag_object->description)) {
$options = new object();
$options->para = false;
$output .= format_text($tag_object->description, $tag_object->descriptionformat, $options);
}
if ($related_tags) {
$more_links = false;
if (count($related_tags) > $max_tags_displayed) {
array_pop($related_tags);
$more_links = true;
}
$output .= '<br /><br /><strong>' . get_string('relatedtags', 'tag') . ': </strong>' . tag_get_related_tags_csv($related_tags);
if ($more_links) {
$output .= ' ...';
}
}
if ($content) {
$output .= print_box_end(true);
}
if ($return) {
return $output;
} else {
echo $output;
}
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:44,代码来源:locallib.php
示例4: tag_get
} else {
if ($tag_id) {
$tag = tag_get('id', $tag_id, '*');
}
}
if (empty($tag)) {
redirect($CFG->wwwroot . '/tag/search.php');
}
$PAGE->set_url('/tag/index.php', array('id' => $tag->id));
$PAGE->set_subpage($tag->id);
$PAGE->set_context($systemcontext);
$PAGE->set_blocks_editing_capability('moodle/tag:editblocks');
$PAGE->set_pagelayout('base');
$tagname = tag_display_name($tag);
// set the relatedtags field of the $tag object that will be passed to the form
$tag->relatedtags = tag_get_related_tags_csv(tag_get_related_tags($tag->id, TAG_RELATED_MANUAL), TAG_RETURN_TEXT);
$options = new stdClass();
$options->smiley = false;
$options->filter = false;
// convert and remove any XSS
$tag->description = format_text($tag->description, $tag->descriptionformat, $options);
$tag->descriptionformat = FORMAT_HTML;
$errorstring = '';
$editoroptions = array('maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $CFG->maxbytes, 'trusttext' => false, 'context' => $systemcontext, 'subdirs' => file_area_contains_subdirs($systemcontext, 'tag', 'description', $tag->id));
$tag = file_prepare_standard_editor($tag, 'description', $editoroptions, $systemcontext, 'tag', 'description', $tag->id);
$tagform = new tag_edit_form(null, compact('editoroptions'));
if ($tag->tagtype == 'official') {
$tag->tagtype = '1';
} else {
$tag->tagtype = '0';
}
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:31,代码来源:edit.php
注:本文中的tag_get_related_tags_csv函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论