mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Move RainLoop core files to new folder
This commit is contained in:
parent
3a9bc849c9
commit
345e7c58af
69 changed files with 1695 additions and 1694 deletions
|
|
@ -2,19 +2,20 @@
|
||||||
|
|
||||||
if (!\defined('RAINLOOP_APP_LIBRARIES_PATH'))
|
if (!\defined('RAINLOOP_APP_LIBRARIES_PATH'))
|
||||||
{
|
{
|
||||||
\define('RAINLOOP_APP_LIBRARIES_PATH', \rtrim(\realpath(__DIR__), '\\/').'/libraries/');
|
\define('RAINLOOP_APP_PATH', \rtrim(\realpath(__DIR__), '\\/').'/');
|
||||||
|
\define('RAINLOOP_APP_LIBRARIES_PATH', RAINLOOP_APP_PATH.'libraries/');
|
||||||
\define('RAINLOOP_MB_SUPPORTED', \function_exists('mb_strtoupper'));
|
\define('RAINLOOP_MB_SUPPORTED', \function_exists('mb_strtoupper'));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sClassName
|
* @param string $sClassName
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function RainLoopSplAutoloadRegisterFunction($sClassName)
|
function RainLoopSplAutoloadRegisterFunction($sClassName)
|
||||||
{
|
{
|
||||||
if (0 === \strpos($sClassName, 'RainLoop') && false !== \strpos($sClassName, '\\'))
|
if (0 === \strpos($sClassName, 'RainLoop') && false !== \strpos($sClassName, '\\'))
|
||||||
{
|
{
|
||||||
return include RAINLOOP_APP_LIBRARIES_PATH.'RainLoop/'.\str_replace('\\', '/', \substr($sClassName, 9)).'.php';
|
return include RAINLOOP_APP_PATH.'src/RainLoop/'.\str_replace('\\', '/', \substr($sClassName, 9)).'.php';
|
||||||
}
|
}
|
||||||
else if (0 === \strpos($sClassName, 'Facebook') && false !== \strpos($sClassName, '\\'))
|
else if (0 === \strpos($sClassName, 'Facebook') && false !== \strpos($sClassName, '\\'))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,290 +1,290 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace RainLoop\Config;
|
namespace RainLoop\Config;
|
||||||
|
|
||||||
abstract class AbstractConfig
|
abstract class AbstractConfig
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $sFile;
|
private $sFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $aData;
|
private $aData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
private $bUseApcCache;
|
private $bUseApcCache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $sFileHeader;
|
private $sFileHeader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sFileName
|
* @param string $sFileName
|
||||||
* @param string $sFileHeader = ''
|
* @param string $sFileHeader = ''
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct($sFileName, $sFileHeader = '')
|
public function __construct($sFileName, $sFileHeader = '')
|
||||||
{
|
{
|
||||||
$this->sFile = \APP_PRIVATE_DATA.'configs/'.$sFileName;
|
$this->sFile = \APP_PRIVATE_DATA.'configs/'.$sFileName;
|
||||||
$this->sFileHeader = $sFileHeader;
|
$this->sFileHeader = $sFileHeader;
|
||||||
$this->aData = $this->defaultValues();
|
$this->aData = $this->defaultValues();
|
||||||
|
|
||||||
$this->bUseApcCache = APP_USE_APC_CACHE &&
|
$this->bUseApcCache = APP_USE_APC_CACHE &&
|
||||||
\MailSo\Base\Utils::FunctionExistsAndEnabled(array('apc_fetch', 'apc_store'));
|
\MailSo\Base\Utils::FunctionExistsAndEnabled(array('apc_fetch', 'apc_store'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected abstract function defaultValues();
|
protected abstract function defaultValues();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function IsInited()
|
public function IsInited()
|
||||||
{
|
{
|
||||||
return \is_array($this->aData) && 0 < \count($this->aData);
|
return \is_array($this->aData) && 0 < \count($this->aData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sSection
|
* @param string $sSection
|
||||||
* @param string $sName
|
* @param string $sName
|
||||||
* @param mixed $mDefault = null
|
* @param mixed $mDefault = null
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function Get($sSection, $sName, $mDefault = null)
|
public function Get($sSection, $sName, $mDefault = null)
|
||||||
{
|
{
|
||||||
$mResult = $mDefault;
|
$mResult = $mDefault;
|
||||||
if (isset($this->aData[$sSection][$sName][0]))
|
if (isset($this->aData[$sSection][$sName][0]))
|
||||||
{
|
{
|
||||||
$mResult = $this->aData[$sSection][$sName][0];
|
$mResult = $this->aData[$sSection][$sName][0];
|
||||||
}
|
}
|
||||||
return $mResult;
|
return $mResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sSectionKey
|
* @param string $sSectionKey
|
||||||
* @param string $sParamKey
|
* @param string $sParamKey
|
||||||
* @param mixed $mParamValue
|
* @param mixed $mParamValue
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function Set($sSectionKey, $sParamKey, $mParamValue)
|
public function Set($sSectionKey, $sParamKey, $mParamValue)
|
||||||
{
|
{
|
||||||
if (isset($this->aData[$sSectionKey][$sParamKey][0]))
|
if (isset($this->aData[$sSectionKey][$sParamKey][0]))
|
||||||
{
|
{
|
||||||
$sType = \gettype($this->aData[$sSectionKey][$sParamKey][0]);
|
$sType = \gettype($this->aData[$sSectionKey][$sParamKey][0]);
|
||||||
switch ($sType)
|
switch ($sType)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case 'string':
|
case 'string':
|
||||||
$this->aData[$sSectionKey][$sParamKey][0] = (string) $mParamValue;
|
$this->aData[$sSectionKey][$sParamKey][0] = (string) $mParamValue;
|
||||||
break;
|
break;
|
||||||
case 'int':
|
case 'int':
|
||||||
case 'integer':
|
case 'integer':
|
||||||
$this->aData[$sSectionKey][$sParamKey][0] = (int) $mParamValue;
|
$this->aData[$sSectionKey][$sParamKey][0] = (int) $mParamValue;
|
||||||
break;
|
break;
|
||||||
case 'bool':
|
case 'bool':
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
$this->aData[$sSectionKey][$sParamKey][0] = (bool) $mParamValue;
|
$this->aData[$sSectionKey][$sParamKey][0] = (bool) $mParamValue;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ('custom' === $sSectionKey)
|
else if ('custom' === $sSectionKey)
|
||||||
{
|
{
|
||||||
$this->aData[$sSectionKey][$sParamKey] = array((string) $mParamValue);
|
$this->aData[$sSectionKey][$sParamKey] = array((string) $mParamValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function cacheKey()
|
private function cacheKey()
|
||||||
{
|
{
|
||||||
return 'config:'.\sha1($this->sFile).':';
|
return 'config:'.\sha1($this->sFile).':';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function loadDataFromCache()
|
private function loadDataFromCache()
|
||||||
{
|
{
|
||||||
if ($this->bUseApcCache)
|
if ($this->bUseApcCache)
|
||||||
{
|
{
|
||||||
$iMTime = @\filemtime($this->sFile);
|
$iMTime = @\filemtime($this->sFile);
|
||||||
if (\is_int($iMTime) && 0 < $iMTime)
|
if (\is_int($iMTime) && 0 < $iMTime)
|
||||||
{
|
{
|
||||||
$sKey = $this->cacheKey();
|
$sKey = $this->cacheKey();
|
||||||
|
|
||||||
$iTime = \apc_fetch($sKey.'time');
|
$iTime = \apc_fetch($sKey.'time');
|
||||||
if ($iTime && $iMTime === (int) $iTime)
|
if ($iTime && $iMTime === (int) $iTime)
|
||||||
{
|
{
|
||||||
$aFetchData = \apc_fetch($sKey.'data');
|
$aFetchData = \apc_fetch($sKey.'data');
|
||||||
if (\is_array($aFetchData))
|
if (\is_array($aFetchData))
|
||||||
{
|
{
|
||||||
$this->aData = $aFetchData;
|
$this->aData = $aFetchData;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function storeDataToCache()
|
private function storeDataToCache()
|
||||||
{
|
{
|
||||||
if ($this->bUseApcCache)
|
if ($this->bUseApcCache)
|
||||||
{
|
{
|
||||||
$iMTime = @\filemtime($this->sFile);
|
$iMTime = @\filemtime($this->sFile);
|
||||||
if (\is_int($iMTime) && 0 < $iMTime)
|
if (\is_int($iMTime) && 0 < $iMTime)
|
||||||
{
|
{
|
||||||
$sKey = $this->cacheKey();
|
$sKey = $this->cacheKey();
|
||||||
|
|
||||||
\apc_store($sKey.'time', $iMTime);
|
\apc_store($sKey.'time', $iMTime);
|
||||||
\apc_store($sKey.'data', $this->aData);
|
\apc_store($sKey.'data', $this->aData);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function clearCache()
|
private function clearCache()
|
||||||
{
|
{
|
||||||
if ($this->bUseApcCache)
|
if ($this->bUseApcCache)
|
||||||
{
|
{
|
||||||
$sKey = $this->cacheKey();
|
$sKey = $this->cacheKey();
|
||||||
|
|
||||||
\apc_delete($sKey.'time');
|
\apc_delete($sKey.'time');
|
||||||
\apc_delete($sKey.'data');
|
\apc_delete($sKey.'data');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function Load()
|
public function Load()
|
||||||
{
|
{
|
||||||
if (\file_exists($this->sFile) && \is_readable($this->sFile))
|
if (\file_exists($this->sFile) && \is_readable($this->sFile))
|
||||||
{
|
{
|
||||||
if ($this->loadDataFromCache())
|
if ($this->loadDataFromCache())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$aData = @\parse_ini_file($this->sFile, true);
|
$aData = @\parse_ini_file($this->sFile, true);
|
||||||
if (\is_array($aData) && 0 < count($aData))
|
if (\is_array($aData) && 0 < count($aData))
|
||||||
{
|
{
|
||||||
foreach ($aData as $sSectionKey => $aSectionValue)
|
foreach ($aData as $sSectionKey => $aSectionValue)
|
||||||
{
|
{
|
||||||
if (\is_array($aSectionValue))
|
if (\is_array($aSectionValue))
|
||||||
{
|
{
|
||||||
foreach ($aSectionValue as $sParamKey => $mParamValue)
|
foreach ($aSectionValue as $sParamKey => $mParamValue)
|
||||||
{
|
{
|
||||||
$this->Set($sSectionKey, $sParamKey, $mParamValue);
|
$this->Set($sSectionKey, $sParamKey, $mParamValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->storeDataToCache();
|
$this->storeDataToCache();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function Save()
|
public function Save()
|
||||||
{
|
{
|
||||||
if (\file_exists($this->sFile) && !\is_writable($this->sFile))
|
if (\file_exists($this->sFile) && !\is_writable($this->sFile))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sNewLine = "\n";
|
$sNewLine = "\n";
|
||||||
|
|
||||||
$aResultLines = array();
|
$aResultLines = array();
|
||||||
|
|
||||||
foreach ($this->aData as $sSectionKey => $aSectionValue)
|
foreach ($this->aData as $sSectionKey => $aSectionValue)
|
||||||
{
|
{
|
||||||
if (\is_array($aSectionValue))
|
if (\is_array($aSectionValue))
|
||||||
{
|
{
|
||||||
$aResultLines[] = '';
|
$aResultLines[] = '';
|
||||||
$aResultLines[] = '['.$sSectionKey.']';
|
$aResultLines[] = '['.$sSectionKey.']';
|
||||||
$bFirst = true;
|
$bFirst = true;
|
||||||
|
|
||||||
foreach ($aSectionValue as $sParamKey => $mParamValue)
|
foreach ($aSectionValue as $sParamKey => $mParamValue)
|
||||||
{
|
{
|
||||||
if (\is_array($mParamValue))
|
if (\is_array($mParamValue))
|
||||||
{
|
{
|
||||||
if (!empty($mParamValue[1]))
|
if (!empty($mParamValue[1]))
|
||||||
{
|
{
|
||||||
$sDesk = \str_replace("\r", '', $mParamValue[1]);
|
$sDesk = \str_replace("\r", '', $mParamValue[1]);
|
||||||
$aDesk = \explode("\n", $sDesk);
|
$aDesk = \explode("\n", $sDesk);
|
||||||
$aDesk = \array_map(function (&$sLine) {
|
$aDesk = \array_map(function (&$sLine) {
|
||||||
return '; '.$sLine;
|
return '; '.$sLine;
|
||||||
}, $aDesk);
|
}, $aDesk);
|
||||||
|
|
||||||
if (!$bFirst)
|
if (!$bFirst)
|
||||||
{
|
{
|
||||||
$aResultLines[] = '';
|
$aResultLines[] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$aResultLines[] = \implode($sNewLine, $aDesk);
|
$aResultLines[] = \implode($sNewLine, $aDesk);
|
||||||
}
|
}
|
||||||
|
|
||||||
$bFirst = false;
|
$bFirst = false;
|
||||||
|
|
||||||
$sValue = '""';
|
$sValue = '""';
|
||||||
switch (\gettype($mParamValue[0]))
|
switch (\gettype($mParamValue[0]))
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case 'string':
|
case 'string':
|
||||||
$sValue = '"'.$mParamValue[0].'"';
|
$sValue = '"'.$mParamValue[0].'"';
|
||||||
break;
|
break;
|
||||||
case 'int':
|
case 'int':
|
||||||
case 'integer':
|
case 'integer':
|
||||||
$sValue = $mParamValue[0];
|
$sValue = $mParamValue[0];
|
||||||
break;
|
break;
|
||||||
case 'bool':
|
case 'bool':
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
$sValue = $mParamValue[0] ? 'On' : 'Off';
|
$sValue = $mParamValue[0] ? 'On' : 'Off';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$aResultLines[] = $sParamKey.' = '.$sValue;
|
$aResultLines[] = $sParamKey.' = '.$sValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->clearCache();
|
$this->clearCache();
|
||||||
return false !== \file_put_contents($this->sFile,
|
return false !== \file_put_contents($this->sFile,
|
||||||
(0 < \strlen($this->sFileHeader) ? $this->sFileHeader : '').
|
(0 < \strlen($this->sFileHeader) ? $this->sFileHeader : '').
|
||||||
$sNewLine.\implode($sNewLine, $aResultLines));
|
$sNewLine.\implode($sNewLine, $aResultLines));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,59 +1,59 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace RainLoop\Config;
|
namespace RainLoop\Config;
|
||||||
|
|
||||||
class Plugin extends \RainLoop\Config\AbstractConfig
|
class Plugin extends \RainLoop\Config\AbstractConfig
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $aMap;
|
private $aMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct($sPluginName, $aMap = array())
|
public function __construct($sPluginName, $aMap = array())
|
||||||
{
|
{
|
||||||
$this->aMap = is_array($aMap) ? $this->convertConfigMap($aMap) : array();
|
$this->aMap = is_array($aMap) ? $this->convertConfigMap($aMap) : array();
|
||||||
|
|
||||||
parent::__construct('plugin-'.$sPluginName.'.ini', '; RainLoop Webmail plugin ('.$sPluginName.')');
|
parent::__construct('plugin-'.$sPluginName.'.ini', '; RainLoop Webmail plugin ('.$sPluginName.')');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $aMap
|
* @param array $aMap
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function convertConfigMap($aMap)
|
private function convertConfigMap($aMap)
|
||||||
{
|
{
|
||||||
if (0 < count($aMap))
|
if (0 < count($aMap))
|
||||||
{
|
{
|
||||||
$aResultMap = array();
|
$aResultMap = array();
|
||||||
foreach ($aMap as /* @var $oProperty \RainLoop\Plugins\Property */ $oProperty)
|
foreach ($aMap as /* @var $oProperty \RainLoop\Plugins\Property */ $oProperty)
|
||||||
{
|
{
|
||||||
if ($oProperty)
|
if ($oProperty)
|
||||||
{
|
{
|
||||||
$mValue = $oProperty->DefaultValue();
|
$mValue = $oProperty->DefaultValue();
|
||||||
$sValue = is_array($mValue) && isset($mValue[0]) ? $mValue[0] : $mValue;
|
$sValue = is_array($mValue) && isset($mValue[0]) ? $mValue[0] : $mValue;
|
||||||
$aResultMap[$oProperty->Name()] = array($sValue, '');
|
$aResultMap[$oProperty->Name()] = array($sValue, '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 < count($aResultMap))
|
if (0 < count($aResultMap))
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'plugin' => $aResultMap
|
'plugin' => $aResultMap
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function defaultValues()
|
protected function defaultValues()
|
||||||
{
|
{
|
||||||
return $this->aMap;
|
return $this->aMap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace RainLoop\Enumerations;
|
namespace RainLoop\Enumerations;
|
||||||
|
|
||||||
class PluginPropertyType
|
class PluginPropertyType
|
||||||
{
|
{
|
||||||
const STRING = 0;
|
const STRING = 0;
|
||||||
const INT = 1;
|
const INT = 1;
|
||||||
const STRING_TEXT = 2;
|
const STRING_TEXT = 2;
|
||||||
const PASSWORD = 3;
|
const PASSWORD = 3;
|
||||||
const SELECTION = 4;
|
const SELECTION = 4;
|
||||||
const BOOL = 5;
|
const BOOL = 5;
|
||||||
}
|
}
|
||||||
|
|
@ -1,338 +1,338 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace RainLoop\Plugins;
|
namespace RainLoop\Plugins;
|
||||||
|
|
||||||
abstract class AbstractPlugin
|
abstract class AbstractPlugin
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var \RainLoop\Plugins\Manager
|
* @var \RainLoop\Plugins\Manager
|
||||||
*/
|
*/
|
||||||
private $oPluginManager;
|
private $oPluginManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \RainLoop\Config\Plugin
|
* @var \RainLoop\Config\Plugin
|
||||||
*/
|
*/
|
||||||
private $oPluginConfig;
|
private $oPluginConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
private $bLangs;
|
private $bLangs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $sName;
|
private $sName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $sPath;
|
private $sPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $sVersion;
|
private $sVersion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $aConfigMap;
|
private $aConfigMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
private $bPluginConfigLoaded;
|
private $bPluginConfigLoaded;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->sName = '';
|
$this->sName = '';
|
||||||
$this->sPath = '';
|
$this->sPath = '';
|
||||||
$this->sVersion = '0.0';
|
$this->sVersion = '0.0';
|
||||||
$this->aConfigMap = null;
|
$this->aConfigMap = null;
|
||||||
|
|
||||||
$this->oPluginManager = null;
|
$this->oPluginManager = null;
|
||||||
$this->oPluginConfig = null;
|
$this->oPluginConfig = null;
|
||||||
$this->bPluginConfigLoaded = false;
|
$this->bPluginConfigLoaded = false;
|
||||||
$this->bLangs = false;
|
$this->bLangs = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \RainLoop\Config\Plugin
|
* @return \RainLoop\Config\Plugin
|
||||||
*/
|
*/
|
||||||
public function Config()
|
public function Config()
|
||||||
{
|
{
|
||||||
if (!$this->bPluginConfigLoaded && $this->oPluginConfig)
|
if (!$this->bPluginConfigLoaded && $this->oPluginConfig)
|
||||||
{
|
{
|
||||||
$this->bPluginConfigLoaded = true;
|
$this->bPluginConfigLoaded = true;
|
||||||
if ($this->oPluginConfig->IsInited())
|
if ($this->oPluginConfig->IsInited())
|
||||||
{
|
{
|
||||||
if (!$this->oPluginConfig->Load())
|
if (!$this->oPluginConfig->Load())
|
||||||
{
|
{
|
||||||
$this->oPluginConfig->Save();
|
$this->oPluginConfig->Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->oPluginConfig;
|
return $this->oPluginConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \RainLoop\Plugins\Manager
|
* @return \RainLoop\Plugins\Manager
|
||||||
*/
|
*/
|
||||||
public function Manager()
|
public function Manager()
|
||||||
{
|
{
|
||||||
return $this->oPluginManager;
|
return $this->oPluginManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function Path()
|
public function Path()
|
||||||
{
|
{
|
||||||
return $this->sPath;
|
return $this->sPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function Name()
|
public function Name()
|
||||||
{
|
{
|
||||||
return $this->sName;
|
return $this->sName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function Version()
|
public function Version()
|
||||||
{
|
{
|
||||||
return $this->sVersion;
|
return $this->sVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool | null $bLangs = null
|
* @param bool | null $bLangs = null
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function UseLangs($bLangs = null)
|
public function UseLangs($bLangs = null)
|
||||||
{
|
{
|
||||||
if (null !== $bLangs)
|
if (null !== $bLangs)
|
||||||
{
|
{
|
||||||
$this->bLangs = (bool) $bLangs;
|
$this->bLangs = (bool) $bLangs;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->bLangs;
|
return $this->bLangs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function configMapping()
|
protected function configMapping()
|
||||||
{
|
{
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function Hash()
|
public function Hash()
|
||||||
{
|
{
|
||||||
return \md5($this->sVersion);
|
return \md5($this->sVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function Supported()
|
public function Supported()
|
||||||
{
|
{
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @final
|
* @final
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
final public function ConfigMap()
|
final public function ConfigMap()
|
||||||
{
|
{
|
||||||
if (null === $this->aConfigMap)
|
if (null === $this->aConfigMap)
|
||||||
{
|
{
|
||||||
$this->aConfigMap = $this->configMapping();
|
$this->aConfigMap = $this->configMapping();
|
||||||
if (!is_array($this->aConfigMap))
|
if (!is_array($this->aConfigMap))
|
||||||
{
|
{
|
||||||
$this->aConfigMap = array();
|
$this->aConfigMap = array();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->aConfigMap;
|
return $this->aConfigMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sPath
|
* @param string $sPath
|
||||||
* @param string $sName
|
* @param string $sName
|
||||||
* @param string $sVersion = ''
|
* @param string $sVersion = ''
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function SetValues($sPath, $sName, $sVersion = '')
|
public function SetValues($sPath, $sName, $sVersion = '')
|
||||||
{
|
{
|
||||||
$this->sName = $sName;
|
$this->sName = $sName;
|
||||||
$this->sPath = $sPath;
|
$this->sPath = $sPath;
|
||||||
|
|
||||||
if (0 < \strlen($sVersion))
|
if (0 < \strlen($sVersion))
|
||||||
{
|
{
|
||||||
$this->sVersion = $sVersion;
|
$this->sVersion = $sVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \RainLoop\Plugins\Manager $oPluginManager
|
* @param \RainLoop\Plugins\Manager $oPluginManager
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function SetPluginManager(\RainLoop\Plugins\Manager $oPluginManager)
|
public function SetPluginManager(\RainLoop\Plugins\Manager $oPluginManager)
|
||||||
{
|
{
|
||||||
$this->oPluginManager = $oPluginManager;
|
$this->oPluginManager = $oPluginManager;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \RainLoop\Config\Plugin $oPluginConfig
|
* @param \RainLoop\Config\Plugin $oPluginConfig
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function SetPluginConfig(\RainLoop\Config\Plugin $oPluginConfig)
|
public function SetPluginConfig(\RainLoop\Config\Plugin $oPluginConfig)
|
||||||
{
|
{
|
||||||
$this->oPluginConfig = $oPluginConfig;
|
$this->oPluginConfig = $oPluginConfig;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function PreInit()
|
public function PreInit()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function Init()
|
public function Init()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $bAdmin
|
* @param bool $bAdmin
|
||||||
* @param bool $bAuth
|
* @param bool $bAuth
|
||||||
* @param array $aConfig
|
* @param array $aConfig
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function FilterAppDataPluginSection($bAdmin, $bAuth, &$aConfig)
|
public function FilterAppDataPluginSection($bAdmin, $bAuth, &$aConfig)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sHookName
|
* @param string $sHookName
|
||||||
* @param string $sFunctionName
|
* @param string $sFunctionName
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
protected function addHook($sHookName, $sFunctionName)
|
protected function addHook($sHookName, $sFunctionName)
|
||||||
{
|
{
|
||||||
if ($this->oPluginManager)
|
if ($this->oPluginManager)
|
||||||
{
|
{
|
||||||
$this->oPluginManager->AddHook($sHookName, array(&$this, $sFunctionName));
|
$this->oPluginManager->AddHook($sHookName, array(&$this, $sFunctionName));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sFile
|
* @param string $sFile
|
||||||
* @param bool $bAdminScope = false
|
* @param bool $bAdminScope = false
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
protected function addJs($sFile, $bAdminScope = false)
|
protected function addJs($sFile, $bAdminScope = false)
|
||||||
{
|
{
|
||||||
if ($this->oPluginManager)
|
if ($this->oPluginManager)
|
||||||
{
|
{
|
||||||
$this->oPluginManager->AddJs($this->sPath.'/'.$sFile, $bAdminScope);
|
$this->oPluginManager->AddJs($this->sPath.'/'.$sFile, $bAdminScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sFile
|
* @param string $sFile
|
||||||
* @param bool $bAdminScope = false
|
* @param bool $bAdminScope = false
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
protected function addTemplate($sFile, $bAdminScope = false)
|
protected function addTemplate($sFile, $bAdminScope = false)
|
||||||
{
|
{
|
||||||
if ($this->oPluginManager)
|
if ($this->oPluginManager)
|
||||||
{
|
{
|
||||||
$this->oPluginManager->AddTemplate($this->sPath.'/'.$sFile, $bAdminScope);
|
$this->oPluginManager->AddTemplate($this->sPath.'/'.$sFile, $bAdminScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sActionName
|
* @param string $sActionName
|
||||||
* @param string $sFunctionName
|
* @param string $sFunctionName
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
protected function addPartHook($sActionName, $sFunctionName)
|
protected function addPartHook($sActionName, $sFunctionName)
|
||||||
{
|
{
|
||||||
if ($this->oPluginManager)
|
if ($this->oPluginManager)
|
||||||
{
|
{
|
||||||
$this->oPluginManager->AddAdditionalPartAction($sActionName, array(&$this, $sFunctionName));
|
$this->oPluginManager->AddAdditionalPartAction($sActionName, array(&$this, $sFunctionName));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sActionName
|
* @param string $sActionName
|
||||||
* @param string $sFunctionName
|
* @param string $sFunctionName
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
protected function addAjaxHook($sActionName, $sFunctionName)
|
protected function addAjaxHook($sActionName, $sFunctionName)
|
||||||
{
|
{
|
||||||
if ($this->oPluginManager)
|
if ($this->oPluginManager)
|
||||||
{
|
{
|
||||||
$this->oPluginManager->AddAdditionalAjaxAction($sActionName, array(&$this, $sFunctionName));
|
$this->oPluginManager->AddAdditionalAjaxAction($sActionName, array(&$this, $sFunctionName));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sName
|
* @param string $sName
|
||||||
* @param string $sPlace
|
* @param string $sPlace
|
||||||
* @param string $sHtml
|
* @param string $sHtml
|
||||||
* @param bool $bPrepend = false
|
* @param bool $bPrepend = false
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
protected function addTemplateHook($sName, $sPlace, $sLocalTemplateName, $bPrepend = false)
|
protected function addTemplateHook($sName, $sPlace, $sLocalTemplateName, $bPrepend = false)
|
||||||
{
|
{
|
||||||
if ($this->oPluginManager)
|
if ($this->oPluginManager)
|
||||||
{
|
{
|
||||||
$this->oPluginManager->AddProcessTemplateAction($sName, $sPlace,
|
$this->oPluginManager->AddProcessTemplateAction($sName, $sPlace,
|
||||||
'<!-- ko template: \''.$sLocalTemplateName.'\' --><!-- /ko -->', $bPrepend);
|
'<!-- ko template: \''.$sLocalTemplateName.'\' --><!-- /ko -->', $bPrepend);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,73 +1,73 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace RainLoop\Plugins;
|
namespace RainLoop\Plugins;
|
||||||
|
|
||||||
class Helper
|
class Helper
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function __construct()
|
private function __construct()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sString
|
* @param string $sString
|
||||||
* @param string $sWildcardValues
|
* @param string $sWildcardValues
|
||||||
* @param string $sFoundedValue = ''
|
* @param string $sFoundedValue = ''
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static public function ValidateWildcardValues($sString, $sWildcardValues, &$sFoundedValue = '')
|
static public function ValidateWildcardValues($sString, $sWildcardValues, &$sFoundedValue = '')
|
||||||
{
|
{
|
||||||
$sFoundedValue = '';
|
$sFoundedValue = '';
|
||||||
|
|
||||||
$sString = \trim($sString);
|
$sString = \trim($sString);
|
||||||
if ('' === $sString)
|
if ('' === $sString)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sWildcardValues = \trim($sWildcardValues);
|
$sWildcardValues = \trim($sWildcardValues);
|
||||||
if ('' === $sWildcardValues)
|
if ('' === $sWildcardValues)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('*' === $sWildcardValues)
|
if ('*' === $sWildcardValues)
|
||||||
{
|
{
|
||||||
$sFoundedValue = '*';
|
$sFoundedValue = '*';
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sWildcardValues = \preg_replace('/[*]+/', '*', \preg_replace('/[\s,;]+/', ' ', $sWildcardValues));
|
$sWildcardValues = \preg_replace('/[*]+/', '*', \preg_replace('/[\s,;]+/', ' ', $sWildcardValues));
|
||||||
$aWildcardValues = \explode(' ', $sWildcardValues);
|
$aWildcardValues = \explode(' ', $sWildcardValues);
|
||||||
|
|
||||||
foreach ($aWildcardValues as $sItem)
|
foreach ($aWildcardValues as $sItem)
|
||||||
{
|
{
|
||||||
if (false === \strpos($sItem, '*'))
|
if (false === \strpos($sItem, '*'))
|
||||||
{
|
{
|
||||||
if ($sString === $sItem)
|
if ($sString === $sItem)
|
||||||
{
|
{
|
||||||
$sFoundedValue = $sItem;
|
$sFoundedValue = $sItem;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$aItem = \explode('*', $sItem);
|
$aItem = \explode('*', $sItem);
|
||||||
$aItem = \array_map(function ($sItem) {
|
$aItem = \array_map(function ($sItem) {
|
||||||
return \preg_quote($sItem, '/');
|
return \preg_quote($sItem, '/');
|
||||||
}, $aItem);
|
}, $aItem);
|
||||||
|
|
||||||
if (\preg_match('/'.\implode('.*', $aItem).'/', $sString))
|
if (\preg_match('/'.\implode('.*', $aItem).'/', $sString))
|
||||||
{
|
{
|
||||||
$sFoundedValue = $sItem;
|
$sFoundedValue = $sItem;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,205 +1,205 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace RainLoop\Plugins;
|
namespace RainLoop\Plugins;
|
||||||
|
|
||||||
class Property
|
class Property
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $sName;
|
private $sName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $sLabel;
|
private $sLabel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $sDesc;
|
private $sDesc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $iType;
|
private $iType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
private $bAllowedInJs;
|
private $bAllowedInJs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var mixed
|
* @var mixed
|
||||||
*/
|
*/
|
||||||
private $mDefaultValue;
|
private $mDefaultValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $sPlaceholder;
|
private $sPlaceholder;
|
||||||
|
|
||||||
private function __construct($sName)
|
private function __construct($sName)
|
||||||
{
|
{
|
||||||
$this->sName = $sName;
|
$this->sName = $sName;
|
||||||
$this->iType = \RainLoop\Enumerations\PluginPropertyType::STRING;
|
$this->iType = \RainLoop\Enumerations\PluginPropertyType::STRING;
|
||||||
$this->mDefaultValue = '';
|
$this->mDefaultValue = '';
|
||||||
$this->sLabel = '';
|
$this->sLabel = '';
|
||||||
$this->sDesc = '';
|
$this->sDesc = '';
|
||||||
$this->bAllowedInJs = false;
|
$this->bAllowedInJs = false;
|
||||||
$this->sPlaceholder = '';
|
$this->sPlaceholder = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sName
|
* @param string $sName
|
||||||
*
|
*
|
||||||
* @return \RainLoop\Plugins\Property
|
* @return \RainLoop\Plugins\Property
|
||||||
*/
|
*/
|
||||||
public static function NewInstance($sName)
|
public static function NewInstance($sName)
|
||||||
{
|
{
|
||||||
return new self($sName);
|
return new self($sName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $iType
|
* @param int $iType
|
||||||
*
|
*
|
||||||
* @return \RainLoop\Plugins\Property
|
* @return \RainLoop\Plugins\Property
|
||||||
*/
|
*/
|
||||||
public function SetType($iType)
|
public function SetType($iType)
|
||||||
{
|
{
|
||||||
$this->iType = (int) $iType;
|
$this->iType = (int) $iType;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $mDefaultValue
|
* @param mixed $mDefaultValue
|
||||||
*
|
*
|
||||||
* @return \RainLoop\Plugins\Property
|
* @return \RainLoop\Plugins\Property
|
||||||
*/
|
*/
|
||||||
public function SetDefaultValue($mDefaultValue)
|
public function SetDefaultValue($mDefaultValue)
|
||||||
{
|
{
|
||||||
$this->mDefaultValue = $mDefaultValue;
|
$this->mDefaultValue = $mDefaultValue;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sPlaceholder
|
* @param string $sPlaceholder
|
||||||
*
|
*
|
||||||
* @return \RainLoop\Plugins\Property
|
* @return \RainLoop\Plugins\Property
|
||||||
*/
|
*/
|
||||||
public function SetPlaceholder($sPlaceholder)
|
public function SetPlaceholder($sPlaceholder)
|
||||||
{
|
{
|
||||||
$this->sPlaceholder = $sPlaceholder;
|
$this->sPlaceholder = $sPlaceholder;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sLabel
|
* @param string $sLabel
|
||||||
*
|
*
|
||||||
* @return \RainLoop\Plugins\Property
|
* @return \RainLoop\Plugins\Property
|
||||||
*/
|
*/
|
||||||
public function SetLabel($sLabel)
|
public function SetLabel($sLabel)
|
||||||
{
|
{
|
||||||
$this->sLabel = $sLabel;
|
$this->sLabel = $sLabel;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sDesc
|
* @param string $sDesc
|
||||||
*
|
*
|
||||||
* @return \RainLoop\Plugins\Property
|
* @return \RainLoop\Plugins\Property
|
||||||
*/
|
*/
|
||||||
public function SetDescription($sDesc)
|
public function SetDescription($sDesc)
|
||||||
{
|
{
|
||||||
$this->sDesc = $sDesc;
|
$this->sDesc = $sDesc;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $bValue = true
|
* @param bool $bValue = true
|
||||||
* @return \RainLoop\Plugins\Property
|
* @return \RainLoop\Plugins\Property
|
||||||
*/
|
*/
|
||||||
public function SetAllowedInJs($bValue = true)
|
public function SetAllowedInJs($bValue = true)
|
||||||
{
|
{
|
||||||
$this->bAllowedInJs = !!$bValue;
|
$this->bAllowedInJs = !!$bValue;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function Name()
|
public function Name()
|
||||||
{
|
{
|
||||||
return $this->sName;
|
return $this->sName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function AllowedInJs()
|
public function AllowedInJs()
|
||||||
{
|
{
|
||||||
return $this->bAllowedInJs;
|
return $this->bAllowedInJs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function Description()
|
public function Description()
|
||||||
{
|
{
|
||||||
return $this->sDesc;
|
return $this->sDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function Label()
|
public function Label()
|
||||||
{
|
{
|
||||||
return $this->sLabel;
|
return $this->sLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function Type()
|
public function Type()
|
||||||
{
|
{
|
||||||
return $this->iType;
|
return $this->iType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function DefaultValue()
|
public function DefaultValue()
|
||||||
{
|
{
|
||||||
return $this->mDefaultValue;
|
return $this->mDefaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function Placeholder()
|
public function Placeholder()
|
||||||
{
|
{
|
||||||
return $this->sPlaceholder;
|
return $this->sPlaceholder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function ToArray()
|
public function ToArray()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'',
|
'',
|
||||||
$this->sName,
|
$this->sName,
|
||||||
$this->iType,
|
$this->iType,
|
||||||
$this->sLabel,
|
$this->sLabel,
|
||||||
$this->mDefaultValue,
|
$this->mDefaultValue,
|
||||||
$this->sDesc,
|
$this->sDesc,
|
||||||
$this->sPlaceholder
|
$this->sPlaceholder
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,340 +1,340 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace RainLoop\PluginsNext;
|
namespace RainLoop\PluginsNext;
|
||||||
|
|
||||||
abstract class AbstractPlugin
|
abstract class AbstractPlugin
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var \RainLoop\PluginsNext\Manager
|
* @var \RainLoop\PluginsNext\Manager
|
||||||
*/
|
*/
|
||||||
private $oPluginManager;
|
private $oPluginManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \RainLoop\Config\Plugin
|
* @var \RainLoop\Config\Plugin
|
||||||
*/
|
*/
|
||||||
private $oPluginConfig;
|
private $oPluginConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
private $bLangs;
|
private $bLangs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $sName;
|
private $sName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $sPath;
|
private $sPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $sVersion;
|
private $sVersion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $aConfigMap;
|
private $aConfigMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
private $bPluginConfigLoaded;
|
private $bPluginConfigLoaded;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->sName = '';
|
$this->sName = '';
|
||||||
$this->sPath = '';
|
$this->sPath = '';
|
||||||
$this->sVersion = '0.0';
|
$this->sVersion = '0.0';
|
||||||
$this->aConfigMap = null;
|
$this->aConfigMap = null;
|
||||||
|
|
||||||
$this->oPluginManager = null;
|
$this->oPluginManager = null;
|
||||||
$this->oPluginConfig = null;
|
$this->oPluginConfig = null;
|
||||||
$this->bPluginConfigLoaded = false;
|
$this->bPluginConfigLoaded = false;
|
||||||
$this->bLangs = false;
|
$this->bLangs = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \RainLoop\Config\Plugin
|
* @return \RainLoop\Config\Plugin
|
||||||
*/
|
*/
|
||||||
public function Config()
|
public function Config()
|
||||||
{
|
{
|
||||||
if (!$this->bPluginConfigLoaded && $this->oPluginConfig)
|
if (!$this->bPluginConfigLoaded && $this->oPluginConfig)
|
||||||
{
|
{
|
||||||
$this->bPluginConfigLoaded = true;
|
$this->bPluginConfigLoaded = true;
|
||||||
if ($this->oPluginConfig->IsInited())
|
if ($this->oPluginConfig->IsInited())
|
||||||
{
|
{
|
||||||
if (!$this->oPluginConfig->Load())
|
if (!$this->oPluginConfig->Load())
|
||||||
{
|
{
|
||||||
$this->oPluginConfig->Save();
|
$this->oPluginConfig->Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->oPluginConfig;
|
return $this->oPluginConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \RainLoop\PluginsNext\Manager
|
* @return \RainLoop\PluginsNext\Manager
|
||||||
*/
|
*/
|
||||||
public function Manager()
|
public function Manager()
|
||||||
{
|
{
|
||||||
return $this->oPluginManager;
|
return $this->oPluginManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function Path()
|
public function Path()
|
||||||
{
|
{
|
||||||
return $this->sPath;
|
return $this->sPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function Name()
|
public function Name()
|
||||||
{
|
{
|
||||||
return $this->sName;
|
return $this->sName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function Version()
|
public function Version()
|
||||||
{
|
{
|
||||||
return $this->sVersion;
|
return $this->sVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool|null $bLangs = null
|
* @param bool|null $bLangs = null
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function UseLangs($bLangs = null)
|
public function UseLangs($bLangs = null)
|
||||||
{
|
{
|
||||||
if (null !== $bLangs)
|
if (null !== $bLangs)
|
||||||
{
|
{
|
||||||
$this->bLangs = (bool) $bLangs;
|
$this->bLangs = (bool) $bLangs;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->bLangs;
|
return $this->bLangs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function configMapping()
|
protected function configMapping()
|
||||||
{
|
{
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function Hash()
|
public function Hash()
|
||||||
{
|
{
|
||||||
return \md5($this->sVersion);
|
return \md5($this->sVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function Supported()
|
public function Supported()
|
||||||
{
|
{
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @final
|
* @final
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
final public function ConfigMap()
|
final public function ConfigMap()
|
||||||
{
|
{
|
||||||
if (null === $this->aConfigMap)
|
if (null === $this->aConfigMap)
|
||||||
{
|
{
|
||||||
$this->aConfigMap = $this->configMapping();
|
$this->aConfigMap = $this->configMapping();
|
||||||
if (!\is_array($this->aConfigMap))
|
if (!\is_array($this->aConfigMap))
|
||||||
{
|
{
|
||||||
$this->aConfigMap = array();
|
$this->aConfigMap = array();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->aConfigMap;
|
return $this->aConfigMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sPath
|
* @param string $sPath
|
||||||
* @param string $sName
|
* @param string $sName
|
||||||
* @param string $sVersion = ''
|
* @param string $sVersion = ''
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function SetValues($sPath, $sName, $sVersion = '')
|
public function SetValues($sPath, $sName, $sVersion = '')
|
||||||
{
|
{
|
||||||
$this->sName = $sName;
|
$this->sName = $sName;
|
||||||
$this->sPath = $sPath;
|
$this->sPath = $sPath;
|
||||||
|
|
||||||
if (0 < \strlen($sVersion))
|
if (0 < \strlen($sVersion))
|
||||||
{
|
{
|
||||||
$this->sVersion = $sVersion;
|
$this->sVersion = $sVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \RainLoop\PluginsNext\Manager $oPluginManager
|
* @param \RainLoop\PluginsNext\Manager $oPluginManager
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function SetPluginManager(\RainLoop\PluginsNext\Manager $oPluginManager)
|
public function SetPluginManager(\RainLoop\PluginsNext\Manager $oPluginManager)
|
||||||
{
|
{
|
||||||
$this->oPluginManager = $oPluginManager;
|
$this->oPluginManager = $oPluginManager;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \RainLoop\Config\Plugin $oPluginConfig
|
* @param \RainLoop\Config\Plugin $oPluginConfig
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function SetPluginConfig(\RainLoop\Config\Plugin $oPluginConfig)
|
public function SetPluginConfig(\RainLoop\Config\Plugin $oPluginConfig)
|
||||||
{
|
{
|
||||||
$this->oPluginConfig = $oPluginConfig;
|
$this->oPluginConfig = $oPluginConfig;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function Init()
|
public function Init()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sStep
|
* @param string $sStep
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function InitStep($sStep)
|
public function InitStep($sStep)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $bAdmin
|
* @param bool $bAdmin
|
||||||
* @param bool $bAuth
|
* @param bool $bAuth
|
||||||
* @param array $aConfig
|
* @param array $aConfig
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function FilterAppDataPluginSection($bAdmin, $bAuth, &$aConfig)
|
public function FilterAppDataPluginSection($bAdmin, $bAuth, &$aConfig)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sHookName
|
* @param string $sHookName
|
||||||
* @param string $sFunctionName
|
* @param string $sFunctionName
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
protected function addHook($sHookName, $sFunctionName)
|
protected function addHook($sHookName, $sFunctionName)
|
||||||
{
|
{
|
||||||
if ($this->oPluginManager)
|
if ($this->oPluginManager)
|
||||||
{
|
{
|
||||||
$this->oPluginManager->AddHook($sHookName, array(&$this, $sFunctionName));
|
$this->oPluginManager->AddHook($sHookName, array(&$this, $sFunctionName));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sFile
|
* @param string $sFile
|
||||||
* @param bool $bAdminScope = false
|
* @param bool $bAdminScope = false
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
protected function addJs($sFile, $bAdminScope = false)
|
protected function addJs($sFile, $bAdminScope = false)
|
||||||
{
|
{
|
||||||
if ($this->oPluginManager)
|
if ($this->oPluginManager)
|
||||||
{
|
{
|
||||||
$this->oPluginManager->AddJs($this->sPath.'/'.$sFile, $bAdminScope);
|
$this->oPluginManager->AddJs($this->sPath.'/'.$sFile, $bAdminScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sFile
|
* @param string $sFile
|
||||||
* @param bool $bAdminScope = false
|
* @param bool $bAdminScope = false
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
protected function addTemplate($sFile, $bAdminScope = false)
|
protected function addTemplate($sFile, $bAdminScope = false)
|
||||||
{
|
{
|
||||||
if ($this->oPluginManager)
|
if ($this->oPluginManager)
|
||||||
{
|
{
|
||||||
$this->oPluginManager->AddTemplate($this->sPath.'/'.$sFile, $bAdminScope);
|
$this->oPluginManager->AddTemplate($this->sPath.'/'.$sFile, $bAdminScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sActionName
|
* @param string $sActionName
|
||||||
* @param string $sFunctionName
|
* @param string $sFunctionName
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
protected function addPartHook($sActionName, $sFunctionName)
|
protected function addPartHook($sActionName, $sFunctionName)
|
||||||
{
|
{
|
||||||
if ($this->oPluginManager)
|
if ($this->oPluginManager)
|
||||||
{
|
{
|
||||||
$this->oPluginManager->AddAdditionalPartAction($sActionName, array(&$this, $sFunctionName));
|
$this->oPluginManager->AddAdditionalPartAction($sActionName, array(&$this, $sFunctionName));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sActionName
|
* @param string $sActionName
|
||||||
* @param string $sFunctionName
|
* @param string $sFunctionName
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
protected function addAjaxHook($sActionName, $sFunctionName)
|
protected function addAjaxHook($sActionName, $sFunctionName)
|
||||||
{
|
{
|
||||||
if ($this->oPluginManager)
|
if ($this->oPluginManager)
|
||||||
{
|
{
|
||||||
$this->oPluginManager->AddAdditionalAjaxAction($sActionName, array(&$this, $sFunctionName));
|
$this->oPluginManager->AddAdditionalAjaxAction($sActionName, array(&$this, $sFunctionName));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sName
|
* @param string $sName
|
||||||
* @param string $sPlace
|
* @param string $sPlace
|
||||||
* @param string $sLocalTemplateName
|
* @param string $sLocalTemplateName
|
||||||
* @param bool $bPrepend = false
|
* @param bool $bPrepend = false
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
protected function addTemplateHook($sName, $sPlace, $sLocalTemplateName, $bPrepend = false)
|
protected function addTemplateHook($sName, $sPlace, $sLocalTemplateName, $bPrepend = false)
|
||||||
{
|
{
|
||||||
if ($this->oPluginManager)
|
if ($this->oPluginManager)
|
||||||
{
|
{
|
||||||
$this->oPluginManager->AddProcessTemplateAction($sName, $sPlace,
|
$this->oPluginManager->AddProcessTemplateAction($sName, $sPlace,
|
||||||
'<!-- ko template: \''.$sLocalTemplateName.'\' --><!-- /ko -->', $bPrepend);
|
'<!-- ko template: \''.$sLocalTemplateName.'\' --><!-- /ko -->', $bPrepend);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,179 +1,179 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace RainLoop\PluginsNext;
|
namespace RainLoop\PluginsNext;
|
||||||
|
|
||||||
class Property
|
class Property
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $sName;
|
private $sName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $sLabel;
|
private $sLabel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $sDesc;
|
private $sDesc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $iType;
|
private $iType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
private $bAllowedInJs;
|
private $bAllowedInJs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var mixed
|
* @var mixed
|
||||||
*/
|
*/
|
||||||
private $mDefaultValue;
|
private $mDefaultValue;
|
||||||
|
|
||||||
private function __construct($sName)
|
private function __construct($sName)
|
||||||
{
|
{
|
||||||
$this->sName = $sName;
|
$this->sName = $sName;
|
||||||
$this->iType = \RainLoop\Enumerations\PluginPropertyType::STRING;
|
$this->iType = \RainLoop\Enumerations\PluginPropertyType::STRING;
|
||||||
$this->mDefaultValue = '';
|
$this->mDefaultValue = '';
|
||||||
$this->sLabel = '';
|
$this->sLabel = '';
|
||||||
$this->sDesc = '';
|
$this->sDesc = '';
|
||||||
$this->bAllowedInJs = false;
|
$this->bAllowedInJs = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sName
|
* @param string $sName
|
||||||
*
|
*
|
||||||
* @return \RainLoop\PluginsNext\Property
|
* @return \RainLoop\PluginsNext\Property
|
||||||
*/
|
*/
|
||||||
public static function NewInstance($sName)
|
public static function NewInstance($sName)
|
||||||
{
|
{
|
||||||
return new self($sName);
|
return new self($sName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $iType
|
* @param int $iType
|
||||||
*
|
*
|
||||||
* @return \RainLoop\PluginsNext\Property
|
* @return \RainLoop\PluginsNext\Property
|
||||||
*/
|
*/
|
||||||
public function SetType($iType)
|
public function SetType($iType)
|
||||||
{
|
{
|
||||||
$this->iType = (int) $iType;
|
$this->iType = (int) $iType;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $mDefaultValue
|
* @param mixed $mDefaultValue
|
||||||
*
|
*
|
||||||
* @return \RainLoop\PluginsNext\Property
|
* @return \RainLoop\PluginsNext\Property
|
||||||
*/
|
*/
|
||||||
public function SetDefaultValue($mDefaultValue)
|
public function SetDefaultValue($mDefaultValue)
|
||||||
{
|
{
|
||||||
$this->mDefaultValue = $mDefaultValue;
|
$this->mDefaultValue = $mDefaultValue;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sLabel
|
* @param string $sLabel
|
||||||
*
|
*
|
||||||
* @return \RainLoop\PluginsNext\Property
|
* @return \RainLoop\PluginsNext\Property
|
||||||
*/
|
*/
|
||||||
public function SetLabel($sLabel)
|
public function SetLabel($sLabel)
|
||||||
{
|
{
|
||||||
$this->sLabel = $sLabel;
|
$this->sLabel = $sLabel;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sDesc
|
* @param string $sDesc
|
||||||
*
|
*
|
||||||
* @return \RainLoop\PluginsNext\Property
|
* @return \RainLoop\PluginsNext\Property
|
||||||
*/
|
*/
|
||||||
public function SetDescription($sDesc)
|
public function SetDescription($sDesc)
|
||||||
{
|
{
|
||||||
$this->sDesc = $sDesc;
|
$this->sDesc = $sDesc;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $bValue = true
|
* @param bool $bValue = true
|
||||||
*
|
*
|
||||||
* @return \RainLoop\PluginsNext\Property
|
* @return \RainLoop\PluginsNext\Property
|
||||||
*/
|
*/
|
||||||
public function SetAllowedInJs($bValue = true)
|
public function SetAllowedInJs($bValue = true)
|
||||||
{
|
{
|
||||||
$this->bAllowedInJs = !!$bValue;
|
$this->bAllowedInJs = !!$bValue;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function Name()
|
public function Name()
|
||||||
{
|
{
|
||||||
return $this->sName;
|
return $this->sName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function AllowedInJs()
|
public function AllowedInJs()
|
||||||
{
|
{
|
||||||
return $this->bAllowedInJs;
|
return $this->bAllowedInJs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function Description()
|
public function Description()
|
||||||
{
|
{
|
||||||
return $this->sDesc;
|
return $this->sDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function Label()
|
public function Label()
|
||||||
{
|
{
|
||||||
return $this->sLabel;
|
return $this->sLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function Type()
|
public function Type()
|
||||||
{
|
{
|
||||||
return $this->iType;
|
return $this->iType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function DefaultValue()
|
public function DefaultValue()
|
||||||
{
|
{
|
||||||
return $this->mDefaultValue;
|
return $this->mDefaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function ToArray()
|
public function ToArray()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'',
|
'',
|
||||||
$this->sName,
|
$this->sName,
|
||||||
$this->iType,
|
$this->iType,
|
||||||
$this->sLabel,
|
$this->sLabel,
|
||||||
$this->mDefaultValue,
|
$this->mDefaultValue,
|
||||||
$this->sDesc
|
$this->sDesc
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,22 +1,22 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace RainLoop\Providers\ChangePassword;
|
namespace RainLoop\Providers\ChangePassword;
|
||||||
|
|
||||||
interface ChangePasswordInterface
|
interface ChangePasswordInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param \RainLoop\Account $oAccount
|
* @param \RainLoop\Account $oAccount
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function PasswordChangePossibility($oAccount);
|
public function PasswordChangePossibility($oAccount);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \RainLoop\Account $oAccount
|
* @param \RainLoop\Account $oAccount
|
||||||
* @param string $sPrevPassword
|
* @param string $sPrevPassword
|
||||||
* @param string $sNewPassword
|
* @param string $sNewPassword
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword);
|
public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword);
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace RainLoop\Providers\Domain;
|
namespace RainLoop\Providers\Domain;
|
||||||
|
|
||||||
interface DomainInterface
|
interface DomainInterface
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -1,28 +1,28 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace RainLoop\Providers\Settings;
|
namespace RainLoop\Providers\Settings;
|
||||||
|
|
||||||
interface SettingsInterface
|
interface SettingsInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param \RainLoop\Account $oAccount
|
* @param \RainLoop\Account $oAccount
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function Load(\RainLoop\Account $oAccount);
|
public function Load(\RainLoop\Account $oAccount);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \RainLoop\Account $oAccount
|
* @param \RainLoop\Account $oAccount
|
||||||
* @param array $aSettings
|
* @param array $aSettings
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function Save(\RainLoop\Account $oAccount, array $aSettings);
|
public function Save(\RainLoop\Account $oAccount, array $aSettings);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sEmail
|
* @param string $sEmail
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function ClearByEmail($sEmail);
|
public function ClearByEmail($sEmail);
|
||||||
}
|
}
|
||||||
|
|
@ -1,40 +1,40 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace RainLoop\Providers;
|
namespace RainLoop\Providers;
|
||||||
|
|
||||||
class Suggestions extends \RainLoop\Providers\AbstractProvider
|
class Suggestions extends \RainLoop\Providers\AbstractProvider
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var \RainLoop\Providers\Suggestions\SuggestionsInterface
|
* @var \RainLoop\Providers\Suggestions\SuggestionsInterface
|
||||||
*/
|
*/
|
||||||
private $oDriver;
|
private $oDriver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \RainLoop\Providers\Suggestions\SuggestionsInterface|null $oDriver = null
|
* @param \RainLoop\Providers\Suggestions\SuggestionsInterface|null $oDriver = null
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct($oDriver = null)
|
public function __construct($oDriver = null)
|
||||||
{
|
{
|
||||||
$this->oDriver = $oDriver;
|
$this->oDriver = $oDriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \RainLoop\Account $oAccount
|
* @param \RainLoop\Account $oAccount
|
||||||
* @param string $sQuery
|
* @param string $sQuery
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function Process(\RainLoop\Account $oAccount, $sQuery)
|
public function Process(\RainLoop\Account $oAccount, $sQuery)
|
||||||
{
|
{
|
||||||
return $this->oDriver && $this->IsActive() && 0 < \strlen($sQuery) ? $this->oDriver->Process($oAccount, $sQuery) : array();
|
return $this->oDriver && $this->IsActive() && 0 < \strlen($sQuery) ? $this->oDriver->Process($oAccount, $sQuery) : array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function IsActive()
|
public function IsActive()
|
||||||
{
|
{
|
||||||
return $this->oDriver instanceof \RainLoop\Providers\Suggestions\SuggestionsInterface;
|
return $this->oDriver instanceof \RainLoop\Providers\Suggestions\SuggestionsInterface;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace RainLoop\Providers\Suggestions;
|
namespace RainLoop\Providers\Suggestions;
|
||||||
|
|
||||||
interface SuggestionsInterface
|
interface SuggestionsInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param \RainLoop\Account $oAccount
|
* @param \RainLoop\Account $oAccount
|
||||||
* @param string $sQuery
|
* @param string $sQuery
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function Process(\RainLoop\Account $oAccount, $sQuery);
|
public function Process(\RainLoop\Account $oAccount, $sQuery);
|
||||||
}
|
}
|
||||||
|
|
@ -1,24 +1,24 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace RainLoop\Providers\TwoFactorAuth;
|
namespace RainLoop\Providers\TwoFactorAuth;
|
||||||
|
|
||||||
abstract class AbstractTwoFactorAuth
|
abstract class AbstractTwoFactorAuth
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function Label()
|
public function Label()
|
||||||
{
|
{
|
||||||
return 'Two Factor Authenticator Code';
|
return 'Two Factor Authenticator Code';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sSecret
|
* @param string $sSecret
|
||||||
* @param string $sCode
|
* @param string $sCode
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function VerifyCode($sSecret, $sCode)
|
public function VerifyCode($sSecret, $sCode)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,64 +1,64 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace RainLoop;
|
namespace RainLoop;
|
||||||
|
|
||||||
class Settings
|
class Settings
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $aData;
|
protected $aData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->aData = array();
|
$this->aData = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $aData
|
* @param array $aData
|
||||||
*
|
*
|
||||||
* @return \RainLoop\Settings
|
* @return \RainLoop\Settings
|
||||||
*/
|
*/
|
||||||
public function InitData($aData)
|
public function InitData($aData)
|
||||||
{
|
{
|
||||||
if (\is_array($aData))
|
if (\is_array($aData))
|
||||||
{
|
{
|
||||||
$this->aData = $aData;
|
$this->aData = $aData;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function DataAsArray()
|
public function DataAsArray()
|
||||||
{
|
{
|
||||||
return $this->aData;
|
return $this->aData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sName
|
* @param string $sName
|
||||||
* @param mixed $mDefValue = null
|
* @param mixed $mDefValue = null
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function GetConf($sName, $mDefValue = null)
|
public function GetConf($sName, $mDefValue = null)
|
||||||
{
|
{
|
||||||
return isset($this->aData[$sName]) ? $this->aData[$sName] : $mDefValue;
|
return isset($this->aData[$sName]) ? $this->aData[$sName] : $mDefValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sName
|
* @param string $sName
|
||||||
* @param mixed $mValue
|
* @param mixed $mValue
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function SetConf($sName, $mValue)
|
public function SetConf($sName, $mValue)
|
||||||
{
|
{
|
||||||
$this->aData[$sName] = $mValue;
|
$this->aData[$sName] = $mValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
<br />
|
<br />
|
||||||
<div class="form-horizontal">
|
<div class="form-horizontal">
|
||||||
<div class="legend">
|
<div class="legend">
|
||||||
Change Admin Password
|
Admin Panel Access Credentials
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label">
|
<label class="control-label">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue