Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated ApiGen to 2.7.0-dev

  • Loading branch information...
commit 0ba934e5e72ee9985d2ff59c9a1b49705bb87b31 1 parent 4a4295d
@dg dg authored
Showing with 315 additions and 89 deletions.
  1. +3 −3 build.php
  2. +1 −1  tools/ApiGen/ApiGen/Backend.php
  3. +4 −10 tools/ApiGen/ApiGen/Config.php
  4. +1 −1  tools/ApiGen/ApiGen/ConfigException.php
  5. +86 −14 tools/ApiGen/ApiGen/Generator.php
  6. +28 −0 tools/ApiGen/ApiGen/IHelperSet.php
  7. +23 −0 tools/ApiGen/ApiGen/MacroSet.php
  8. +1 −1  tools/ApiGen/ApiGen/ReflectionBase.php
  9. +5 −6 tools/ApiGen/ApiGen/ReflectionClass.php
  10. +1 −1  tools/ApiGen/ApiGen/ReflectionConstant.php
  11. +8 −2 tools/ApiGen/ApiGen/ReflectionElement.php
  12. +1 −1  tools/ApiGen/ApiGen/ReflectionExtension.php
  13. +1 −1  tools/ApiGen/ApiGen/ReflectionFunction.php
  14. +1 −1  tools/ApiGen/ApiGen/ReflectionFunctionBase.php
  15. +26 −1 tools/ApiGen/ApiGen/ReflectionMethod.php
  16. +1 −1  tools/ApiGen/ApiGen/ReflectionParameter.php
  17. +1 −1  tools/ApiGen/ApiGen/ReflectionProperty.php
  18. +75 −0 tools/ApiGen/ApiGen/SourceFilesFilterIterator.php
  19. +3 −8 tools/ApiGen/ApiGen/Template.php
  20. +1 −1  tools/ApiGen/ApiGen/Tree.php
  21. +1 −1  tools/ApiGen/templates/@elementlist.latte
  22. +1 −1  tools/ApiGen/templates/@layout.latte
  23. +8 −2 tools/ApiGen/templates/class.latte
  24. +1 −1  tools/ApiGen/templates/combined.js.latte
  25. +1 −1  tools/ApiGen/templates/constant.latte
  26. +1 −1  tools/ApiGen/templates/deprecated.latte
  27. +1 −1  tools/ApiGen/templates/elementlist.js.latte
  28. +1 −1  tools/ApiGen/templates/function.latte
  29. +3 −0  tools/ApiGen/templates/js/jquery.autocomplete.js
  30. +16 −16 tools/ApiGen/templates/js/main.js
  31. +1 −1  tools/ApiGen/templates/namespace.latte
  32. +1 −1  tools/ApiGen/templates/opensearch.xml.latte
  33. +1 −1  tools/ApiGen/templates/overview.latte
  34. +1 −1  tools/ApiGen/templates/package.latte
  35. +1 −1  tools/ApiGen/templates/resources/style.css
  36. +1 −1  tools/ApiGen/templates/robots.txt.latte
  37. +1 −1  tools/ApiGen/templates/sitemap.xml.latte
  38. +1 −1  tools/ApiGen/templates/source.latte
  39. +1 −1  tools/ApiGen/templates/todo.latte
  40. +1 −1  tools/ApiGen/templates/tree.latte
