本文整理汇总了PHP中mimport函数的典型用法代码示例。如果您正苦于以下问题:PHP mimport函数的具体用法?PHP mimport怎么用?PHP mimport使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mimport函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setCredentials
public static function setCredentials($client, $user, $pass)
{
$return = false;
$client = strtolower($client);
// Test if the given credentials are valid
switch ($client) {
case 'ftp':
$config = MFactory::getConfig();
$options = array('enabled' => $config->get('ftp_enable'), 'host' => $config->get('ftp_host'), 'port' => $config->get('ftp_port'));
if ($options['enabled']) {
mimport('framework.client.ftp');
$ftp = MFTP::getInstance($options['host'], $options['port']);
// Test the connection and try to log in
if ($ftp->isConnected()) {
if ($ftp->login($user, $pass)) {
$return = true;
}
$ftp->quit();
}
}
break;
default:
break;
}
if ($return) {
// Save valid credentials to the session
$session = MFactory::getSession();
$session->set($client . '.user', $user, 'MClientHelper');
$session->set($client . '.pass', $pass, 'MClientHelper');
// Force re-creation of the data saved within MClientHelper::getCredentials()
MClientHelper::getCredentials($client, true);
}
return $return;
}
示例2: getInstance
public static function getInstance($type, $prefix = 'MTable', $config = array())
{
// Sanitize and prepare the table class name.
$type = preg_replace('/[^A-Z0-9_\\.-]/i', '', $type);
$tableClass = $prefix . ucfirst($type);
// Only try to load the class if it doesn't already exist.
if (!class_exists($tableClass)) {
// Search for the class file in the MTable include paths.
mimport('framework.filesystem.path');
MTable::addIncludePath(MPATH_MIWI . '/proxy/database/table');
if ($path = MPath::find(MTable::addIncludePath(), strtolower($type) . '.php')) {
// Import the class file.
include_once $path;
// If we were unable to load the proper class, raise a warning and return false.
if (!class_exists($tableClass)) {
MError::raiseWarning(0, MText::sprintf('MLIB_DATABASE_ERROR_CLASS_NOT_FOUND_IN_FILE', $tableClass));
return false;
}
} else {
// If we were unable to find the class file in the MTable include paths, raise a warning and return false.
MError::raiseWarning(0, MText::sprintf('MLIB_DATABASE_ERROR_NOT_SUPPORTED_FILE_NOT_FOUND', $type));
return false;
}
}
// If a database object was passed in the configuration array use it, otherwise get the global one from MFactory.
$db = isset($config['dbo']) ? $config['dbo'] : MFactory::getDbo();
// Instantiate a new table class and return it.
return new $tableClass($db);
}
示例3: getPagination
function getPagination()
{
if (empty($this->_pagination)) {
mimport('framework.html.pagination');
$this->_pagination = new MPagination($this->getTotal(), $this->getState($this->option . '.queries.limitstart'), $this->getState($this->option . '.queries.limit'));
}
return $this->_pagination;
}
示例4: _getCommand
protected function _getCommand($ref, $com, $override, $component)
{
// Get Help URL
mimport('framework.language.help');
$url = MHelp::createURL($ref, $com, $override, $component);
$url = htmlspecialchars($url, ENT_QUOTES);
$cmd = "Miwi.popupWindow('{$url}', '" . MText::_('MHELP', true) . "', 700, 500, 1)";
return $cmd;
}
示例5: raise
public static function raise($level, $code, $msg, $info = null, $backtrace = false)
{
// Deprecation warning.
MLog::add('MError::raise() is deprecated.', MLog::WARNING, 'deprecated');
mimport('framework.error.exception');
// Build error object
$exception = new MException($msg, $code, $level, $info, $backtrace);
return MError::throwError($exception);
}
示例6: cleanUrl
public static function cleanUrl($url)
{
$url = self::cleanText($url);
$bad_chars = array('#', '>', '<', '\\', '="', 'px;', 'onmouseover=');
$url = trim(str_replace($bad_chars, '', $url));
mimport('framework.filter.input');
MFilterInput::getInstance(array('br', 'i', 'em', 'b', 'strong'), array(), 0, 0, 1)->clean($url);
return $url;
}
示例7: addIncludePath
public static function addIncludePath($path = '')
{
static $paths;
if (!isset($paths)) {
$paths = array();
}
if (!empty($path) && !in_array($path, $paths)) {
mimport('framework.filesystem.path');
array_unshift($paths, MPath::clean($path));
}
return $paths;
}
示例8: __construct
public function __construct($context)
{
$this->context = $context;
$this->constants();
$miwi = MPATH_WP_CNT . '/miwi/initialise.php';
if (!file_exists($miwi)) {
return false;
}
require_once $miwi;
$this->app = MFactory::getApplication();
$this->app->initialise();
mimport('framework.filesystem.file');
}
示例9: images
public static function images($name, $active = null, $javascript = null, $directory = null, $extensions = "bmp|gif|jpg|png")
{
if (!$directory) {
$directory = '/images/';
}
if (!$javascript) {
$javascript = "onchange=\"if (document.forms.adminForm." . $name . ".options[selectedIndex].value!='') {document.imagelib.src='..{$directory}' + document.forms.adminForm." . $name . ".options[selectedIndex].value} else {document.imagelib.src='media/system/images/blank.png'}\"";
}
mimport('framework.filesystem.folder');
$imageFiles = MFolder::files(MPATH_SITE . '/' . $directory);
$images = array(MHtml::_('select.option', '', MText::_('MOPTION_SELECT_IMAGE')));
foreach ($imageFiles as $file) {
if (preg_match('#(' . $extensions . ')$#', $file)) {
$images[] = MHtml::_('select.option', $file);
}
}
$images = MHtml::_('select.genericlist', $images, $name, array('list.attr' => 'class="inputbox" size="1" ' . $javascript, 'list.select' => $active));
return $images;
}
示例10: __construct
public function __construct($options = array())
{
// If default transfer type is not set, set it to autoascii detect
if (!isset($options['type'])) {
$options['type'] = FTP_BINARY;
}
$this->setOptions($options);
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$this->_OS = 'WIN';
} elseif (strtoupper(substr(PHP_OS, 0, 3)) === 'MAC') {
$this->_OS = 'MAC';
} else {
$this->_OS = 'UNIX';
}
if (FTP_NATIVE) {
// Import the generic buffer stream handler
mimport('framework.utilities.buffer');
// Autoloading fails for MBuffer as the class is used as a stream handler
MLoader::load('MBuffer');
}
}
示例11: getInstance
public static function getInstance($type, $prefix = '', $config = array())
{
$type = preg_replace('/[^A-Z0-9_\\.-]/i', '', $type);
$modelClass = $prefix . ucfirst($type);
if (!class_exists($modelClass)) {
mimport('framework.filesystem.path');
$path = MPath::find(self::addIncludePath(null, $prefix), self::_createFileName('model', array('name' => $type)));
if (!$path) {
$path = MPath::find(self::addIncludePath(null, ''), self::_createFileName('model', array('name' => $type)));
}
if ($path) {
require_once $path;
if (!class_exists($modelClass)) {
MError::raiseWarning(0, MText::sprintf('MLIB_APPLICATION_ERROR_MODELCLASS_NOT_FOUND', $modelClass));
return false;
}
} else {
return false;
}
}
return new $modelClass($config);
}
示例12: defined
<?php
/*
* @package Miwi Framework
* @copyright Copyright (C) 2009-2014 Miwisoft, LLC. All rights reserved.
* @copyright Copyright (C) 2005-2012 Open Source Matters, Inc. All rights reserved.
* @license GNU/GPL based on Moomla www.joomla.org
*/
defined('MIWI') or die('MIWI');
mimport('framework.filesystem.helper');
//mimport('framework.utilities.utility'); kullanılan fonction göremedim
class MStream extends MObject
{
protected $filemode = 0644;
protected $dirmode = 0755;
protected $chunksize = 8192;
protected $filename;
protected $writeprefix;
protected $readprefix;
protected $processingmethod = 'f';
protected $filters = array();
protected $_fh;
protected $_filesize;
protected $_context = null;
protected $_contextOptions;
protected $_openmode;
public function __construct($writeprefix = '', $readprefix = '', $context = array())
{
$this->writeprefix = $writeprefix;
$this->readprefix = $readprefix;
$this->_contextOptions = $context;
示例13: defined
<?php
/*
* @package MiwoSQL
* @copyright 2009-2012 Mijosoft LLC, www.mijosoft.com
* @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
*/
// No Permission
defined('MIWI') or die('Restricted access');
mimport('framework.filesystem.file');
mimport('framework.filesystem.folder');
class com_MiwosqlInstallerScript
{
public function postflight($type, $parent)
{
if (MFolder::copy(MPath::clean(MPATH_WP_PLG . '/miwosql/languages'), MPath::clean(MPATH_WP_CNT . '/miwi/languages'), null, true)) {
MFolder::delete(MPath::clean(MPATH_WP_PLG . '/miwosql/languages'));
}
}
}
示例14: getStream
public static function getStream($use_prefix = true, $use_network = true, $ua = null, $uamask = false)
{
mimport('framework.filesystem.stream');
// Setup the context;
$context = array();
$version = new MVersion();
// set the UA for HTTP and overwrite for FTP
$context['http']['user_agent'] = $version->getUserAgent($ua, $uamask);
$context['ftp']['overwrite'] = true;
if ($use_prefix) {
$FTPOptions = MClientHelper::getCredentials('ftp');
$SCPOptions = MClientHelper::getCredentials('scp');
if ($FTPOptions['enabled'] == 1 && $use_network) {
$prefix = 'ftp://' . $FTPOptions['user'] . ':' . $FTPOptions['pass'] . '@' . $FTPOptions['host'];
$prefix .= $FTPOptions['port'] ? ':' . $FTPOptions['port'] : '';
$prefix .= $FTPOptions['root'];
} elseif ($SCPOptions['enabled'] == 1 && $use_network) {
$prefix = 'ssh2.sftp://' . $SCPOptions['user'] . ':' . $SCPOptions['pass'] . '@' . $SCPOptions['host'];
$prefix .= $SCPOptions['port'] ? ':' . $SCPOptions['port'] : '';
$prefix .= $SCPOptions['root'];
} else {
$prefix = MPATH_ROOT . '/';
}
$retval = new MStream($prefix, MPATH_ROOT, $context);
} else {
$retval = new MStream('', '', $context);
}
return $retval;
}
示例15: MVersion
if (!defined('_MREQUEST_NO_CLEAN') && (bool) ini_get('register_globals')) {
//MRequest::clean(); // miwisoft ticket 110
}
}
MLoader::import('framework.object.object');
MLoader::import('framework.text.text');
MLoader::import('framework.route.route');
// Register the library base path for CMS libraries.
MLoader::registerPrefix('M', MPATH_MIWI . '/framework');
// Define the Miwi version if not already defined.
if (!defined('MVERSION')) {
$Mversion = new MVersion();
define('MVERSION', $Mversion->getShortVersion());
}
mimport('framework.application.menu');
mimport('framework.environment.uri');
mimport('framework.utilities.utility');
mimport('framework.event.dispatcher');
mimport('framework.utilities.arrayhelper');
mimport('framework.access.access');
mimport('framework.user.user');
mimport('framework.document.document');
mimport('phputf8.utf8');
mimport('framework.database.table');
if (is_admin()) {
mimport('framework.html.toolbar');
mimport('framework.html.toolbar.helper');
}
mimport('framework.application.component.helper');
// Base.css file
MFactory::getDocument()->addStyleSheet(MURL_WP_CNT . '/miwi/media/system/css/base.css');