/**
  * Action Plugin Main Function
  */
 function action()
 {
     sonots::init_myerror();
     do {
         // try
         global $vars;
         $argoptions = PluginSonotsOption::parse_uri_option_line($vars);
         $argoptions = array_intersect_key($argoptions, $this->conf_options);
         list($options, $unknowns) = PluginSonotsOption::evaluate_options($argoptions, $this->conf_options);
         $options = $this->check_options($options, array(), $this->conf_options);
         if (sonots::mycatch()) {
             break;
         }
         if (isset($options['tag'])) {
             $plugin_tag = new PluginSonotsTag();
             $pages = $plugin_tag->get_taggedpages($options['tag']);
             $title = _('List of pages tagged by "') . htmlspecialchars($options['tag']) . '"';
             $html = $this->pagelist($pages, $options, $argoptions);
         } else {
             $plugin_tag = new PluginSonotsTag();
             if (isset($options['related'])) {
                 $tags = $plugin_tag->get_related_tags($options['related']);
                 $title = _('List of tags related to "') . htmlspecialchars($options['related']) . _('" and their tagged pages');
             } else {
                 $tags = $plugin_tag->get_existtags();
                 $title = _('List of all tags and their tagged pages');
             }
             $html = $this->tagpagelist($tags, $options, $argoptions);
         }
         if (empty($html)) {
             $html = '<p>' . _('No page found.') . '</p>';
         }
         return array('msg' => $title, 'body' => $html);
     } while (false);
     if (sonots::mycatch()) {
         // catch
         return array('msg' => $this->plugin, 'body' => '<p>' . sonots::mycatch() . '</p>');
     }
 }