本文整理汇总了PHP中dirName函数的典型用法代码示例。如果您正苦于以下问题:PHP dirName函数的具体用法?PHP dirName怎么用?PHP dirName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dirName函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: startRouter
private function startRouter()
{
$uri = $this->getURI();
if (!empty($uri)) {
//create file path
$file = dirName(__FILE__) . "/../components/" . strtolower($this->uri['component']) . ".component.php";
//check if component exists
if (file_exists($file)) {
require_once $file;
//create component name (cName) and component action (cAction), call with cParameters
$this->cName = "component" . $this->uri['component'];
$this->cAction = "action" . $this->uri['action'];
$this->cParameters = $this->uri['parameters'];
//create object and call method
if (isset($this->cParameters)) {
if (class_exists($this->cName) and $component = new $this->cName($this->uri) and method_exists($component, $this->cAction) and $action = $this->cAction) {
$component->{$action}($this->cParameters);
} else {
if (class_exists($this->cName) and $component = new $this->cName($this->uri) and method_exists($component, $this->cAction) and $action = $this->cAction) {
$component->{$action}();
}
}
}
//return true if all was executed
return true;
}
} else {
return false;
}
}
示例2: _gs_utf8_get_map
function _gs_utf8_get_map()
{
$map = array();
$lines = @file(dirName(__FILE__) . '/Translit.txt');
if (!is_array($lines)) {
return $map;
}
foreach ($lines as $line) {
$line = trim($line);
if ($line == '' || subStr($line, 0, 1) == '#') {
continue;
}
$tmp = explode(';', $line, 3);
$char = rTrim(@$tmp[0]);
$translit = trim(@$tmp[1]);
if (!$translit) {
$map[$char] = '';
} else {
$char = hexUnicodeToUtf8($char);
$tmp = @preg_split('/\\s+/S', $translit);
if (!is_array($tmp)) {
continue;
}
$t = '';
foreach ($tmp as $translit) {
$t .= hexUnicodeToUtf8($translit);
}
$map[$char] = $t;
}
}
return $map;
}
示例3: setUp
protected function setUp()
{
$this->app->backup();
$application = new \Nano\Application();
$application->withConfigurationFormat('php')->withRootDir(dirName(dirName(dirName(__DIR__))) . DS . 'application-example')->configure();
$this->redirect = new \Nano\Controller\Redirect(new \Nano\Controller\Response($application));
}
示例4: Controller
function Controller($module, $defaultMode = "default", $modeField = "", $params = array())
{
$path = dirName(__FILE__);
$mode = $defaultMode;
if ($modeField == "") {
$modeField = $module . "_mode";
}
if (!is_dir($path . "/" . $module)) {
die("Module " . $path . "/" . $module . " not found in {$path}.");
}
if (array_key_exists($modeField, $_POST)) {
$mode = $_POST[$modeField];
} elseif (array_key_exists($modeField, $_GET)) {
$mode = $_GET[$modeField];
}
# include module file for any params
$paramsPath = $path . "/" . $module . "/module-params.php";
if (file_exists($paramsPath)) {
include $paramsPath;
}
# include model file from processing / getting data
$lastMode = "";
while ($lastMode != $mode) {
$lastMode = $mode;
$actionPath = $path . "/" . $module . "/action/" . $mode . ".php";
if (file_exists($actionPath)) {
include $actionPath;
}
}
# include view file for displaying data
$viewPath = $path . "/" . $module . "/view/" . $mode . ".php";
if (file_exists($viewPath)) {
include $viewPath;
}
}
示例5: language
public static function language($language)
{
$dir = dirName(__FILE__) . "/../language/";
$file = $language . ".language.php";
if (file_exists($dir . $file)) {
require_once $dir . $file;
}
}
示例6: get
/**
* @return string
* @param \Nano\TestUtils\TestCase $test
* @param string $name
* @param string|null $anotherDir
*/
public function get(\Nano\TestUtils\TestCase $test, $name, $anotherDir = null)
{
$class = new \ReflectionClass($test);
$name = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $name);
$result = dirName($class->getFileName());
if (null !== $anotherDir) {
$result .= str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $anotherDir);
}
return $result . DIRECTORY_SEPARATOR . '_files' . $name;
}
示例7: setUp
protected function setUp()
{
$this->app->backup();
ob_start();
$this->setUseOutputBuffering(true);
$this->appRoot = dirName(__DIR__) . '/Application/_files';
$this->cwd = getCwd();
$this->cli = new \Nano\Cli();
chDir($this->appRoot);
$this->cli->run(array());
}
示例8: setUp
protected function setUp()
{
$this->app->backup();
ob_start();
$this->setUseOutputBuffering(true);
$application = new \Nano\Application();
$application->withRootDir($GLOBALS['application']->rootDir)->withConfigurationFormat('php')->configure();
$this->appRoot = dirName(__DIR__) . '/Application/_files';
$this->nanoRoot = $application->nanoRootDir;
$this->cwd = getCwd();
$this->cli = new \Nano\Cli();
chDir($this->appRoot);
}
示例9: realpath
<?php
/**
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright 2014 Akvelon Inc.
* http://www.akvelon.com/contact-us
*/
require_once realpath(dirName(__FILE__) . '/../bootstrap_base.php');
require_once KALTURA_ROOT_PATH . '/api_v3/lib/KalturaErrors.php';
require_once KALTURA_ROOT_PATH . '/vendor/autoload.php';
use WindowsAzure\Common\ServicesBuilder;
use WindowsAzure\Common\Internal\MediaServicesSettings;
use WindowsAzure\MediaServices\Models\Asset;
use WindowsAzure\MediaServices\Models\AccessPolicy;
use WindowsAzure\MediaServices\Models\Locator;
use WindowsAzure\MediaServices\Models\Task;
use WindowsAzure\MediaServices\Models\Job;
use WindowsAzure\Common\Internal\Http\Url;
use WindowsAzure\Common\Internal\Resources;
/**
* Provides interface for access to Microsoft Azure Media Services
* @package infra
* @subpackage utils
*/
class kWAMS
{
示例10: dirName
<?php
require dirName(__DIR__) . '/library/Nano.php';
Nano::instance();
$database = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : null;
Nano_Migrate_Init::init(Nano::db($database));
示例11: gs_ringtone_set
//.........这里部分代码省略.........
#
if (!$file) {
$ok = $db->execute('UPDATE `ringtones` SET `file`=NULL WHERE `user_id`=' . $user_id . ' AND `src`=\'' . $src . '\'');
if (!$ok) {
return new GsError('DB error.');
}
return true;
}
# convert sound file to the formats needed for each phone type
#
$to_sox_format = array('alaw' => 'al', 'ulaw' => 'ul');
$pinfo = pathInfo($file);
//$base = $pinfo['basename'];
$ext = strToLower(@$pinfo['extension']);
if (array_key_exists($ext, $to_sox_format)) {
$ext = $to_sox_format[$ext];
}
$rand = base_convert(rand(1296, 46655), 10, 36);
# 100(36) - zzz(36)
$tmpbase = '/tmp/gs-ring-' . $user . '-' . $rand;
$infile = $tmpbase . '-in.' . $ext;
$outbase = $tmpbase . '-out';
$ok = @copy($file, $infile);
@chmod($infile, 0666);
if (!$ok) {
return new GsError('Failed to copy file to "' . $infile . '".');
}
include_once GS_DIR . 'inc/phone-capability.php';
$phone_types = glob(GS_DIR . 'htdocs/prov/*/capability.php');
if (!is_array($phone_types)) {
$phone_types = array();
}
for ($i = 0; $i < count($phone_types); ++$i) {
$phone_types[$i] = baseName(dirName($phone_types[$i]));
}
gs_log(GS_LOG_DEBUG, 'Ringtone conversion: Found phone types: ' . implode(', ', $phone_types));
$errors = array();
$new_ringer_basename = $user . '-' . subStr($src, 0, 3) . '-' . $rand;
foreach ($phone_types as $phone_type) {
include_once GS_DIR . 'htdocs/prov/' . $phone_type . '/capability.php';
$class = 'PhoneCapability_' . $phone_type;
if (!class_exists($class)) {
gs_log(GS_LOG_WARNING, $phone_type . ': Class broken.');
$errors[] = $phone_type . ': Class broken.';
continue;
}
$PhoneCapa = new $class();
$outfile = $PhoneCapa->conv_ringtone($infile, $outbase);
if (isGsError($outfile)) {
gs_log(GS_LOG_WARNING, 'Ringtone conversion: ' . $phone_type . ': ' . $outfile->getMsg());
$errors[] = $phone_type . ': ' . $outfile->getMsg();
} elseif ($outfile === null) {
gs_log(GS_LOG_DEBUG, 'Ringtone conversion: ' . $phone_type . ': Not implemented.');
continue;
} elseif (!$outfile) {
gs_log(GS_LOG_WARNING, 'Ringtone conversion: ' . $phone_type . ': Failed to convert file.');
$errors[] = $phone_type . ': ' . 'Failed to convert file.';
continue;
}
if (!file_exists($outfile)) {
gs_log(GS_LOG_WARNING, 'Ringtone conversion: ' . $phone_type . ': Failed to convert file.');
$errors[] = $phone_type . ': ' . 'Failed to convert file.';
continue;
}
gs_log(GS_LOG_DEBUG, 'Ringtone conversion: ' . $phone_type . ': Converted.');
@chmod($outfile, 0666);
示例12: dirName
<?php
require_once dirName(__FILE__) . '/../../../../../../wp-load.php';
?>
<script type="text/javascript">
// executes this when the DOM is ready
jQuery(function(){
// handles the click event of the submit button
jQuery('#submit').click(function(){
// defines the options and their default values
// again, this is not the most elegant way to do this
// but well, this gets the job done nonetheless
var shortcode = '[wpsm_post_images_slider]';
window.send_to_editor(shortcode);
// closes Thickbox
tb_remove();
});
});
</script>
<form action="/" method="get" id="form" name="form" accept-charset="utf-8">
<p>
<?php
_e('This shortcode makes slider from all images that attached to post', 'rehub_framework');
?>
</p>
<p>
示例13: createStep
/**
* @return Nano_Migrate_Step
* @param string $path
*/
protected function createStep($path)
{
$result = new Nano_Migrate_Step(dirName(__FILE__) . '/_files/db-migrate-steps/' . $path);
$result->load();
return $result;
}
示例14: header
<?php
header('Content-Type: text/x-component');
//header( 'Content-Type: text/plain' );
//header( 'Pragma: cache' );
header('Cache-Control: public, max-age=120, must-revalidate');
//header( 'Last-Modified: '. gmDate('D, d M Y 00:00:00') .' GMT');
//header( 'Expires: '. gmDate('D, d M Y 23:59:59') .' GMT');
header('Expires: ' . gmDate('D, d M Y H:i:s', time() + 120) . ' GMT');
//header( 'ETag: '. gmDate('Ymd') );
define('GS_VALID', true);
/// this is a parent file
require_once dirName(__FILE__) . '/../../../inc/conf.php';
# set paths
#
$GS_URL_PATH = dirName(dirName(@$_SERVER['SCRIPT_NAME']));
if (subStr($GS_URL_PATH, -1, 1) != '/') {
$GS_URL_PATH .= '/';
}
header('ETag: ' . gmDate('Ymd') . '-' . md5($GS_URL_PATH));
function _not_modified()
{
header('HTTP/1.0 304 Not Modified', true, 304);
header('Status: 304 Not Modified', true, 304);
exit;
}
if (array_key_exists('HTTP_IF_NONE_MATCH', $_SERVER) && $_SERVER['HTTP_IF_NONE_MATCH'] === gmDate('Ymd') . '-' . md5($GS_URL_PATH)) {
_not_modified();
}
/*
$tmp = gmDate('D, d M Y');
示例15: __construct
public function __construct()
{
parent::__construct();
$this->readOnly('configFormat')->readOnly('nanoRootDir', dirName(__DIR__))->readOnly('loader', new Loader())->readOnly('modules', new Application\Modules())->readOnly('plugins', new \SplObjectStorage())->readOnly('helper', new HelperBroker())->readOnly('dispatcher', new Application\Dispatcher())->readOnly('eventManager', new Event\Manager())->readOnly('rootDir')->readOnly('publicDir')->readOnly('modulesDir')->readOnly('sharedModulesDir')->ensure('configFormat', 'Nano\\Application\\Config\\Format')->ensure('config', 'Nano\\Application\\Config')->ensure('modules', 'Nano\\Application\\Modules')->ensure('dispatcher', 'Nano\\Application\\Dispatcher')->ensure('helper', 'Nano\\HelperBroker')->ensure('eventManager', 'Nano\\Event\\Manager')->ensure('plugins', 'SplObjectStorage');
}