本文整理汇总了PHP中with_slash函数的典型用法代码示例。如果您正苦于以下问题:PHP with_slash函数的具体用法?PHP with_slash怎么用?PHP with_slash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了with_slash函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cw_files_get_dir
/**
* Return the folder list in provided directory
* folders are returned with absolute path
*
* @param string $dir
* @param int $mode - binary flag [1-files; 2-folders; 3-both]
* @param boolean $recursive
* @return array
*/
function cw_files_get_dir($dir, $mode = 1, $recursive = false)
{
if (!is_dir($dir)) {
return false;
}
// if
$folders = array();
if ($dirstream = @opendir($dir)) {
while (false !== ($filename = readdir($dirstream))) {
$path = with_slash($dir) . $filename;
if ($filename != '.' && $filename != '..') {
if ($mode & 1 && is_file($path)) {
$folders[] = $path;
}
if ($mode & 2 && is_dir($path)) {
$folders[] = $path;
}
if ($recursive && is_dir($path)) {
$sub_folders = cw_files_get_dir($path, $mode, $recursive);
if (is_array($sub_folders)) {
$folders = array_merge($folders, $sub_folders);
}
// if
}
// if
}
// if
}
// while
}
// if
closedir($dirstream);
return $folders;
}
示例2: index
/**
* Settings form
*
* @param void
* @return null
*/
function index()
{
js_assign('test_svn_url', assemble_url('admin_source_test_svn'));
$source_data = $this->request->post('source');
if (!is_foreachable($source_data)) {
$source_data = array('svn_path' => ConfigOptions::getValue('source_svn_path'), 'svn_config_dir' => ConfigOptions::getValue('source_svn_config_dir'), 'source_svn_use_output_redirect' => ConfigOptions::getValue('source_svn_use_output_redirect'), 'source_svn_trust_server_cert' => ConfigOptions::getValue('source_svn_trust_server_cert'));
}
// if
if ($this->request->isSubmitted()) {
$svn_path = array_var($source_data, 'svn_path', null);
$svn_path = $svn_path ? with_slash($svn_path) : null;
ConfigOptions::setValue('source_svn_path', $svn_path);
$svn_config_dir = array_var($source_data, 'svn_config_dir') == '' ? null : array_var($source_data, 'svn_config_dir');
ConfigOptions::setValue('source_svn_config_dir', $svn_config_dir);
$svn_use_output_redirection = array_var($source_data, 'source_svn_use_output_redirect') == "1";
ConfigOptions::setValue('source_svn_use_output_redirect', $svn_use_output_redirection);
$svn_trust_server_certificate = array_var($source_data, 'source_svn_trust_server_cert') == "1";
ConfigOptions::setValue('source_svn_trust_server_cert', $svn_trust_server_certificate);
flash_success("Source settings successfully saved");
$this->redirectTo('admin_source');
}
// if
if (!RepositoryEngine::executableExists()) {
$this->wireframe->addPageMessage(lang("SVN executable not found. You won't be able to use this module"), 'error');
}
// if
$this->smarty->assign(array('source_data' => $source_data));
}
示例3: __construct
/**
* Constructor
*
* @param void
* @return ThemeConfigHandler
*/
function __construct() {
$themes_dir = with_slash(THEMES_DIR);
if(is_dir($themes_dir)) {
$d = dir($themes_dir);
while(($entry = $d->read()) !== false) {
if (str_starts_with($entry, '.') || $entry == "CVS") {
continue;
} // if
if(is_dir($themes_dir . $entry)) {
$this->available_themes[] = $entry;
} // if
} // while
$d->close();
} // if
} // __construct
示例4: __construct
/**
* Constructor
*
* @param void
* @return LocalizationConfigHandler
*/
function __construct() {
$language_dir = with_slash(ROOT . "/language");
if (is_dir($language_dir)) {
$d = dir($language_dir);
while (($entry = $d->read()) !== false) {
if (str_starts_with($entry, '.') || $entry == "CVS") {
continue;
} // if
if (is_dir($language_dir . $entry)) {
$this->available_locales[] = $entry;
} // if
} // while
$d->close();
sort($this->available_locales);
} // if
} // __construct
示例5: setRepositoryUrl
/**
* Set repository_url value
*
* @param string $value
* @return null
*/
static function setRepositoryUrl($value) {
self::$repository_url = with_slash($value);
} // setRepositoryUrl
示例6: setCacheDir
/**
* Set cache dir value
*
* @param string $value
* @return null
*/
function setCacheDir($value)
{
$this->cache_dir = with_slash($value);
}
示例7: execute
//.........这里部分代码省略.........
if (!defined('FILE_STORAGE_FILE_SYSTEM')) {
define('FILE_STORAGE_FILE_SYSTEM', 'fs');
}
if (!defined('FILE_STORAGE_MYSQL')) {
define('FILE_STORAGE_MYSQL', 'mysql');
}
if (!defined('MAX_SEARCHABLE_FILE_SIZE')) {
define('MAX_SEARCHABLE_FILE_SIZE', 1048576);
}
try {
DB::connect(DB_ADAPTER, array('host' => DB_HOST, 'user' => DB_USER, 'pass' => DB_PASS, 'name' => DB_NAME, 'persist' => DB_PERSIST));
if (defined('DB_CHARSET') && trim(DB_CHARSET)) {
DB::execute("SET NAMES ?", DB_CHARSET);
}
} catch (Exception $e) {
$this->printMessage("Error connecting to database: " . $e->getMessage() . "\n" . $e->getTraceAsString());
}
try {
$db_result = DB::execute("SELECT value FROM " . $t_prefix . "config_options WHERE name = 'file_storage_adapter'");
$db_result_row = $db_result->fetchRow();
if ($db_result_row['value'] == FILE_STORAGE_FILE_SYSTEM) {
if (!defined('FILES_DIR')) {
define('FILES_DIR', ROOT . '/upload');
}
FileRepository::setBackend(new FileRepository_Backend_FileSystem(FILES_DIR, TABLE_PREFIX));
} else {
FileRepository::setBackend(new FileRepository_Backend_DB(TABLE_PREFIX));
}
PublicFiles::setRepositoryPath(ROOT . '/public/files');
if (!defined('PUBLIC_FOLDER')) {
define('PUBLIC_FOLDER', 'public');
}
if (trim(PUBLIC_FOLDER) == '') {
PublicFiles::setRepositoryUrl(with_slash(ROOT_URL) . 'files');
} else {
PublicFiles::setRepositoryUrl(with_slash(ROOT_URL) . 'public/files');
}
$member_parents = array();
$members = Members::findAll();
foreach ($members as $member) {
$member_parents[$member->getId()] = $member->getAllParentMembersInHierarchy(false, false);
}
$object_members = DB::executeAll('SELECT * FROM ' . $t_prefix . 'object_members WHERE is_optimization=0 and not exists (SELECT x.object_id FROM ' . $t_prefix . 'object_members x where x.object_id=fo_object_members.object_id and x.is_optimization=1)');
foreach ($object_members as $om) {
$parents = isset($member_parents[$om['member_id']]) ? $member_parents[$om['member_id']] : array();
if (count($parents) > 0) {
$sql_values = "";
foreach ($parents as $p) {
$sql_values .= ($sql_values == "" ? "" : ",") . "(" . $om['object_id'] . "," . $p->getId() . ",1)";
}
$sql = "INSERT INTO " . $t_prefix . "object_members (object_id, member_id, is_optimization) VALUES {$sql_values} ON DUPLICATE KEY UPDATE is_optimization=1;";
DB::execute($sql);
}
}
$this->printMessage("Finished generating Object Members");
foreach ($members as $m) {
if ($m->getParentMember() instanceof Member && $m->getDimensionId() != $m->getParentMember()->getDimensionId()) {
$m->setDimensionId($m->getParentMember()->getDimensionId());
$m->save();
}
}
$app_move_logs = ApplicationLogs::findAll(array("conditions" => "action = 'move'"));
foreach ($app_move_logs as &$app_log) {
/* @var $app_log ApplicationLog */
$exp_log_data = explode(";", $app_log->getLogData());
if (count($exp_log_data) > 1) {
示例8: dir_size
/**
* Return size of a specific dir in bytes
*
* @access public
* @param string $dir Directory
* @return integer
*/
function dir_size($dir)
{
$totalsize = 0;
if ($dirstream = @opendir($dir)) {
while (false !== ($filename = readdir($dirstream))) {
if ($filename != "." && $filename != "..") {
$path = with_slash($dir) . $filename;
if (is_file($path)) {
$totalsize += filesize($path);
}
if (is_dir($path)) {
$totalsize += dir_size($path);
}
}
// if
}
// while
}
// if
closedir($dirstream);
return $totalsize;
}
示例9: cw_md_cleanup_skin
function cw_md_cleanup_skin($dir, $dir_, $int = '')
{
global $app_dir;
$int = with_leading_slash($int);
if (!cw_allowed_path($app_dir, $dir . $int)) {
return false;
}
if (!cw_allowed_path($app_dir, $dir_ . $int)) {
return false;
}
$status = array();
if (is_dir($dir . $int)) {
if ($handle = opendir($dir . $int)) {
while ($file = readdir($handle)) {
if ($file == "." || $file == "..") {
continue;
}
$full = $int . $file;
$is_dir = is_dir($dir . $full);
if ($is_dir) {
$status = array_merge($status, cw_md_cleanup_skin($dir, $dir_, with_slash($full)));
if (cw_is_empty_dir($dir_ . $full)) {
cw_rm_dir($dir_ . $full);
$status[] = '[ ] Dir ' . $dir_ . $full . ' removed';
}
} elseif (in_array(pathinfo($full, PATHINFO_EXTENSION), array('tpl', 'css', 'js', 'gif', 'png', 'jpg', 'jpeg', 'bmp'), true)) {
if (file_exists($dir_ . $full)) {
$md5 = md5_file($dir . $full);
$md5_ = md5_file($dir_ . $full);
$same = $md5 == $md5_;
if ($same) {
if (!unlink($dir_ . $full)) {
$status[] = '[!] Can\'t remove file: ' . $dir_ . $full;
} else {
$status[] = '[ ] File ' . $dir_ . $full . ' removed';
}
} else {
$status[] = '[*] File ' . $dir_ . $full . ' differs';
}
}
}
}
closedir($handle);
} else {
$status[] = '[!] Can\'t open ' . $dir . $int . " directory (need to check permissions)";
}
}
return $status;
}
示例10: get_public_url
/**
* Return URL relative to public folder
*
* @param string $rel
* @return string
*/
function get_public_url($rel) {
$base = trim(PUBLIC_FOLDER) == '' ? with_slash(ROOT_URL) : with_slash(with_slash(ROOT_URL) . PUBLIC_FOLDER);
return $base . $rel;
} // get_public_url
示例11: trace
VersionChecker::check(false);
}
// if
if (config_option('file_storage_adapter', 'mysql') == FILE_STORAGE_FILE_SYSTEM) {
trace(__FILE__, 'FileRepository::setBackend() - use file storage');
FileRepository::setBackend(new FileRepository_Backend_FileSystem(FILES_DIR));
} else {
trace(__FILE__, 'FileRepository::setBackend() - use mysql storage');
FileRepository::setBackend(new FileRepository_Backend_MySQL(DB::connection()->getLink(), TABLE_PREFIX));
}
// if
PublicFiles::setRepositoryPath(ROOT . '/public/files');
if (trim(PUBLIC_FOLDER) == '') {
PublicFiles::setRepositoryUrl(with_slash(ROOT_URL) . 'files');
} else {
PublicFiles::setRepositoryUrl(with_slash(ROOT_URL) . PUBLIC_FOLDER . '/files');
}
// if
// Owner company or administrator doen't exist? Let the user create them
} catch (OwnerCompanyDnxError $e) {
Env::executeAction('access', 'complete_installation');
} catch (AdministratorDnxError $e) {
Env::executeAction('access', 'complete_installation');
// Other type of error? We need to break here
} catch (Exception $e) {
trace(__FILE__, '- catch ' . $e);
if (Env::isDebugging()) {
Env::dumpError($e);
} else {
Logger::log($e, Logger::FATAL);
Env::executeAction('error', 'system');
示例12: force_mkdir_from_base
function force_mkdir_from_base($base, $path, $chmod = null) {
if(is_dir(with_slash($base).$path)) return true;
$real_path = str_replace('\\', '/', $path);
$parts = explode('/', $real_path);
$forced_path = '';
foreach($parts as $part) {
if($part !='')
{
// Skip first on windows
if($forced_path == '') {
$forced_path = with_slash($base) . $part;
} else {
$forced_path .= '/' . $part;
} // if
if(!is_dir($forced_path)) {
if(!is_null($chmod)) {
if(!mkdir($forced_path)) return false;
} else {
if(!mkdir($forced_path, $chmod)) return false;
} // if
} // if
} // if
} // foreach
return true;
} // force_mkdir
示例13: check_valid_localization
private function check_valid_localization($localization)
{
$language_dir = with_slash(ROOT . "/language");
$result = false;
if (is_dir($language_dir)) {
$d = dir($language_dir);
while (!$result && ($entry = $d->read()) !== false) {
if (str_starts_with($entry, '.') || str_starts_with($entry, '..') || $entry == "CVS") {
continue;
}
$result = is_dir($language_dir . $entry) && $entry == $localization;
}
$d->close();
}
return $result;
}
示例14: dir_size
/**
* Walks recursively through directory and calculates its total size - returned in bytes
*
* @param string $dir Directory
* @param boolean $skip_files_starting_with_dot (Hidden files)
* @return integer
*/
function dir_size($dir, $skip_files_starting_with_dot = true)
{
$totalsize = 0;
if ($dirstream = @opendir($dir)) {
while (false !== ($filename = readdir($dirstream))) {
if ($skip_files_starting_with_dot) {
if ($filename != '.' && $filename != '..' && $filename[0] != '.') {
$path = with_slash($dir) . $filename;
if (is_file($path)) {
$totalsize += filesize($path);
}
if (is_dir($path)) {
$totalsize += dir_size($path, $skip_files_starting_with_dot);
}
}
// if
} else {
if ($filename != '.' && $filename != '..') {
$path = with_slash($dir) . $filename;
if (is_file($path)) {
$totalsize += filesize($path);
}
if (is_dir($path)) {
$totalsize += dir_size($path, $skip_files_starting_with_dot);
}
}
// if
}
}
// while
}
// if
closedir($dirstream);
return $totalsize;
}
示例15: add_favicon_to_page
/**
* Add a favicon to page
*
* @access public
* @param string $src URL of favicon
* @return string
*/
function add_favicon_to_page($src)
{
$page = PageDescription::instance();
$page->addRelLink(with_slash(ROOT_URL) . $src, 'shortcut icon', null);
}