Move RainLoop core files to new folder

This commit is contained in:
RainLoop Team 2014-10-18 16:52:51 +04:00
parent 3a9bc849c9
commit 345e7c58af
69 changed files with 1695 additions and 1694 deletions

View file

@ -2,19 +2,20 @@
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'));
/**
* @param string $sClassName
*
*
* @return mixed
*/
function RainLoopSplAutoloadRegisterFunction($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, '\\'))
{

View file

@ -1,290 +1,290 @@
<?php
namespace RainLoop\Config;
abstract class AbstractConfig
{
/**
* @var string
*/
private $sFile;
/**
* @var array
*/
private $aData;
/**
* @var bool
*/
private $bUseApcCache;
/**
* @var string
*/
private $sFileHeader;
/**
* @param string $sFileName
* @param string $sFileHeader = ''
*
* @return void
*/
public function __construct($sFileName, $sFileHeader = '')
{
$this->sFile = \APP_PRIVATE_DATA.'configs/'.$sFileName;
$this->sFileHeader = $sFileHeader;
$this->aData = $this->defaultValues();
$this->bUseApcCache = APP_USE_APC_CACHE &&
\MailSo\Base\Utils::FunctionExistsAndEnabled(array('apc_fetch', 'apc_store'));
}
/**
* @return array
*/
protected abstract function defaultValues();
/**
* @return bool
*/
public function IsInited()
{
return \is_array($this->aData) && 0 < \count($this->aData);
}
/**
* @param string $sSection
* @param string $sName
* @param mixed $mDefault = null
*
* @return mixed
*/
public function Get($sSection, $sName, $mDefault = null)
{
$mResult = $mDefault;
if (isset($this->aData[$sSection][$sName][0]))
{
$mResult = $this->aData[$sSection][$sName][0];
}
return $mResult;
}
/**
* @param string $sSectionKey
* @param string $sParamKey
* @param mixed $mParamValue
*
* @return void
*/
public function Set($sSectionKey, $sParamKey, $mParamValue)
{
if (isset($this->aData[$sSectionKey][$sParamKey][0]))
{
$sType = \gettype($this->aData[$sSectionKey][$sParamKey][0]);
switch ($sType)
{
default:
case 'string':
$this->aData[$sSectionKey][$sParamKey][0] = (string) $mParamValue;
break;
case 'int':
case 'integer':
$this->aData[$sSectionKey][$sParamKey][0] = (int) $mParamValue;
break;
case 'bool':
case 'boolean':
$this->aData[$sSectionKey][$sParamKey][0] = (bool) $mParamValue;
break;
}
}
else if ('custom' === $sSectionKey)
{
$this->aData[$sSectionKey][$sParamKey] = array((string) $mParamValue);
}
}
/**
* @return string
*/
private function cacheKey()
{
return 'config:'.\sha1($this->sFile).':';
}
/**
* @return bool
*/
private function loadDataFromCache()
{
if ($this->bUseApcCache)
{
$iMTime = @\filemtime($this->sFile);
if (\is_int($iMTime) && 0 < $iMTime)
{
$sKey = $this->cacheKey();
$iTime = \apc_fetch($sKey.'time');
if ($iTime && $iMTime === (int) $iTime)
{
$aFetchData = \apc_fetch($sKey.'data');
if (\is_array($aFetchData))
{
$this->aData = $aFetchData;
return true;
}
}
}
}
return false;
}
/**
* @return bool
*/
private function storeDataToCache()
{
if ($this->bUseApcCache)
{
$iMTime = @\filemtime($this->sFile);
if (\is_int($iMTime) && 0 < $iMTime)
{
$sKey = $this->cacheKey();
\apc_store($sKey.'time', $iMTime);
\apc_store($sKey.'data', $this->aData);
return true;
}
}
return false;
}
/**
* @return bool
*/
private function clearCache()
{
if ($this->bUseApcCache)
{
$sKey = $this->cacheKey();
\apc_delete($sKey.'time');
\apc_delete($sKey.'data');
return true;
}
return false;
}
/**
* @return bool
*/
public function Load()
{
if (\file_exists($this->sFile) && \is_readable($this->sFile))
{
if ($this->loadDataFromCache())
{
return true;
}
$aData = @\parse_ini_file($this->sFile, true);
if (\is_array($aData) && 0 < count($aData))
{
foreach ($aData as $sSectionKey => $aSectionValue)
{
if (\is_array($aSectionValue))
{
foreach ($aSectionValue as $sParamKey => $mParamValue)
{
$this->Set($sSectionKey, $sParamKey, $mParamValue);
}
}
}
$this->storeDataToCache();
return true;
}
}
return false;
}
/**
* @return bool
*/
public function Save()
{
if (\file_exists($this->sFile) && !\is_writable($this->sFile))
{
return false;
}
$sNewLine = "\n";
$aResultLines = array();
foreach ($this->aData as $sSectionKey => $aSectionValue)
{
if (\is_array($aSectionValue))
{
$aResultLines[] = '';
$aResultLines[] = '['.$sSectionKey.']';
$bFirst = true;
foreach ($aSectionValue as $sParamKey => $mParamValue)
{
if (\is_array($mParamValue))
{
if (!empty($mParamValue[1]))
{
$sDesk = \str_replace("\r", '', $mParamValue[1]);
$aDesk = \explode("\n", $sDesk);
$aDesk = \array_map(function (&$sLine) {
return '; '.$sLine;
}, $aDesk);
if (!$bFirst)
{
$aResultLines[] = '';
}
$aResultLines[] = \implode($sNewLine, $aDesk);
}
$bFirst = false;
$sValue = '""';
switch (\gettype($mParamValue[0]))
{
default:
case 'string':
$sValue = '"'.$mParamValue[0].'"';
break;
case 'int':
case 'integer':
$sValue = $mParamValue[0];
break;
case 'bool':
case 'boolean':
$sValue = $mParamValue[0] ? 'On' : 'Off';
break;
}
$aResultLines[] = $sParamKey.' = '.$sValue;
}
}
}
}
$this->clearCache();
return false !== \file_put_contents($this->sFile,
(0 < \strlen($this->sFileHeader) ? $this->sFileHeader : '').
$sNewLine.\implode($sNewLine, $aResultLines));
}
}
<?php
namespace RainLoop\Config;
abstract class AbstractConfig
{
/**
* @var string
*/
private $sFile;
/**
* @var array
*/
private $aData;
/**
* @var bool
*/
private $bUseApcCache;
/**
* @var string
*/
private $sFileHeader;
/**
* @param string $sFileName
* @param string $sFileHeader = ''
*
* @return void
*/
public function __construct($sFileName, $sFileHeader = '')
{
$this->sFile = \APP_PRIVATE_DATA.'configs/'.$sFileName;
$this->sFileHeader = $sFileHeader;
$this->aData = $this->defaultValues();
$this->bUseApcCache = APP_USE_APC_CACHE &&
\MailSo\Base\Utils::FunctionExistsAndEnabled(array('apc_fetch', 'apc_store'));
}
/**
* @return array
*/
protected abstract function defaultValues();
/**
* @return bool
*/
public function IsInited()
{
return \is_array($this->aData) && 0 < \count($this->aData);
}
/**
* @param string $sSection
* @param string $sName
* @param mixed $mDefault = null
*
* @return mixed
*/
public function Get($sSection, $sName, $mDefault = null)
{
$mResult = $mDefault;
if (isset($this->aData[$sSection][$sName][0]))
{
$mResult = $this->aData[$sSection][$sName][0];
}
return $mResult;
}
/**
* @param string $sSectionKey
* @param string $sParamKey
* @param mixed $mParamValue
*
* @return void
*/
public function Set($sSectionKey, $sParamKey, $mParamValue)
{
if (isset($this->aData[$sSectionKey][$sParamKey][0]))
{
$sType = \gettype($this->aData[$sSectionKey][$sParamKey][0]);
switch ($sType)
{
default:
case 'string':
$this->aData[$sSectionKey][$sParamKey][0] = (string) $mParamValue;
break;
case 'int':
case 'integer':
$this->aData[$sSectionKey][$sParamKey][0] = (int) $mParamValue;
break;
case 'bool':
case 'boolean':
$this->aData[$sSectionKey][$sParamKey][0] = (bool) $mParamValue;
break;
}
}
else if ('custom' === $sSectionKey)
{
$this->aData[$sSectionKey][$sParamKey] = array((string) $mParamValue);
}
}
/**
* @return string
*/
private function cacheKey()
{
return 'config:'.\sha1($this->sFile).':';
}
/**
* @return bool
*/
private function loadDataFromCache()
{
if ($this->bUseApcCache)
{
$iMTime = @\filemtime($this->sFile);
if (\is_int($iMTime) && 0 < $iMTime)
{
$sKey = $this->cacheKey();
$iTime = \apc_fetch($sKey.'time');
if ($iTime && $iMTime === (int) $iTime)
{
$aFetchData = \apc_fetch($sKey.'data');
if (\is_array($aFetchData))
{
$this->aData = $aFetchData;
return true;
}
}
}
}
return false;
}
/**
* @return bool
*/
private function storeDataToCache()
{
if ($this->bUseApcCache)
{
$iMTime = @\filemtime($this->sFile);
if (\is_int($iMTime) && 0 < $iMTime)
{
$sKey = $this->cacheKey();
\apc_store($sKey.'time', $iMTime);
\apc_store($sKey.'data', $this->aData);
return true;
}
}
return false;
}
/**
* @return bool
*/
private function clearCache()
{
if ($this->bUseApcCache)
{
$sKey = $this->cacheKey();
\apc_delete($sKey.'time');
\apc_delete($sKey.'data');
return true;
}
return false;
}
/**
* @return bool
*/
public function Load()
{
if (\file_exists($this->sFile) && \is_readable($this->sFile))
{
if ($this->loadDataFromCache())
{
return true;
}
$aData = @\parse_ini_file($this->sFile, true);
if (\is_array($aData) && 0 < count($aData))
{
foreach ($aData as $sSectionKey => $aSectionValue)
{
if (\is_array($aSectionValue))
{
foreach ($aSectionValue as $sParamKey => $mParamValue)
{
$this->Set($sSectionKey, $sParamKey, $mParamValue);
}
}
}
$this->storeDataToCache();
return true;
}
}
return false;
}
/**
* @return bool
*/
public function Save()
{
if (\file_exists($this->sFile) && !\is_writable($this->sFile))
{
return false;
}
$sNewLine = "\n";
$aResultLines = array();
foreach ($this->aData as $sSectionKey => $aSectionValue)
{
if (\is_array($aSectionValue))
{
$aResultLines[] = '';
$aResultLines[] = '['.$sSectionKey.']';
$bFirst = true;
foreach ($aSectionValue as $sParamKey => $mParamValue)
{
if (\is_array($mParamValue))
{
if (!empty($mParamValue[1]))
{
$sDesk = \str_replace("\r", '', $mParamValue[1]);
$aDesk = \explode("\n", $sDesk);
$aDesk = \array_map(function (&$sLine) {
return '; '.$sLine;
}, $aDesk);
if (!$bFirst)
{
$aResultLines[] = '';
}
$aResultLines[] = \implode($sNewLine, $aDesk);
}
$bFirst = false;
$sValue = '""';
switch (\gettype($mParamValue[0]))
{
default:
case 'string':
$sValue = '"'.$mParamValue[0].'"';
break;
case 'int':
case 'integer':
$sValue = $mParamValue[0];
break;
case 'bool':
case 'boolean':
$sValue = $mParamValue[0] ? 'On' : 'Off';
break;
}
$aResultLines[] = $sParamKey.' = '.$sValue;
}
}
}
}
$this->clearCache();
return false !== \file_put_contents($this->sFile,
(0 < \strlen($this->sFileHeader) ? $this->sFileHeader : '').
$sNewLine.\implode($sNewLine, $aResultLines));
}
}

View file

@ -1,59 +1,59 @@
<?php
namespace RainLoop\Config;
class Plugin extends \RainLoop\Config\AbstractConfig
{
/**
* @var array
*/
private $aMap;
/**
* @return void
*/
public function __construct($sPluginName, $aMap = array())
{
$this->aMap = is_array($aMap) ? $this->convertConfigMap($aMap) : array();
parent::__construct('plugin-'.$sPluginName.'.ini', '; RainLoop Webmail plugin ('.$sPluginName.')');
}
/**
* @param array $aMap
* @return array
*/
private function convertConfigMap($aMap)
{
if (0 < count($aMap))
{
$aResultMap = array();
foreach ($aMap as /* @var $oProperty \RainLoop\Plugins\Property */ $oProperty)
{
if ($oProperty)
{
$mValue = $oProperty->DefaultValue();
$sValue = is_array($mValue) && isset($mValue[0]) ? $mValue[0] : $mValue;
$aResultMap[$oProperty->Name()] = array($sValue, '');
}
}
if (0 < count($aResultMap))
{
return array(
'plugin' => $aResultMap
);
}
}
return array();
}
/**
* @return array
*/
protected function defaultValues()
{
return $this->aMap;
}
<?php
namespace RainLoop\Config;
class Plugin extends \RainLoop\Config\AbstractConfig
{
/**
* @var array
*/
private $aMap;
/**
* @return void
*/
public function __construct($sPluginName, $aMap = array())
{
$this->aMap = is_array($aMap) ? $this->convertConfigMap($aMap) : array();
parent::__construct('plugin-'.$sPluginName.'.ini', '; RainLoop Webmail plugin ('.$sPluginName.')');
}
/**
* @param array $aMap
* @return array
*/
private function convertConfigMap($aMap)
{
if (0 < count($aMap))
{
$aResultMap = array();
foreach ($aMap as /* @var $oProperty \RainLoop\Plugins\Property */ $oProperty)
{
if ($oProperty)
{
$mValue = $oProperty->DefaultValue();
$sValue = is_array($mValue) && isset($mValue[0]) ? $mValue[0] : $mValue;
$aResultMap[$oProperty->Name()] = array($sValue, '');
}
}
if (0 < count($aResultMap))
{
return array(
'plugin' => $aResultMap
);
}
}
return array();
}
/**
* @return array
*/
protected function defaultValues()
{
return $this->aMap;
}
}

View file

@ -1,13 +1,13 @@
<?php
namespace RainLoop\Enumerations;
class PluginPropertyType
{
const STRING = 0;
const INT = 1;
const STRING_TEXT = 2;
const PASSWORD = 3;
const SELECTION = 4;
const BOOL = 5;
}
<?php
namespace RainLoop\Enumerations;
class PluginPropertyType
{
const STRING = 0;
const INT = 1;
const STRING_TEXT = 2;
const PASSWORD = 3;
const SELECTION = 4;
const BOOL = 5;
}

View file

@ -1,338 +1,338 @@
<?php
namespace RainLoop\Plugins;
abstract class AbstractPlugin
{
/**
* @var \RainLoop\Plugins\Manager
*/
private $oPluginManager;
/**
* @var \RainLoop\Config\Plugin
*/
private $oPluginConfig;
/**
* @var bool
*/
private $bLangs;
/**
* @var string
*/
private $sName;
/**
* @var string
*/
private $sPath;
/**
* @var string
*/
private $sVersion;
/**
* @var array
*/
private $aConfigMap;
/**
* @var bool
*/
private $bPluginConfigLoaded;
public function __construct()
{
$this->sName = '';
$this->sPath = '';
$this->sVersion = '0.0';
$this->aConfigMap = null;
$this->oPluginManager = null;
$this->oPluginConfig = null;
$this->bPluginConfigLoaded = false;
$this->bLangs = false;
}
/**
* @return \RainLoop\Config\Plugin
*/
public function Config()
{
if (!$this->bPluginConfigLoaded && $this->oPluginConfig)
{
$this->bPluginConfigLoaded = true;
if ($this->oPluginConfig->IsInited())
{
if (!$this->oPluginConfig->Load())
{
$this->oPluginConfig->Save();
}
}
}
return $this->oPluginConfig;
}
/**
* @return \RainLoop\Plugins\Manager
*/
public function Manager()
{
return $this->oPluginManager;
}
/**
* @return string
*/
public function Path()
{
return $this->sPath;
}
/**
* @return string
*/
public function Name()
{
return $this->sName;
}
/**
* @return string
*/
public function Version()
{
return $this->sVersion;
}
/**
* @param bool | null $bLangs = null
* @return bool
*/
public function UseLangs($bLangs = null)
{
if (null !== $bLangs)
{
$this->bLangs = (bool) $bLangs;
}
return $this->bLangs;
}
/**
* @return array
*/
protected function configMapping()
{
return array();
}
/**
* @return string
*/
public function Hash()
{
return \md5($this->sVersion);
}
/**
* @return string
*/
public function Supported()
{
return '';
}
/**
* @final
* @return array
*/
final public function ConfigMap()
{
if (null === $this->aConfigMap)
{
$this->aConfigMap = $this->configMapping();
if (!is_array($this->aConfigMap))
{
$this->aConfigMap = array();
}
}
return $this->aConfigMap;
}
/**
* @param string $sPath
* @param string $sName
* @param string $sVersion = ''
*
* @return self
*/
public function SetValues($sPath, $sName, $sVersion = '')
{
$this->sName = $sName;
$this->sPath = $sPath;
if (0 < \strlen($sVersion))
{
$this->sVersion = $sVersion;
}
return $this;
}
/**
* @param \RainLoop\Plugins\Manager $oPluginManager
*
* @return self
*/
public function SetPluginManager(\RainLoop\Plugins\Manager $oPluginManager)
{
$this->oPluginManager = $oPluginManager;
return $this;
}
/**
* @param \RainLoop\Config\Plugin $oPluginConfig
*
* @return self
*/
public function SetPluginConfig(\RainLoop\Config\Plugin $oPluginConfig)
{
$this->oPluginConfig = $oPluginConfig;
return $this;
}
/**
* @return void
*/
public function PreInit()
{
}
/**
* @return void
*/
public function Init()
{
}
/**
* @param bool $bAdmin
* @param bool $bAuth
* @param array $aConfig
*
* @return void
*/
public function FilterAppDataPluginSection($bAdmin, $bAuth, &$aConfig)
{
}
/**
* @param string $sHookName
* @param string $sFunctionName
*
* @return self
*/
protected function addHook($sHookName, $sFunctionName)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddHook($sHookName, array(&$this, $sFunctionName));
}
return $this;
}
/**
* @param string $sFile
* @param bool $bAdminScope = false
*
* @return self
*/
protected function addJs($sFile, $bAdminScope = false)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddJs($this->sPath.'/'.$sFile, $bAdminScope);
}
return $this;
}
/**
* @param string $sFile
* @param bool $bAdminScope = false
*
* @return self
*/
protected function addTemplate($sFile, $bAdminScope = false)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddTemplate($this->sPath.'/'.$sFile, $bAdminScope);
}
return $this;
}
/**
* @param string $sActionName
* @param string $sFunctionName
*
* @return self
*/
protected function addPartHook($sActionName, $sFunctionName)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddAdditionalPartAction($sActionName, array(&$this, $sFunctionName));
}
return $this;
}
/**
* @param string $sActionName
* @param string $sFunctionName
*
* @return self
*/
protected function addAjaxHook($sActionName, $sFunctionName)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddAdditionalAjaxAction($sActionName, array(&$this, $sFunctionName));
}
return $this;
}
/**
* @param string $sName
* @param string $sPlace
* @param string $sHtml
* @param bool $bPrepend = false
*
* @return self
*/
protected function addTemplateHook($sName, $sPlace, $sLocalTemplateName, $bPrepend = false)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddProcessTemplateAction($sName, $sPlace,
'<!-- ko template: \''.$sLocalTemplateName.'\' --><!-- /ko -->', $bPrepend);
}
return $this;
}
}
<?php
namespace RainLoop\Plugins;
abstract class AbstractPlugin
{
/**
* @var \RainLoop\Plugins\Manager
*/
private $oPluginManager;
/**
* @var \RainLoop\Config\Plugin
*/
private $oPluginConfig;
/**
* @var bool
*/
private $bLangs;
/**
* @var string
*/
private $sName;
/**
* @var string
*/
private $sPath;
/**
* @var string
*/
private $sVersion;
/**
* @var array
*/
private $aConfigMap;
/**
* @var bool
*/
private $bPluginConfigLoaded;
public function __construct()
{
$this->sName = '';
$this->sPath = '';
$this->sVersion = '0.0';
$this->aConfigMap = null;
$this->oPluginManager = null;
$this->oPluginConfig = null;
$this->bPluginConfigLoaded = false;
$this->bLangs = false;
}
/**
* @return \RainLoop\Config\Plugin
*/
public function Config()
{
if (!$this->bPluginConfigLoaded && $this->oPluginConfig)
{
$this->bPluginConfigLoaded = true;
if ($this->oPluginConfig->IsInited())
{
if (!$this->oPluginConfig->Load())
{
$this->oPluginConfig->Save();
}
}
}
return $this->oPluginConfig;
}
/**
* @return \RainLoop\Plugins\Manager
*/
public function Manager()
{
return $this->oPluginManager;
}
/**
* @return string
*/
public function Path()
{
return $this->sPath;
}
/**
* @return string
*/
public function Name()
{
return $this->sName;
}
/**
* @return string
*/
public function Version()
{
return $this->sVersion;
}
/**
* @param bool | null $bLangs = null
* @return bool
*/
public function UseLangs($bLangs = null)
{
if (null !== $bLangs)
{
$this->bLangs = (bool) $bLangs;
}
return $this->bLangs;
}
/**
* @return array
*/
protected function configMapping()
{
return array();
}
/**
* @return string
*/
public function Hash()
{
return \md5($this->sVersion);
}
/**
* @return string
*/
public function Supported()
{
return '';
}
/**
* @final
* @return array
*/
final public function ConfigMap()
{
if (null === $this->aConfigMap)
{
$this->aConfigMap = $this->configMapping();
if (!is_array($this->aConfigMap))
{
$this->aConfigMap = array();
}
}
return $this->aConfigMap;
}
/**
* @param string $sPath
* @param string $sName
* @param string $sVersion = ''
*
* @return self
*/
public function SetValues($sPath, $sName, $sVersion = '')
{
$this->sName = $sName;
$this->sPath = $sPath;
if (0 < \strlen($sVersion))
{
$this->sVersion = $sVersion;
}
return $this;
}
/**
* @param \RainLoop\Plugins\Manager $oPluginManager
*
* @return self
*/
public function SetPluginManager(\RainLoop\Plugins\Manager $oPluginManager)
{
$this->oPluginManager = $oPluginManager;
return $this;
}
/**
* @param \RainLoop\Config\Plugin $oPluginConfig
*
* @return self
*/
public function SetPluginConfig(\RainLoop\Config\Plugin $oPluginConfig)
{
$this->oPluginConfig = $oPluginConfig;
return $this;
}
/**
* @return void
*/
public function PreInit()
{
}
/**
* @return void
*/
public function Init()
{
}
/**
* @param bool $bAdmin
* @param bool $bAuth
* @param array $aConfig
*
* @return void
*/
public function FilterAppDataPluginSection($bAdmin, $bAuth, &$aConfig)
{
}
/**
* @param string $sHookName
* @param string $sFunctionName
*
* @return self
*/
protected function addHook($sHookName, $sFunctionName)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddHook($sHookName, array(&$this, $sFunctionName));
}
return $this;
}
/**
* @param string $sFile
* @param bool $bAdminScope = false
*
* @return self
*/
protected function addJs($sFile, $bAdminScope = false)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddJs($this->sPath.'/'.$sFile, $bAdminScope);
}
return $this;
}
/**
* @param string $sFile
* @param bool $bAdminScope = false
*
* @return self
*/
protected function addTemplate($sFile, $bAdminScope = false)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddTemplate($this->sPath.'/'.$sFile, $bAdminScope);
}
return $this;
}
/**
* @param string $sActionName
* @param string $sFunctionName
*
* @return self
*/
protected function addPartHook($sActionName, $sFunctionName)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddAdditionalPartAction($sActionName, array(&$this, $sFunctionName));
}
return $this;
}
/**
* @param string $sActionName
* @param string $sFunctionName
*
* @return self
*/
protected function addAjaxHook($sActionName, $sFunctionName)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddAdditionalAjaxAction($sActionName, array(&$this, $sFunctionName));
}
return $this;
}
/**
* @param string $sName
* @param string $sPlace
* @param string $sHtml
* @param bool $bPrepend = false
*
* @return self
*/
protected function addTemplateHook($sName, $sPlace, $sLocalTemplateName, $bPrepend = false)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddProcessTemplateAction($sName, $sPlace,
'<!-- ko template: \''.$sLocalTemplateName.'\' --><!-- /ko -->', $bPrepend);
}
return $this;
}
}