View
6 build.php
@@ -14,7 +14,7 @@
// configuration
-$project->gitExecutable = 'C:\Program Files\Git\bin\git.exe';
+$project->gitExecutable = 'C:\Program Files (x86)\Git\bin\git.exe';
$project->phpExecutable = realpath('tools/PHP-5.3/php.exe');
$project->php52Executable = realpath('tools/PHP-5.2/php.exe');
$project->apiGenExecutable = realpath('tools/ApiGen/apigen.php');
@@ -91,8 +91,8 @@
// build API doc
$apiGenConfig = dirname($project->apiGenExecutable) . '/apigen.neon';
$project->apiGen("$dir53/Nette", "$dir53/API-reference", $apiGenConfig, "Nette Framework $label API");
- $project->apiGen("$dir52p/Nette", "$dir52p/API-reference", $apiGenConfig, "Nette Framework $label (for PHP 5.2) API");
- $project->apiGen("$dir52n/Nette", "$dir52n/API-reference", $apiGenConfig, "Nette Framework $label (for PHP 5.2) API");
+ $project->apiGen("$dir52p/Nette", "$dir52p/API-reference", $apiGenConfig, "Nette Framework $label (for PHP 5.2, prefixed) API");
+ $project->apiGen("$dir52n/Nette", "$dir52n/API-reference", $apiGenConfig, "Nette Framework $label (for PHP 5.2, un-prefixed) API");
// create archives
if ($tag === 'master') {
View
2  tools/ApiGen/ApiGen/Backend.php
@@ -1,7 +1,7 @@
<?php
/**
- * ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ * ApiGen 2.7.0 - API documentation generator for PHP 5.3+
*
* Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
* Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
14 tools/ApiGen/ApiGen/Config.php
@@ -1,7 +1,7 @@
<?php
/**
- * ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ * ApiGen 2.7.0 - API documentation generator for PHP 5.3+
*
* Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
* Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
@@ -323,7 +323,8 @@ public function prepare()
);
// Merge template config
- $this->config = array_merge_recursive($this->config, array('template' => Neon::decode(file_get_contents($this->config['templateConfig']))));
+ $this->config = array_merge_recursive($this->config, array('template' => Neon::decode(file_get_contents($fileName = $this->config['templateConfig']))));
+ $this->config['template']['config'] = realpath($fileName);
// Check template
$this->checkTemplate();
@@ -351,13 +352,6 @@ private function check()
throw new ConfigException(sprintf('Source "%s" doesn\'t exist', $source));
}
}
- foreach ($this->config['source'] as $source) {
- foreach ($this->config['source'] as $source2) {
- if ($source !== $source2 && 0 === strpos($source, $source2)) {
- throw new ConfigException(sprintf('Sources "%s" and "%s" overlap', $source, $source2));
- }
- }
- }
if (empty($this->config['destination'])) {
throw new ConfigException('Destination is not set');
@@ -377,7 +371,7 @@ private function check()
throw new ConfigException(sprintf('Invalid base url "%s"', $this->config['baseUrl']));
}
- if (!empty($this->config['googleCseId']) && !preg_match('~^\d{21}:[-a-z0-9]{11}$~', $this->config['googleCseId'])) {
+ if (!empty($this->config['googleCseId']) && !preg_match('~^\d{21}:[-a-z0-9_]{11}$~', $this->config['googleCseId'])) {
throw new ConfigException(sprintf('Invalid Google Custom Search ID "%s"', $this->config['googleCseId']));
}
View
2  tools/ApiGen/ApiGen/ConfigException.php
@@ -1,7 +1,7 @@
<?php
/**
- * ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ * ApiGen 2.7.0 - API documentation generator for PHP 5.3+
*
* Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
* Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
100 tools/ApiGen/ApiGen/Generator.php
@@ -1,7 +1,7 @@
<?php
/**
- * ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ * ApiGen 2.7.0 - API documentation generator for PHP 5.3+
*
* Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
* Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
@@ -34,7 +34,7 @@ class Generator extends Nette\Object
*
* @var string
*/
- const VERSION = '2.6.1';
+ const VERSION = '2.7.0';
/**
* Configuration.
@@ -175,10 +175,11 @@ public function parse()
// Available from PHP 5.3.1
$flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
}
+
foreach ($this->config->source as $source) {
$entries = array();
if (is_dir($source)) {
- foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source, $flags)) as $entry) {
+ foreach (new \RecursiveIteratorIterator(new SourceFilesFilterIterator(new \RecursiveDirectoryIterator($source, $flags), $this->config->exclude)) as $entry) {
if (!$entry->isFile()) {
continue;
}
@@ -203,14 +204,8 @@ public function parse()
if (!preg_match($regexp, $entry->getFilename())) {
continue;
}
- $pathName = $this->normalizePath($entry->getPathName());
- $unPharName = $this->unPharPath($pathName);
- foreach ($this->config->exclude as $mask) {
- if (fnmatch($mask, $unPharName, FNM_NOESCAPE)) {
- continue 2;
- }
- }
+ $pathName = $this->normalizePath($entry->getPathName());
$files[$pathName] = $entry->getSize();
if (false !== $entry->getRealPath() && $pathName !== $entry->getRealPath()) {
$this->symlinks[$entry->getRealPath()] = $pathName;
@@ -413,6 +408,8 @@ public function generate()
$template->version = self::VERSION;
$template->config = $this->config;
+ $this->registerCustomTemplateMacros($template);
+
// Common files
$this->generateCommon($template);
@@ -458,6 +455,60 @@ public function generate()
}
/**
+ * Loads template-specific macro and helper libraries.
+ *
+ * @param \ApiGen\Template $template Template instance
+ */
+ private function registerCustomTemplateMacros(Template $template)
+ {
+ $latte = new Nette\Latte\Engine();
+ $macroSet = new Nette\Latte\Macros\MacroSet($latte->compiler);
+ $macroSet->addMacro('try', 'try {', '} catch (\Exception $e) {}');
+
+ if (!empty($this->config->template['options']['extensions'])) {
+ $this->output("Loading custom template macro and helper libraries\n");
+ $broker = new Broker(new Broker\Backend\Memory(), 0);
+
+ $baseDir = dirname($this->config->template['config']);
+ foreach ((array) $this->config->template['options']['extensions'] as $fileName) {
+ $pathName = $baseDir . DIRECTORY_SEPARATOR . $fileName;
+ if (is_file($pathName)) {
+ try {
+ $reflectionFile = $broker->processFile($pathName, true);
+
+ foreach ($reflectionFile->getNamespaces() as $namespace) {
+ foreach ($namespace->getClasses() as $class) {
+ if ($class->isSubclassOf('ApiGen\\MacroSet')) {
+ // Macro set
+
+ include $pathName;
+ call_user_func(array($class->getName(), 'install'), $latte->compiler);
+
+ $this->output(sprintf(" %s (macro set)\n", $class->getName()));
+ } elseif ($class->implementsInterface('ApiGen\\IHelperSet')) {
+ // Helpers set
+
+ include $pathName;
+ $className = $class->getName();
+ $template->registerHelperLoader(callback(new $className($template), 'loader'));
+
+ $this->output(sprintf(" %s (helper set)\n", $class->getName()));
+ }
+ }
+ }
+ } catch (\Exception $e) {
+ throw new \Exception(sprintf('Could not load macros and helpers from file "%s"', $pathName), 0, $e);
+ }
+ } else {
+ throw new \Exception(sprintf('Helper file "%s" does not exist.', $pathName));
+ }
+ }
+ }
+
+ $template->registerFilter($latte);
+ }
+
+ /**
* Categorizes by packages and namespaces.
*
* @return \ApiGen\Generator
@@ -1325,7 +1376,7 @@ private function generateElements(Template $template)
* Creates ZIP archive.
*
* @return \ApiGen\Generator
- * @throws \RuntimeException If something went wront.
+ * @throws \RuntimeException If something went wrong.
*/
private function generateArchive()
{
@@ -1454,6 +1505,8 @@ public function resolveElement($definition, ReflectionElement $context, &$expect
return null;
}
+ $originalContext = $context;
+
if ($context instanceof ReflectionParameter && null === $context->getDeclaringClassName()) {
// Parameter of function in namespace or global space
$context = $this->getFunction($context->getDeclaringFunctionName());
@@ -1465,11 +1518,26 @@ public function resolveElement($definition, ReflectionElement $context, &$expect
$context = $this->getClass($context->getDeclaringClassName());
}
+ if (null === $context) {
+ return null;
+ }
+
+ // self, $this references
+ if ('self' === $definition || '$this' === $definition) {
+ return $context instanceof ReflectionClass ? $context : null;
+ }
+
+ $definitionBase = substr($definition, 0, strcspn($definition, '\\:'));
$namespaceAliases = $context->getNamespaceAliases();
- if (isset($namespaceAliases[$definition]) && $definition !== ($className = \TokenReflection\Resolver::resolveClassFQN($definition, $namespaceAliases, $context->getNamespaceName()))) {
+ if (!empty($definitionBase) && isset($namespaceAliases[$definitionBase]) && $definition !== ($className = \TokenReflection\Resolver::resolveClassFQN($definition, $namespaceAliases, $context->getNamespaceName()))) {
// Aliased class
$expectedName = $className;
- return $this->getClass($className, $context->getNamespaceName());
+
+ if (false === strpos($className, ':')) {
+ return $this->getClass($className, $context->getNamespaceName());
+ } else {
+ $definition = $className;
+ }
} elseif ($class = $this->getClass($definition, $context->getNamespaceName())) {
// Class
return $class;
@@ -1481,7 +1549,9 @@ public function resolveElement($definition, ReflectionElement $context, &$expect
) {
// Function
return $function;
- } elseif (($pos = strpos($definition, '::')) || ($pos = strpos($definition, '->'))) {
+ }
+
+ if (($pos = strpos($definition, '::')) || ($pos = strpos($definition, '->'))) {
// Class::something or Class->something
if (0 === strpos($definition, 'parent::') && ($parentClassName = $context->getParentClassName())) {
$context = $this->getClass($parentClassName);
@@ -1496,6 +1566,8 @@ public function resolveElement($definition, ReflectionElement $context, &$expect
}
$definition = substr($definition, $pos + 2);
+ } elseif ($originalContext instanceof ReflectionParameter) {
+ return null;
}
// No usable context
View
28 tools/ApiGen/ApiGen/IHelperSet.php
@@ -0,0 +1,28 @@
+<?php
+
+/**
+ * ApiGen 2.7.0 - API documentation generator for PHP 5.3+
+ *
+ * Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
+ * Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
+ * Copyright (c) 2011-2012 Ondřej Nešpor (https://github.com/Andrewsville)
+ *
+ * For the full copyright and license information, please view
+ * the file LICENSE.md that was distributed with this source code.
+ */
+
+namespace ApiGen;
+
+/**
+ * Helper set interface.
+ */
+interface IHelperSet
+{
+ /**
+ * Tries to load the requested helper.
+ *
+ * @param string $helperName Helper name
+ * @return \Nette\Callback
+ */
+ public function loader($helperName);
+}
View
23 tools/ApiGen/ApiGen/MacroSet.php
@@ -0,0 +1,23 @@
+<?php
+
+/**
+ * ApiGen 2.7.0 - API documentation generator for PHP 5.3+
+ *
+ * Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
+ * Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
+ * Copyright (c) 2011-2012 Ondřej Nešpor (https://github.com/Andrewsville)
+ *
+ * For the full copyright and license information, please view
+ * the file LICENSE.md that was distributed with this source code.
+ */
+
+namespace ApiGen;
+
+use Nette\Latte\Macros\MacroSet as NetteMacroSet;
+
+/**
+ * Macro set base class.
+ */
+abstract class MacroSet extends NetteMacroSet
+{
+}
View
2  tools/ApiGen/ApiGen/ReflectionBase.php
@@ -1,7 +1,7 @@
<?php
/**
- * ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ * ApiGen 2.7.0 - API documentation generator for PHP 5.3+
*
* Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
* Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
11 tools/ApiGen/ApiGen/ReflectionClass.php
@@ -1,7 +1,7 @@
<?php
/**
- * ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ * ApiGen 2.7.0 - API documentation generator for PHP 5.3+
*
* Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
* Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
@@ -666,14 +666,13 @@ public function getUsedMethods()
{
$usedMethods = array();
foreach ($this->getMethods() as $method) {
- if (null === $method->getDeclaringTraitName()) {
+ if (null === $method->getDeclaringTraitName() || $this->getName() === $method->getDeclaringTraitName()) {
continue;
}
- if (null === $method->getOriginalName() || $method->getName() === $method->getOriginalName()) {
- $usedMethods[$method->getDeclaringTraitName()][$method->getName()]['method'] = $method;
- } else {
- $usedMethods[$method->getDeclaringTraitName()][$method->getOriginalName()]['aliases'][$method->getName()] = $method;
+ $usedMethods[$method->getDeclaringTraitName()][$method->getName()]['method'] = $method;
+ if (null !== $method->getOriginalName() && $method->getName() !== $method->getOriginalName()) {
+ $usedMethods[$method->getDeclaringTraitName()][$method->getName()]['aliases'][$method->getName()] = $method;
}
}
View
2  tools/ApiGen/ApiGen/ReflectionConstant.php
@@ -1,7 +1,7 @@
<?php
/**
- * ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ * ApiGen 2.7.0 - API documentation generator for PHP 5.3+
*
* Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
* Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
10 tools/ApiGen/ApiGen/ReflectionElement.php
@@ -1,7 +1,7 @@
<?php
/**
- * ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ * ApiGen 2.7.0 - API documentation generator for PHP 5.3+
*
* Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
* Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
@@ -122,9 +122,15 @@ public function getPackageName()
if ($package = $this->getAnnotation('package')) {
$packageName = preg_replace('~\s+.*~s', '', $package[0]);
+ if (empty($packageName)) {
+ return '';
+ }
+
if ($subpackage = $this->getAnnotation('subpackage')) {
$subpackageName = preg_replace('~\s+.*~s', '', $subpackage[0]);
- if (0 === strpos($subpackageName, $packageName)) {
+ if (empty($subpackageName)) {
+ // Do nothing
+ } elseif (0 === strpos($subpackageName, $packageName)) {
$packageName = $subpackageName;
} else {
$packageName .= '\\' . $subpackageName;
View
2  tools/ApiGen/ApiGen/ReflectionExtension.php
@@ -1,7 +1,7 @@
<?php
/**
- * ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ * ApiGen 2.7.0 - API documentation generator for PHP 5.3+
*
* Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
* Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
2  tools/ApiGen/ApiGen/ReflectionFunction.php
@@ -1,7 +1,7 @@
<?php
/**
- * ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ * ApiGen 2.7.0 - API documentation generator for PHP 5.3+
*
* Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
* Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
2  tools/ApiGen/ApiGen/ReflectionFunctionBase.php
@@ -1,7 +1,7 @@
<?php
/**
- * ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ * ApiGen 2.7.0 - API documentation generator for PHP 5.3+
*
* Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
* Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
27 tools/ApiGen/ApiGen/ReflectionMethod.php
@@ -1,7 +1,7 @@
<?php
/**
- * ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ * ApiGen 2.7.0 - API documentation generator for PHP 5.3+
*
* Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
* Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
@@ -54,6 +54,31 @@ public function getPrototype()
}
/**
+ * Returns the overridden method.
+ *
+ * @return \ApiGen\ReflectionMethod
+ */
+ public function getOverriddenMethod()
+ {
+ $parent = $this->getDeclaringClass()->getParentClass();
+ if (null === $parent) {
+ return null;
+ }
+
+ foreach ($parent->getMethods() as $method) {
+ if ($this->getName() === $method->getName()) {
+ if (!$method->isPrivate() && !$method->isAbstract()) {
+ return $method;
+ } else {
+ return null;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
* Returns the original method when importing from a trait.
*
* @return \ApiGen\ReflectionMethod|null
View
2  tools/ApiGen/ApiGen/ReflectionParameter.php
@@ -1,7 +1,7 @@
<?php
/**
- * ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ * ApiGen 2.7.0 - API documentation generator for PHP 5.3+
*
* Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
* Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
2  tools/ApiGen/ApiGen/ReflectionProperty.php
@@ -1,7 +1,7 @@
<?php
/**
- * ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ * ApiGen 2.7.0 - API documentation generator for PHP 5.3+
*
* Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
* Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
75 tools/ApiGen/ApiGen/SourceFilesFilterIterator.php
@@ -0,0 +1,75 @@
+<?php
+
+/**
+ * ApiGen 2.7.0 - API documentation generator for PHP 5.3+
+ *
+ * Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
+ * Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
+ * Copyright (c) 2011-2012 Ondřej Nešpor (https://github.com/Andrewsville)
+ *
+ * For the full copyright and license information, please view
+ * the file LICENSE.md that was distributed with this source code.
+ */
+
+namespace ApiGen;
+
+use RecursiveDirectoryIterator;
+use RecursiveFilterIterator;
+
+/**
+ * Filters excluded files and directories.
+ */
+class SourceFilesFilterIterator extends RecursiveFilterIterator
+{
+ /**
+ * File/directory exclude masks.
+ *
+ * @var array
+ */
+ private $excludeMasks;
+
+ /**
+ * Creates the iterator.
+ *
+ * @param \RecursiveDirectoryIterator $iterator Directory iterator
+ * @param array $excludeMasks File/directory exlude masks
+ */
+ public function __construct(RecursiveDirectoryIterator $iterator, array $excludeMasks)
+ {
+ parent::__construct($iterator);
+
+ $this->excludeMasks = $excludeMasks;
+ }
+
+ /**
+ * Returns if the current file/directory should be processed.
+ *
+ * @return boolean
+ */
+ public function accept() {
+ /** @var \SplFileInfo */
+ $current = $this->current();
+
+ foreach ($this->excludeMasks as $mask) {
+ if (fnmatch($mask, $current->getPathName(), FNM_NOESCAPE)) {
+ return false;
+ }
+ }
+
+ if (!is_readable($current->getPathname())) {
+ throw new \InvalidArgumentException(sprintf('File/directory "%s" is not readable.', $current->getPathname()));
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns the iterator of the current element's children.
+ *
+ * @return \ApiGen\SourceFilesFilterIterator
+ */
+ public function getChildren()
+ {
+ return new static($this->getInnerIterator()->getChildren(), $this->excludeMasks);
+ }
+}
View
11 tools/ApiGen/ApiGen/Template.php
@@ -1,7 +1,7 @@
<?php
/**
- * ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ * ApiGen 2.7.0 - API documentation generator for PHP 5.3+
*
* Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
* Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
@@ -122,17 +122,12 @@ function($parser, $matches, $name) use ($fshl) {
'codeBlockSyntax'
);
- $latte = new Nette\Latte\Engine();
- $macroSet = new Nette\Latte\Macros\MacroSet($latte->compiler);
- $macroSet->addMacro('try', 'try {', '} catch (\Exception $e) {}');
- $this->registerFilter($latte);
-
// Common operations
$this->registerHelperLoader('Nette\Templating\Helpers::loader');
// PHP source highlight
$this->registerHelper('highlightPHP', function($source, $context) use ($that, $fshl) {
- return $that->resolveLink($source, $context) ?: $fshl->highlight((string) $source);
+ return $that->resolveLink($that->getTypeName($source), $context) ?: $fshl->highlight((string) $source);
});
$this->registerHelper('highlightValue', function($definition, $context) use ($that) {
return $that->highlightPHP(preg_replace('~^(?:[ ]{4}|\t)~m', '', $definition), $context);
@@ -477,7 +472,7 @@ public function getClassUrl($class)
public function getMethodUrl(ReflectionMethod $method, ReflectionClass $class = null)
{
$className = null !== $class ? $class->getName() : $method->getDeclaringClassName();
- return $this->getClassUrl($className) . '#_' . $method->getName();
+ return $this->getClassUrl($className) . '#_' . ($method->getOriginalName() ?: $method->getName());
}
/**
View
2  tools/ApiGen/ApiGen/Tree.php
@@ -1,6 +1,6 @@
<?php
/**
- * ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ * ApiGen 2.7.0 - API documentation generator for PHP 5.3+
*
* Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
* Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
2  tools/ApiGen/templates/@elementlist.latte
@@ -1,5 +1,5 @@
{*
-ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ApiGen 2.7.0 - API documentation generator for PHP 5.3+
Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
2  tools/ApiGen/templates/@layout.latte
@@ -1,5 +1,5 @@
{*
-ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ApiGen 2.7.0 - API documentation generator for PHP 5.3+
Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
10 tools/ApiGen/templates/class.latte
@@ -1,5 +1,5 @@
{*
-ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ApiGen 2.7.0 - API documentation generator for PHP 5.3+
Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
@@ -181,6 +181,12 @@ the file LICENSE.md that was distributed with this source code.
</div>
{/foreach}
+ {var $overriddenMethod = $method->overriddenMethod}
+ {if $overriddenMethod}
+ <h4>Overrides</h4>
+ <div class="list"><code><a n:tag-if="$template->getClass($overriddenMethod->declaringClassName)" href="{$overriddenMethod|methodUrl}">{$overriddenMethod->declaringClassName}::{$overriddenMethod->name}</a></code></div>
+ {/if}
+
{try}
{var $prototype = $method->prototype}
{if $prototype->declaringClass->interface}
@@ -209,7 +215,7 @@ the file LICENSE.md that was distributed with this source code.
<tr>
<td><code>
{foreach $methods as $data}
- <a href="{$data['method']|methodUrl:$data['method']->declaringTrait}" n:tag-if="$template->getClass($traitName)"><span n:tag-if="$data['method']->deprecated" class="deprecated">{$data['method']->name}()</span></a>{if $data['aliases']}(as {foreach $data['aliases'] as $alias}<span n:tag-if="$data['method']->deprecated" class="deprecated">{$alias->name}()</span>{sep}, {/sep}{/foreach}){/if}{sep}, {/sep}
+ <a href="{$data['method']|methodUrl:$data['method']->declaringTrait}" n:tag-if="$template->getClass($traitName)"><span n:tag-if="$data['method']->deprecated" class="deprecated">{$data['method']->originalName}()</span></a>{if $data['aliases']}(as {foreach $data['aliases'] as $alias}<span n:tag-if="$data['method']->deprecated" class="deprecated">{$alias->name}()</span>{sep}, {/sep}{/foreach}){/if}{sep}, {/sep}
{/foreach}
</code></td>
</tr>
View
2  tools/ApiGen/templates/combined.js.latte
@@ -1,5 +1,5 @@
{*
-ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ApiGen 2.7.0 - API documentation generator for PHP 5.3+
Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
2  tools/ApiGen/templates/constant.latte
@@ -1,5 +1,5 @@
{*
-ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ApiGen 2.7.0 - API documentation generator for PHP 5.3+
Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
2  tools/ApiGen/templates/deprecated.latte
@@ -1,5 +1,5 @@
{*
-ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ApiGen 2.7.0 - API documentation generator for PHP 5.3+
Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
2  tools/ApiGen/templates/elementlist.js.latte
@@ -1,5 +1,5 @@
{*
-ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ApiGen 2.7.0 - API documentation generator for PHP 5.3+
Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
2  tools/ApiGen/templates/function.latte
@@ -1,5 +1,5 @@
{*
-ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ApiGen 2.7.0 - API documentation generator for PHP 5.3+
Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
3  tools/ApiGen/templates/js/jquery.autocomplete.js
@@ -28,6 +28,8 @@ $.fn.extend({
// if the formatMatch option is not specified, then use formatItem for backwards compatibility
options.formatMatch = options.formatMatch || options.formatItem;
+ options.show = options.show || function(list) {};
+
return this.each(function() {
new $.Autocompleter(this, options);
});
@@ -714,6 +716,7 @@ $.Autocompleter.Select = function (options, input, select, config) {
top: offset.top + input.offsetHeight,
left: offset.left
}).show();
+ options.show(element);
if(options.scroll) {
list.scrollTop(0);
list.css({
View
32 tools/ApiGen/templates/js/main.js
@@ -1,5 +1,5 @@
/*!
- * ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ * ApiGen 2.7.0 - API documentation generator for PHP 5.3+
*
* Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
* Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
@@ -54,13 +54,23 @@ $(function() {
scrollHeight: 200,
max: 20,
formatItem: function(data) {
- return data[1].replace(/^(.+\\)(.+)$/, '<small>$1</small>$2');
+ return data[1].replace(/^(.+\\)(.+)$/, '<span><small>$1</small>$2</span>');
},
formatMatch: function(data) {
return data[1];
},
formatResult: function(data) {
return data[1];
+ },
+ show: function($list) {
+ var $items = $('li span', $list);
+ var maxWidth = Math.max.apply(null, $items.map(function() {
+ return $(this).width();
+ }));
+ // 10px padding
+ $list
+ .width(Math.max(maxWidth + 10, $search.innerWidth()))
+ .css('left', $search.offset().left + $search.outerWidth() - $list.outerWidth());
}
}).result(function(event, data) {
autocompleteFound = true;
@@ -73,6 +83,8 @@ $(function() {
}
location.push(file);
window.location = location.join('/');
+ $(this).closest('form').prop('action', location.join('/')); // workaround for Opera bug
+
}).closest('form')
.submit(function() {
var query = $search.val();
@@ -121,22 +133,10 @@ $(function() {
$caption.click();
}
- // Delayed hover efect on summary
+ // Open details
if (ApiGen.config.options.elementDetailsCollapsed) {
- var timeout;
$('tr', $content).filter(':has(.detailed)')
- .hover(function() {
- clearTimeout(timeout);
- var $this = $(this);
- timeout = setTimeout(function() {
- $('.short', $this).hide();
- $('.detailed', $this).show();
- }, 500);
- }, function() {
- clearTimeout(timeout);
- }).click(function() {
- // Immediate hover effect on summary
- clearTimeout(timeout);
+ .click(function() {
var $this = $(this);
$('.short', $this).hide();
$('.detailed', $this).show();
View
2  tools/ApiGen/templates/namespace.latte
@@ -1,5 +1,5 @@
{*
-ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ApiGen 2.7.0 - API documentation generator for PHP 5.3+
Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
2  tools/ApiGen/templates/opensearch.xml.latte
@@ -1,5 +1,5 @@
{*
-ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ApiGen 2.7.0 - API documentation generator for PHP 5.3+
Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
2  tools/ApiGen/templates/overview.latte
@@ -1,5 +1,5 @@
{*
-ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ApiGen 2.7.0 - API documentation generator for PHP 5.3+
Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
2  tools/ApiGen/templates/package.latte
@@ -1,5 +1,5 @@
{*
-ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ApiGen 2.7.0 - API documentation generator for PHP 5.3+
Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
2  tools/ApiGen/templates/resources/style.css
@@ -1,5 +1,5 @@
/*!
- * ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ * ApiGen 2.7.0 - API documentation generator for PHP 5.3+
*
* Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
* Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
2  tools/ApiGen/templates/robots.txt.latte
@@ -1,5 +1,5 @@
{*
-ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ApiGen 2.7.0 - API documentation generator for PHP 5.3+
Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
2  tools/ApiGen/templates/sitemap.xml.latte
@@ -1,5 +1,5 @@
{*
-ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ApiGen 2.7.0 - API documentation generator for PHP 5.3+
Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
2  tools/ApiGen/templates/source.latte
@@ -1,5 +1,5 @@
{*
-ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ApiGen 2.7.0 - API documentation generator for PHP 5.3+
Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
2  tools/ApiGen/templates/todo.latte
@@ -1,5 +1,5 @@
{*
-ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ApiGen 2.7.0 - API documentation generator for PHP 5.3+
Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
View
2  tools/ApiGen/templates/tree.latte
@@ -1,5 +1,5 @@
{*
-ApiGen 2.6.1 - API documentation generator for PHP 5.3+
+ApiGen 2.7.0 - API documentation generator for PHP 5.3+
Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
Please sign in to comment.
Something went wrong with that request. Please try again.