当前位置: 首页>>代码示例>>PHP>>正文


PHP DIRNAME函数代码示例

本文整理汇总了PHP中DIRNAME函数的典型用法代码示例。如果您正苦于以下问题:PHP DIRNAME函数的具体用法?PHP DIRNAME怎么用?PHP DIRNAME使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DIRNAME函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: bootstrapScript

 public function bootstrapScript($url = 'bootstrap.min.js', $options = array())
 {
     $pluginRoot = dirname(dirname(DIRNAME(__FILE__)));
     $pluginName = end(explode(DS, $pluginRoot));
     $url = '/' . Inflector::underscore($pluginName) . '/js/' . $url;
     return parent::script($url, $options);
 }
开发者ID:racklin,项目名称:TwitterBootstrap,代码行数:7,代码来源:BootstrapHtmlHelper.php

示例2: applyWrapper

 protected static function applyWrapper($connection, $wrapper_name)
 {
     $wrapper_class = 'lmb' . ucfirst($wrapper_name) . 'CacheWrapper';
     if (!class_exists($wrapper_class)) {
         $file = DIRNAME(__FILE__) . '/wrappers/' . $wrapper_class . '.class.php';
         if (!file_exists($file)) {
             throw new lmbException("Cache wripper '{$wrapper_class}' file not found", array('dsn' => $dsn, 'name' => $wrapper_name, 'class' => $wrapper_class, 'file' => $file));
         }
         lmb_require($file);
     }
     return new $wrapper_class($connection);
 }
开发者ID:snowjobgit,项目名称:limb,代码行数:12,代码来源:lmbCacheFactory.class.php

示例3: run

 /**
  * Run validation
  * @param array $data
  * @param array $rules
  * @return bool
  */
 public function run($data, $rules = NULL)
 {
     // Optional rules
     if ($rules !== NULL) {
         // Add rules
         if ($this->add_rules($rules) === FALSE) {
             // Could not add rules
             return FALSE;
         }
     }
     // Set data to validate
     $this->data = $data;
     $this->rules = $rules;
     error_log(print_r($rules, true), 3, DIRNAME(__FILE__) . '/rules.log');
     // Rules are set
     if (is_array($this->rules)) {
         // Check fields
         foreach ($this->rules as $k => $v) {
             $this->check_field($k);
         }
     }
     // Check if any errors were set
     return !empty($this->error) ? $this->error : TRUE;
 }
开发者ID:jacobross85,项目名称:community,代码行数:30,代码来源:Validate.php

示例4: foreach

<?php

/* LOAD FUNCTION MODULES */
foreach (glob(dirname(__FILE__) . '/functions/*.php') as $filename) {
    require_once $filename;
}
foreach (glob(dirname(__FILE__) . '/functions/**/*.php') as $filename) {
    require_once $filename;
}
/* APPLICATION LOGIC */
require DIRNAME(__FILE__) . '/application.php';
/* LOAD APPLICATION MODULES */
foreach (glob(dirname(__FILE__) . '/application/*.php') as $filename) {
    require_once $filename;
}
foreach (glob(dirname(__FILE__) . '/application/**/*.php') as $filename) {
    require_once $filename;
}
开发者ID:bjorn-ali-goransson,项目名称:Wordpress-Theme,代码行数:18,代码来源:functions.php