View file

@ -1,73 +1,73 @@
<?php
namespace RainLoop\Plugins;
class Helper
{
/**
* @return void
*/
private function __construct()
{
}
/**
* @param string $sString
* @param string $sWildcardValues
* @param string $sFoundedValue = ''
*
* @return bool
*/
static public function ValidateWildcardValues($sString, $sWildcardValues, &$sFoundedValue = '')
{
$sFoundedValue = '';
$sString = \trim($sString);
if ('' === $sString)
{
return false;
}
$sWildcardValues = \trim($sWildcardValues);
if ('' === $sWildcardValues)
{
return true;
}
if ('*' === $sWildcardValues)
{
$sFoundedValue = '*';
return true;
}
$sWildcardValues = \preg_replace('/[*]+/', '*', \preg_replace('/[\s,;]+/', ' ', $sWildcardValues));
$aWildcardValues = \explode(' ', $sWildcardValues);
foreach ($aWildcardValues as $sItem)
{
if (false === \strpos($sItem, '*'))
{
if ($sString === $sItem)
{
$sFoundedValue = $sItem;
return true;
}
}
else
{
$aItem = \explode('*', $sItem);
$aItem = \array_map(function ($sItem) {
return \preg_quote($sItem, '/');
}, $aItem);
if (\preg_match('/'.\implode('.*', $aItem).'/', $sString))
{
$sFoundedValue = $sItem;
return true;
}
}
}
return false;
}
}
<?php
namespace RainLoop\Plugins;
class Helper
{
/**
* @return void
*/
private function __construct()
{
}
/**
* @param string $sString
* @param string $sWildcardValues
* @param string $sFoundedValue = ''
*
* @return bool
*/
static public function ValidateWildcardValues($sString, $sWildcardValues, &$sFoundedValue = '')
{
$sFoundedValue = '';
$sString = \trim($sString);
if ('' === $sString)
{
return false;
}
$sWildcardValues = \trim($sWildcardValues);
if ('' === $sWildcardValues)
{
return true;
}
if ('*' === $sWildcardValues)
{
$sFoundedValue = '*';
return true;
}
$sWildcardValues = \preg_replace('/[*]+/', '*', \preg_replace('/[\s,;]+/', ' ', $sWildcardValues));
$aWildcardValues = \explode(' ', $sWildcardValues);
foreach ($aWildcardValues as $sItem)
{
if (false === \strpos($sItem, '*'))
{
if ($sString === $sItem)
{
$sFoundedValue = $sItem;
return true;
}
}
else
{
$aItem = \explode('*', $sItem);
$aItem = \array_map(function ($sItem) {
return \preg_quote($sItem, '/');
}, $aItem);
if (\preg_match('/'.\implode('.*', $aItem).'/', $sString))
{
$sFoundedValue = $sItem;
return true;
}
}
}
return false;
}
}

