本文整理汇总了PHP中join_paths函数的典型用法代码示例。如果您正苦于以下问题:PHP join_paths函数的具体用法?PHP join_paths怎么用?PHP join_paths使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了join_paths函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: list_dir
function list_dir($root)
{
global $script_path;
$files = array();
$dirs = array();
$dir = opendir($root);
while (($entry = readdir($dir)) !== false) {
if (in_excludes($entry)) {
continue;
}
$full_path = join_paths($root, $entry);
if (is_dir($full_path) && $full_path != $script_path) {
$dirs[] = $entry;
}
if (is_file($full_path)) {
$files[] = array("name" => $entry, "size" => big_filesize($full_path), "path" => $full_path);
}
}
closedir($dir);
sort($files);
sort($dirs);
reset($files);
reset($dirs);
return array($files, $dirs);
}
示例2: initialize_logger
function initialize_logger($name)
{
if (!IN_DEBUG) {
return;
}
global $logger;
Logger::configure(array('rootLogger' => array('appenders' => array('default')), 'appenders' => array('default' => array('class' => 'LoggerAppenderRollingFile', 'layout' => array('class' => 'LoggerLayoutPattern', "params" => array("ConversionPattern" => "%d{ISO8601} [%p] %m (at %F line %L)%n")), 'params' => array('file' => join_paths(QWP_LOG_DIR, $name . '.log'), 'append' => true, 'MaxFileSize' => '10MB', 'MaxBackupIndex' => '3')))));
$logger = Logger::getRootLogger();
}
示例3: get_partial_path
function get_partial_path($name, $partials_base_dir = 'partials', $extension = 'php')
{
// Replace periods in the name with the directory separator if the developer used dot notation
$name = str_replace('.', DIRECTORY_SEPARATOR, $name);
// By default, it should just be the extension without the period
// If the period was included by accident, remove it
if ($extension[0] === '.') {
$extension = substr($extension, 1);
}
return join_paths(get_template_directory(), $partials_base_dir, $name . '.' . $extension);
}
示例4: qwp_create_dialog_with_file
function qwp_create_dialog_with_file($dialog_id, $options, $file_name)
{
global $QWP_DIALOGS;
if (!isset($QWP_DIALOGS)) {
$QWP_DIALOGS = array();
}
if (!isset($options['url']) && !isset($options['content'])) {
$options['tmpl'] = $dialog_id;
}
$QWP_DIALOGS[$dialog_id] = $options;
global $MODULE_ROOT;
require_once join_paths($MODULE_ROOT, $file_name . '.php');
}
示例5: __autoload
function __autoload($sClassName)
{
foreach ($_ENV['SETTINGS']['INCLUDE_DIRS'] as $sIncludeDir) {
$sFileName = join_paths(getcwd(), "server/{$sIncludeDir}/class.{$sClassName}.php");
if (file_exists($sFileName)) {
require_once $sFileName;
if (!class_exists($sClassName, false)) {
throw new Exception("Class {$sClassName} could not be loaded, check syntax errors");
}
return;
}
}
throw new Exception("Class {$sClassName} is not found");
}
示例6: define
<?php
/*!
* qwp: https://github.com/steem/qwp
*
* Copyright (c) 2015 Steem
* Released under the MIT license
*/
define('QWP_TOOLS_ROOT', dirname(__FILE__));
define('QWP_ROOT', QWP_TOOLS_ROOT . '/..');
require_once QWP_ROOT . '/include/common.php';
if (count($argv) > 1) {
$object = $argv[1];
$template = file_get_contents(join_paths(QWP_ROOT, 'modules', 'users', 'home.js.php'));
$template = str_replace('user', $object, $template);
$template = str_replace('User', camel_case($object), $template);
file_put_contents(join_paths(QWP_TOOLS_ROOT, $object . '.js.php'), $template);
} else {
echo_line('please specify the object name, eg. user');
}
示例7: _finalize_url
/**
* Called on a fully-resolved URL before returning it.
* Once all aliases in a URL have been expanded, it is expanded to the root if
* {@link $resolve_to_root} is True. URLs beginning with a {@link $local_anchor}
* or a domain are not expanded (both can be resolved without a relative context).
* @see _can_have_root()
* @param string $url
* @param boolean $root_override Overrides {@link $resolve_to_root} if set to {@link Force_root_on}.
* @return string
* @access private
*/
protected function _finalize_url($url, $root_override)
{
if ($this->_needs_root($url, $root_override)) {
$url = join_paths($this->root_url, $url, $this->_url_options);
}
if (isset($this->_parent_resources)) {
$url = $this->_parent_resources->_finalize_url($url, $root_override);
}
return $url;
}
示例8: append
/**
* Append a url to the current one
* Handles separate merging and resolves all '..' marks
* @param string $url
*/
public function append($url)
{
$opts = $this->options();
$is_file = is_file_name($url, $opts);
$this->_text = join_paths($this->_text, $url, $opts);
if (!$is_file && !$this->ends_with_delimiter()) {
$this->_text .= $opts->path_delimiter;
}
}
示例9: foreach
echo $db->authorizeKey($options["hash"]);
} else {
if ($task === "addUser") {
$db = new \mfoley\StudentSQL("students.db");
echo $db->addKey($options["userID"]);
} else {
if ($task === "generateQR") {
$db = new \mfoley\StudentSQL("students.db");
$outfile = $options["outputDir"];
$array = $db->getAll();
$filenames = [];
foreach ($array as $str) {
array_push($filenames, base64_decode($str));
}
if (!is_dir($outfile)) {
echo "Path does not exist or is not a directory\n\t" . $outfile . "\n";
die;
} else {
if (!is_writeable($outfile)) {
echo "Path could not be written to.\n\t" . $outfile . "\n";
die;
}
}
include 'qr/qrlib.php';
# Generates a png QR code for each user to exist in the database
for ($i = 0; $i < count($array); $i += 1) {
QRcode::png($array[$i], join_paths($outfile, $filenames[$i] . ".png"));
}
}
}
}
示例10: EL
</ul>
<form class="navbar-form navbar-right">
<input type="text" class="form-control" placeholder="Search...">
</form>
</div>
</div>
</nav>
<?php
if (qwp_tmpl_has_sub_modules($MODULE[0])) {
?>
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<?php
if (file_exists(join_paths($MODULE_ROOT, 'home.php'))) {
?>
<li class="<?php
echo $PAGE ? '' : 'active';
?>
"><a href="<?php
echo qwp_uri_current_home();
?>
"><?php
EL('Dashboard');
?>
<span class="sr-only">(current)</span></a></li>
<?php
}
?>
<?php
示例11: scandir
* lms is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Jorani. If not, see <http://www.gnu.org/licenses/>.
*
* @copyright Copyright (c) 2014 - 2015 Benjamin BALET
*/
//Utility script that converts PHP array i18n files to a POT file
//Include all translation files
$files = scandir('english/');
foreach ($files as $file) {
if ($file != '.' && $file != '..' && $file != 'index.html') {
$path = join_paths("english", $file);
include $path;
}
}
$strings = array();
//Array of unique strings
//File content
$messages = 'msgid ""' . PHP_EOL;
$messages .= 'msgstr ""' . PHP_EOL;
$messages .= '"Project-Id-Version: Jorani\\n"' . PHP_EOL;
$messages .= '"POT-Creation-Date: \\n"' . PHP_EOL;
$messages .= '"PO-Revision-Date: \\n"' . PHP_EOL;
$messages .= '"Last-Translator: \\n"' . PHP_EOL;
$messages .= '"Language-Team: Jorani <jorani@googlegroups.com>\\n"' . PHP_EOL;
$messages .= '"MIME-Version: 1.0\\n"' . PHP_EOL;
$messages .= '"Content-Type: text/plain; charset=UTF-8\\n"' . PHP_EOL;
示例12: process_file_upload
function process_file_upload()
{
global $UPLOAD_DIR;
if (!is_dir($UPLOAD_DIR)) {
mkdir($UPLOAD_DIR);
}
header('Content-Type: application/json');
$protocol = empty($_SERVER['HTTPS']) ? 'http://' : 'https://';
$ext = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
$upload_name = randomish() . '.' . $ext;
$upload_file = join_paths($UPLOAD_DIR, $upload_name);
$public_url = $protocol . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . "/?i=" . $upload_name;
if (move_uploaded_file($_FILES['file']['tmp_name'], $upload_file)) {
jecho(["public_url" => $public_url]);
} else {
jecho(['error' => "Unable to process file upload"]);
}
}
示例13: _test_join_paths
private function _test_join_paths()
{
$this->_check_equal('/a/b/c/d/', join_paths('/a/', 'b/././c/d/'));
$this->_check_equal('a/b/c/d/', join_paths('a/', 'b/././c/d/'));
$this->_check_equal('/a/b/c/d', join_paths('/a/', 'b/././c/d'));
$this->_check_equal('/a/b/c/d/', join_paths('/a', 'b/././c/d/'));
$this->_check_equal('a/b/c/d/', join_paths('a', 'b/././c/d/'));
$this->_check_equal('/a/b/c/d', join_paths('/a', 'b/././c/d'));
$this->_check_equal('/a/b/c/d/', join_paths('/a', '/b/././c/d/'));
$this->_check_equal('a/b/c/d/', join_paths('a', '/b/././c/d/'));
$this->_check_equal('/a/b/c/d', join_paths('/a', '/b/././c/d'));
$this->_check_equal('/a/b/c/d/', join_paths('/a/', '/b/././c/d/'));
$this->_check_equal('a/b/c/d/', join_paths('a/', '/b/././c/d/'));
$this->_check_equal('/a/b/c/d', join_paths('/a/', '/b/././c/d'));
$this->_check_equal('/a/b/c/d/', join_paths('/a/b/c/', '../../b/././c/d/'));
$this->_check_equal('a/b/c/d/', join_paths('a/b/c/', '../../b/././c/d/'));
$this->_check_equal('/a/b/c/d', join_paths('/a/b/c/', '../../b/././c/d'));
$this->_check_equal('/a/b/c/d/', join_paths('/a/b/c', '../../b/././c/d/'));
$this->_check_equal('a/b/c/d/', join_paths('a/b/c', '../../b/././c/d/'));
$this->_check_equal('/a/b/c/d', join_paths('/a/b/c', '../../b/././c/d'));
}
示例14: array
$paths = array();
foreach (func_get_args() as $arg) {
if ($arg !== '') {
$paths[] = $arg;
}
}
return preg_replace('#/+#', '/', join('/', $paths));
}
$source = filter_input(INPUT_GET, 'source');
$name = filter_input(INPUT_GET, 'name');
if (is_null($source)) {
die('Missing "source".');
} else {
if (is_null($name)) {
die('Missing "name".');
}
}
$path = join_paths($jsonObject->backend->file_store->directory, 'temp', $source);
if (!file_exists($path)) {
die('File not found.');
}
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $name . '"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($path));
readfile($path);
unlink($path);
die;
示例15: rename_files_with_suffix
function rename_files_with_suffix($src, $dst, $suffix)
{
$files = scandir($src);
foreach ($files as $file) {
if (is_dot_dir($file) || !ends_with($file, $suffix)) {
continue;
}
$src_file = join_paths($src, $file);
if (file_exists($src_file)) {
@rename($src_file, join_paths($dst, $file));
}
}
}