示例5: __call

 function __call($method, $params)
 {
     $this->status = null;
     $this->error = null;
     $this->raw_response = null;
     $this->response = null;
     // If no parameters are passed, this will be an empty array
     $params = array_values($params);
     // The ID should be unique for each call
     $this->id++;
     // Build the request, it's ok that params might have any empty array
     $request = json_encode(array('method' => $method, 'params' => $params, 'id' => $this->id));
     // Build the cURL session
     $curl = curl_init("{$this->proto}://{$this->username}:{$this->password}@{$this->host}:{$this->port}/{$this->url}");
     $options = array(CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_FOLLOWLOCATION => TRUE, CURLOPT_MAXREDIRS => 10, CURLOPT_HTTPHEADER => array('Content-type: application/json'), CURLOPT_POST => TRUE, CURLOPT_POSTFIELDS => $request);
     // This prevents users from getting the following warning when open_basedir is set:
     // Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set
     if (ini_get('open_basedir')) {
         unset($options[CURLOPT_FOLLOWLOCATION]);
     }
     if ($this->proto == 'https') {
         // If the CA Certificate was specified we change CURL to look for it
         if ($this->CACertificate != null) {
             $options[CURLOPT_CAINFO] = $this->CACertificate;
             $options[CURLOPT_CAPATH] = DIRNAME($this->CACertificate);
         } else {
             // If not we need to assume the SSL cannot be verified so we set this flag to FALSE to allow the connection
             $options[CURLOPT_SSL_VERIFYPEER] = FALSE;
         }
     }
     curl_setopt_array($curl, $options);
     // Execute the request and decode to an array
     $this->raw_response = curl_exec($curl);
     $this->response = json_decode($this->raw_response, TRUE);
     // If the status is not 200, something is wrong
     $this->status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
     // If there was no error, this will be an empty string
     $curl_error = curl_error($curl);
     curl_close($curl);
     if (!empty($curl_error)) {
         $this->error = $curl_error;
     }
     if ($this->response['error']) {
         // If gamecreditsd returned an error, put that in $this->error
         $this->error = $this->response['error']['message'];
     } elseif ($this->status != 200) {
         // If gamecreditsd didn't return a nice error message, we need to make our own
         switch ($this->status) {
             case 400:
                 $this->error = 'HTTP_BAD_REQUEST';
                 break;
             case 401:
                 $this->error = 'HTTP_UNAUTHORIZED';
                 break;
             case 403:
                 $this->error = 'HTTP_FORBIDDEN';
                 break;
             case 404:
                 $this->error = 'HTTP_NOT_FOUND';
                 break;
         }
     }
     if ($this->error) {
         return FALSE;
     }
     return $this->response['result'];
 }
开发者ID:Gamecredits-Universe,项目名称:php-gamecredits,代码行数:67,代码来源:gamecredits.php

示例6: __call

 function __call($method, $params)
 {
     $this->status = null;
     $this->error = null;
     $this->raw_response = null;
     $this->response = null;
     // The ID should be unique for each call
     $this->id++;
     // If no parameters are passed, this will be an empty array
     if ($method == 'getblocktemplate') {
         $param = $params[0];
         $request = "{\"method\":\"{$method}\",\"params\":[{$param}],\"id\":{$this->id}}";
         //	debuglog($request);
     } else {
         $params = array_values($params);
         // Build the request, it's ok that params might have any empty array
         $request = json_encode(array('method' => $method, 'params' => $params, 'id' => $this->id));
     }
     // Build the cURL session
     $curl = curl_init("{$this->proto}://{$this->username}:{$this->password}@{$this->host}:{$this->port}/{$this->url}");
     $options = array(CURLOPT_CONNECTTIMEOUT => 20, CURLOPT_TIMEOUT => 30, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_FOLLOWLOCATION => TRUE, CURLOPT_MAXREDIRS => 10, CURLOPT_HTTPHEADER => array('Content-type: application/json'), CURLOPT_POST => TRUE, CURLOPT_POSTFIELDS => $request);
     if ($this->proto == 'https') {
         // If the CA Certificate was specified we change CURL to look for it
         if ($this->CACertificate != null) {
             $options[CURLOPT_CAINFO] = $this->CACertificate;
             $options[CURLOPT_CAPATH] = DIRNAME($this->CACertificate);
         } else {
             // If not we need to assume the SSL cannot be verified so we set this flag to FALSE to allow the connection
             $options[CURLOPT_SSL_VERIFYPEER] = FALSE;
         }
     }
     curl_setopt_array($curl, $options);
     // Execute the request and decode to an array
     $this->raw_response = curl_exec($curl);
     //		debuglog($this->raw_response);
     $this->response = json_decode($this->raw_response, TRUE);
     // If the status is not 200, something is wrong
     $this->status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
     // If there was no error, this will be an empty string
     $curl_error = curl_error($curl);
     curl_close($curl);
     //		debuglog($this->response);
     if (!empty($curl_error)) {
         $this->error = $curl_error;
     }
     if (isset($this->response['error']) && $this->response['error']) {
         // If bitcoind returned an error, put that in $this->error
         $this->error = strtolower($this->response['error']['message']);
     } elseif ($this->status != 200) {
         // If bitcoind didn't return a nice error message, we need to make our own
         switch ($this->status) {
             case 400:
                 $this->error = 'HTTP_BAD_REQUEST';
                 break;
             case 401:
                 $this->error = 'HTTP_UNAUTHORIZED';
                 break;
             case 403:
                 $this->error = 'HTTP_FORBIDDEN';
                 break;
             case 404:
                 $this->error = 'HTTP_NOT_FOUND';
                 break;
         }
     }
     if ($this->error) {
         return FALSE;
     }
     return $this->response['result'];
 }
