本文整理汇总了PHP中Pi::path方法的典型用法代码示例。如果您正苦于以下问题:PHP Pi::path方法的具体用法?PHP Pi::path怎么用?PHP Pi::path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pi
的用法示例。
在下文中一共展示了Pi::path方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
* 'csv-mode-audit' => array(
* 'file' => <path/to/csv.log>,
* 'format' => 'csv', // fixed
* 'timeformat' => <date-format>,
* ),
* ```
*
* - Custom mode with option array (could be empty):
* - file: optional; if file is not specified, log data will be stored in "var/log/<audit-name>.log"
* - timeformat: optional, default as "c"
* - format: optional, default as "csv"
*
* ```
* 'custom-mode-audit' => array(
* ['file' => <path/to/audit.log>,]
* ['timeformat' => <date-format>,]
* ['format' => <data-format>,]
* )
* ```
*
* - Custom mode with string option:
* - file: the specified string is used as log file
* - timeformat: "c"
* - format: "csv"
*
* ```
* 'audit-name' => <path/to/audit.log>
* ```
*/
$path = Pi::path('log');
return array('full' => array('file' => $path . '/full.log', 'timeformat' => 'c', 'format' => '%time% %d %s [%s]'), 'csv' => array('file' => $path . '/csv.log', 'format' => 'csv', 'timeformat' => 'c'), 'relative' => array('timeformat' => 'c'), 'lean' => array('file' => $path . '/lean.log'), 'easy' => $path . '/easy.log', 'simple' => array());
示例2: array
*/
//define('PI_HEADER_TYPE', 'SENDFILE');
/*#@-*/
// Allowed file extensions
$allowedExtension = array('css', 'js', 'gif', 'jpg', 'png');
// Disable error_reporting
//define('APPLICATION_ENV', 'production');
// Pi boot with no engine bootup: current file is located in www/script/...
$boot = dirname(dirname($_SERVER['SCRIPT_FILENAME'])) . '/boot.php';
include $boot;
// Disable debugger message
Pi::service('log')->mute();
// Fetch path from query string if path is not set,
// i.e. through a direct request
if (!empty($_SERVER['QUERY_STRING'])) {
$path = Pi::path(ltrim($_SERVER['QUERY_STRING'], '/'));
}
if (empty($path) || !is_readable($path)) {
if (substr(PHP_SAPI, 0, 3) == 'cgi') {
header('Status: 404 Not Found');
} else {
header('HTTP/1.1 404 Not Found');
}
return;
}
/**
* #@+
* Any file could be reached through the browse.php if its path is known.
* There are two possible policies to protect files:
* 1. Only files in restricted paths are allowed to reach;
* 2. Only files of specific mimetypes are allowed to reach.
示例3:
<?php
$customFile = Pi::path('config/custom/saml/authsources.php');
if (is_readable($customFile)) {
include $customFile;
return;
}
include __DIR__ . '/authsources.default.php';
return;
示例4: array
<?php
// User avatar service configuration
return array('adapter' => 'gravatar', 'adapter' => 'local', 'adapter' => 'select', 'adapter' => array('upload', 'select', 'gravatar'), 'size_map' => array('mini' => 16, 'xmall' => 24, 'small' => 28, 'medium' => 46, 'normal' => 80, 'large' => 96, 'xlarge' => 120, 'xxlarge' => 214, 'origin' => 300), 'local' => array('size_list' => array('mini', 'small', 'medium', 'normal', 'xlarge')), 'gravatar' => array('extension' => 'png', 'rate' => 'g', 'size_list' => array('mini', 'small', 'medium', 'normal', 'xlarge')), 'select' => array('extension' => 'png', 'path' => function ($data) {
$path = sprintf('%s/%s' . '.png', $data['source'], $data['size']);
return $path;
}, 'size_list' => array('mini', 'normal', 'xlarge', 'xxlarge')), 'upload' => array('extension' => array('jpg', 'gif', 'png', 'bmp'), 'root_path' => Pi::path('upload/avatar'), 'root_url' => Pi::url('upload/avatar', true), 'path' => function ($data) {
$fileLimit = 10000;
$uid = $data['uid'];
$sn = str_pad(round($uid / $fileLimit) + 1, 4, '0', STR_PAD_LEFT);
$path = sprintf('%s/%s/%s', $sn, $data['size'], $data['source']);
return $path;
}, 'source_hash' => function ($data) {
// Return $data['source'] will skip hash
$result = md5($data['uid']) . '.' . $data['extension'];
return $result;
}, 'size_list' => array('mini', 'small', 'medium', 'normal', 'xlarge', 'origin')), 'qq' => array('api' => '', 'size_list' => array('small', 'normal', 'large')));
示例5: array
<?php
// User avatar service configuration
return array('driver' => 'gd', 'driver' => 'imagick', 'driver' => 'gmagick', 'driver' => 'auto', 'watermark' => Pi::path('static/image/logo.png'), 'auto_mkdir' => true);
示例6: array
<?php
// Media service configuration
// Root of remote media center
$apiRoot = 'http://master.pi/api/media/doc';
$config = array('adapter' => 'local', 'local' => array('class' => 'Pi\\Media\\Adapter\\Local', 'options' => array('root_path' => Pi::path('upload/media'), 'root_uri' => Pi::url('upload/media', true), 'locator' => array('path' => function ($time = null) {
return date('Y/m/d', $time ?: time());
}, 'file' => function ($source) {
$extension = pathinfo($source, PATHINFO_EXTENSION);
return uniqid() . '.' . $extension;
}))), 'remote' => array('class' => 'Pi\\Media\\Adapter\\Remote', 'options' => array('ftp' => array('username' => '', 'password' => '', 'timeout' => 0), 'authorization' => array(), 'api' => array('add' => $apiRoot . '/insert', 'update' => $apiRoot . '/update', 'upload' => $apiRoot . '/upload', 'download' => $apiRoot . '/download/id/%s', 'get' => $apiRoot . '/get', 'mget' => $apiRoot . '/mget', 'list' => $apiRoot . '/list', 'count' => $apiRoot . '/count', 'delete' => $apiRoot . '/delete', 'stats' => $apiRoot . '/stats', 'stats_list' => $apiRoot . '/mstats'))));
return $config;
示例7: array
<?php
/*
* The configuration of simpleSAMLphp
*
* $Id: config.php 3246 2013-05-23 11:43:52Z olavmrk $
*/
$config = array('baseurlpath' => 'simplesaml/', 'certdir' => 'cert/', 'loggingdir' => Pi::path('log/saml/'), 'datadir' => 'data/', 'tempdir' => Pi::path('cache/simplesaml'), 'debug' => FALSE, 'showerrors' => TRUE, 'debug.validatexml' => FALSE, 'auth.adminpassword' => '123', 'admin.protectindexpage' => false, 'admin.protectmetadata' => false, 'secretsalt' => 'defaultsecretsalt', 'technicalcontact_name' => 'Administrator', 'technicalcontact_email' => 'na@example.org', 'timezone' => NULL, 'logging.level' => SimpleSAML_Logger::NOTICE, 'logging.handler' => 'file', 'logging.facility' => defined('LOG_LOCAL5') ? constant('LOG_LOCAL5') : LOG_USER, 'logging.processname' => 'simplesamlphp', 'logging.logfile' => 'simplesamlphp.log', 'statistics.out' => array(), 'enable.saml20-idp' => false, 'enable.shib13-idp' => false, 'enable.adfs-idp' => false, 'enable.wsfed-sp' => false, 'enable.authmemcookie' => false, 'session.duration' => 8 * (60 * 60), 'session.datastore.timeout' => 4 * 60 * 60, 'session.state.timeout' => 60 * 60, 'session.cookie.name' => 'SimpleSAMLSessionID', 'session.cookie.lifetime' => 0, 'session.cookie.path' => '/', 'session.cookie.domain' => NULL, 'session.cookie.secure' => FALSE, 'session.disable_fallback' => FALSE, 'enable.http_post' => FALSE, 'session.phpsession.cookiename' => null, 'session.phpsession.savepath' => null, 'session.phpsession.httponly' => FALSE, 'session.authtoken.cookiename' => 'SimpleSAMLAuthToken', 'language.available' => array('en', 'no', 'nn', 'se', 'da', 'de', 'sv', 'fi', 'es', 'fr', 'it', 'nl', 'lb', 'cs', 'sl', 'lt', 'hr', 'hu', 'pl', 'pt', 'pt-br', 'tr', 'ja', 'zh', 'zh-tw', 'ru', 'et', 'he', 'id', 'sr', 'lv'), 'language.rtl' => array('ar', 'dv', 'fa', 'ur', 'he'), 'language.default' => 'en', 'language.parameter.name' => 'language', 'language.parameter.setcookie' => TRUE, 'language.cookie.name' => 'language', 'language.cookie.domain' => NULL, 'language.cookie.path' => '/', 'language.cookie.lifetime' => 60 * 60 * 24 * 900, 'attributes.extradictionary' => NULL, 'theme.use' => 'default', 'default-wsfed-idp' => 'urn:federation:pingfederate:localhost', 'idpdisco.enableremember' => TRUE, 'idpdisco.rememberchecked' => TRUE, 'idpdisco.validate' => TRUE, 'idpdisco.extDiscoveryStorage' => NULL, 'idpdisco.layout' => 'dropdown', 'shib13.signresponse' => TRUE, 'authproc.idp' => array(30 => 'core:LanguageAdaptor', 45 => array('class' => 'core:StatisticsWithAttribute', 'attributename' => 'realm', 'type' => 'saml20-idp-SSO'), 50 => 'core:AttributeLimit', 99 => 'core:LanguageAdaptor'), 'authproc.sp' => array(), 'metadata.sources' => array(array('type' => 'flatfile', 'directory' => Pi::path('config/saml/metadata'))), 'store.type' => 'phpsession', 'store.sql.dsn' => 'sqlite:/path/to/sqlitedatabase.sq3', 'store.sql.username' => NULL, 'store.sql.password' => NULL, 'store.sql.prefix' => 'simpleSAMLphp', 'memcache_store.servers' => array(array(array('hostname' => 'localhost'))), 'memcache_store.expires' => 36 * (60 * 60), 'metadata.sign.enable' => FALSE, 'metadata.sign.privatekey' => NULL, 'metadata.sign.privatekey_pass' => NULL, 'metadata.sign.certificate' => NULL, 'proxy' => NULL, 'redirect.trustedsites' => NULL);
示例8: array
<?php
// Cache configuration for Filesystem
$config = array('adapter' => array('name' => 'filesystem', 'options' => array('cache_dir' => Pi::path('cache'), 'dir_level' => 1, 'dir_permission' => 0700, 'file_permission' => 0600)), 'plugins' => array('exception_handler' => array('throw_exceptions' => false)));
return $config;
示例9:
<?php
/*
* The configuration of simpleSAMLphp
*
* $Id: config.php 3246 2013-05-23 11:43:52Z olavmrk $
*/
$customFile = Pi::path('config/custom/saml/config.php');
if (is_readable($customFile)) {
include $customFile;
return;
}
include __DIR__ . '/config.default.php';
return;