Skip to content

Commit

Permalink
Merge pull request #95 from beluga-core/develop-5
Browse files Browse the repository at this point in the history
Develop 5
  • Loading branch information
jschultze authored Jan 29, 2020
2 parents 4e8d0d9 + d2b7425 commit 5781f0f
Show file tree
Hide file tree
Showing 58 changed files with 4,017 additions and 63 deletions.
92 changes: 92 additions & 0 deletions module/AutocompleteTerms/Module.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php
/**
* Template for ZF2 module for storing local overrides.
*
* PHP version 5
*
* Copyright (C) Villanova University 2010.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @category VuFind2
* @package Module
* @author Demian Katz <[email protected]>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://github.com/dmj/vf2-proxy
*/
namespace AutocompleteTerms;
use Zend\ModuleManager\ModuleManager,
Zend\Mvc\MvcEvent;

/**
* Template for ZF2 module for storing local overrides.
*
* @category VuFind2
* @package Module
* @author Demian Katz <[email protected]>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://github.com/dmj/vf2-proxy
*/
class Module
{
/**
* Get module configuration
*
* @return array
*/
public function getConfig()
{
return include __DIR__ . '/config/module.config.php';
}

/**
* Get autoloader configuration
*
* @return array
*/
public function getAutoloaderConfig()
{
return array(
'Zend\Loader\StandardAutoloader' => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
),
),
);
}

/**
* Initialize the module
*
* @param ModuleManager $m Module manager
*
* @return void
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function init(ModuleManager $m)
{
}

/**
* Bootstrap the module
*
* @param MvcEvent $e Event
*
* @return void
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function onBootstrap(MvcEvent $e)
{
}
}
17 changes: 17 additions & 0 deletions module/AutocompleteTerms/config/module.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
namespace AutocompleteTerms\Module\Config;

$config = [
'service_manager' => [
'allow_override' => true,
'factories' => [
'AutocompleteTerms\Autocomplete\PluginManager' => 'VuFind\ServiceManager\AbstractPluginManagerFactory',
],
'aliases' => [
'VuFind\AutocompletePluginManager' => 'AutocompleteTerms\Autocomplete\PluginManager',
'VuFind\Autocomplete\PluginManager' => 'AutocompleteTerms\Autocomplete\PluginManager',
],
],
];

return $config;
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* Autocomplete handler plugin factory
*
* PHP version 7
*
* Copyright (C) Villanova University 2010.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category VuFind
* @package Autocomplete
* @author Demian Katz <[email protected]>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development:plugins:autosuggesters Wiki
*/
namespace AutocompleteTerms\Autocomplete;

/**
* Autocomplete handler plugin factory
*
* @category VuFind
* @package Autocomplete
* @author Demian Katz <[email protected]>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development:plugins:autosuggesters Wiki
*/
class PluginFactory extends \VuFind\ServiceManager\AbstractPluginFactory
{
/**
* Constructor
*/
public function __construct()
{
$this->defaultNamespace = 'AutocompleteTerms\Autocomplete';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<?php
/**
* Autocomplete handler plugin manager
*
* PHP version 7
*
* Copyright (C) Villanova University 2010.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category VuFind
* @package Autocomplete
* @author Demian Katz <[email protected]>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development:plugins:autosuggesters Wiki
*/
namespace AutocompleteTerms\Autocomplete;

/**
* Autocomplete handler plugin manager
*
* @category VuFind
* @package Autocomplete
* @author Demian Katz <[email protected]>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development:plugins:autosuggesters Wiki
*/
class PluginManager extends \VuFind\Autocomplete\PluginManager
{
/**
* Default plugin aliases.
*
* @var array
*/
protected $aliases = [
'none' => 'VuFind\Autocomplete\None',
'eds' => 'VuFind\Autocomplete\Eds',
'oclcidentities' => 'VuFind\Autocomplete\OCLCIdentities',
'search2' => 'VuFind\Autocomplete\Search2',
'search2cn' => 'VuFind\Autocomplete\Search2CN',
'solr' => 'VuFind\Autocomplete\Solr',
'solrauth' => 'VuFind\Autocomplete\SolrAuth',
'solrcn' => 'VuFind\Autocomplete\SolrCN',
'solrreserves' => 'VuFind\Autocomplete\SolrReserves',
'tag' => 'VuFind\Autocomplete\Tag',
// for legacy 1.x compatibility
'noautocomplete' => 'None',
'oclcidentitiesautocomplete' => 'OCLCIdentities',
'solrautocomplete' => 'Solr',
'solrauthautocomplete' => 'SolrAuth',
'solrcnautocomplete' => 'SolrCN',
'solrreservesautocomplete' => 'SolrReserves',
'tagautocomplete' => 'Tag',
'terms' => 'AutocompleteTerms\Autocomplete\Terms',
];

/**
* Default plugin factories.
*
* @var array
*/
protected $factories = [
'VuFind\Autocomplete\None' => 'Zend\ServiceManager\Factory\InvokableFactory',
'VuFind\Autocomplete\Eds' => 'VuFind\Autocomplete\EdsFactory',
'VuFind\Autocomplete\OCLCIdentities' =>
'Zend\ServiceManager\Factory\InvokableFactory',
'VuFind\Autocomplete\Search2' => 'VuFind\Autocomplete\SolrFactory',
'VuFind\Autocomplete\Search2CN' => 'VuFind\Autocomplete\SolrFactory',
'VuFind\Autocomplete\Solr' => 'VuFind\Autocomplete\SolrFactory',
'VuFind\Autocomplete\SolrAuth' => 'VuFind\Autocomplete\SolrFactory',
'VuFind\Autocomplete\SolrCN' => 'VuFind\Autocomplete\SolrFactory',
'VuFind\Autocomplete\SolrReserves' => 'VuFind\Autocomplete\SolrFactory',
'VuFind\Autocomplete\Tag' => 'Zend\ServiceManager\Factory\InvokableFactory',
'AutocompleteTerms\Autocomplete\Terms' => 'AutocompleteTerms\Autocomplete\TermsFactory',
];

/**
* Constructor
*
* Make sure plugins are properly initialized.
*
* @param mixed $configOrContainerInstance Configuration or container instance
* @param array $v3config If $configOrContainerInstance is a
* container, this value will be passed to the parent constructor.
*/
public function __construct($configOrContainerInstance = null,
array $v3config = []
) {
$this->addAbstractFactory('AutocompleteTerms\Autocomplete\PluginFactory');
parent::__construct($configOrContainerInstance, $v3config);
}

/**
* Return the name of the base class or interface that plug-ins must conform
* to.
*
* @return string
*/
protected function getExpectedInterface()
{
return 'VuFind\Autocomplete\AutocompleteInterface';
}
}
Loading

0 comments on commit 5781f0f

Please sign in to comment.