本文整理汇总了PHP中Maged_Controller类的典型用法代码示例。如果您正苦于以下问题:PHP Maged_Controller类的具体用法?PHP Maged_Controller怎么用?PHP Maged_Controller使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Maged_Controller类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: singleton
/**
* Initialize object of class
*
* @return Maged_Controller
*/
public static function singleton()
{
if (!self::$_instance) {
self::$_instance = new self();
if (self::$_instance->isDownloaded() && self::$_instance->isInstalled()) {
Mage::app('', 'store', array('global_ban_use_cache' => true));
Mage::getSingleton('adminhtml/url')->turnOffSecretKey();
}
}
return self::$_instance;
}
示例2: singleton
/**
* Initialize object of class
*
* @return Maged_Controller
*/
public static function singleton()
{
if (!self::$_instance) {
self::$_instance = new self();
if (self::$_instance->isDownloaded() && self::$_instance->isInstalled()) {
Mage::app();
Mage::getSingleton('adminhtml/url')->turnOffSecretKey();
}
}
return self::$_instance;
}
示例3: controller
/**
* Retrieve Controller as singleton
*
* @return Maged_Controller
*/
public function controller()
{
return Maged_Controller::singleton();
}
示例4: umask
*
* NOTICE OF LICENSE
*
* This source file is subject to the Magento Enterprise Edition License
* that is bundled with this package in the file LICENSE_EE.txt.
* It is also available through the world-wide-web at this URL:
* http://www.magentocommerce.com/license/enterprise-edition
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
* @package Mage_Connect
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
* @license http://www.magentocommerce.com/license/enterprise-edition
*/
if (version_compare(phpversion(), '5.2.0', '<') === true) {
echo '<div style="font:12px/1.35em arial, helvetica, sans-serif;"><div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;"><h3 style="margin:0; font-size:1.7em; font-weight:normal; text-transform:none; text-align:left; color:#2f2f2f;">Whoops, it looks like you have an invalid PHP version.</h3></div><p>Magento supports PHP 5.2.0 or newer. <a href="http://www.magentocommerce.com/install" target="">Find out</a> how to install</a> Magento using PHP-CGI as a work-around.</p></div>';
exit;
}
require_once "lib/Mage/Autoload/Simple.php";
Mage_Autoload_Simple::register();
umask(0);
Maged_Controller::run();
示例5: mkDirHier
/**
* Wrapper to System::mkDir(), creates a directory as well as
* any necessary parent directories.
*
* @param string $dir directory name
*
* @return bool TRUE on success, or a PEAR error
*
* @access public
*/
function mkDirHier($dir)
{
$this->log(2, "+ create dir {$dir}");
if (!class_exists('System')) {
require_once 'System.php';
}
/*
* Magento fix for custom set permissions in config.ini
*/
if (class_exists('Maged_Controller', false)) {
$magedConfig = Maged_Controller::model('Config', true)->load();
if ($magedConfig->get('use_custom_permissions_mode') == '1' && ($mode = $magedConfig->get('mkdir_mode'))) {
return System::mkDir(array('-m' . $mode, $dir));
}
}
/*
* End fix
*/
return System::mkDir(array('-p', $dir));
}
示例6: _installFile2
//.........这里部分代码省略.........
$task =& new $task($this->config, $this, PEAR_TASK_INSTALL);
if (!$task->isScript()) {
// scripts are only handled after installation
$task->init($raw, $attribs, $pkg->getLastInstalledVersion());
$res = $task->startSession($pkg, $contents, $final_dest_file);
if ($res === false) {
continue;
// skip this file
}
if (PEAR::isError($res)) {
return $res;
}
$contents = $res;
// save changes
}
$wp = @fopen($dest_file, "wb");
if (!is_resource($wp)) {
return $this->raiseError("failed to create {$dest_file}: {$php_errormsg}", PEAR_INSTALLER_FAILED);
}
if (fwrite($wp, $contents) === false) {
return $this->raiseError("failed writing to {$dest_file}: {$php_errormsg}", PEAR_INSTALLER_FAILED);
}
fclose($wp);
}
}
// {{{ check the md5
if (isset($md5sum)) {
if (strtolower($md5sum) === strtolower($attribs['md5sum'])) {
$this->log(2, "md5sum ok: {$final_dest_file}");
} else {
if (empty($options['force'])) {
// delete the file
if (file_exists($dest_file)) {
unlink($dest_file);
}
if (!isset($options['ignore-errors'])) {
return $this->raiseError("bad md5sum for file {$final_dest_file}", PEAR_INSTALLER_FAILED);
} else {
if (!isset($options['soft'])) {
$this->log(0, "warning : bad md5sum for file {$final_dest_file}");
}
}
} else {
if (!isset($options['soft'])) {
$this->log(0, "warning : bad md5sum for file {$final_dest_file}");
}
}
}
}
// }}}
// {{{ set file permissions
if (!OS_WINDOWS) {
if ($role->isExecutable()) {
$mode = 0777 & ~(int) octdec($this->config->get('umask'));
$this->log(3, "+ chmod +x {$dest_file}");
} else {
$mode = 0666 & ~(int) octdec($this->config->get('umask'));
}
/*
* Magento fix for custom set permissions in config.ini
*/
if (class_exists('Maged_Controller', false)) {
$magedConfig = Maged_Controller::model('Config', true)->load();
if ($magedConfig->get('use_custom_permissions_mode') == '1') {
if ($role->isExecutable() && ($configMode = $magedConfig->get('chmod_file_mode_executable'))) {
$mode = $magedConfig;
}
if (!$role->isExecutable() && ($configMode = $magedConfig->get('chmod_file_mode'))) {
$mode = $magedConfig;
}
}
}
/*
* End fix
*/
if ($attribs['role'] != 'src') {
$this->addFileOperation("chmod", array($mode, $dest_file));
if (!@chmod($dest_file, $mode)) {
if (!isset($options['soft'])) {
$this->log(0, "failed to change mode of {$dest_file}: {$php_errormsg}");
}
}
}
}
// }}}
if ($attribs['role'] == 'src') {
rename($dest_file, $final_dest_file);
$this->log(2, "renamed source file {$dest_file} to {$final_dest_file}");
} else {
$this->addFileOperation("rename", array($dest_file, $final_dest_file, $role->isExtension()));
}
}
// Store the full path where the file was installed for easy uninstall
if ($attribs['role'] != 'src') {
$loc = $this->config->get($role->getLocationConfig(), null, $channel);
$this->addFileOperation("installed_as", array($file, $installed_as, $loc, dirname(substr($installed_as, strlen($loc)))));
}
//$this->log(2, "installed: $dest_file");
return PEAR_INSTALLER_OK;
}
示例7: tmpdir
/**
* Get the path of the temporal directory set in the system
* by looking in its environments variables.
* Note: php.ini-recommended removes the "E" from the variables_order setting,
* making unavaible the $_ENV array, that s why we do tests with _ENV
*
* @static
* @return string The temporary directory on the system
*/
function tmpdir()
{
/*
* Magento fix for set tmp dir in config.ini
*/
if (class_exists('Maged_Controller', false)) {
$magedConfig = Maged_Controller::model('Config', true)->load();
if (!is_null($tmpDir = $magedConfig->get('tmp_dir'))) {
return $tmpDir;
}
}
/*
* End fix
*/
if (OS_WINDOWS) {
if ($var = isset($_ENV['TMP']) ? $_ENV['TMP'] : getenv('TMP')) {
return $var;
}
if ($var = isset($_ENV['TEMP']) ? $_ENV['TEMP'] : getenv('TEMP')) {
return $var;
}
if ($var = isset($_ENV['USERPROFILE']) ? $_ENV['USERPROFILE'] : getenv('USERPROFILE')) {
return $var;
}
if ($var = isset($_ENV['windir']) ? $_ENV['windir'] : getenv('windir')) {
return $var;
}
return getenv('SystemRoot') . '\\temp';
}
if ($var = isset($_ENV['TMPDIR']) ? $_ENV['TMPDIR'] : getenv('TMPDIR')) {
return $var;
}
return realpath('/tmp');
}
示例8: singleton
public static function singleton()
{
if (!self::$_instance) {
self::$_instance = new self();
}
return self::$_instance;
}