View file

@ -1,205 +1,205 @@
<?php
namespace RainLoop\Plugins;
class Property
{
/**
* @var string
*/
private $sName;
/**
* @var string
*/
private $sLabel;
/**
* @var string
*/
private $sDesc;
/**
* @var int
*/
private $iType;
/**
* @var bool
*/
private $bAllowedInJs;
/**
* @var mixed
*/
private $mDefaultValue;
/**
* @var string
*/
private $sPlaceholder;
private function __construct($sName)
{
$this->sName = $sName;
$this->iType = \RainLoop\Enumerations\PluginPropertyType::STRING;
$this->mDefaultValue = '';
$this->sLabel = '';
$this->sDesc = '';
$this->bAllowedInJs = false;
$this->sPlaceholder = '';
}
/**
* @param string $sName
*
* @return \RainLoop\Plugins\Property
*/
public static function NewInstance($sName)
{
return new self($sName);
}
/**
* @param int $iType
*
* @return \RainLoop\Plugins\Property
*/
public function SetType($iType)
{
$this->iType = (int) $iType;
return $this;
}
/**
* @param mixed $mDefaultValue
*
* @return \RainLoop\Plugins\Property
*/
public function SetDefaultValue($mDefaultValue)
{
$this->mDefaultValue = $mDefaultValue;
return $this;
}
/**
* @param string $sPlaceholder
*
* @return \RainLoop\Plugins\Property
*/
public function SetPlaceholder($sPlaceholder)
{
$this->sPlaceholder = $sPlaceholder;
return $this;
}
/**
* @param string $sLabel
*
* @return \RainLoop\Plugins\Property
*/
public function SetLabel($sLabel)
{
$this->sLabel = $sLabel;
return $this;
}
/**
* @param string $sDesc
*
* @return \RainLoop\Plugins\Property
*/
public function SetDescription($sDesc)
{
$this->sDesc = $sDesc;
return $this;
}
/**
* @param bool $bValue = true
* @return \RainLoop\Plugins\Property
*/
public function SetAllowedInJs($bValue = true)
{
$this->bAllowedInJs = !!$bValue;
return $this;
}
/**
* @return string
*/
public function Name()
{
return $this->sName;
}
/**
* @return bool
*/
public function AllowedInJs()
{
return $this->bAllowedInJs;
}
/**
* @return string
*/
public function Description()
{
return $this->sDesc;
}
/**
* @return string
*/
public function Label()
{
return $this->sLabel;
}
/**
* @return int
*/
public function Type()
{
return $this->iType;
}
/**
* @return mixed
*/
public function DefaultValue()
{
return $this->mDefaultValue;
}
/**
* @return string
*/
public function Placeholder()
{
return $this->sPlaceholder;
}
/**
* @return array
*/
public function ToArray()
{
return array(
'',
$this->sName,
$this->iType,
$this->sLabel,
$this->mDefaultValue,
$this->sDesc,
$this->sPlaceholder
);
}
}
<?php
namespace RainLoop\Plugins;
class Property
{
/**
* @var string
*/
private $sName;
/**
* @var string
*/
private $sLabel;
/**
* @var string
*/
private $sDesc;
/**
* @var int
*/
private $iType;
/**
* @var bool
*/
private $bAllowedInJs;
/**
* @var mixed
*/
private $mDefaultValue;
/**
* @var string
*/
private $sPlaceholder;
private function __construct($sName)
{
$this->sName = $sName;
$this->iType = \RainLoop\Enumerations\PluginPropertyType::STRING;
$this->mDefaultValue = '';
$this->sLabel = '';
$this->sDesc = '';
$this->bAllowedInJs = false;
$this->sPlaceholder = '';
}
/**
* @param string $sName
*
* @return \RainLoop\Plugins\Property
*/
public static function NewInstance($sName)
{
return new self($sName);
}
/**
* @param int $iType
*
* @return \RainLoop\Plugins\Property
*/
public function SetType($iType)
{
$this->iType = (int) $iType;
return $this;
}
/**
* @param mixed $mDefaultValue
*
* @return \RainLoop\Plugins\Property
*/
public function SetDefaultValue($mDefaultValue)
{
$this->mDefaultValue = $mDefaultValue;
return $this;
}
/**
* @param string $sPlaceholder
*
* @return \RainLoop\Plugins\Property
*/
public function SetPlaceholder($sPlaceholder)
{
$this->sPlaceholder = $sPlaceholder;
return $this;
}
/**
* @param string $sLabel
*
* @return \RainLoop\Plugins\Property
*/
public function SetLabel($sLabel)
{
$this->sLabel = $sLabel;
return $this;
}
/**
* @param string $sDesc
*
* @return \RainLoop\Plugins\Property
*/
public function SetDescription($sDesc)
{
$this->sDesc = $sDesc;
return $this;
}
/**
* @param bool $bValue = true
* @return \RainLoop\Plugins\Property
*/
public function SetAllowedInJs($bValue = true)
{
$this->bAllowedInJs = !!$bValue;
return $this;
}
/**
* @return string
*/
public function Name()
{
return $this->sName;
}
/**
* @return bool
*/
public function AllowedInJs()
{
return $this->bAllowedInJs;
}
/**
* @return string
*/
public function Description()
{
return $this->sDesc;
}
/**
* @return string
*/
public function Label()
{
return $this->sLabel;
}
/**
* @return int
*/
public function Type()
{
return $this->iType;
}
/**
* @return mixed
*/
public function DefaultValue()
{
return $this->mDefaultValue;
}
/**
* @return string
*/
public function Placeholder()
{
return $this->sPlaceholder;
}
/**
* @return array
*/
public function ToArray()
{
return array(
'',
$this->sName,
$this->iType,
$this->sLabel,
$this->mDefaultValue,
$this->sDesc,
$this->sPlaceholder
);
}
}

