本文整理汇总了PHP中Phing::explodeIncludePath方法的典型用法代码示例。如果您正苦于以下问题:PHP Phing::explodeIncludePath方法的具体用法?PHP Phing::explodeIncludePath怎么用?PHP Phing::explodeIncludePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phing
的用法示例。
在下文中一共展示了Phing::explodeIncludePath方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __import
/**
* Import a PHP file
*
* @param string $path Path to the PHP file
* @param mixed $classpath String or object supporting __toString()
*
* @throws ConfigurationException
*/
public static function __import($path, $classpath = null)
{
if ($classpath) {
// Apparently casting to (string) no longer invokes __toString() automatically.
if (is_object($classpath)) {
$classpath = $classpath->__toString();
}
// classpaths are currently additive, but we also don't want to just
// indiscriminantly prepand/append stuff to the include_path. This means
// we need to parse current incldue_path, and prepend any
// specified classpath locations that are not already in the include_path.
//
// NOTE: the reason why we do it this way instead of just changing include_path
// and then changing it back, is that in many cases applications (e.g. Propel) will
// include/require class files from within method calls. This means that not all
// necessary files will be included in this import() call, and hence we can't
// change the include_path back without breaking those apps. While this method could
// be more expensive than switching & switching back (not sure, but maybe), it makes it
// possible to write far less expensive run-time applications (e.g. using Propel), which is
// really where speed matters more.
$curr_parts = Phing::explodeIncludePath();
$add_parts = Phing::explodeIncludePath($classpath);
$new_parts = array_diff($add_parts, $curr_parts);
if ($new_parts) {
set_include_path(implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts)));
}
}
$ret = (include_once $path);
if ($ret === false) {
$msg = "Error importing {$path}";
if (self::getMsgOutputLevel() >= Project::MSG_DEBUG) {
$x = new Exception("for-path-trace-only");
$msg .= $x->getTraceAsString();
}
throw new ConfigurationException($msg);
}
}
示例2: init
/**
* The init method: check if Net_FTP is available
*/
public function init()
{
require_once 'PEAR.php';
$paths = Phing::explodeIncludePath();
foreach ($paths as $path) {
if (file_exists($path . DIRECTORY_SEPARATOR . 'Net' . DIRECTORY_SEPARATOR . 'FTP.php')) {
return true;
}
}
throw new BuildException('The FTP Deploy task requires the Net_FTP PEAR package.');
}
示例3: initializePhpDocumentor
/**
* Finds and initializes the phpDocumentor installation
*/
private function initializePhpDocumentor()
{
$phpDocumentorPath = null;
foreach (Phing::explodeIncludePath() as $path) {
$testPhpDocumentorPath = $path . DIRECTORY_SEPARATOR . 'phpDocumentor' . DIRECTORY_SEPARATOR . 'src';
if (file_exists($testPhpDocumentorPath)) {
$phpDocumentorPath = $testPhpDocumentorPath;
}
}
if (empty($phpDocumentorPath)) {
throw new BuildException("Please make sure PhpDocumentor 2 is installed and on the include_path.", $this->getLocation());
}
set_include_path($phpDocumentorPath . PATH_SEPARATOR . get_include_path());
require_once $phpDocumentorPath . '/phpDocumentor/Bootstrap.php';
\phpDocumentor\Bootstrap::createInstance()->initialize();
$this->phpDocumentorPath = $phpDocumentorPath;
}
示例4: findPhpDocumentorInstall
/**
* Searches include_path for PhpDocumentor install and adjusts include_path appropriately.
* @throws BuildException - if unable to find PhpDocumentor on include_path
*/
protected function findPhpDocumentorInstall()
{
$found = null;
foreach (Phing::explodeIncludePath() as $path) {
$testpath = $path . DIRECTORY_SEPARATOR . 'PhpDocumentor';
if (file_exists($testpath)) {
$found = $testpath;
break;
}
}
if (!$found) {
throw new BuildException("PhpDocumentor task depends on PhpDocumentor being installed and on include_path.", $this->getLocation());
}
// otherwise, adjust the include_path to path to include the PhpDocumentor directory ...
set_include_path(get_include_path() . PATH_SEPARATOR . $found);
include_once "phpDocumentor/Setup.inc.php";
if (!class_exists('phpDocumentor_setup')) {
throw new BuildException("Error including PhpDocumentor setup class file.");
}
}
示例5: main
/** Main entry point */
public function main()
{
// Apparently casting to (string) no longer invokes __toString() automatically.
if (is_object($this->classpath)) {
$classpath = $this->classpath->__toString();
}
if (empty($classpath)) {
throw new BuildException("Provided classpath was empty.");
}
$curr_parts = Phing::explodeIncludePath();
$add_parts = Phing::explodeIncludePath($classpath);
$new_parts = array_diff($add_parts, $curr_parts);
if ($new_parts) {
$this->log("Prepending new include_path components: " . implode(PATH_SEPARATOR, $new_parts), Project::MSG_VERBOSE);
set_include_path(implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts)));
}
}
示例6: findPhpDocumentorPath
/**
* Find the correct php documentor path
*
* @return null|string
*/
private function findPhpDocumentorPath()
{
$phpDocumentorPath = null;
$directories = array('phpDocumentor', 'phpdocumentor');
foreach ($directories as $directory) {
foreach (Phing::explodeIncludePath() as $path) {
$testPhpDocumentorPath = $path . DIRECTORY_SEPARATOR . $directory . DIRECTORY_SEPARATOR . 'src';
if (file_exists($testPhpDocumentorPath)) {
$phpDocumentorPath = $testPhpDocumentorPath;
}
}
}
return $phpDocumentorPath;
}
示例7: main
/** Main entry point */
public function main()
{
// Apparently casting to (string) no longer invokes __toString() automatically.
if (is_object($this->classpath)) {
$classpath = $this->classpath->__toString();
}
if (empty($classpath)) {
throw new BuildException("Provided classpath was empty.");
}
$curr_parts = Phing::explodeIncludePath();
$add_parts = Phing::explodeIncludePath($classpath);
$new_parts = array_diff($add_parts, $curr_parts);
if ($new_parts) {
$this->updateIncludePath($new_parts, $curr_parts);
}
}
示例8: initializeDocBlox
/**
* Finds and initializes the DocBlox installation
*/
private function initializeDocBlox()
{
$docbloxPath = null;
foreach (Phing::explodeIncludePath() as $path) {
$testDocBloxPath = $path . DIRECTORY_SEPARATOR . 'DocBlox' . DIRECTORY_SEPARATOR . 'src';
if (file_exists($testDocBloxPath)) {
$docbloxPath = $testDocBloxPath;
}
}
if (empty($docbloxPath)) {
throw new BuildException("Please make sure DocBlox is installed and on the include_path.", $this->getLocation());
}
set_include_path($docbloxPath . PATH_SEPARATOR . get_include_path());
require_once $docbloxPath . '/DocBlox/Bootstrap.php';
$bootstrap = DocBlox_Bootstrap::createInstance();
$autoloader = $bootstrap->registerAutoloader();
if ($this->quiet) {
DocBlox_Core_Abstract::config()->logging->level = 'quiet';
} else {
DocBlox_Core_Abstract::config()->logging->level = 'debug';
}
$bootstrap->registerPlugins($autoloader);
}