Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions tag/inc/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,18 @@ function simple() {
// Get the simple tags
if (!empty($this->simplebody)) {
$entry = array(
'content' => $this->simplebody
'entry' => $this->simplebody
);
} else {
$entry = $smarty->getTemplateVars('post');
}
$this->entry->tag_list($entry ['content']);
if (empty($this->simplebody)) {
$entry = array(
'content' => 'content'
);
$entry = $entry ['content'];
$entry = $this->entry->tag_list($entry);
}
$tags = $this->entry->tags;
if (!empty($_POST ['taginput'])) {
$tags = array_merge((array) $tags, explode(',', $_POST ['taginput']));
Expand All @@ -316,6 +322,7 @@ function simple() {
return true;
}


/**
* This function prints the stylesheet of the template
*/
Expand Down
36 changes: 25 additions & 11 deletions tag/inc/entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,35 +179,49 @@ function tag_list($content) {
* if there aren't tags...
* @returns: The tag list or $default
*/
function smarty_modifier($array, $glue = ', ', $default = 'No Tags') {
function smarty_modifier($array, $glue = ', ', $default = 'No Tag') {
// If there aren't tags, let's return $default
if (!is_array($array) || !count($array)) {
return $default;
}

$entries = $draft = null;

$count = 0;

$link = null;

$titleadd = '';

$links = array();

// Load lang
global $lang;
if (!isset($lang ['plugin'] ['tag'])) {
load_lang('plugin:tag');
}
$plang = $lang ['plugin'] ['tag'];

$links = array();
// Ok, foreach already checked
foreach ($array as $v) {
// To be compatible with Flatpress System, we use the filter
$link = apply_filters('tag_link', $v);

// For LAttilaD: show number of entries
$entries = $this->tagdb->taggedEntries($v);
$count = count($entries);
$titleadd = $count == 1 ? $plang ['oneentry'] : $count . $plang ['entries'];
$titleadd = " ({$titleadd})";

$v = wp_specialchars($v, true);
$links [] = "\n" . '<a href="' . $link . '" title="' . $v . $titleadd . '">' . $v . '</a>';
// Check if the entry is a draft
if ($draft == 0 && is_array($entries) && count($entries) >= 1) {
// To be compatible with Flatpress System, we use the filter
$link = apply_filters('tag_link', $v);

$count = count($entries);
$v = wp_specialchars($v, true);
}

$titleadd = $count == 1 ? $plang ['oneentry'] : $count . $plang ['entries'];
$titleadd = "({$titleadd})";
$links [] = "\n" . '<a href="' . $link . '" title="' . $v . ' ' . $titleadd . '">' . $v . '</a>';
}
return implode($glue, $links);

return implode($glue, $links);
}

/**
Expand Down