View file

@ -1,340 +1,340 @@
<?php
namespace RainLoop\PluginsNext;
abstract class AbstractPlugin
{
/**
* @var \RainLoop\PluginsNext\Manager
*/
private $oPluginManager;
/**
* @var \RainLoop\Config\Plugin
*/
private $oPluginConfig;
/**
* @var bool
*/
private $bLangs;
/**
* @var string
*/
private $sName;
/**
* @var string
*/
private $sPath;
/**
* @var string
*/
private $sVersion;
/**
* @var array
*/
private $aConfigMap;
/**
* @var bool
*/
private $bPluginConfigLoaded;
public function __construct()
{
$this->sName = '';
$this->sPath = '';
$this->sVersion = '0.0';
$this->aConfigMap = null;
$this->oPluginManager = null;
$this->oPluginConfig = null;
$this->bPluginConfigLoaded = false;
$this->bLangs = false;
}
/**
* @return \RainLoop\Config\Plugin
*/
public function Config()
{
if (!$this->bPluginConfigLoaded && $this->oPluginConfig)
{
$this->bPluginConfigLoaded = true;
if ($this->oPluginConfig->IsInited())
{
if (!$this->oPluginConfig->Load())
{
$this->oPluginConfig->Save();
}
}
}
return $this->oPluginConfig;
}
/**
* @return \RainLoop\PluginsNext\Manager
*/
public function Manager()
{
return $this->oPluginManager;
}
/**
* @return string
*/
public function Path()
{
return $this->sPath;
}
/**
* @return string
*/
public function Name()
{
return $this->sName;
}
/**
* @return string
*/
public function Version()
{
return $this->sVersion;
}
/**
* @param bool|null $bLangs = null
* @return bool
*/
public function UseLangs($bLangs = null)
{
if (null !== $bLangs)
{
$this->bLangs = (bool) $bLangs;
}
return $this->bLangs;
}
/**
* @return array
*/
protected function configMapping()
{
return array();
}
/**
* @return string
*/
public function Hash()
{
return \md5($this->sVersion);
}
/**
* @return string
*/
public function Supported()
{
return '';
}
/**
* @final
* @return array
*/
final public function ConfigMap()
{
if (null === $this->aConfigMap)
{
$this->aConfigMap = $this->configMapping();
if (!\is_array($this->aConfigMap))
{
$this->aConfigMap = array();
}
}
return $this->aConfigMap;
}
/**
* @param string $sPath
* @param string $sName
* @param string $sVersion = ''
*
* @return self
*/
public function SetValues($sPath, $sName, $sVersion = '')
{
$this->sName = $sName;
$this->sPath = $sPath;
if (0 < \strlen($sVersion))
{
$this->sVersion = $sVersion;
}
return $this;
}
/**
* @param \RainLoop\PluginsNext\Manager $oPluginManager
*
* @return self
*/
public function SetPluginManager(\RainLoop\PluginsNext\Manager $oPluginManager)
{
$this->oPluginManager = $oPluginManager;
return $this;
}
/**
* @param \RainLoop\Config\Plugin $oPluginConfig
*
* @return self
*/
public function SetPluginConfig(\RainLoop\Config\Plugin $oPluginConfig)
{
$this->oPluginConfig = $oPluginConfig;
return $this;
}
/**
* @return self
*/
public function Init()
{
}
/**
* @param string $sStep
*
* @return self
*/
public function InitStep($sStep)
{
}
/**
* @param bool $bAdmin
* @param bool $bAuth
* @param array $aConfig
*
* @return void
*/
public function FilterAppDataPluginSection($bAdmin, $bAuth, &$aConfig)
{
}
/**
* @param string $sHookName
* @param string $sFunctionName
*
* @return self
*/
protected function addHook($sHookName, $sFunctionName)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddHook($sHookName, array(&$this, $sFunctionName));
}
return $this;
}
/**
* @param string $sFile
* @param bool $bAdminScope = false
*
* @return self
*/
protected function addJs($sFile, $bAdminScope = false)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddJs($this->sPath.'/'.$sFile, $bAdminScope);
}
return $this;
}
/**
* @param string $sFile
* @param bool $bAdminScope = false
*
* @return self
*/
protected function addTemplate($sFile, $bAdminScope = false)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddTemplate($this->sPath.'/'.$sFile, $bAdminScope);
}
return $this;
}
/**
* @param string $sActionName
* @param string $sFunctionName
*
* @return self
*/
protected function addPartHook($sActionName, $sFunctionName)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddAdditionalPartAction($sActionName, array(&$this, $sFunctionName));
}
return $this;
}
/**
* @param string $sActionName
* @param string $sFunctionName
*
* @return self
*/
protected function addAjaxHook($sActionName, $sFunctionName)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddAdditionalAjaxAction($sActionName, array(&$this, $sFunctionName));
}
return $this;
}
/**
* @param string $sName
* @param string $sPlace
* @param string $sLocalTemplateName
* @param bool $bPrepend = false
*
* @return self
*/
protected function addTemplateHook($sName, $sPlace, $sLocalTemplateName, $bPrepend = false)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddProcessTemplateAction($sName, $sPlace,
'<!-- ko template: \''.$sLocalTemplateName.'\' --><!-- /ko -->', $bPrepend);
}
return $this;
}
}
<?php
namespace RainLoop\PluginsNext;
abstract class AbstractPlugin
{
/**
* @var \RainLoop\PluginsNext\Manager
*/
private $oPluginManager;
/**
* @var \RainLoop\Config\Plugin
*/
private $oPluginConfig;
/**
* @var bool
*/
private $bLangs;
/**
* @var string
*/
private $sName;
/**
* @var string
*/
private $sPath;
/**
* @var string
*/
private $sVersion;
/**
* @var array
*/
private $aConfigMap;
/**
* @var bool
*/
private $bPluginConfigLoaded;
public function __construct()
{
$this->sName = '';
$this->sPath = '';
$this->sVersion = '0.0';
$this->aConfigMap = null;
$this->oPluginManager = null;
$this->oPluginConfig = null;
$this->bPluginConfigLoaded = false;
$this->bLangs = false;
}
/**
* @return \RainLoop\Config\Plugin
*/
public function Config()
{
if (!$this->bPluginConfigLoaded && $this->oPluginConfig)
{
$this->bPluginConfigLoaded = true;
if ($this->oPluginConfig->IsInited())
{
if (!$this->oPluginConfig->Load())
{
$this->oPluginConfig->Save();
}
}
}
return $this->oPluginConfig;
}
/**
* @return \RainLoop\PluginsNext\Manager
*/
public function Manager()
{
return $this->oPluginManager;
}
/**
* @return string
*/
public function Path()
{
return $this->sPath;
}
/**
* @return string
*/
public function Name()
{
return $this->sName;
}
/**
* @return string
*/
public function Version()
{
return $this->sVersion;
}
/**
* @param bool|null $bLangs = null
* @return bool
*/
public function UseLangs($bLangs = null)
{
if (null !== $bLangs)
{
$this->bLangs = (bool) $bLangs;
}
return $this->bLangs;
}
/**
* @return array
*/
protected function configMapping()
{
return array();
}
/**
* @return string
*/
public function Hash()
{
return \md5($this->sVersion);
}
/**
* @return string
*/
public function Supported()
{
return '';
}
/**
* @final
* @return array
*/
final public function ConfigMap()
{
if (null === $this->aConfigMap)
{
$this->aConfigMap = $this->configMapping();
if (!\is_array($this->aConfigMap))
{
$this->aConfigMap = array();
}
}
return $this->aConfigMap;
}
/**
* @param string $sPath
* @param string $sName
* @param string $sVersion = ''
*
* @return self
*/
public function SetValues($sPath, $sName, $sVersion = '')
{
$this->sName = $sName;
$this->sPath = $sPath;
if (0 < \strlen($sVersion))
{
$this->sVersion = $sVersion;
}
return $this;
}
/**
* @param \RainLoop\PluginsNext\Manager $oPluginManager
*
* @return self
*/
public function SetPluginManager(\RainLoop\PluginsNext\Manager $oPluginManager)
{
$this->oPluginManager = $oPluginManager;
return $this;
}
/**
* @param \RainLoop\Config\Plugin $oPluginConfig
*
* @return self
*/
public function SetPluginConfig(\RainLoop\Config\Plugin $oPluginConfig)
{
$this->oPluginConfig = $oPluginConfig;
return $this;
}
/**
* @return self
*/
public function Init()
{
}
/**
* @param string $sStep
*
* @return self
*/
public function InitStep($sStep)
{
}
/**
* @param bool $bAdmin
* @param bool $bAuth
* @param array $aConfig
*
* @return void
*/
public function FilterAppDataPluginSection($bAdmin, $bAuth, &$aConfig)
{
}
/**
* @param string $sHookName
* @param string $sFunctionName
*
* @return self
*/
protected function addHook($sHookName, $sFunctionName)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddHook($sHookName, array(&$this, $sFunctionName));
}
return $this;
}
/**
* @param string $sFile
* @param bool $bAdminScope = false
*
* @return self
*/
protected function addJs($sFile, $bAdminScope = false)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddJs($this->sPath.'/'.$sFile, $bAdminScope);
}
return $this;
}
/**
* @param string $sFile
* @param bool $bAdminScope = false
*
* @return self
*/
protected function addTemplate($sFile, $bAdminScope = false)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddTemplate($this->sPath.'/'.$sFile, $bAdminScope);
}
return $this;
}
/**
* @param string $sActionName
* @param string $sFunctionName
*
* @return self
*/
protected function addPartHook($sActionName, $sFunctionName)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddAdditionalPartAction($sActionName, array(&$this, $sFunctionName));
}
return $this;
}
/**
* @param string $sActionName
* @param string $sFunctionName
*
* @return self
*/
protected function addAjaxHook($sActionName, $sFunctionName)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddAdditionalAjaxAction($sActionName, array(&$this, $sFunctionName));
}
return $this;
}
/**
* @param string $sName
* @param string $sPlace
* @param string $sLocalTemplateName
* @param bool $bPrepend = false
*
* @return self
*/
protected function addTemplateHook($sName, $sPlace, $sLocalTemplateName, $bPrepend = false)
{
if ($this->oPluginManager)
{
$this->oPluginManager->AddProcessTemplateAction($sName, $sPlace,
'<!-- ko template: \''.$sLocalTemplateName.'\' --><!-- /ko -->', $bPrepend);
}
return $this;
}
}

