本文整理汇总了PHP中path函数的典型用法代码示例。如果您正苦于以下问题:PHP path函数的具体用法?PHP path怎么用?PHP path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了path函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: make
public function make($items = array(), $html = '', $partial_path = null)
{
foreach ($items as $child) {
$url = empty($child['url']) ? '#' : $child['url'];
$has_partial = false;
// if partial path is not null
// lets try to load from there first
if (!is_null($partial_path)) {
$has_partial = $this->view_exists($partial_path);
if ($has_partial) {
$html .= View::make($has_partial)->with('child', $child)->with('theme', $this)->with('url', $url);
continue;
}
}
// look on themes partial
$has_partial = $this->view_exists($this->theme->_theme_absolute_path . DS . 'views' . DS . 'partials' . DS . 'menu_li');
if ($has_partial) {
$html .= View::make($has_partial)->with('child', $child)->with('theme', $this)->with('url', $url);
continue;
}
// look on shared folder partials
$has_partial = $this->view_exists(path('public') . 'shared' . DS . 'views' . DS . 'partials' . DS . 'menu_li');
if ($has_partial) {
$html .= View::make($has_partial)->with('child', $child)->with('theme', $this)->with('url', $url);
continue;
}
// we did not find the partial
// load the default provided by
// navigation module
$html .= View::make('navigation::partials.menu_li')->with('child', $child)->with('theme', $this)->with('url', $url);
}
return $html;
}
开发者ID:juaniiie,项目名称:mwi,代码行数:33,代码来源:menu.php
示例2: index
public function index()
{
$this->subtitle($this('list_teams'))->load->library('table');
$teams = $this->table->add_columns(array(array('content' => function ($data) {
return button_sort($data['team_id'], 'admin/ajax/teams/sort.html');
}, 'size' => TRUE), array('title' => $this('teams'), 'content' => function ($data) {
return '<a href="' . url('teams/' . $data['team_id'] . '/' . $data['name'] . '.html') . '"><img src="' . path($data['icon_id']) . '" alt="" /> ' . $data['title'] . '</a>';
}), array('title' => $this('game'), 'content' => function ($data) {
return '<a href="' . url('admin/games/' . $data['team_id'] . '/' . $data['game'] . '.html') . '"><img src="' . path($data['game_icon']) . '" alt="" /> ' . $data['game_title'] . '</a>';
}), array('title' => '<i class="fa fa-users" data-toggle="tooltip" title="' . $this('players') . '"></i>', 'content' => function ($data) {
return $data['users'];
}, 'size' => TRUE), array('content' => array(function ($data) {
return button_edit('admin/teams/' . $data['team_id'] . '/' . $data['name'] . '.html');
}, function ($data) {
return button_delete('admin/teams/delete/' . $data['team_id'] . '/' . $data['name'] . '.html');
}), 'size' => TRUE)))->data($this->model()->get_teams())->no_data($this('no_team'))->display();
$roles = $this->table->add_columns(array(array('content' => function ($data) {
return button_sort($data['role_id'], 'admin/ajax/teams/roles/sort.html');
}, 'size' => TRUE), array('content' => function ($data) {
return '<a href="' . url('admin/teams/roles/' . $data['role_id'] . '/' . url_title($data['title']) . '.html') . '">' . $data['title'] . '</a>';
}), array('content' => array(function ($data) {
return button_edit('admin/teams/roles/' . $data['role_id'] . '/' . url_title($data['title']) . '.html');
}, function ($data) {
return button_delete('admin/teams/roles/delete/' . $data['role_id'] . '/' . url_title($data['title']) . '.html');
}), 'size' => TRUE)))->pagination(FALSE)->data($this->model('roles')->get_roles())->no_data($this('no_role'))->display();
return new Row(new Col(new Panel(array('title' => $this('roles'), 'icon' => 'fa-sitemap', 'content' => $roles, 'footer' => button_add('admin/teams/roles/add.html', $this('add_role')), 'size' => 'col-md-12 col-lg-4'))), new Col(new Panel(array('title' => $this('list_teams'), 'icon' => 'fa-gamepad', 'content' => $teams, 'footer' => button_add('admin/teams/add.html', $this('add_team')), 'size' => 'col-md-12 col-lg-8'))));
}
开发者ID:nsystem1,项目名称:neofrag-cms,代码行数:27,代码来源:admin.php
示例3: globSeedFiles
/**
* Get all of the files at a given path.
*
* @param string $path
* @return array
*/
protected function globSeedFiles()
{
if (isset($this->seedFiles)) {
return $this->seedFiles;
}
// If the seeds haven't been read before, we will glob the directories and sort
// them alphabetically just in case the developer is using numbers to make
// the seed run in a certain order based on their database design needs.
$folders = array(path('app') . 'seeds' . DS);
foreach (Bundle::$bundles as $bundle) {
$folders[] = Bundle::path($bundle['location']) . 'seeds' . DS;
}
$files = array();
foreach ($folders as $folder) {
$files = array_merge($files, glob($folder . '*.php'));
}
if (false !== $this->getParameter('except')) {
$exclude = explode(',', $this->getParameter('except'));
foreach ($files as $key => $file) {
if (in_array(pathinfo($file, PATHINFO_FILENAME), $exclude)) {
unset($files[$key]);
}
}
}
sort($files);
return $this->seedFiles = $files;
}
开发者ID:laravelbook,项目名称:framework3,代码行数:33,代码来源:seeder.php
示例4: zipball
/**
* Install a bundle from by downloading a Zip.
*
* @param string $url
* @param array $bundle
* @param string $path
* @return void
*/
protected function zipball($url, $bundle, $path)
{
$work = path('storage') . 'work/';
// When installing a bundle from a Zip archive, we'll first clone
// down the bundle zip into the bundles "working" directory so
// we have a spot to do all of our bundle extration work.
$target = $work . 'laravel-bundle.zip';
File::put($target, $this->download($url));
$zip = new \ZipArchive();
$zip->open($target);
// Once we have the Zip archive, we can open it and extract it
// into the working directory. By convention, we expect the
// archive to contain one root directory with the bundle.
mkdir($work . 'zip');
$zip->extractTo($work . 'zip');
$latest = File::latest($work . 'zip')->getRealPath();
@chmod($latest, 0777);
// Once we have the latest modified directory, we should be
// able to move its contents over into the bundles folder
// so the bundle will be usable by the develoepr.
File::mvdir($latest, $path);
File::rmdir($work . 'zip');
$zip->close();
@unlink($target);
}
开发者ID:Shahriar1824,项目名称:laravel-tutorial,代码行数:33,代码来源:provider.php
示例5: isConnected
function isConnected($URL = false)
{
if (!SESSION("ZanUser")) {
redirect($URL !== false ? $URL : path("users/login/?return_to=" . urlencode(getURL())));
}
return true;
}
开发者ID:jgianpiere,项目名称:ZanPHP,代码行数:7,代码来源:sessions.php
示例6: __construct
/**
*
* @param string $view
* @param mixed $viewData
* @param array $composer
* @return mixed
*/
public function __construct($view, $viewData, $composers)
{
if (count($composers) != 0) {
foreach ($composers as $composer) {
$composer = new $composer();
if ($composer->composerData != null) {
extract($composer->composerData);
}
}
}
if ($viewData != null) {
extract($viewData);
}
$h = IoC::resolve('ViewHelper');
$helper = IoC::resolve('Helper');
ob_start();
require_once path("application/views/{$view}.php");
$layout = isset($layout) ? $layout : 'master';
$view = ob_get_contents();
ob_end_clean();
ob_start();
require_once path("application/views/layout/" . $layout . ".php");
$output = ob_get_contents();
ob_end_clean();
Event::trigger('before_echo', array());
return $this->output = $output;
}
开发者ID:netprogs1,项目名称:yafop,代码行数:34,代码来源:View.php
示例7: loadConfig
/**
* Méthode qui charge le fichier plugins.xml (ancien format)
*
* @return null
* @author Stephane F
**/
public function loadConfig()
{
$aPlugins = array();
if (!is_file(path('XMLFILE_PLUGINS'))) {
return false;
}
# Mise en place du parseur XML
$data = implode('', file(path('XMLFILE_PLUGINS')));
$parser = xml_parser_create(PLX_CHARSET);
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0);
xml_parse_into_struct($parser, $data, $values, $iTags);
xml_parser_free($parser);
# On verifie qu'il existe des tags "plugin"
if (isset($iTags['plugin'])) {
# On compte le nombre de tags "plugin"
$nb = sizeof($iTags['plugin']);
# On boucle sur $nb
for ($i = 0; $i < $nb; $i++) {
$name = $values[$iTags['plugin'][$i]]['attributes']['name'];
$activate = $values[$iTags['plugin'][$i]]['attributes']['activate'];
$value = isset($values[$iTags['plugin'][$i]]['value']) ? $values[$iTags['plugin'][$i]]['value'] : '';
$aPlugins[$name] = array('activate' => $activate, 'title' => $value, 'instance' => null);
}
}
return $aPlugins;
}
开发者ID:wafflefactor,项目名称:PluXml,代码行数:33,代码来源:update_5.2.php
示例8: run
public function run(&$params)
{
//1.判断用户是否登录,如果登录了才能得到用户id,进而才有可能获取到所拥有的权限
// $userinfo = session('USERINFO');
$userinfo = login();
//自动登录
$admin_id = cookie('admin_id');
$token = cookie('token');
if (!$userinfo) {
//自动登录
D('AdminToken')->checkToken($admin_id, $token);
// $userinfo = session('USERINFO');
$userinfo = login();
}
$url = MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME;
//忽略验证的请求
$ignore = C('IGNORE_PATH');
if (in_array($url, $ignore)) {
return true;
}
return true;
//判断是否有权限,如果没有权限就判断是否登录,登录了就提示切换用户,否则跳到登录页面
if (!in_array($url, path())) {
if ($userinfo) {
echo '无权访问,<a href="' . U('Admin/Admin/login') . '">切换用户</a>';
exit;
} else {
redirect(U('Admin/Admin/login'), '请先登录');
exit;
}
}
}
开发者ID:kunx-edu,项目名称:tp1030,代码行数:32,代码来源:checkBehavior.class.php
示例9: exception
/**
* Handle an exception by logging it and either
* displaying detailed report or directing to base
* exceptions pages
* @param Exception $exception The exception being handled
* @return void
*/
public static function exception($exception)
{
// Send exception to be logged
static::log($exception);
// If debug enabled, format the exception
// to clean message and display on screen
if (Configuration::get('error.debug')) {
$message = $exception->getMessage();
$code = $exception->getCode();
$file = $exception->getFile();
$line = $exception->getLine();
$trace = $exception->getTraceAsString();
$date = date('d-M-Y H:i:s');
$logMessage = "<h3>System Exception:</h3>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t<strong>Date:</strong> {$date}\n\t\t\t\t\t</p>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t<strong>Message:</strong> {$message}\n\t\t\t\t\t</p>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t<strong>Code:</strong> {$code}\n\t\t\t\t\t</p>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t<strong>File:</strong> {$file}\n\t\t\t\t\t</p>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t<strong>Line:</strong> {$line}\n\t\t\t\t\t</p>\n\n\t\t\t\t\t<h3>Stack Trace:</h3>\n\t\t\t\t\t<pre>{$trace}</pre>\n\t\t\t\t\t<br/>\n\t\t\t\t\t<hr/>\n\t\t\t\t\t<br/><br/>";
echo $logMessage;
return;
} else {
// If detailed reports NOT enabled direct to
// base exception pages
$code = $exception->getCode();
if (!in_array($code, static::$_exceptions)) {
$code = '500';
}
header("Content-type: text/html");
$view = file_get_contents(path('app') . "views/errors/{$code}" . EXT);
echo $view;
exit;
}
// Should it all fail render a fallback template
header("Content-type: text/html");
echo "An error occurred.";
exit(1);
}
开发者ID:chapmang,项目名称:phpframework,代码行数:40,代码来源:error.php
示例10: post_new_city
public function post_new_city()
{
$rules = array('city' => 'required|unique:photos', 'picture' => 'required');
$v = Validator::make(Input::all(), $rules);
if ($v->fails()) {
return Redirect::to('admin/cityphotos')->with_errors($v)->with_input();
} else {
$new_photo = array('city' => ucwords(Input::get('city')));
$photo = new Photo($new_photo);
if ($photo->save()) {
$upload_path = path('public') . Photo::$upload_path_city . $photo->city;
if (!File::exists($upload_path)) {
File::mkdir($upload_path);
}
$filename = $photo->city . '.jpg';
$path_to_file = $upload_path . '/' . $filename;
$dynamic_path = '/' . Photo::$upload_path_city . $photo->city . '/' . $filename;
$success = Resizer::open(Input::file('picture'))->resize(1024, 724, 'auto')->save($path_to_file, 75);
if ($success) {
$new_photo = Photo::find($photo->id);
$new_photo->location = $dynamic_path;
$new_photo->save();
}
return Redirect::to('admin/cityphotos')->with('msg', '<div class="alert alert-success"><strong>City foto is geupload!</strong></div>');
} else {
return Redirect::to('admin/cityphotos')->with('msg', '<div class="alert alert-error"><strong>Er is iets mis gegaan bij het toevoegen.</strong></div>');
}
}
}
开发者ID:sanneterpstra,项目名称:Kamergenood,代码行数:29,代码来源:photo.php
示例11: handle
public function handle()
{
$path = BASE_PATH . 'cache' . path('ds') . 'framework' . path('ds');
if ($this->option('skip-database')) {
$this->output('Skipping database cache');
} else {
$this->output('Clearing database cache');
$this->unlink($path, 'database');
$this->output('Database cache cleared');
}
if ($this->option('skip-defaults')) {
$this->output('Skipping defaults cache');
} else {
$this->output('Clearing defaults cache');
$this->unlink($path, 'defaults');
$this->output('Defaults cache cleared');
}
if ($this->option('skip-router')) {
$this->output('Skipping router cache');
} else {
$this->output('Clearing router cache');
$this->unlink($path, 'router');
$this->output('Router cache cleared');
}
}
开发者ID:pckg,项目名称:framework,代码行数:25,代码来源:ClearCache.php
示例12: action_create
public function action_create()
{
$input = Input::all();
if (isset($input['description'])) {
$input['description'] = filter_var($input['description'], FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES);
}
$rules = array('image' => 'required|image|max:200', 'description' => 'required', 'name' => 'required');
$messages = array('image_required' => 'Please select an image for upload!', 'image_max' => 'Make sure image is no larger than 500kb', 'image_image' => 'Please select an image file');
$validation = Validator::make($input, $rules, $messages);
if ($validation->fails()) {
return Redirect::to('admin/gallery/new')->with_errors($validation);
}
$extension = File::extension($input['image']['name']);
$directory = path('public') . 'uploads/' . sha1(Auth::user()->id);
$filename = sha1(Auth::user()->id . time()) . ".{$extension}";
$upload_success = Input::upload('image', $directory, $filename);
if ($upload_success) {
$photo = new Image(array('name' => Input::get('name'), 'location' => '/uploads/' . sha1(Auth::user()->id) . '/' . $filename, 'description' => $input['description'], 'type' => $extension));
Auth::user()->images()->insert($photo);
Session::flash('status_create', 'Successfully uploaded your new Instapic');
Session::flash('id', $photo->id);
} else {
Log::write('admin.gallery.create', 'Image was not uploaded, $photo->create() returned false.');
Session::flash('error_create', 'An error occurred while uploading your new Instapic - please try again.');
}
return Redirect::to('admin/gallery/new');
}
开发者ID:ryankennedy1991,项目名称:Toure-cms,代码行数:27,代码来源:gallery.php
示例13: it_provides_helper_functions
/**
* @test
*/
public function it_provides_helper_functions()
{
expect(ds())->to_be(DIRECTORY_SEPARATOR);
expect(ds('foo', 'bar', 'baz'))->to_be('foo' . ds() . 'bar' . ds() . 'baz');
expect(path('foo'))->to_be_a('PhpPackages\\Fs\\Path');
expect((string) path(path('foo')))->to_be('foo');
}
开发者ID:php-packages,项目名称:fs,代码行数:10,代码来源:BootstrapTest.php
示例14: test_load
public function test_load()
{
$path = path(__DIR__, '../configs/config.yml');
$driver = new YamlConfigDriver();
$config = $driver->loadFile($path);
$this->assertEquals(['foo' => 'bar', 'bar' => 'foo', 'section' => ['yolo' => 'swag']], $config);
}
开发者ID:weew,项目名称:config,代码行数:7,代码来源:YamlConfigDriverTest.php
示例15: execute
public function execute(callable $next)
{
$this->application->getProvider()->register();
config()->parseDir(path('app'));
chain([Localize::class]);
return $next();
}
开发者ID:pckg,项目名称:framework,代码行数:7,代码来源:RegisterApplication.php
示例16: findOneModule
static function findOneModule($classname)
{
global $domain, $site_domains;
$inc = getIncludePaths();
$dir = getcwd();
// узнаем имя модуля
if (substr(strtolower($classname), 0, 1) == "t") {
$filename = substr(strtolower($classname), 1);
}
$modulename = $filename;
$filename = $filename . ".class.php";
foreach ($inc as $v) {
$path = path($v) . "/";
if (isset($site_domains) && in_array($domain, array_keys($site_domains))) {
// Сначала ищем в директории с названием $site_domains[$domain]['modules']
$search_pattern = $path == './' ? $dir . '/modules/' . $site_domains[$domain]['modules'] : $path . PATH . '/modules/' . $site_domains[$domain]['modules'];
$search_pattern = realpath($search_pattern) . '/' . $modulename . '/';
if (is_file($search_pattern . $filename)) {
break;
}
}
// Теперь ищем в общей папке с модулями
$search_pattern = $path == './' ? $dir . '/modules/' : $path . ENGINE_VERSION . '/' . ENGINE_TYPE . '/modules/';
$search_pattern = $search_pattern . $modulename . '/';
if (is_file($search_pattern . $filename)) {
break;
}
}
if (is_file($search_pattern . $filename)) {
return $search_pattern . $filename;
} else {
return false;
}
}
开发者ID:romlg,项目名称:cms36,代码行数:34,代码来源:registry.php5.class.php
示例17: test_load_invalid_file
public function test_load_invalid_file()
{
$path = path(__DIR__, '../configs/foo.ini');
$driver = new IniConfigDriver();
$this->setExpectedException(InvalidConfigFormatException::class);
$driver->loadFile($path);
}
开发者ID:weew,项目名称:config,代码行数:7,代码来源:IniConfigDriverTest.php
示例18: getUploadedFile
public function getUploadedFile($tag, $where = '/app/cache/uploads/')
{
$return = array('error' => false, 'path' => false, 'name' => false);
if (isset($_FILES[$tag]['name']) && $_FILES[$tag]['name'] != '') {
$image = $_FILES[$tag];
$orig_name = isset($image['name']) ? $image['name'] : false;
$type = isset($image['type']) ? $image['type'] : false;
$tmp_name = isset($image['tmp_name']) ? $image['tmp_name'] : false;
$error_value = isset($image['error']) ? $image['error'] : false;
if ($error_value === false) {
$return['error'] = 'The file could not be uploaded because ' . $error_value;
} else {
$dots = explode('.', $orig_name);
if (count($dots) == 1) {
$return['error'] = 'Your filename does not have an extension';
} else {
$extension = $dots[count($dots) - 1];
unset($dots[count($dots) - 1]);
$orig_file_name = implode('.', $dots);
$new_name = sanitize(trim($orig_file_name)) . '_' . md5(time() . $orig_name) . '.' . $extension;
while (file_exists(path($where . $new_name))) {
$new_name = time() % 100 . $new_name;
}
if (!move_uploaded_file($tmp_name, path($where . $new_name))) {
$return['error'] = 'The file could not be uploaded. Please try again.';
} else {
$return['path'] = $where . $new_name;
$return['name'] = $orig_name;
}
}
}
}
return $return;
}
开发者ID:nikhildixit,项目名称:Generatrix,代码行数:34,代码来源:controller.php
示例19: factory
/**
* Create a new cache driver instance.
*
* @param string $driver
* @return Cache\Drivers\Driver
*/
protected static function factory($driver)
{
if (isset(static::$registrar[$driver])) {
$resolver = static::$registrar[$driver];
return $resolver();
}
switch ($driver) {
case 'apc':
return new Cache\Drivers\APC(Config::get('cache.key'));
case 'file':
return new Cache\Drivers\File(path('storage') . 'cache' . DS);
case 'memcached':
return new Cache\Drivers\Memcached(Memcached::connection(), Config::get('cache.key'));
case 'memory':
return new Cache\Drivers\Memory();
case 'redis':
return new Cache\Drivers\Redis(Redis::db());
case 'database':
return new Cache\Drivers\Database(Config::get('cache.key'));
case 'wincache':
return new Cache\Drivers\WinCache(Config::get('cache.key'));
default:
throw new \Exception("Cache driver {$driver} is not supported.");
}
}
开发者ID:gigikiri,项目名称:masjid-l3,代码行数:31,代码来源:cache.php
示例20: load
/**
* Set include paths from $_paths array,
* build file name using include path, search
* and if found include
* @param string $class The class name being searched for
*/
public static function load($class)
{
// fix extra backslashes in $_POST/$_GET
if (get_magic_quotes_gpc()) {
$globals = array("_POST", "_GET", "_COOKIE", "_REQUEST", "_SESSION");
foreach ($globals as $global) {
if (isset($GLOBALS[$global])) {
$GLOBALS[$global] = self::_clean($GLOBALS[$global]);
}
}
}
$paths = array_map(function ($item) {
return path('app') . $item;
}, self::$_paths);
$paths[] = get_include_path();
set_include_path(join(PATH_SEPARATOR, $paths));
$paths = explode(PATH_SEPARATOR, get_include_path());
$flags = PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE;
$file = strtolower(str_replace("\\", DIRECTORY_SEPARATOR, trim($class, "\\"))) . ".php";
foreach ($paths as $path) {
$combined = $path . DIRECTORY_SEPARATOR . $file;
if (file_exists($combined)) {
include $combined;
return;
}
}
$paths = array();
throw new \Exception("{$class} not found");
}
开发者ID:chapmang,项目名称:phpframework,代码行数:35,代码来源:autoloader.php
注:本文中的path函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论