本文整理汇总了PHP中join_path函数的典型用法代码示例。如果您正苦于以下问题:PHP join_path函数的具体用法?PHP join_path怎么用?PHP join_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了join_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: record
/**
* Enregistre un message dans un fichier de log spécifique
* Message non loggué si
* - environment = SILENT
* - level = WARNING et environment = PRODUCTION
* - level = NOTICE et environment = PRODUCTION
* @param $information message d'erreur / information à enregistrer
* @param $level niveau d'erreur
* @param $file_name fichier de log
*/
public static function record($information, $level, $file_name = null)
{
try {
$conf = Minz_Configuration::get('system');
$env = $conf->environment;
} catch (Minz_ConfigurationException $e) {
$env = 'production';
}
if (!($env === 'silent' || $env === 'production' && $level >= Minz_Log::NOTICE)) {
if ($file_name === null) {
$file_name = join_path(USERS_PATH, Minz_Session::param('currentUser', '_'), 'log.txt');
}
switch ($level) {
case Minz_Log::ERROR:
$level_label = 'error';
break;
case Minz_Log::WARNING:
$level_label = 'warning';
break;
case Minz_Log::NOTICE:
$level_label = 'notice';
break;
case Minz_Log::DEBUG:
$level_label = 'debug';
break;
default:
$level_label = 'unknown';
}
$log = '[' . date('r') . ']' . ' [' . $level_label . ']' . ' --- ' . $information . "\n";
if (file_put_contents($file_name, $log, FILE_APPEND | LOCK_EX) === false) {
throw new Minz_PermissionDeniedException($file_name, Minz_Exception::ERROR);
}
}
}
示例2: applyAction
public function applyAction()
{
if (!file_exists(UPDATE_FILENAME) || !is_writable(FRESHRSS_PATH)) {
Minz_Request::forward(array('c' => 'update'), true);
}
require UPDATE_FILENAME;
if (Minz_Request::param('post_conf', false)) {
$res = do_post_update();
Minz_ExtensionManager::callHook('post_update');
if ($res === true) {
@unlink(UPDATE_FILENAME);
@file_put_contents(join_path(DATA_PATH, 'last_update.txt'), '');
Minz_Request::good(_t('feedback.update.finished'));
} else {
Minz_Request::bad(_t('feedback.update.error', $res), array('c' => 'update', 'a' => 'index'));
}
}
if (Minz_Request::isPost()) {
save_info_update();
}
if (!need_info_update()) {
$res = apply_update();
if ($res === true) {
Minz_Request::forward(array('c' => 'update', 'a' => 'apply', 'params' => array('post_conf' => true)), true);
} else {
Minz_Request::bad(_t('feedback.update.error', $res), array('c' => 'update', 'a' => 'index'));
}
}
}
示例3: init
/**
* Initialize the different FreshRSS / Minz components.
*
* PLEASE DON'T CHANGE THE ORDER OF INITIALIZATIONS UNLESS YOU KNOW WHAT
* YOU DO!!
*
* Here is the list of components:
* - Create a configuration setter and register it to system conf
* - Init extension manager and enable system extensions (has to be done asap)
* - Init authentication system
* - Init user configuration (need auth system)
* - Init FreshRSS context (need user conf)
* - Init i18n (need context)
* - Init sharing system (need user conf and i18n)
* - Init generic styles and scripts (need user conf)
* - Init notifications
* - Enable user extensions (need all the other initializations)
*/
public function init()
{
if (!isset($_SESSION)) {
Minz_Session::init('FreshRSS');
}
// Register the configuration setter for the system configuration
$configuration_setter = new FreshRSS_ConfigurationSetter();
$system_conf = Minz_Configuration::get('system');
$system_conf->_configurationSetter($configuration_setter);
// Load list of extensions and enable the "system" ones.
Minz_ExtensionManager::init();
// Auth has to be initialized before using currentUser session parameter
// because it's this part which create this parameter.
$this->initAuth();
// Then, register the user configuration and use the configuration setter
// created above.
$current_user = Minz_Session::param('currentUser', '_');
Minz_Configuration::register('user', join_path(USERS_PATH, $current_user, 'config.php'), join_path(USERS_PATH, '_', 'config.default.php'), $configuration_setter);
// Finish to initialize the other FreshRSS / Minz components.
FreshRSS_Context::init();
$this->initI18n();
FreshRSS_Share::load(join_path(DATA_PATH, 'shares.php'));
$this->loadStylesAndScripts();
$this->loadNotifications();
// Enable extensions for the current (logged) user.
if (FreshRSS_Auth::hasAccess()) {
$ext_list = FreshRSS_Context::$user_conf->extensions_enabled;
Minz_ExtensionManager::enableByList($ext_list);
}
}
示例4: load_routes
public static function load_routes($path = '')
{
if ($path == '') {
$path = join_path(ROOT_DIR, 'config', 'routes.php');
}
include_once $path;
}
示例5: handleRequest
public function handleRequest()
{
$config = Registry::getInstance();
$scriptdir = str_replace($config->web_root, '', $config->site_root);
$scriptname = basename($_SERVER['SCRIPT_FILENAME']);
$request = trim(str_replace(join_path($scriptdir, $scriptname), '', $_SERVER['REQUEST_URI']), DIRECTORY_SEPARATOR);
$config->base_dir = $scriptdir;
$view = 'default';
if (strlen($request) > 0) {
$args = explode(DIRECTORY_SEPARATOR, $request);
if (count($args) > 0) {
$controller = array_shift($args);
}
if (count($args) > 0) {
$view = array_shift($args);
}
if (count($args) > 0) {
foreach ($args as $k => $v) {
$args[$k] = urldecode($v);
}
}
}
if (!isset($controller)) {
$controller = $config->default_controller;
$args = array();
}
$controller = 'V7F\\Controller\\' . $controller;
if (class_exists($controller)) {
$active_controller = new $controller();
$active_controller->{$view}($args);
} else {
trigger_error('Controller not found - ' . $controller, E_USER_ERROR);
}
}
示例6: setup
public function setup()
{
//Setup session stuff
SilkSession::setup();
//Load up the configuration file
if (is_file(join_path(ROOT_DIR, 'config', 'setup.yml'))) {
$config = SilkYaml::load(join_path(ROOT_DIR, 'config', 'setup.yml'));
} else {
die("Config file not found!");
}
//Add class path entries
if (isset($config['class_autoload'])) {
foreach ($config['class_autoload'] as $dir) {
add_class_directory(join_path(ROOT_DIR, $dir));
}
}
//Setup the database connection
if (!isset($config['database']['dsn'])) {
die("No database information found in the configuration file");
}
if (null == SilkDatabase::connect($config['database']['dsn'], $config['debug'], true, $config['database']['prefix'])) {
die("Could not connect to the database");
}
silk()->set('config', $config);
//Load components
SilkComponentManager::load();
}
示例7: renderRoute
public function renderRoute($vars)
{
$config = Config::getInstance();
$queries = CMS7_Queries::getInstance();
$config->queries = $queries;
$config->theme_path = join_path($config->base_path, 'themes');
$config->module_path = join_path($config->base_path, 'modules');
$config->plugin_path = join_path($config->base_path, 'plugin');
$config->request_vars = $vars;
$config->site = $config->queries->site->get_site_details();
$this->site = $config->site;
if (isset($vars->page)) {
if (ctype_digit($vars->page)) {
$page_id = $vars->page;
} else {
$page_id = $config->queries->site->find_page_id_by_name(strtolower($vars->page));
}
}
if (!isset($page_id) || !$page_id) {
$page_id = $this->site->site_home_page_id;
}
$this->page_id = $page_id;
$layout = new Layout($page_id);
$this->layout = $layout;
$layout->vars = $vars;
$content = $layout->render();
return $content;
}
示例8: find_template
function find_template ($template) {
// Template param may be a string or an array
// If it's not an array, put the string in a new array
if (!is_array($template)) {
$template = array($template);
}
// Loop through template paths config
foreach (Frix::config('TEMPLATE_PATHS') as $path) {
foreach ($template as $template_file) {
$template_path = join_path(array($path, $template_file . '.php'));
if (file_exists($template_path)) {
return $template_path;
}
}
}
// No template found? Throw an exception.
// debug($template);
throw new TemplateException(sprintf('Template(s) "%s" not found!', implode('", "', $template)));
}
示例9: get_path
/**
* Get relative path to a directory/file
* @param string $path Path to a directory/file
* @param boolean $use_doc_root Use document root or relative path?
* @return string
*/
function get_path($path, $use_doc_root = false)
{
$doc_root = DOCUMENT_ROOT;
if (!$use_doc_root) {
$doc_root = get_relative_path();
}
return join_path(preg_replace('/(\\/)+$/', '', $doc_root), preg_replace('/^(\\/+)/', '', $path));
}
示例10: getURL
public function getURL()
{
$path = $this->asset_module . '_path';
if (!isset($this->{$path})) {
throw new AssetNoModuleException('Asset path not found! ' . var_export($this));
}
return join_path(Config::get('webroot'), $this->asset_module . 's', $this->{$path}, $this->asset_format_path, $this->asset_path);
}
示例11: truncate
public static function truncate()
{
file_put_contents(join_path(DATA_PATH, 'users', Minz_Session::param('currentUser', '_'), 'log.txt'), '');
if (FreshRSS_Auth::hasAccess('admin')) {
file_put_contents(join_path(DATA_PATH, 'users', '_', 'log.txt'), '');
file_put_contents(join_path(DATA_PATH, 'users', '_', 'log_api.txt'), '');
file_put_contents(join_path(DATA_PATH, 'users', '_', 'log_pshb.txt'), '');
}
}
示例12: uninstall
public function uninstall()
{
$filename = 'ttrss.php';
$file_destination = join_path(PUBLIC_PATH, 'api', $filename);
if (file_exists($file_destination) && !unlink($file_destination)) {
return 'API file cannot be removed';
}
return true;
}
示例13: __construct
function __construct()
{
parent::__construct();
$this->mailer_object = null;
$fn = join_path(SILK_LIB_PATH, 'phpmailer', 'class.phpmailer.php');
require_once $fn;
$this->mailer_object = new PHPMailer();
$this->reset();
}
示例14: __construct
function __construct()
{
parent::__construct();
$this->template_dir = join_path(ROOT_DIR, 'tmp', 'templates');
$this->compile_dir = join_path(ROOT_DIR, 'tmp', 'templates_c');
$this->config_dir = join_path(ROOT_DIR, 'tmp', 'configs');
$this->cache_dir = join_path(ROOT_DIR, 'tmp', 'cache');
$this->plugins_dir = array(join_path(SILK_LIB_DIR, 'plugins'), join_path(SILK_LIB_DIR, 'smarty', 'plugins'));
$this->cache_plugins = false;
}
示例15: list_controllers
public static function list_controllers($component)
{
$controllers = array();
$component_dir = join_path(ROOT_DIR, 'components');
foreach (scandir(join_path($component_dir, $component, "controllers")) as $one_controller) {
$filename = join_path($component_dir, $component, "controllers", $one_controller);
if (is_file($filename) && substr($one_controller, 0, 1) != ".") {
$controllers[] = $one_controller;
}
}
return $controllers;
}