本文整理汇总了PHP中Ak::sanitize_include方法的典型用法代码示例。如果您正苦于以下问题:PHP Ak::sanitize_include方法的具体用法?PHP Ak::sanitize_include怎么用?PHP Ak::sanitize_include使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ak
的用法示例。
在下文中一共展示了Ak::sanitize_include方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: trim
function &recognize($Map = null)
{
AK_ENVIRONMENT != 'setup' ? $this->_connectToDatabase() : null;
$this->_startSession();
$this->_enableInternationalizationSupport();
$this->_mapRoutes($Map);
$params = $this->getParams();
$module_path = $module_class_peffix = '';
if (!empty($params['module'])) {
$module_path = trim(str_replace(array('/', '\\'), DS, Ak::sanitize_include($params['module'], 'high')), DS) . DS;
$module_shared_model = AK_CONTROLLERS_DIR . DS . trim($module_path, DS) . '_controller.php';
$module_class_peffix = str_replace(' ', '_', AkInflector::titleize(str_replace(DS, ' ', trim($module_path, DS)))) . '_';
}
$controller_file_name = AkInflector::underscore($params['controller']) . '_controller.php';
$controller_class_name = $module_class_peffix . AkInflector::camelize($params['controller']) . 'Controller';
$controller_path = AK_CONTROLLERS_DIR . DS . $module_path . $controller_file_name;
include_once AK_APP_DIR . DS . 'application_controller.php';
if (!empty($module_path) && file_exists($module_shared_model)) {
include_once $module_shared_model;
}
if (!is_file($controller_path) || !(include_once $controller_path)) {
defined('AK_LOG_EVENTS') && AK_LOG_EVENTS && $this->Logger->error('Controller ' . $controller_path . ' not found.');
if (AK_ENVIRONMENT == 'development') {
trigger_error(Ak::t('Could not find the file /app/controllers/<i>%controller_file_name</i> for ' . 'the controller %controller_class_name', array('%controller_file_name' => $controller_file_name, '%controller_class_name' => $controller_class_name)), E_USER_ERROR);
} elseif (@(include AK_PUBLIC_DIR . DS . '404.php')) {
$response = new AkTestResponse();
$response->addHeader('Status', 404);
return false;
//exit;
} else {
//header("HTTP/1.1 404 Not Found");
$response = new AkResponse();
$response->addHeader('Status', 404);
return false;
//die('404 Not found');
}
}
if (!class_exists($controller_class_name)) {
defined('AK_LOG_EVENTS') && AK_LOG_EVENTS && $this->Logger->error('Controller ' . $controller_path . ' does not implement ' . $controller_class_name . ' class.');
if (AK_ENVIRONMENT == 'development') {
trigger_error(Ak::t('Controller <i>%controller_name</i> does not exist', array('%controller_name' => $controller_class_name)), E_USER_ERROR);
} elseif (@(include AK_PUBLIC_DIR . DS . '405.php')) {
exit;
} else {
$response = new AkResponse();
$response->addHeader('Status', 405);
return false;
//header("HTTP/1.1 405 Method Not Allowed");
//die('405 Method Not Allowed');
}
}
$Controller =& new $controller_class_name(array('controller' => true));
$Controller->_module_path = $module_path;
isset($_SESSION) ? $Controller->session =& $_SESSION : null;
return $Controller;
}
示例2: populateTables
function populateTables()
{
$args = func_get_args();
$tables = !empty($args) ? (is_array($args[0]) ? $args[0] : (count($args) > 1 ? $args : Ak::toArray($args))) : array();
foreach ($tables as $table){
$file = AK_TEST_DIR.DS.'fixtures'.DS.'data'.DS.(empty($this->module)?'':$this->module.DS).Ak::sanitize_include($table).'.yaml';
if(!file_exists($file)){
continue;
}
$class_name = AkInflector::modulize($table);
if($this->instantiateModel($class_name)){
$items = Ak::convert('yaml','array',file_get_contents($file));
foreach ($items as $item){
$this->{$class_name}->create($item);
}
}
}
}
示例3: _getImagePath
protected function _getImagePath($path)
{
$tmp_dir = AkConfig::getDir('tmp');
if (preg_match('/^http(s)?:\\/\\//', $path)) {
$path_info = pathinfo($path);
$base_file_name = Ak::sanitize_include($path_info['basename'], 'paranaoid');
if (empty($path_info['extension'])) {
// no extension, we don't do magic stuff
$path = '';
} else {
$local_path = $tmp_dir . DS . 'mailer' . DS . 'remote_images' . DS . md5($path) . DS . $base_file_name . '.' . $path_info['extension'];
if (!file_exists($local_path) || time() > filemtime($local_path) + 7200) {
if (!AkFileSystem::file_put_contents($local_path, Ak::url_get_contents($path), array('base_path' => $tmp_dir))) {
return '';
}
}
if (!file_exists($local_path) || filesize($local_path) < 1) {
return '';
}
return $local_path;
}
}
$org_path = $path;
$public_dir = AkConfig::getDir('public');
$path = $public_dir . $path;
$path = realpath($path);
if (substr($path, 0, strlen($public_dir)) != $public_dir || !file_exists($path)) {
$path = '';
}
return $path;
}
示例4: setDictionary
static function setDictionary($dictionary, $language, $namespace = false, $comment = null)
{
$path = AkConfig::getDir('app') . DS . 'locales' . DS . ($namespace ? trim(Ak::sanitize_include($namespace, 'high'), DS) . DS : '') . basename($language) . '.php';
AkLocaleManager::getDictionary($language, $namespace, true, $dictionary);
AkFileSystem::file_put_contents($path, "<?php\n/** {$comment} */\n\n\$dictionary=" . var_export((array) $dictionary, true) . ";\n");
return $path;
}
示例5: getBasePath
/**
* Gets a plugin base path.) ...
*
* @param string $plugin_name Plugins name
* @return string Plugin root path
* @access public
*/
function getBasePath($plugin_name)
{
return AK_PLUGINS_DIR.DS.Ak::sanitize_include($plugin_name);
}
示例6: _getImagePath
public function _getImagePath($path)
{
if (preg_match('/^http(s)?:\\/\\//', $path)) {
$path_info = pathinfo($path);
$base_file_name = Ak::sanitize_include($path_info['basename'], 'paranaoid');
if (empty($path_info['extension'])) {
// no extension, we don't do magic stuff
$path = '';
} else {
$local_path = AK_TMP_DIR . DS . 'mailer' . DS . 'remote_images' . DS . md5($path) . DS . $base_file_name . '.' . $path_info['extension'];
if (!file_exists($local_path) || time() > @filemtime($local_path) + 7200) {
if (!Ak::file_put_contents($local_path, Ak::url_get_contents($path))) {
return '';
}
}
if (@filesize($local_path) < 1) {
return '';
}
return $local_path;
}
}
$org_path = $path;
$path = AK_PUBLIC_DIR . $path;
$path = realpath($path);
if (substr($path, 0, strlen(AK_PUBLIC_DIR)) != AK_PUBLIC_DIR || !file_exists($path)) {
$path = '';
}
return $path;
}
示例7: _generateConfigFileName
function _generateConfigFileName($namespace, $environment = AK_ENVIRONMENT)
{
$namespace = Ak::sanitize_include($namespace, 'high');
$yaml_file_name = AK_CONFIG_DIR . DS . $namespace . '.yml';
return $yaml_file_name;
}
示例8: _getImagePath
function _getImagePath($path)
{
if(preg_match('/^http(s)?:\/\//', $path)){
$path_info = pathinfo($path);
$base_file_name = Ak::sanitize_include($path_info['basename'], 'paranaoid');
if(empty($path_info['extension'])){ // no extension, we don't do magic stuff
$path = '';
}else{
$local_path = AK_TMP_DIR.DS.'mailer'.DS.'remote_images'.DS.md5($base_file_name['dirname']).DS.$base_file_name.'.'.$path_info['extension'];
if(!file_exists($local_path) || (time() > @filemtime($local_path)+7200)){
if(!Ak::file_put_contents($local_path, Ak::url_get_contents($path))){
return '';
}
}
return $local_path;
}
}
$path = AK_PUBLIC_DIR.Ak::sanitize_include($path);
if(!file_exists($path)){
$path = '';
}
return $path;
}
示例9: _generateConfigFileName
public function _generateConfigFileName($namespace, $environment = AK_ENVIRONMENT)
{
$namespace = Ak::sanitize_include($namespace, 'high');
$yaml_file_name = AK_TEST_DIR . DS . 'fixtures' . DS . 'config' . DS . $namespace . '.yml';
return $yaml_file_name;
}
示例10: uninstallPlugin
/**
* Uninstalls an existing plugin
*
* Plugins can have an Akelos installer at located at "plugin_name/installer/plugin_name_installer.php"
* If the installer is available, it will run the "PluginNameInstaller::uninstall()" method, which will trigger
* all the down_* methods for the installer.
*
* @param string $plugin_name Plugin name
* @return void
* @access public
*/
public function uninstallPlugin($plugin_name)
{
$plugin_name = Ak::sanitize_include($plugin_name, 'high');
$this->_runInstaller($plugin_name, 'uninstall');
if (is_dir(AK_PLUGINS_DIR . DS . $plugin_name)) {
AkFileSystem::directory_delete(AK_PLUGINS_DIR . DS . $plugin_name);
}
if ($this->_shouldUseSvnExternals()) {
$this->_uninstallExternals($plugin_name);
}
}
示例11: _getModuleDetailsFromParams
private function _getModuleDetailsFromParams($params = array())
{
$details = array();
$details['name'] = $details['path'] = $details['class_peffix'] = '';
if (!empty($params['module'])) {
$details['name'] = Ak::sanitize_include($params['module'], 'high');
$details['path'] = trim(str_replace(array('/', '\\'), DS, $details['name']), DS) . DS;
$details['shared_controller'] = AkConfig::getDir('controllers') . DS . trim($details['path'], DS) . '_controller.php';
$details['class_peffix'] = AkInflector::camelize($params['module']) . '_';
}
return $details;
}
示例12: setDictionary
function setDictionary($dictionary,$language,$namespace=false,$comment=null)
{
$path = AK_APP_DIR.DS.'locales'.DS.($namespace?trim(Ak::sanitize_include($namespace,'high'),DS).DS:'').basename($language).'.php';
AkLocaleManager::getDictionary($language,$namespace,true,$dictionary);
return Ak::file_put_contents($path,"<?php\n/** $comment */\n\n\$dictionary=".var_export((array)$dictionary,true).";\n");
}
示例13: renderFile
/**
* Renders the template present at <tt>template_path</tt>. If <tt>use_full_path</tt> is set to true,
* it's relative to the template_root, otherwise it's absolute. The array in <tt>local_assigns</tt>
* is made available as local variables.
*/
public function renderFile($template_path, $use_full_path = true, $local_assigns = array())
{
if (empty($this->first_render)) {
$this->first_render = $template_path;
}
list($template_extension, $template_file_name) = $this->_getTemplateExtenssionAndFileName($template_path, $use_full_path);
$format = '';
if (isset($local_assigns['params']['format']) && $local_assigns['params']['format'] != 'html') {
$format = Ak::sanitize_include($local_assigns['params']['format'], 'paranoid');
$template_extension = $format . '.' . $template_extension;
}
if (AK_DEBUG && AK_CALLED_FROM_LOCALHOST && AK_ENCLOSE_RENDERS_WITH_DEBUG_SPANS && empty($format)) {
$files_name = trim(str_replace(AkConfig::getDir('base'), '', realpath($template_file_name)), '/');
return "\n\n<span title='file: {$files_name}'>" . $this->renderTemplate($template_extension, null, $template_file_name, $local_assigns) . "\n\n</span>";
}
return $this->renderTemplate($template_extension, null, $template_file_name, $local_assigns);
}
示例14: _deliverUsingMailDeliveryMethod
public function _deliverUsingMailDeliveryMethod($method, &$Message, $options)
{
$handler_name = 'Ak' . AkInflector::camelize(Ak::sanitize_include($method, 'paranoid')) . 'Delivery';
$handler_path = AK_LIB_DIR . DS . 'AkActionMailer' . DS . 'AkMailDelivery' . DS . $handler_name . '.php';
if (file_exists($handler_path)) {
require_once $handler_path;
}
if (!class_exists($handler_name)) {
trigger_error(Ak::t('Could not find message handler %handler_name', array('%handler_name' => $handler_name)), E_USER_ERROR);
return false;
}
$DeliveryHandler = new $handler_name();
$this->Message =& $Message;
return $DeliveryHandler->deliver($this, $options);
}
示例15: _generateConfigFileName
protected function _generateConfigFileName($namespace)
{
$namespace = Ak::sanitize_include($namespace, 'high');
$yaml_file_name = AkConfig::getDir('config') . DS . $namespace . '.yml';
return $yaml_file_name;
}