Skip to content

Commit

Permalink
allow hidding tags with '@' symbol in their name
Browse files Browse the repository at this point in the history
  • Loading branch information
wazari972 committed Sep 26, 2014
1 parent 76895e5 commit c21bf0f
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 2 deletions.
13 changes: 12 additions & 1 deletion daos/Items.php
Expand Up @@ -80,6 +80,17 @@ public function get($options = array()) {
$options
);

return $this->backend->get($options);
$items = $this->backend->get($options);

if(!\F3::get('auth')->showHiddenTags()) {
foreach($items as $idx => $item) {
if (strpos($item['tags'], "@") !== false) {
unset($items[$idx]);
}
}
$items = array_values($items);
}

return $items;
}
}
14 changes: 14 additions & 0 deletions daos/Sources.php
Expand Up @@ -47,6 +47,20 @@ public function __call($name, $args) {
\F3::get('logger')->log('Unimplemented method for ' . \F3::get('db_type') . ': ' . $name, \ERROR);
}

public function get() {
$sources = $this->backend->get();

if(!\F3::get('auth')->showHiddenTags()) {
foreach($sources as $idx => $source) {
if (strpos($source['tags'], "@") !== false) {
unset($sources[$idx]);
}
}
$sources = array_values($sources);
}

return $sources;
}

/**
* validate new data for a given source
Expand Down
16 changes: 15 additions & 1 deletion daos/Tags.php
Expand Up @@ -30,7 +30,21 @@ public function __construct() {
$this->backend = new $class();
parent::__construct();
}


public function get() {
$tags = $this->backend->get();

if(!\F3::get('auth')->showHiddenTags()) {
foreach($tags as $idx => $tag) {
if (strpos($tag['tag'], "@") !== false) {
unset($tags[$idx]);
}
}
$tags = array_values($tags);
}

return $tags;
}

/**
* pass any method call to the backend.
Expand Down
10 changes: 10 additions & 0 deletions helpers/Authentication.php
Expand Up @@ -129,6 +129,16 @@ public function isLoggedin() {
return $this->loggedin;
}


/**
* showHiddenTags
*
* @return bool
*/
public function showHiddenTags() {
return $this->isLoggedin();
}


/**
* logout
Expand Down

0 comments on commit c21bf0f

Please sign in to comment.