View file

@ -1,179 +1,179 @@
<?php
namespace RainLoop\PluginsNext;
class Property
{
/**
* @var string
*/
private $sName;
/**
* @var string
*/
private $sLabel;
/**
* @var string
*/
private $sDesc;
/**
* @var int
*/
private $iType;
/**
* @var bool
*/
private $bAllowedInJs;
/**
* @var mixed
*/
private $mDefaultValue;
private function __construct($sName)
{
$this->sName = $sName;
$this->iType = \RainLoop\Enumerations\PluginPropertyType::STRING;
$this->mDefaultValue = '';
$this->sLabel = '';
$this->sDesc = '';
$this->bAllowedInJs = false;
}
/**
* @param string $sName
*
* @return \RainLoop\PluginsNext\Property
*/
public static function NewInstance($sName)
{
return new self($sName);
}
/**
* @param int $iType
*
* @return \RainLoop\PluginsNext\Property
*/
public function SetType($iType)
{
$this->iType = (int) $iType;
return $this;
}
/**
* @param mixed $mDefaultValue
*
* @return \RainLoop\PluginsNext\Property
*/
public function SetDefaultValue($mDefaultValue)
{
$this->mDefaultValue = $mDefaultValue;
return $this;
}
/**
* @param string $sLabel
*
* @return \RainLoop\PluginsNext\Property
*/
public function SetLabel($sLabel)
{
$this->sLabel = $sLabel;
return $this;
}
/**
* @param string $sDesc
*
* @return \RainLoop\PluginsNext\Property
*/
public function SetDescription($sDesc)
{
$this->sDesc = $sDesc;
return $this;
}
/**
* @param bool $bValue = true
*
* @return \RainLoop\PluginsNext\Property
*/
public function SetAllowedInJs($bValue = true)
{
$this->bAllowedInJs = !!$bValue;
return $this;
}
/**
* @return string
*/
public function Name()
{
return $this->sName;
}
/**
* @return bool
*/
public function AllowedInJs()
{
return $this->bAllowedInJs;
}
/**
* @return string
*/
public function Description()
{
return $this->sDesc;
}
/**
* @return string
*/
public function Label()
{
return $this->sLabel;
}
/**
* @return int
*/
public function Type()
{
return $this->iType;
}
/**
* @return mixed
*/
public function DefaultValue()
{
return $this->mDefaultValue;
}
/**
* @return array
*/
public function ToArray()
{
return array(
'',
$this->sName,
$this->iType,
$this->sLabel,
$this->mDefaultValue,
$this->sDesc
);
}
}
<?php
namespace RainLoop\PluginsNext;
class Property
{
/**
* @var string
*/
private $sName;
/**
* @var string
*/
private $sLabel;
/**
* @var string
*/
private $sDesc;
/**
* @var int
*/
private $iType;
/**
* @var bool
*/
private $bAllowedInJs;
/**
* @var mixed
*/
private $mDefaultValue;
private function __construct($sName)
{
$this->sName = $sName;
$this->iType = \RainLoop\Enumerations\PluginPropertyType::STRING;
$this->mDefaultValue = '';
$this->sLabel = '';
$this->sDesc = '';
$this->bAllowedInJs = false;
}
/**
* @param string $sName
*
* @return \RainLoop\PluginsNext\Property
*/
public static function NewInstance($sName)
{
return new self($sName);
}
/**
* @param int $iType
*
* @return \RainLoop\PluginsNext\Property
*/
public function SetType($iType)
{
$this->iType = (int) $iType;
return $this;
}
/**
* @param mixed $mDefaultValue
*
* @return \RainLoop\PluginsNext\Property
*/
public function SetDefaultValue($mDefaultValue)
{
$this->mDefaultValue = $mDefaultValue;
return $this;
}
/**
* @param string $sLabel
*
* @return \RainLoop\PluginsNext\Property
*/
public function SetLabel($sLabel)
{
$this->sLabel = $sLabel;
return $this;
}
/**
* @param string $sDesc
*
* @return \RainLoop\PluginsNext\Property
*/
public function SetDescription($sDesc)
{
$this->sDesc = $sDesc;
return $this;
}
/**
* @param bool $bValue = true
*
* @return \RainLoop\PluginsNext\Property
*/
public function SetAllowedInJs($bValue = true)
{
$this->bAllowedInJs = !!$bValue;
return $this;
}
/**
* @return string
*/
public function Name()
{
return $this->sName;
}
/**
* @return bool
*/
public function AllowedInJs()
{
return $this->bAllowedInJs;
}
/**
* @return string
*/
public function Description()
{
return $this->sDesc;
}
/**
* @return string
*/
public function Label()
{
return $this->sLabel;
}
/**
* @return int
*/
public function Type()
{
return $this->iType;
}
/**
* @return mixed
*/
public function DefaultValue()
{
return $this->mDefaultValue;
}
/**
* @return array
*/
public function ToArray()
{
return array(
'',
$this->sName,
$this->iType,
$this->sLabel,
$this->mDefaultValue,
$this->sDesc
);
}
}