开发者ID:zarethernet,项目名称:yaamp,代码行数:70,代码来源:easybitcoin.php

示例7: DIRNAME

<?php

/**
*	include FFmpeg class
**/
include DIRNAME(DIRNAME(__FILE__)) . '/src/ffmpeg.class.php';
/**
*	get options from database
**/
$options = array('duration' => 99, 'position' => 0, 'itsoffset' => 2);
/**
*	Create command
*/
$FFmpeg = new FFmpeg('/usr/local/bin/ffmpeg');
$FFmpeg->input('/var/media/original.avi');
$FFmpeg->transpose(0)->vflip()->grayScale()->vcodec('h264')->frameRate('30000/1001');
$FFmpeg->acodec('aac')->audioBitrate('192k');
foreach ($options as $option => $values) {
    $FFmpeg->call($option, $values);
}
$FFmpeg->output('/var/media/new.mp4', 'mp4');
print $FFmpeg->command;
开发者ID:socialweb,项目名称:PiGo,代码行数:22,代码来源:complete.php

示例8: chdir

     $g_ignore_weights = true;
 } else {
     if ($arg == "--no-drop-db") {
         $locals['no_drop_db'] = true;
     } else {
         if ($arg == "--keep-all") {
             $locals['keep_all'] = true;
         } else {
             if ($arg == "--no-demo") {
                 $g_skipdemo = true;
             } else {
                 if ($arg == "--no-marks") {
                     $g_usemarks = false;
                 } else {
                     if ($arg == "--cwd") {
                         chdir(DIRNAME(__FILE__));
                     } else {
                         if (is_dir($arg)) {
                             $test_dirs[] = $arg;
                         } else {
                             if (preg_match("/^(\\d+)-(\\d+)\$/", $arg, $range)) {
                                 $test_range = array($range[1], $range[2]);
                                 // from, to
                             } else {
                                 if (preg_match("/^(\\d+):(\\d+)\$/", $arg, $range)) {
                                     // FIXME! lockdown gen model, only keep test mode
                                     // FIXME! lockdown $test_dirs from here, and check it for emptiness
                                     // ie. make sure there are NO other test arguments when this syntax is in use
                                     $test_dirs = array(sprintf("test_%03d", $range[1]));
                                     $g_pick_query = (int) $range[2];
                                 } else {
开发者ID:ravelry,项目名称:sphinx,代码行数:31,代码来源:ubertest.php

示例9: define

<?php

define('MENU_STAFF', true);
require_once DIRNAME(__DIR__) . '/includes/globals.php';
require_once DIRNAME(__DIR__) . '/includes/class/class_mtg_paginate.php';
$pages = new Paginator();
$_SESSION['staff_authed_time'] = time() + 900;
$_GET['pull'] = isset($_GET['pull']) && ctype_alpha(str_replace('.php', '', $_GET['pull'])) ? str_replace('.php', '', $_GET['pull']) : null;
$file = empty($_GET['pull']) ? 'index.php' : $_GET['pull'] . '.php';
$path = __DIR__ . '/pull/' . $file;
if (file_exists($path)) {
    require_once $path;
} else {
    $mtg->error('Invalid pull request' . ($users->hasAccess('override_all') ? ' - ' . $path : ''));
}
开发者ID:jwest00724,项目名称:mtg-engine,代码行数:15,代码来源:index.php

示例10: DIRNAME

<?php

namespace JBBCode\visitors;

require_once DIRNAME(__DIR__) . '/CodeDefinition.php';
require_once DIRNAME(__DIR__) . '/DocumentElement.php';
require_once DIRNAME(__DIR__) . '/ElementNode.php';
require_once DIRNAME(__DIR__) . '/NodeVisitor.php';
require_once DIRNAME(__DIR__) . '/TextNode.php';
/**
 * This visitor is used by the jBBCode core to enforce nest limits after
 * parsing. It traverses the parse graph depth first, removing any subtrees
 * that are nested deeper than an element's code definition allows.
 *
 * @author jbowens
 * @since May 2013
 */
class NestLimitVisitor implements \JBBCode\NodeVisitor
{
    protected $depth = array();
    /* A map from tag name to current depth. */
    public function visitDocumentElement(\JBBCode\DocumentElement $documentElement)
    {
        foreach ($documentElement->getChildren() as $child) {
            $child->accept($this);
        }
    }
    public function visitTextNode(\JBBCode\TextNode $textNode)
    {
        /* Nothing to do. Text nodes don't have tag names or children. */
    }
开发者ID:jwest00724,项目名称:mtg-engine,代码行数:31,代码来源:NestLimitVisitor.php

示例11: error_reporting

<?php

error_reporting(E_ALL);
ini_set('display_errors', '1');
DEFINE('SMARTY_ROOT', DIRNAME(__FILE__) . '/../_smarty');
DEFINE('CONTENT_ROOT', DIRNAME(__FILE__) . '/../_content');
DEFINE('CURRENT_THEME', 'cogsci');
开发者ID:bcipolli,项目名称:website-old-php,代码行数:7,代码来源:_config.php

示例12: DIRNAME

<?php

require 'php-dpa-parser/parser.php';
$dirname = DIRNAME(__FILE__);
foreach (glob("{$dirname}/php-dpa-parser/result/*.php") as $file) {
    require $file;
}
foreach (glob("{$dirname}/php-dpa-parser/result/media/*.php") as $file) {
    require $file;
}
foreach (glob("{$dirname}/php-dpa-parser/result/content/*.php") as $file) {
    require $file;
}
foreach (glob("{$dirname}/php-dpa-parser/result/content/media/*.php") as $file) {
    require $file;
}
开发者ID:smee-dee,项目名称:php-dpa-parser,代码行数:16,代码来源:php-dpa-parser.php

示例13: explode

<?php

/**
 * 2013-7-6 13:41:44
 * @author      x.li
 * @abstract    入口文件
 */
$arr = explode('/', $_SERVER['PHP_SELF']);
$root_dir = $arr[1];
// 站点物理路径
defined("HOME_REAL_PATH") || define("HOME_REAL_PATH", $_SERVER['DOCUMENT_ROOT'] . '/' . $root_dir);
// 站点根目录
defined("HOME_PATH") || define("HOME_PATH", 'http://' . $_SERVER['HTTP_HOST'] . '/' . $root_dir);
// 应用根目录
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// 第三方库目录
defined("LIBRARY_PATH") || define("LIBRARY_PATH", realpath(DIRNAME(__FILE__) . "/../library"));
// 站点配置文件目录
defined("CONFIGS_PATH") || define("CONFIGS_PATH", REALPATH(APPLICATION_PATH . "/configs"));
// 默认以调试方式运行
defined("APPLICATION_ENV") || define("APPLICATION_ENV", getenv("APPLICATION_ENV") ? getenv("APPLICATION_ENV") : "development");
set_include_path(implode(PATH_SEPARATOR, array(realpath(LIBRARY_PATH), get_include_path())));
// 自动加载library/Evolve目录下的文件
require_once LIBRARY_PATH . "/Evolve/ClassLoader.php";
// 常量
require_once CONFIGS_PATH . "/Constant.php";
require_once 'Zend/Application.php';
$application = new Zend_Application(APPLICATION_ENV, CONFIGS_PATH . "/application.ini");
$application->bootstrap()->run();
开发者ID:xindalu,项目名称:evolve,代码行数:29,代码来源:index.php

示例14: __construct


//.........这里部分代码省略.........
 - MTG Codes v9</title>
				<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.6.0/pure-min.css" />
				<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.6.0/grids-responsive-min.css" />
				<!--[if lte IE 8]>
				<link rel="stylesheet" href="css/layouts/side-menu-old-ie.css" />
				<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.6.0/grids-responsive-old-ie-min.css" />
				<![endif]-->
				<!--[if gt IE 8]><!-->
				<link rel="stylesheet" href="css/layouts/side-menu.css" />
				<!--<![endif]-->
				<style type='text/css'>
					.center {
						text-align:center;
					}
				</style>
				<link rel="stylesheet" type="text/css" href="css/message.css" />
				<link rel="stylesheet" type="text/css" href="css/style.css" />
				<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" />
			</head>
		<body>
			<div id="layout">
				<a href="#menu" id="menuLink" class="menu-link"><span>&nbsp;</span></a>
				<div id="menu">
					<div class="userinfo">
						<ul class="pure-menu-list">
							<li class="pure-menu-item"><?php 
        echo $users->name($my['id'], true);
        ?>
</li>
							<li class="pure-menu-item"><strong>Money:</strong> <?php 
        echo $set['main_currency_symbol'] . $mtg->format($my['money']);
        ?>
</li>
							<li class="pure-menu-item"><strong>Level:</strong> <?php 
        echo $mtg->format($my['level']);
        ?>
</li>
							<li class="pure-menu-item"><strong>Points:</strong> <?php 
        echo $mtg->format($my['points']);
        ?>
</li>
							<li class="pure-menu-item"><strong>Merits:</strong> <?php 
        echo $mtg->format($my['merits']);
        ?>
</li>
						</ul><hr />
						<ul class="pure-menu-list">
							<li class="pure-menu-item">Energy: <?php 
        echo $my['energy'] . '/' . $my['energy_max'];
        ?>
</li>
							<li class="pure-menu-item">Nerve: <?php 
        echo $my['nerve'] . '/' . $my['nerve_max'];
        ?>
</li>
							<li class="pure-menu-item">Happy: <?php 
        echo $my['happy'] . '/' . $my['happy_max'];
        ?>
</li>
							<li class="pure-menu-item">Life: <?php 
        echo $my['health'] . '/' . $my['health_max'];
        ?>
</li>
							<li class="pure-menu-item">Exp: <?php 
        echo $mtg->format($my['exp'], 2) . '/' . $users->expRequired(true);
        ?>
</li>
						</ul>
					</div>
					<div class="pure-menu"><?php 
        if (!defined('MENU_ENABLE')) {
            define('MENU_ENABLE', true);
        }
        require_once defined('MENU_STAFF') ? DIRNAME(__DIR__) . '/staff/menu.php' : __DIR__ . '/menu.php';
        ?>
</div>
				</div>
				<div id="main">
					<div class="header">
						<div class="logo">&nbsp;</div><?php 
        if (defined('HEADER_TEXT')) {
            echo '<h3>', HEADER_TEXT, '</h3>';
        }
        ?>
</div>
					<div class="content"><?php 
        if (array_key_exists('action', $_GET) && $_GET['action'] == 'logout') {
            session_unset();
            session_destroy();
            session_start();
            $_SESSION['msg'] = ['type' => 'success', 'content' => 'You\'ve logged out. Come back soon!'];
            exit(header('Location: index.php'));
        }
        if ($my['hospital']) {
            echo '<strong>Nurse:</strong> You\'re currently in hospital for ' . $mtg->time_format($my['hospital'] * 60) . '.<br />';
        }
        if ($my['jail']) {
            echo '<strong>Officer:</strong> You\'re currently in jail for ' . $mtg->time_format($my['jail'] * 60) . '.<br />';
        }
    }
开发者ID:jwest00724,项目名称:mtg-engine,代码行数:101,代码来源:header.php

示例15: csyn_main_menu

function csyn_main_menu()
{
    if (function_exists('add_menu_page')) {
        add_menu_page('CyberSyn', 'CyberSyn', 'add_users', DIRNAME(__FILE__) . '/cybersyn-options.php');
        add_submenu_page(DIRNAME(__FILE__) . '/cybersyn-options.php', 'CyberSyn RSS/Atom Syndicator', 'RSS/Atom Syndicator', 'add_users', DIRNAME(__FILE__) . '/cybersyn-syndicator.php');
    }
}
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:7,代码来源:cybersyn.php


注:本文中的DIRNAME函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。