本文整理汇总了PHP中xapp_import函数的典型用法代码示例。如果您正苦于以下问题:PHP xapp_import函数的具体用法?PHP xapp_import怎么用?PHP xapp_import使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xapp_import函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ls
public function ls($path = null)
{
xapp_import('xapp.Directory.Utils');
xapp_import('xapp.VFS.Local');
//we listen to VFS messages
Xapp_Hook::connect(XApp_VFS_Base::EVENT_ON_NODE_META_CREATED, $this, "_onItem");
Xapp_Hook::connect(XApp_VFS_Base::EVENT_ON_NODE_ADD, $this, "_addNode");
//create a single scope for now
//prepare vfs
$vfsItems = array();
//mount one item at root, the system scope.
$vfsItems[] = array('name' => 'root', 'path' => $path . DIRECTORY_SEPARATOR);
//vfs ctor
$this->_vfs = XApp_VFS_Local::factory($vfsItems);
//vfs dir scanning options
$directoryOptions = array(XApp_Directory_Utils::OPTION_ONLY_DIRS => false, XApp_Directory_Utils::OPTION_ONLY_FILES => false, XApp_Directory_Utils::OPTION_RECURSIVE => true, XApp_Directory_Utils::OPTION_CLEAR_PATH => true);
//prepare result
$this->_currentNodes = array();
$this->_currentNodes['items'] = array();
//fire vfs
$items = $this->_vfs->ls('root/', true, array(XApp_File_Utils::OPTION_DIR_LIST_FIELDS => XAPP_XFILE_SHOW_ISDIR, XApp_File_Utils::OPTION_DIR_LIST => $directoryOptions, XApp_Directory_Utils::OPTION_INCLUDE_LIST => array('*')));
//complete tree-store data
$this->_currentNodes['identifier'] = 'path';
$this->_currentNodes['label'] = 'name';
return $this->_currentNodes;
}
示例2: __construct
/**
* class constructor will include the external console class, initialize it and store
* its instance as $console property. the class can not be instantiated other
* then using singleton method create. the loaded console class will be init and map
* with its log types to this classed log types.
*
* @error 10901
* @param string $driver expects the driver string to load
* @param array $options expects an driver dependent option array
* @throws Xapp_Error
*/
protected function __construct($driver, array $options = array())
{
$this->_driver = strtolower(trim($driver));
switch ($this->_driver) {
case 'firephp':
xapp_import('firephp.firephp-core.*');
if (sizeof(ob_list_handlers()) === 0) {
ob_start();
}
$this->console = FirePHP::init();
$this->console->setOptions($options);
self::$_typeMap = array_merge(self::$_typeMap, array('log' => FirePHP::LOG, 'warn' => FirePHP::WARN, 'info' => FirePHP::INFO, 'error' => FirePHP::ERROR, 'dump' => FirePHP::DUMP, 'trace' => FirePHP::TRACE, 'group' => FirePHP::GROUP_START, 'ungroup' => FirePHP::GROUP_END));
break;
case 'chromephp':
xapp_import('xapp.Ext.ChromePhp');
$this->console = ChromePhp::getInstance();
if (!isset($options[ChromePhp::BACKTRACE_LEVEL])) {
$options[ChromePhp::BACKTRACE_LEVEL] = 2;
}
$this->console->addSettings($options);
self::$_typeMap = array_merge(self::$_typeMap, array('log' => ChromePhp::LOG, 'warn' => ChromePhp::WARN, 'info' => ChromePhp::INFO, 'error' => ChromePhp::ERROR, 'dump' => ChromePhp::INFO, 'trace' => ChromePhp::INFO, 'group' => ChromePhp::GROUP, 'ungroup' => ChromePhp::GROUP_END));
break;
default:
throw new Xapp_Error(xapp_sprintf(_("xapp console driver: %s not supported"), $driver), 1090101);
}
}
示例3: download
public static function download($url, $timeout = 3000)
{
xapp_import('xapp.Commons.Error');
xapp_import('xapp.Utils.Strings');
xapp_import('xapp.Http.MiniHTTP');
xapp_import('xapp.Directory.Utils');
xapp_import('xapp.File.Utils');
if (!$url) {
return new XApp_Error('http_no_url', 'Invalid URL Provided.');
}
$tmpfname = XApp_Directory_Utils::tempname($url);
if (!$tmpfname) {
return new XApp_Error_Base('http_no_file', 'Could not create Temporary file.');
}
$http = new XApp_Http();
$response = $http->request($url, array('timeout' => $timeout, 'stream' => true, 'filename' => $tmpfname));
/*xapp_clog($response);*/
if (XApp_Error_Base::is_error($response)) {
unlink($tmpfname);
return $response;
}
/*
if ( 200 != self::remote_retrieve_response_code( $response ) ){
unlink( $tmpfname );
return self::remote_retrieve_response_message( $response );
}*/
$content_md5 = self::remote_retrieve_header($response, 'content-md5');
if ($content_md5) {
$md5_check = XApp_File_Utils::verify_file_md5($tmpfname, $content_md5);
if (XApp_Error::is_error($md5_check)) {
unlink($tmpfname);
return $md5_check;
}
}
return $tmpfname;
}
示例4: xapp_import
<?php
/**
* @version 0.1.0
*
* @author Luis Ramos
* @author Guenter Baumgart
* @license : GPL v2. http://www.gnu.org/licenses/gpl-2.0.html
* @package XApp\xide\Controller
*/
xapp_import("xapp.Commons.Entity");
xapp_import('xapp.Utils.Strings');
xapp_import('xapp.xide.Base.Scoped');
/***
* Class XIDE_Manager
*/
class XIDE_Manager extends XIDE_Scoped
{
public $logger = null;
/**
* @param $message
* @param string $prefix
* @param bool $stdError
* @return null
*/
public function log($message, $prefix = '', $stdError = true)
{
if (function_exists('xp_log')) {
xp_log(__CLASS__ . ' : ' . $message);
}
if ($stdError) {
示例5: defined
<?php
defined('XAPP') || (require_once dirname(__FILE__) . '/../Core/core.php');
xapp_import('xapp.Config');
xapp_import('xapp.Config.Exception');
/**
* Config Xml class
*
* @package Config
* @class Xapp_Config_Xml
* @error 128
* @author Frank Mueller <set@cooki.me>
*/
class Xapp_Config_Xml extends Xapp_Config
{
/**
* load xml config structure from xml string or xml file pointer converting the xml
* to json and back to array to get xml to array result
*
* @error 12801
* @param string $xml expects xml string or xml file pointer
* @return array
* @throws Xapp_Config_Exception
*/
public static function load($xml)
{
if ((bool) preg_match('/\\.xml$/i', $xml)) {
if (is_file($xml) && ($xml = simplexml_load_file($xml, 'SimpleXMLElement', LIBXML_NOBLANKS | LIBXML_NOCDATA)) === false) {
throw new Xapp_Config_Exception(xapp_sprintf(_("unable to load xml config from file: %s, error: %s"), $xml, libxml_get_last_error()), 1280101);
}
} else {
示例6: createApp
/**
* @param $XAPP_BASE_DIRECTORY
* @param $XAPP_APP_NAME
* @param $XAPP_CLIENT_DIRECTORY
* @param $REPOSITORY_ROOT
* @param $REPOSITORY_START_PATH
* @param $UPLOAD_EXTENSIONS
* @param $XFILE_CONFIG
* @param string $XAPP_JQUERY_THEME
* @param $LOG_DIRECTORY
* @param $CONF_FILE
* @param $XAPP_SALT_KEY
* @param $XF_PROHIBITED_PLUGINS
* @param $RELATIVE_VARIABLES
* @param $XAPP_COMPONENTS
* @param $XAPP_RESOURCE_CONFIG
* @param null $XAPP_BOOTSTRAP_OVERRIDE
*
* @return array
*/
function createApp($XAPP_BASE_DIRECTORY, $XAPP_APP_NAME, $XAPP_CLIENT_DIRECTORY, $REPOSITORY_ROOT, $REPOSITORY_START_PATH, $UPLOAD_EXTENSIONS, $XFILE_CONFIG, $XAPP_JQUERY_THEME = 'dot-luv', $LOG_DIRECTORY, $CONF_FILE, $XAPP_SALT_KEY, $XF_PROHIBITED_PLUGINS, $RELATIVE_VARIABLES, $XAPP_COMPONENTS, $XAPP_RESOURCE_CONFIG, $XAPP_BOOTSTRAP_OVERRIDE = null)
{
/***
* prepare and adjust bootstrapper for stand-alone
*/
if (!defined('XAPP_BASEDIR')) {
define('XAPP_BASEDIR', $XAPP_BASE_DIRECTORY);
}
require_once XAPP_BASEDIR . 'XApp_Service_Entry_Utils.php';
XApp_Service_Entry_Utils::includeXAppCore();
XApp_Service_Entry_Utils::includeXAppRPC();
require_once XAPP_BASEDIR . 'app/Renderer.php';
require_once XAPP_BASEDIR . 'commander/Commander.php';
XApp_App_Commander::loadDependencies();
xapp_setup_language_standalone();
xapp_import('xapp.Utils.Strings');
xapp_import('xapp.Utils.Debugging');
$urlParams = array();
if (isset($_SERVER["QUERY_STRING"])) {
XApp_Utils_Strings::parse_str($_SERVER["QUERY_STRING"], $urlParams);
if (isset($urlParams['view'])) {
unset($urlParams['view']);
}
}
define('XAPP_INDEX', xapp_fix_index());
/***
* Quick'n dirty auth delegate
* @TODO replace with new ACL/Permission system
*/
class XAPP_AUTH_DELEGATE
{
// salt key, passed from index.php
public static $_salt;
// xf config, passed from index.php
public static $_config;
/**
* Reject RPC methods
* @param $what
* @return bool
*/
public static function authorize($what)
{
/**
* Option 1. Use the xfile config passed from index.php
*/
if (self::$_config) {
$data = (array) json_decode(self::$_config);
$allowedActions = $data['ALLOWED_ACTIONS'];
$intOp = intval(XApp_Service_Entry_Utils::opToInteger($what));
if ($intOp != XC_OPERATION_UNKOWN) {
if ($intOp > 0 && $intOp < count($allowedActions)) {
//boundary check
return $allowedActions[$intOp];
}
}
}
/**
* Option 2. Reject via string match if you like
*/
switch ($what) {
case XC_OPERATION_COPY_STR:
case XC_OPERATION_MOVE_STR:
case XC_OPERATION_DELETE_STR:
case XC_OPERATION_READ_STR:
case XC_OPERATION_EDIT_STR:
case XC_OPERATION_COMPRESS_STR:
case XC_OPERATION_RENAME_STR:
case XC_OPERATION_DOWNLOAD_STR:
case XC_OPERATION_FILE_UPDATE_STR:
case XC_OPERATION_NEW_DIRECTORY_STR:
case XC_OPERATION_NEW_FILE_STR:
case XC_OPERATION_UPLOAD:
case XC_OPERATION_DOWNLOAD:
case XC_OPERATION_EXTRACT:
return true;
}
return true;
}
public function getUserName()
{
//.........这里部分代码省略.........
示例7: xapp_import
<?php
/**
* Image manipulation functions for extension Imagick
*
*
* Created by PhpStorm.
* User: Luigi
* Date: 5/03/14
* Time: 12:38
*/
xapp_import("xapp.Image.Interface.ImageHandler");
class XApp_ImageImagick implements Xapp_ImageHandler
{
/**
* Default imagick resize filter
*/
const IMAGICK_RESIZE_FILTER = imagick::FILTER_LANCZOS;
/**
* Opens an Image file
*
* @param $src
* @param $errors
* @return mixed
*/
public static function open($src, &$errors)
{
$file_ext = XApp_Image_Utils::imageExtension($src);
if (!array_key_exists($file_ext, XApp_Image_Utils::$compatibleImageTypes)) {
$errors[] = XAPP_TEXT_FORMATTED("IMAGE_TYPE_NOT_SUPPORTED", $file_ext);
return false;
示例8: xapp_import
<?php
/**
* @version 0.1.0
*
* @author https://github.com/mc007
* @license : GPL v2. http://www.gnu.org/licenses/gpl-2.0.html
* @package XApp\xide\Directory
*/
xapp_import('xapp.Service.Service');
xapp_import('xapp.Directory.Service');
/***
* Class XIDE_Service extends the standard service
*/
class XIDE_Service extends XApp_Service
{
/**
* class constructor
* call parent constructor for class initialization
*
* @error 14601
* @param null|array|object $options expects optional options
*/
public function __construct($options = null)
{
parent::__construct($options);
//standard constructor
xapp_set_options($options, $this);
}
}
示例9: xapp_import
<?php
/**
* @version 0.1.0
*
* @author Guenter Baumgart
* @license : GPL v2. http://www.gnu.org/licenses/gpl-2.0.html
* @package XApp\xide\Models
*/
xapp_import("xapp.Commons.Entity");
xapp_import('xapp.Utils.Strings');
xapp_import('xapp.Option.Utils');
xapp_import('xapp.Xapp.Registry');
/***
* Class XIDE_Scope
*/
class XIDE_Scope extends XApp_Entity
{
////////////////////////////////////////////////////////////////////////////
//
// Constants
//
////////////////////////////////////////////////////////////////////////////
//default scope names
const SYSTEM = "system";
const USER = "user";
const APP = "app";
////////////////////////////////////////////////////////////////////////////
//
// Options
//
示例10: xapp_import
* This file is part of the Nette Framework (http://nette.org)
* Copyright (c) 2004 David Grudl (http://davidgrudl.com)
*/
/**
* Default implementation of IIdentity.
*
* @author David Grudl
*
* @serializationVersion 1.0
*
* @property mixed $id
* @property array $roles
* @property-read array $data
*/
xapp_import('xapp.Commons.Object');
xapp_import('xapp.Security.IIdentity');
class XApp_Security_Identity extends XApp_Object implements XApp_Security_IIdentity
{
/** @var mixed */
private $id;
/** @var array */
private $roles;
/** @var array */
private $data;
/**
* @param mixed identity ID
* @param mixed roles
* @param array user data
*/
public function __construct($id, $roles = NULL, $data = NULL)
{
示例11: defined
<?php
/**
* @version 0.1.0
*
* @author https://github.com/mc007
* @license : GPL v2. http://www.gnu.org/licenses/gpl-2.0.html
*/
defined('XAPP') || (require_once dirname(__FILE__) . '/../../Core/core.php');
xapp_import('xapp.Rpc.Server.Exception');
xapp_import('xapp.Rpc.Fault');
xapp_import('xapp.Rpc.Server.Json');
xapp_import('xapp.Rpc.Smd.Jsonp');
xapp_import('xapp.Rpc.Server.Jsonp');
xapp_import('xapp.Rpc.Response.Json');
xapp_import('xapp.Rpc.Request.Json');
/**
* Rpc server jsonp class
*
* @package Rpc
* @subpackage Rpc_Server
* @class Xapp_Rpc_Server_Raw
* @error 147
* @author Guenter Baumgart
*/
class Xapp_Rpc_Server_Raw extends Xapp_Rpc_Server_Jsonp
{
/**
* executing requested service if found passing result from service invoking to response
* or pass compile smd map to response if no service was called. if a callback was supplied
* will wrap result into callback function
示例12: defined
<?php
/**
* @version 0.1.0
*
* @author https://github.com/mc007
* @license : GPL v2. http://www.gnu.org/licenses/gpl-2.0.html
*/
defined('XAPP') || (require_once dirname(__FILE__) . '/../Core/core.php');
xapp_import('xapp.Util.Json.Exception');
xapp_import('xapp.Util.Json');
/**
* Util json store class
*
* @package Util
* @subpackage Util_Json
* @class Xapp_Util_Json_Store
* @error 169
* @author Frank Mueller
*/
class Xapp_Util_Json_Store extends Xapp_Util_Std_Store
{
/**
* query the object with path and query parameters from Xapp_Util_Json_Query::find method and use store
* methods on search result, e.g.
* <code>
* $store = Xapp_Util_Json_Store::create($object)
->query('/firstElement', array("id=1000"))
->query('.', array('title=foo'))
->set(null, 1);
* </code>
示例13: defined
<?php
/**
* @version 0.1.0
*
* @author https://github.com/mc007
* @license : GPL v2. http://www.gnu.org/licenses/gpl-2.0.html
*/
defined('XAPP') || (require_once dirname(__FILE__) . '/../Core/core.php');
xapp_import('xapp.Cache.Exception');
/**
* Cache base class
*
* @package Cache
* @class Xapp_Cache
* @error 153
* @author Frank Mueller
*/
abstract class Xapp_Cache
{
/**
* cache option value default expiration when cache key expires after
*
* @const DEFAULT_EXPIRATION
*/
const DEFAULT_EXPIRATION = 'XAPP_CACHE_DEFAULT_EXPIRATION';
/**
* contains the current active last created instance either with instance or factory
* method
*
* @var null|Xapp_Cache
示例14: isLoggedIn
public function isLoggedIn()
{
$flags = xapp_get_option(self::FLAGS);
if ($this->testFlag(XAPP_BOOTSTRAP_NEEDS_AUTHENTICATION, $flags) && xapp_get_option(self::USER_CONF, $this)) {
self::loadJSONTools();
self::loadXAppJSONStoreClasses();
xapp_import('xapp.Store.Json.Json');
$userMgr = new XApp_UserManager(array(XApp_UserManager::STORE_CONF => array(XApp_Store_JSON::CONF_FILE => xapp_get_option(self::USER_CONF, $this))));
$userMgr->init();
$userMgr->initSessionStorage();
$result = $userMgr->isLoggedIn();
return $result;
}
return true;
}
示例15: defined
<?php
defined('XAPP') || (require_once dirname(__FILE__) . '/../Core/core.php');
xapp_import('xapp.Xapp.Error');
xapp_import('xapp.Xapp.Reflection');
/**
* Autoloader class
*
* @package Xapp
* @class Xapp_Autoloader
* @error 107
* @author Frank Mueller <set@cooki.me>
*/
class Xapp_Autoloader implements Xapp_Singleton_Interface
{
/**
* expects a string value or empty string for no value if classes use namespaces
* like Xapp_ or Zend_. this default value defines the default path divider
* which can only be a string or an empty value. the value can be also passed in first constructor
* parameter $dir as array key lil array('path to dir', 'ns', 'divider') overwriting
* default value. With this value you can match class name namespaces to file/dir namespace e.g.
* a file in /app/foo/class.php will be stored as app_foo_class in cache map. use the ns divider
* to overwrite the default value "_" to anything else
*
* @const PATH_SEPARATOR
*/
const PATH_SEPARATOR = 'AUTOLOADER_PATH_SEPARATOR';
/**
* expects the default php real namespace separator so it can be replaced with PATH_DIVIDER value
* when looking for class name. e.g. a class Namespace\Foo will be replaced to Namespace_Foo with
* default path separator making sure that namespaces match folder/file separator syntax.