function init_metapages() { if ($this->options['sort'][1] === 'reading') { // Beta Function if ($this->options['tag'][1] == '') { $readings = $this->get_readings(); } else { $plugin_tag = new PluginTag(); $pages = $plugin_tag->get_taggedpages($this->options['tag'][1]); if ($pages === FALSE) { $this->error = 'The tag token, ' . htmlspecialchars($this->options['tag'][1]) . ', is invalid. '; $this->error .= 'Perhaps, the tag does not exist. '; } $readings = $this->get_readings(); // why can not set pages... foreach ($pages as $page) { $tagged_readings[$page] = ''; } // array_intersect_key >= PHP 5.1.0 RC1 // $readings = array_intersect_key($readings, $tagged_readings); foreach ($readings as $page => $reading) { if (!isset($tagged_readings[$page])) { unset($readings[$page]); } } } $metapages = array(); foreach ($readings as $page => $reading) { unset($readings[$page]); $metapages[] = array('reading' => $reading, 'page' => $page, 'exist' => true, 'depth' => 1, 'listdepth' => 1, 'timestamp' => 1, 'date' => ''); } $this->metapages = $metapages; } else { if ($this->options['tag'][1] == '') { $pages = get_existpages(); } else { $plugin_tag = new PluginTag(); $pages = $plugin_tag->get_taggedpages($this->options['tag'][1]); if ($pages === FALSE) { $this->error = 'The tag token, ' . htmlspecialchars($this->options['tag'][1]) . ', is invalid. '; $this->error .= 'Perhaps, the tag does not exist. '; } } $metapages = array(); foreach ($pages as $i => $page) { unset($pages[$i]); $metapages[] = array('page' => $page, 'exist' => true, 'depth' => 1, 'listdepth' => 1, 'timestamp' => 1, 'date' => ''); } $this->metapages = $metapages; } }
public function setGitTags($tags, $stable = null) { // delete all current tags which are obsolete $currentTags = array(); foreach ($this->getPluginTags() as $gitTag) { $currentTags[] = $gitTag->getName(); } $deleteTags = array_diff($currentTags, $tags); foreach ($deleteTags as $tag) { $criteria = new Criteria(); $criteria->add(PluginTagPeer::PLUGIN_ID, $this->getId()); $criteria->add(PluginTagPeer::NAME, $tag); PluginTagPeer::doDelete($criteria); } foreach ($tags as $i => $tag) { if (!trim($tag)) { continue; } $existent = $this->getGitTagByName($tag); // if it was marked as stable and it's not the currently stable one, unmark it if ($existent && $existent->isCurrent() && $stable && $existent->getName(true) !== $stable) { $existent->setCurrent(false); $existent->save(); } if (!$existent) { $t = new PluginTag(); $t->setPluginId($this->getId()); $t->setName($tag); if ($stable === null && $i + 1 == sizeof($tags) || floatval($tag) == $stable) { $t->setCurrent(true); } $t->save(); if ($t->isCurrent()) { $this->stable_tag = $t; } } } }
function init_metapages() { $qm = get_qm(); if ($this->options['sort'][1] === 'reading') { // Beta Function if ($this->options['tag'][1] == '') { $readings = $this->get_readings(); } else { $plugin_tag = new PluginTag(); $pages = $plugin_tag->get_taggedpages($this->options['tag'][1]); if ($pages === FALSE) { $this->error = $qm->replace('plg_lsx.err_invalid_tag', h($this->options['tag'][1])); } $readings = $this->get_readings(); // why can not set pages... foreach ($pages as $page) { $tagged_readings[$page] = ''; } // array_intersect_key >= PHP 5.1.0 RC1 // $readings = array_intersect_key($readings, $tagged_readings); foreach ($readings as $page => $reading) { if (!isset($tagged_readings[$page])) { unset($readings[$page]); } } } $metapages = array(); foreach ($readings as $page => $reading) { unset($readings[$page]); $metapages[] = array('reading' => $reading, 'page' => $page, 'exist' => true, 'depth' => 1, 'listdepth' => 1, 'timestamp' => 1, 'date' => ''); } $this->metapages = $metapages; } else { if ($this->options['tag'][1] == '') { $pages = get_existpages(); } else { $plugin_tag = new PluginTag(); $pages = $plugin_tag->get_taggedpages($this->options['tag'][1]); if ($pages === FALSE) { $this->error = $qm->replace('plg_lsx.err_invalid_tag', h($this->options['tag'][1])); } } $metapages = array(); foreach ($pages as $i => $page) { unset($pages[$i]); $metapages[] = array('page' => $page, 'exist' => true, 'depth' => 1, 'listdepth' => 1, 'timestamp' => 1, 'date' => ''); } $this->metapages = $metapages; } }