Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Refactor names and namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Jun 22, 2016
1 parent 310959a commit 50ca28d
Show file tree
Hide file tree
Showing 14 changed files with 74 additions and 26 deletions.
Expand Up @@ -18,6 +18,7 @@
*
* The latest code can be found at <http://pyd.io/>.
*/
namespace Pydio\Uploader\Core;

use Pydio\Core\Utils\StatHelper;
use Pydio\Core\PluginFramework\Plugin;
Expand All @@ -33,19 +34,35 @@ class CoreUploaderLoader extends Plugin
{
public $AUTO_LOAD_TYPE = true;

/**
* Return this plugin configs, merged with its associated "core" configs.
* @return array
*/
public function getConfigs()
{
$data = parent::getConfigs();
$this->filterData($data);
return $data;
}

/**
* Load the configs passed as parameter. This method will
* + Parse the config definitions and load the default values
* + Merge these values with the $configData parameter
* + Publish their value in the manifest if the global_param is "exposed" to the client.
* @param array $data
* @return void
*/
public function loadConfigs($data)
{
$this->filterData($data);
parent::loadConfigs($data);

}

/**
* @param $data
*/
private function filterData(&$data)
{
$confMaxSize = StatHelper::convertBytes($data["UPLOAD_MAX_SIZE"]);
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/core.uploader/manifest.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<ajxpcore id="core.uploader" label="CONF_MESSAGE[Uploaders Options]" description="CONF_MESSAGE[Options shared by all uploaders plugins]" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd">
<class_definition filename="plugins/core.uploader/class.CoreUploaderLoader.php" classname="CoreUploaderLoader"/>
<class_definition filename="plugins/core.uploader/CoreUploaderLoader.php" classname="Pydio\Uploader\Core\CoreUploaderLoader"/>
<client_settings>
<resources>
<i18n namespace="core_uploader" path="plugins/core.uploader/i18n"/>
Expand Down
Expand Up @@ -4,6 +4,8 @@
* based in bit.ly plugin
*/

namespace Pydio\LinkShortener;

use Pydio\Core\Model\ContextInterface;
use Pydio\Core\Utils\Utils;
use Pydio\Core\PluginFramework\Plugin;
Expand All @@ -15,7 +17,7 @@
* @package AjaXplorer_Plugins
* @subpackage Shorten
*/
class multiShortener extends Plugin
class MultiShortener extends Plugin
{

/**
Expand All @@ -26,6 +28,11 @@ public function processShortenHook(ContextInterface $ctx, $url, &$shorten){
$shorten = $this->generateLink($ctx, $url);
}

/**
* @param ContextInterface $ctx
* @param $url
* @return bool|mixed|null|string
*/
protected function generateLink(ContextInterface $ctx, $url){

$type = $this->getContextualOption($ctx, "SHORTEN_TYPE");
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/shorten.multi/manifest.xml
Expand Up @@ -33,7 +33,7 @@
<serverCallback methodName="processShortenHook" hookName="url.shorten"/>
</hooks>
</registry_contributions>
<class_definition filename="plugins/shorten.multi/class.multiShortener.php" classname="multiShortener"/>
<class_definition filename="plugins/shorten.multi/MultiShortener.php" classname="Pydio\LinkShortener\MultiShortener"/>
<dependencies>
<activePlugin pluginName="action.share"/>
</dependencies>
Expand Down
Expand Up @@ -18,6 +18,7 @@
*
* The latest code can be found at <http://pyd.io/>.
*/
namespace Pydio\Uploader\Processor;

use Pydio\Core\Controller\Controller;
use Pydio\Core\Model\ContextInterface;
Expand All @@ -33,7 +34,7 @@
* @package AjaXplorer_Plugins
* @subpackage Uploader
*/
class FlexUploadProcessor extends Plugin
class FlexUpload extends Plugin
{
private static $active = false;

Expand Down Expand Up @@ -100,7 +101,7 @@ public function preProcess(\Psr\Http\Message\ServerRequestInterface &$request, \
/**
* @param \Psr\Http\Message\ServerRequestInterface $request
* @param \Psr\Http\Message\ResponseInterface $response
* @throws Exception
* @throws \Exception
*/
public function postProcess(\Psr\Http\Message\ServerRequestInterface &$request, \Psr\Http\Message\ResponseInterface &$response)
{
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/uploader.flex/manifest.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<uploader id="uploader.flex" text="51" order="1" title="162" label="CONF_MESSAGE[Flash uploader]" description="CONF_MESSAGE[Legacy flash uploader, used when the browser does not support HTML5. If you want to force the usage of this uploader, deactivate the uploader.html, and remove the activeCondition tag from the uploader.flex manifest file.]" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd">
<class_definition filename="plugins/uploader.flex/class.FlexUploadProcessor.php" classname="FlexUploadProcessor"/>
<class_definition filename="plugins/uploader.flex/FlexUpload.php" classname="Pydio\Uploader\Processor\FlexUpload"/>
<client_settings>
<resources>
<i18n namespace="flex_uploader" path="plugins/uploader.flex/i18n" />
Expand Down
Expand Up @@ -18,6 +18,7 @@
*
* The latest code can be found at <http://pyd.io/>.
*/
namespace Pydio\Uploader\Processor;

use Pydio\Access\Core\Model\AJXP_Node;
use Pydio\Access\Core\Model\UserSelection;
Expand All @@ -35,8 +36,13 @@
* @package AjaXplorer_Plugins
* @subpackage Uploader
*/
class SimpleUploadProcessor extends Plugin
class SimpleUpload extends Plugin
{
/**
* @param $action
* @param $httpVars
* @param $fileVars
*/
public function getDropBg($action, $httpVars, $fileVars)
{
$lang = LocaleService::getLanguage();
Expand Down Expand Up @@ -167,6 +173,13 @@ public function postProcess(\Psr\Http\Message\ServerRequestInterface &$request,
}
}

/**
* @param $action
* @param $httpVars
* @param $fileVars
* @param \Pydio\Core\Model\ContextInterface $contextInterface
* @throws \Exception
*/
public function unifyChunks($action, $httpVars, $fileVars, \Pydio\Core\Model\ContextInterface $contextInterface)
{
$selection = UserSelection::fromContext($contextInterface, []);
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/uploader.html/manifest.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<uploader id="uploader.html" order="0" text="51" title="162" className="MultiUploader" label="CONF_MESSAGE[HTML Uploader]" description="CONF_MESSAGE[Auto-switching HTML5 or IFrame uploader.]" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd">
<class_definition filename="plugins/uploader.html/class.SimpleUploadProcessor.php" classname="SimpleUploadProcessor"/>
<class_definition filename="plugins/uploader.html/SimpleUpload.php" classname="Pydio\Uploader\Processor\SimpleUpload"/>
<server_settings>
<global_param expose="true" name="DEFAULT_EXISTING" group="CONF_MESSAGE[Default Behaviour]" type="select" choices="overwrite|CONF_MESSAGE[Always Override],rename|CONF_MESSAGE[Auto Rename File],alert|CONF_MESSAGE[Prompt user]" label="CONF_MESSAGE[Existing Files]" description="CONF_MESSAGE[Inform the user or not if the file already exists (default behaviour, the user will be able to change this preference)]" mandatory="false" default="rename"/>
<global_param expose="true" name="DEFAULT_AUTO_START" group="CONF_MESSAGE[Default Behaviour]" type="boolean" label="CONF_MESSAGE[Auto Start]" description="CONF_MESSAGE[Default value for automatically starting upload or not]" mandatory="false" default="true"/>
Expand Down
Expand Up @@ -18,6 +18,7 @@
*
* The latest code can be found at <http://pyd.io/>.
*/
namespace Pydio\Uploader\Processor;

use Pydio\Access\Core\Model\AJXP_Node;
use Pydio\Access\Core\Model\UserSelection;
Expand All @@ -37,8 +38,15 @@
* @package AjaXplorer_Plugins
* @subpackage Downloader
*/
class HttpDownloader extends Plugin
class HttpDownload extends Plugin
{
/**
* @param \Psr\Http\Message\ServerRequestInterface $request
* @param \Psr\Http\Message\ResponseInterface $response
* @return bool
* @throws \Exception
* @throws \Pydio\Core\Exception\PydioException
*/
public function switchAction(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response)
{
//$this->logInfo("DL file", $httpVars);
Expand All @@ -56,13 +64,13 @@ public function switchAction(\Psr\Http\Message\ServerRequestInterface $request,
}else if (isSet($httpVars["dlfile"])) {
$dlFile = $userSelection->currentBaseUrl().Utils::decodeSecureMagic($httpVars["dlfile"]);
$realFile = file_get_contents($dlFile);
if(empty($realFile)) throw new Exception("cannot find file $dlFile for download");
if(empty($realFile)) throw new \Exception("cannot find file $dlFile for download");
$parts = parse_url($realFile);
$getPath = $parts["path"];
$basename = basename($getPath);
//$dlURL = $realFile;
}else{
throw new Exception("Missing argument, either file or dlfile");
throw new \Exception("Missing argument, either file or dlfile");
}

switch ($action) {
Expand All @@ -89,7 +97,7 @@ function ($msg, $progress) use ($taskId) {
TaskService::getInstance()->updateTaskStatus($taskId, Task::STATUS_RUNNING, sprintf($msg, $progress), null, $progress);
} // Showing progress for the download
);
} catch (Exception $e) {
} catch (\Exception $e) {
// In case of a problem, removing the task
TaskService::getInstance()->updateTaskStatus($taskId, Task::STATUS_FAILED, $e->getMessage());
return false;
Expand Down Expand Up @@ -148,16 +156,16 @@ function ($msg, $progress) use ($taskId) {
* @param string $url
* @param AJXP_Node $node
* @param $updateFn
* @throws Exception
* @throws \Exception
*/
public function externalDownload($url, $node, $updateFn) {

$client = new GuzzleHttp\Client(['base_url' => $url]);
$client = new \GuzzleHttp\Client(['base_url' => $url]);

$response = $client->get();

if ($response->getStatusCode() !== 200) {
throw new Exception("There was a problem retrieving the file from the server");
throw new \Exception("There was a problem retrieving the file from the server");
}

$totalSize = -1;
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/uploader.http/manifest.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<uploader text="51" title="132" order="10" id="uploader.http" label="CONF_MESSAGE[Remote Download]" description="CONF_MESSAGE[Async downloader to load a file from another source]" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd">
<class_definition filename="plugins/uploader.http/class.HttpDownloader.php" classname="HttpDownloader"/>
<class_definition filename="plugins/uploader.http/HttpDownload.php" classname="Pydio\Uploader\Processor\HttpDownload"/>
<client_settings>
<resources>
<i18n namespace="httpdownloader" path="plugins/uploader.http/resources/i18n" />
Expand Down
Expand Up @@ -18,6 +18,7 @@
*
* The latest code can be found at <http://pyd.io/>.
*/
namespace Pydio\Uploader\Processor;

use Pydio\Access\Core\AJXP_MetaStreamWrapper;
use Pydio\Access\Core\Model\AJXP_Node;
Expand All @@ -37,7 +38,7 @@
* @package AjaXplorer_Plugins
* @subpackage Uploader
*/
class JumploaderProcessor extends Plugin
class Jumploader extends Plugin
{
/**
* Handle UTF8 Decoding
Expand Down Expand Up @@ -81,7 +82,7 @@ public function getTemplate(\Psr\Http\Message\ServerRequestInterface &$request,
/**
* @param \Psr\Http\Message\ServerRequestInterface $request
* @param \Psr\Http\Message\ResponseInterface $response
* @throws Exception
* @throws \Exception
*/
public function preProcess(\Psr\Http\Message\ServerRequestInterface &$request, \Psr\Http\Message\ResponseInterface &$response)
{
Expand Down Expand Up @@ -129,7 +130,7 @@ public function preProcess(\Psr\Http\Message\ServerRequestInterface &$request, \

if (!self::$remote) {
$resumeIndexes = array ();
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($destStreamURL));
$it = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($destStreamURL));
$it->setMaxDepth(0);
while ($it->valid()) {
if (!$it->isDot()) {
Expand Down Expand Up @@ -215,7 +216,7 @@ public function preProcess(\Psr\Http\Message\ServerRequestInterface &$request, \
* @param \Psr\Http\Message\ServerRequestInterface $request
* @param \Psr\Http\Message\ResponseInterface $response
* @return void
* @throws Exception
* @throws \Exception
*/
public function postProcess(\Psr\Http\Message\ServerRequestInterface &$request, \Psr\Http\Message\ResponseInterface &$response)
{
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/uploader.jumploader/manifest.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<uploader id="uploader.jumploader" order="2" enabled="false" text="51" title="162" label="CONF_MESSAGE[Jumploader]" description="CONF_MESSAGE[Third-party JumpLoader JAVA applet allowing to upload folders, chunk big files, etc.]" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd">
<class_definition filename="plugins/uploader.jumploader/class.JumploaderProcessor.php" classname="JumploaderProcessor"/>
<class_definition filename="plugins/uploader.jumploader/Jumploader.php" classname="Pydio\Uploader\Processor\Jumploader"/>
<client_settings>
<resources>
<i18n namespace="jumploader" path="plugins/uploader.jumploader/i18n"/>
Expand Down
@@ -1,6 +1,5 @@
<?php
/**
* @package info.ajaxplorer
*
* Copyright 2007-2009 Charles du Jeu
* This file is part of Pydio.
Expand Down Expand Up @@ -33,6 +32,8 @@
*
* Description : Class for handling flex upload
*/
namespace Pydio\Uploader\Processor;

use Pydio\Access\Core\AJXP_MetaStreamWrapper;
use Pydio\Access\Core\Model\AJXP_Node;
use Pydio\Access\Core\Model\UserSelection;
Expand All @@ -47,9 +48,9 @@
defined('AJXP_EXEC') or die( 'Access not allowed');

/**
* Class PluploadProcessor
* Class Pluploader
*/
class PluploadProcessor extends Plugin
class Pluploader extends Plugin
{
/**
* @param \Psr\Http\Message\ServerRequestInterface $requestInterface
Expand Down Expand Up @@ -93,7 +94,7 @@ public function getTemplate(\Psr\Http\Message\ServerRequestInterface $requestInt
* @param $httpVars
* @param $fileVars
* @param \Pydio\Core\Model\ContextInterface $ctx
* @throws Exception
* @throws \Exception
* @throws \Pydio\Core\Exception\ActionNotFoundException
* @throws \Pydio\Core\Exception\AuthRequiredException
*/
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/uploader.plupload/manifest.xml
Expand Up @@ -5,7 +5,7 @@
<plugin_author>lmanders</plugin_author>
<plugin_version>1.0</plugin_version>
</plugin_info>
<class_definition filename="plugins/uploader.plupload/class.PluploadProcessor.php" classname="PluploadProcessor"/>
<class_definition filename="plugins/uploader.plupload/Pluploader.php" classname="Pydio\Uploader\Processor\Pluploader"/>
<client_settings>
<resources>
<i18n namespace="plupload" path="plugins/uploader.plupload/i18n" />
Expand Down

0 comments on commit 50ca28d

Please sign in to comment.