View file

@ -1,22 +1,22 @@
<?php
namespace RainLoop\Providers\ChangePassword;
interface ChangePasswordInterface
{
/**
* @param \RainLoop\Account $oAccount
*
* @return bool
*/
public function PasswordChangePossibility($oAccount);
/**
* @param \RainLoop\Account $oAccount
* @param string $sPrevPassword
* @param string $sNewPassword
*
* @return bool
*/
public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword);
}
<?php
namespace RainLoop\Providers\ChangePassword;
interface ChangePasswordInterface
{
/**
* @param \RainLoop\Account $oAccount
*
* @return bool
*/
public function PasswordChangePossibility($oAccount);
/**
* @param \RainLoop\Account $oAccount
* @param string $sPrevPassword
* @param string $sNewPassword
*
* @return bool
*/
public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword);
}

View file

@ -1,7 +1,7 @@
<?php
namespace RainLoop\Providers\Domain;
interface DomainInterface
{
<?php
namespace RainLoop\Providers\Domain;
interface DomainInterface
{
}

View file

@ -1,28 +1,28 @@
<?php
namespace RainLoop\Providers\Settings;
interface SettingsInterface
{
/**
* @param \RainLoop\Account $oAccount
*
* @return array
*/
public function Load(\RainLoop\Account $oAccount);
/**
* @param \RainLoop\Account $oAccount
* @param array $aSettings
*
* @return bool
*/
public function Save(\RainLoop\Account $oAccount, array $aSettings);
/**
* @param string $sEmail
*
* @return bool
*/
public function ClearByEmail($sEmail);
<?php
namespace RainLoop\Providers\Settings;
interface SettingsInterface
{
/**
* @param \RainLoop\Account $oAccount
*
* @return array
*/
public function Load(\RainLoop\Account $oAccount);
/**
* @param \RainLoop\Account $oAccount
* @param array $aSettings
*
* @return bool
*/
public function Save(\RainLoop\Account $oAccount, array $aSettings);
/**
* @param string $sEmail
*
* @return bool
*/
public function ClearByEmail($sEmail);
}

View file

@ -1,40 +1,40 @@
<?php
namespace RainLoop\Providers;
class Suggestions extends \RainLoop\Providers\AbstractProvider
{
/**
* @var \RainLoop\Providers\Suggestions\SuggestionsInterface
*/
private $oDriver;
/**
* @param \RainLoop\Providers\Suggestions\SuggestionsInterface|null $oDriver = null
*
* @return void
*/
public function __construct($oDriver = null)
{
$this->oDriver = $oDriver;
}
/**
* @param \RainLoop\Account $oAccount
* @param string $sQuery
*
* @return array
*/
public function Process(\RainLoop\Account $oAccount, $sQuery)
{
return $this->oDriver && $this->IsActive() && 0 < \strlen($sQuery) ? $this->oDriver->Process($oAccount, $sQuery) : array();
}
/**
* @return bool
*/
public function IsActive()
{
return $this->oDriver instanceof \RainLoop\Providers\Suggestions\SuggestionsInterface;
}
<?php
namespace RainLoop\Providers;
class Suggestions extends \RainLoop\Providers\AbstractProvider
{
/**
* @var \RainLoop\Providers\Suggestions\SuggestionsInterface
*/
private $oDriver;
/**
* @param \RainLoop\Providers\Suggestions\SuggestionsInterface|null $oDriver = null
*
* @return void
*/
public function __construct($oDriver = null)
{
$this->oDriver = $oDriver;
}
/**
* @param \RainLoop\Account $oAccount
* @param string $sQuery
*
* @return array
*/
public function Process(\RainLoop\Account $oAccount, $sQuery)
{
return $this->oDriver && $this->IsActive() && 0 < \strlen($sQuery) ? $this->oDriver->Process($oAccount, $sQuery) : array();
}
/**
* @return bool
*/
public function IsActive()
{
return $this->oDriver instanceof \RainLoop\Providers\Suggestions\SuggestionsInterface;
}
}

View file

@ -1,14 +1,14 @@
<?php
namespace RainLoop\Providers\Suggestions;
interface SuggestionsInterface
{
/**
* @param \RainLoop\Account $oAccount
* @param string $sQuery
*
* @return array
*/
public function Process(\RainLoop\Account $oAccount, $sQuery);
<?php
namespace RainLoop\Providers\Suggestions;
interface SuggestionsInterface
{
/**
* @param \RainLoop\Account $oAccount
* @param string $sQuery
*
* @return array
*/
public function Process(\RainLoop\Account $oAccount, $sQuery);
}

View file

@ -1,24 +1,24 @@
<?php
namespace RainLoop\Providers\TwoFactorAuth;
abstract class AbstractTwoFactorAuth
{
/**
* @return string
*/
public function Label()
{
return 'Two Factor Authenticator Code';
}
/**
* @param string $sSecret
* @param string $sCode
* @return bool
*/
public function VerifyCode($sSecret, $sCode)
{
return false;
}
}
<?php
namespace RainLoop\Providers\TwoFactorAuth;
abstract class AbstractTwoFactorAuth
{
/**
* @return string
*/
public function Label()
{
return 'Two Factor Authenticator Code';
}
/**
* @param string $sSecret
* @param string $sCode
* @return bool
*/
public function VerifyCode($sSecret, $sCode)
{
return false;
}
}

View file

@ -1,64 +1,64 @@
<?php
namespace RainLoop;
class Settings
{
/**
* @var array
*/
protected $aData;
/**
* @return void
*/
public function __construct()
{
$this->aData = array();
}
/**
* @param array $aData
*
* @return \RainLoop\Settings
*/
public function InitData($aData)
{
if (\is_array($aData))
{
$this->aData = $aData;
}
return $this;
}
/**
* @return array
*/
public function DataAsArray()
{
return $this->aData;
}
/**
* @param string $sName
* @param mixed $mDefValue = null
*
* @return mixed
*/
public function GetConf($sName, $mDefValue = null)
{
return isset($this->aData[$sName]) ? $this->aData[$sName] : $mDefValue;
}
/**
* @param string $sName
* @param mixed $mValue
*
* @return void
*/
public function SetConf($sName, $mValue)
{
$this->aData[$sName] = $mValue;
}
<?php
namespace RainLoop;
class Settings
{
/**
* @var array
*/
protected $aData;
/**
* @return void
*/
public function __construct()
{
$this->aData = array();
}
/**
* @param array $aData
*
* @return \RainLoop\Settings
*/
public function InitData($aData)
{
if (\is_array($aData))
{
$this->aData = $aData;
}
return $this;
}
/**
* @return array
*/
public function DataAsArray()
{
return $this->aData;
}
/**
* @param string $sName
* @param mixed $mDefValue = null
*
* @return mixed
*/
public function GetConf($sName, $mDefValue = null)
{
return isset($this->aData[$sName]) ? $this->aData[$sName] : $mDefValue;
}
/**
* @param string $sName
* @param mixed $mValue
*
* @return void
*/
public function SetConf($sName, $mValue)
{
$this->aData[$sName] = $mValue;
}
}

View file

@ -41,7 +41,7 @@
<br />
<div class="form-horizontal">
<div class="legend">
Change Admin Password
Admin Panel Access Credentials
</div>
<div class="control-group">
<label class="control-label">