function fill_db($path, $parent_id) { $dh = opendir($path) or error("Can't open {$path}"); while (($file = readdir($dh)) !== false) { if ($file[0] == '.') { continue; } $rpath = $path . '/' . $file; $fl = new FileItem(); $fl->parent_id = $parent_id; $fl->name = $file; if (is_dir($rpath)) { $fl->type = FileItem::Folder; $fl->save(); Initiator::fill_db($rpath, $fl->id); } else { if ($file == 'all.php') { continue; } if (substr($file, -4) != '.php') { continue; } $fl->type = FileItem::File; $fl->save(); $doc = new Documenter(); $doc->parse($rpath); $doc->save($fl); } } closedir($dh); }
/** * Register admin pages. * * @since 1.0.0 * * @uses Manager::settings_page() for general options page output. * @uses Documenter::register_help_tabs() to register help tabs for all screens. */ public static function add_menu_pages() { // Main Options page $options_page_hook = add_utility_page(__('[plugin name] Options', 'plugin-name'), _x('[plugin name]', 'menu title', 'plugin-name'), 'manage_options', 'pluginname-options', array(get_called_class(), 'settings_page'), 'dashicons-admin-generic'); // Setup the help tabs for each page Documenter::register_help_tabs(array($options_page_hook => 'options')); }
/** * Register hooks and esure existence of content folder. * * @since 1.2.0 Added internal hooks setup, PME content directory adding. * @since 1.0.0 * * @uses Backend::register_hooks() to setup backend functionality. * @uses Manager::register_hooks() to setup admin screens. * @uses Documenter::register_hooks() to setup admin documentation. */ public static function setup() { // Register the hooks of the subsystems Backend::register_hooks(); Manager::register_hooks(); Documenter::register_hooks(); // Ensure the content directory exists if (!file_exists(PME_CONTENT_DIR) && is_readable(dirname(PME_CONTENT_DIR))) { wp_mkdir_p(PME_CONTENT_DIR); } // Register global hooks static::register_hooks(); }
/** * Setup the help tabs based on what's being displayed for the page. * * @since 1.0.0 * * @uses Documenter::setup_help_tabs() to display the appropriate help tabs. */ public static function display_help_tabs() { $screen = get_current_screen(); // Abort if not the admin page for this plugin if ($screen->id != 'tools_page_pomo-editor') { return; } // If the file is specified, setup the interface help tabs if (isset($_GET['pofile'])) { Documenter::setup_help_tabs('editor'); } else { Documenter::setup_help_tabs('index'); } }
/** * Register hooks and load options. * * @since 1.0.0 * * @uses Registry::load() to load the options. * @uses Loader::register_hooks() to setup plugin management. * @uses System::register_hooks() to setup global functionality. * @uses Backend::register_hooks() to setup backend functionality. * @uses AJAX::register_hooks() to setup AJAX functionality. * @uses Manager::register_hooks() to setup admin screens. * @uses Documenter::register_hooks() to setup admin documentation. */ public static function setup() { // Setup the registry Registry::load(); // Register the Installer stuff Installer::register_hooks(); // Register global hooks self::register_hooks(); // Register the hooks of the subsystems Backend::register_hooks(); AJAX::register_hooks(); Manager::register_hooks(); Documenter::register_hooks(); }
function show_data_members(Documenter $d, $type, $arr) { $arrdefaultvalue = $d->getDefaultproperties(); echo "<h3>{$type}</h3>\n"; foreach ($arr as $key => $value) { $strtemp = "<p><span class=\"keyword\">" . $d->getModifiers($value) . "</span> " . "<span class=\"name\">{$key}</span>"; if (isset($arrdefaultvalue[$key])) { $val = $arrdefaultvalue[$key]; if (is_string($val)) { $val = "\"{$val}\""; } elseif (is_array($val)) { $val = " array()"; } elseif (is_bool($val)) { if ($val === true) { $val = "true"; } else { $val = "false"; } } else { //$val = "$val"; } } if ($val) { $strtemp .= " = {$val}"; } /* getDocComment() для свойств был добавлен в PHP 5.1.0. но не работал до версии 5.1.3 */ if ($value->getDocComment()) { $strtemp .= "<br /><span class=\"comment\">"; $strtemp .= $value->getDocComment() . "</span><br />"; } //} echo $strtemp; echo "</p>\n"; } }
function _smarty_documenter_modifiers(Documenter $d, $value) { //used in documentation return $d->getModifiers($value); }
public function getDocs($r) { // note: doc comments are only displayed // on first web view after a file is updated, // indicating that a bytecode cache is removing comments $tpl = new Dase_Template($r); $dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(BASE_PATH . '/lib')); foreach ($dir as $file) { $matches = array(); if (false === strpos($file->getPathname(), 'smarty') && false === strpos($file->getPathname(), 'Smarty') && false === strpos($file->getPathname(), 'getid3') && false === strpos($file->getPathname(), 'markdown') && false === strpos($file->getPathname(), 'htaccess') && false === strpos($file->getPathname(), 'svn') && '.' != array_shift(str_split($file->getFilename())) && $file->isFile()) { try { $filepath = $file->getPathname(); //causes seg fault AND we don't need it //include_once $filepath; } catch (Exception $e) { print $e->getMessage() . "\n"; } } } $arr = get_declared_classes(); natcasesort($arr); //include only $filter = create_function('$filename', 'return preg_match("/(dase|mimeparse|service|utlookup)/i",$filename);'); $class_list = array_filter($arr, $filter); //except $filter = create_function('$filename', 'return !preg_match("/autogen/i",$filename);'); $class_list = array_filter($class_list, $filter); $tpl->assign('class_list', $class_list); if ($r->has('class_id')) { $tpl->assign('phpversion', phpversion()); $tpl->assign('class_id', $r->get('class_id')); $documenter = new Documenter($class_list[$r->get('class_id')]); $tpl->assign('default_properties', $documenter->getDefaultProperties()); $tpl->assign('doc', $documenter); } $r->renderResponse($tpl->fetch('admin/docs.tpl')); }