first commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
namespace WapplerSystems\Meilisearch\System\Mvc\Backend\Component\Exception;
|
||||
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2010-2017 dkd Internet Service GmbH <solr-support@dkd.de>
|
||||
* All rights reserved
|
||||
*
|
||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||
* free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The GNU General Public License can be found at
|
||||
* http://www.gnu.org/copyleft/gpl.html.
|
||||
*
|
||||
* This script is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
use \TYPO3\CMS\Extbase\Mvc\Exception;
|
||||
|
||||
class InvalidViewObjectNameException extends Exception
|
||||
{
|
||||
}
|
84
Classes/System/Mvc/Backend/ModuleData.php
Normal file
84
Classes/System/Mvc/Backend/ModuleData.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
namespace WapplerSystems\Meilisearch\System\Mvc\Backend;
|
||||
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2010-2017 dkd Internet Service GmbH <solr-support@dkd.de>
|
||||
* All rights reserved
|
||||
*
|
||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||
* free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The GNU General Public License can be found at
|
||||
* http://www.gnu.org/copyleft/gpl.html.
|
||||
*
|
||||
* This script is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
use WapplerSystems\Meilisearch\Domain\Site\Site;
|
||||
|
||||
/**
|
||||
* Represents the state of needed for backend module components e.g. selected option from select menu, enabled or disabled button, etc..
|
||||
*/
|
||||
class ModuleData
|
||||
{
|
||||
/**
|
||||
* @var Site
|
||||
*/
|
||||
protected $site = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $core = '';
|
||||
|
||||
/**
|
||||
* Gets the site to work with.
|
||||
*
|
||||
* @return Site
|
||||
*/
|
||||
public function getSite()
|
||||
{
|
||||
return $this->site;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the site to work with.
|
||||
*
|
||||
* @param Site $site
|
||||
* @return void
|
||||
*/
|
||||
public function setSite(Site $site)
|
||||
{
|
||||
$this->site = $site;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of the currently selected core
|
||||
*
|
||||
* @return string Selected core name
|
||||
*/
|
||||
public function getCore()
|
||||
{
|
||||
return $this->core;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name of the currently selected core
|
||||
*
|
||||
* @param string $core Selected core name
|
||||
*/
|
||||
public function setCore($core)
|
||||
{
|
||||
$this->core = $core;
|
||||
}
|
||||
}
|
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
namespace WapplerSystems\Meilisearch\System\Mvc\Backend\Service;
|
||||
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2013-2015 Ingo Renner <ingo@typo3.org>
|
||||
* All rights reserved
|
||||
*
|
||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||
* free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The GNU General Public License can be found at
|
||||
* http://www.gnu.org/copyleft/gpl.html.
|
||||
*
|
||||
* This script is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
use WapplerSystems\Meilisearch\System\Mvc\Backend\ModuleData;
|
||||
use TYPO3\CMS\Core\SingletonInterface;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/**
|
||||
* Module data storage service. Used to store and retrieve module state (eg.
|
||||
* checkboxes, selections).
|
||||
*/
|
||||
class ModuleDataStorageService implements SingletonInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const KEY = 'tx_meilisearch';
|
||||
|
||||
/**
|
||||
* Loads module data for user settings or returns a fresh object initially
|
||||
*
|
||||
* @return ModuleData
|
||||
*/
|
||||
public function loadModuleData()
|
||||
{
|
||||
$moduleData = $GLOBALS['BE_USER']->getModuleData(self::KEY);
|
||||
|
||||
$this->unsetModuleDataIfCanNotBeSerialized($moduleData);
|
||||
if (empty($moduleData) || !$moduleData) {
|
||||
$moduleData = GeneralUtility::makeInstance(ModuleData::class);
|
||||
} else {
|
||||
$moduleData = unserialize($moduleData);
|
||||
}
|
||||
|
||||
return $moduleData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Persists serialized module data to user settings
|
||||
*
|
||||
* @param ModuleData $moduleData
|
||||
* @return void
|
||||
*/
|
||||
public function persistModuleData(ModuleData $moduleData)
|
||||
{
|
||||
$GLOBALS['BE_USER']->pushModuleData(self::KEY, serialize($moduleData));
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets not serializable module data.
|
||||
*
|
||||
* @param string|null $serializedModuleData
|
||||
*/
|
||||
private function unsetModuleDataIfCanNotBeSerialized(string &$serializedModuleData = null)
|
||||
{
|
||||
if (!isset($serializedModuleData)) {
|
||||
$serializedModuleData = '';
|
||||
return;
|
||||
}
|
||||
if (false !== strpos($serializedModuleData, 'ApacheSolrForTypo3\\Solr\\Domain\\Model\\ModuleData')
|
||||
|| false !== strpos($serializedModuleData, 'Tx_Solr_Site')) {
|
||||
$serializedModuleData = '';
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user