Пример #1
0
 /**
  * Block Plugin Main Function
  */
 function convert()
 {
     sonots::init_myerror();
     do {
         // try
         $args = func_get_args();
         $argline = csv_implode(',', $args);
         $argoptions = PluginSonotsOption::parse_option_line($argline);
         list($options, $unknowns) = PluginSonotsOption::evaluate_options($argoptions, $this->conf_options);
         $options = $this->check_options($options, $unknowns, $this->conf_options);
         if (sonots::mycatch()) {
             break;
         }
         if (isset($options['tag'])) {
             $plugin_tag = new PluginSonotsTag();
             $pages = $plugin_tag->get_taggedpages($options['tag']);
         } elseif (isset($options['prefix'])) {
             $pages = sonots::get_existpages($options['prefix']);
         } else {
             $pages = get_existpages();
         }
         $pagelist = $this->pagelist($pages, $options, $argoptions);
         $navipages = $this->get_navipages($pagelist, $options);
         $html = $this->display_navi($navipages, $options['look'], $options['border'], $this->conf['printcss']);
         return $html;
     } while (false);
     if (sonots::mycatch()) {
         // catch
         return '<p>#' . $this->plugin . '(): ' . sonots::mycatch() . '</p>';
     }
 }
Пример #2
0
 /**
  * Execute (convert_html) all pages
  *
  * PukiWiki API Extension
  *
  * @access public
  * @static
  * @param string $prefix restrict pages by prefix condition
  * @param string $regexp execute only matched lines (preg_grep)
  * @return array executed pages
  * @uses sonots::get_existpages
  * @uses get_source (PukiWiki lib/file.php)
  * @uses convert_html (PukiWiki lib/convert_html.php)
  * @version $Id: v 1.0 2008-06-05 11:14:46 sonots $
  */
 function exec_existpages($prefix = '', $regexp = null)
 {
     global $vars, $get, $post;
     $pages = sonots::get_existpages($prefix);
     $exec_pages = array();
     $tmp_page = $vars['page'];
     $tmp_cmd = $vars['cmd'];
     $vars['cmd'] = $get['cmd'] = $post['cmd'] = 'read';
     foreach ($pages as $page) {
         $vars['page'] = $get['page'] = $post['page'] = $page;
         $lines = get_source($page);
         if (isset($regexp)) {
             $lines = preg_grep($regexp, $lines);
         }
         if (empty($lines)) {
             continue;
         }
         convert_html($lines);
         $exec_pages[] = $page;
     }
     $vars['page'] = $get['page'] = $post['page'] = $tmp_page;
     $vars['cmd'] = $get['cmd'] = $post['cmd'] = $tmp_cmd;
     return $exec_pages;
 }
Пример #3
0
 /**
  * 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']) . '"';
         } elseif (isset($options['prefix']) && $options['prefix'] !== '') {
             $pages = sonots::get_existpages($options['prefix']);
             $title = _('List of pages under "') . htmlspecialchars($options['prefix']) . '"';
         } else {
             $pages = get_existpages();
             $title = _('List of pages');
         }
         $html = $this->pagelist($pages, $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>');
     }
 }