Skip to content

Commit 5781f0f

Browse files
authored
Merge pull request #95 from beluga-core/develop-5
Develop 5
2 parents 4e8d0d9 + d2b7425 commit 5781f0f

58 files changed

Lines changed: 4017 additions & 63 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<?php
2+
/**
3+
* Template for ZF2 module for storing local overrides.
4+
*
5+
* PHP version 5
6+
*
7+
* Copyright (C) Villanova University 2010.
8+
*
9+
* This program is free software; you can redistribute it and/or modify
10+
* it under the terms of the GNU General Public License version 2,
11+
* as published by the Free Software Foundation.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU General Public License
19+
* along with this program; if not, write to the Free Software
20+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21+
*
22+
* @category VuFind2
23+
* @package Module
24+
* @author Demian Katz <demian.katz@villanova.edu>
25+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
26+
* @link https://github.com/dmj/vf2-proxy
27+
*/
28+
namespace AutocompleteTerms;
29+
use Zend\ModuleManager\ModuleManager,
30+
Zend\Mvc\MvcEvent;
31+
32+
/**
33+
* Template for ZF2 module for storing local overrides.
34+
*
35+
* @category VuFind2
36+
* @package Module
37+
* @author Demian Katz <demian.katz@villanova.edu>
38+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
39+
* @link https://github.com/dmj/vf2-proxy
40+
*/
41+
class Module
42+
{
43+
/**
44+
* Get module configuration
45+
*
46+
* @return array
47+
*/
48+
public function getConfig()
49+
{
50+
return include __DIR__ . '/config/module.config.php';
51+
}
52+
53+
/**
54+
* Get autoloader configuration
55+
*
56+
* @return array
57+
*/
58+
public function getAutoloaderConfig()
59+
{
60+
return array(
61+
'Zend\Loader\StandardAutoloader' => array(
62+
'namespaces' => array(
63+
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
64+
),
65+
),
66+
);
67+
}
68+
69+
/**
70+
* Initialize the module
71+
*
72+
* @param ModuleManager $m Module manager
73+
*
74+
* @return void
75+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
76+
*/
77+
public function init(ModuleManager $m)
78+
{
79+
}
80+
81+
/**
82+
* Bootstrap the module
83+
*
84+
* @param MvcEvent $e Event
85+
*
86+
* @return void
87+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
88+
*/
89+
public function onBootstrap(MvcEvent $e)
90+
{
91+
}
92+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
namespace AutocompleteTerms\Module\Config;
3+
4+
$config = [
5+
'service_manager' => [
6+
'allow_override' => true,
7+
'factories' => [
8+
'AutocompleteTerms\Autocomplete\PluginManager' => 'VuFind\ServiceManager\AbstractPluginManagerFactory',
9+
],
10+
'aliases' => [
11+
'VuFind\AutocompletePluginManager' => 'AutocompleteTerms\Autocomplete\PluginManager',
12+
'VuFind\Autocomplete\PluginManager' => 'AutocompleteTerms\Autocomplete\PluginManager',
13+
],
14+
],
15+
];
16+
17+
return $config;
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
/**
3+
* Autocomplete handler plugin factory
4+
*
5+
* PHP version 7
6+
*
7+
* Copyright (C) Villanova University 2010.
8+
*
9+
* This program is free software; you can redistribute it and/or modify
10+
* it under the terms of the GNU General Public License version 2,
11+
* as published by the Free Software Foundation.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU General Public License
19+
* along with this program; if not, write to the Free Software
20+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21+
*
22+
* @category VuFind
23+
* @package Autocomplete
24+
* @author Demian Katz <demian.katz@villanova.edu>
25+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
26+
* @link https://vufind.org/wiki/development:plugins:autosuggesters Wiki
27+
*/
28+
namespace AutocompleteTerms\Autocomplete;
29+
30+
/**
31+
* Autocomplete handler plugin factory
32+
*
33+
* @category VuFind
34+
* @package Autocomplete
35+
* @author Demian Katz <demian.katz@villanova.edu>
36+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
37+
* @link https://vufind.org/wiki/development:plugins:autosuggesters Wiki
38+
*/
39+
class PluginFactory extends \VuFind\ServiceManager\AbstractPluginFactory
40+
{
41+
/**
42+
* Constructor
43+
*/
44+
public function __construct()
45+
{
46+
$this->defaultNamespace = 'AutocompleteTerms\Autocomplete';
47+
}
48+
}
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<?php
2+
/**
3+
* Autocomplete handler plugin manager
4+
*
5+
* PHP version 7
6+
*
7+
* Copyright (C) Villanova University 2010.
8+
*
9+
* This program is free software; you can redistribute it and/or modify
10+
* it under the terms of the GNU General Public License version 2,
11+
* as published by the Free Software Foundation.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU General Public License
19+
* along with this program; if not, write to the Free Software
20+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21+
*
22+
* @category VuFind
23+
* @package Autocomplete
24+
* @author Demian Katz <demian.katz@villanova.edu>
25+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
26+
* @link https://vufind.org/wiki/development:plugins:autosuggesters Wiki
27+
*/
28+
namespace AutocompleteTerms\Autocomplete;
29+
30+
/**
31+
* Autocomplete handler plugin manager
32+
*
33+
* @category VuFind
34+
* @package Autocomplete
35+
* @author Demian Katz <demian.katz@villanova.edu>
36+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
37+
* @link https://vufind.org/wiki/development:plugins:autosuggesters Wiki
38+
*/
39+
class PluginManager extends \VuFind\Autocomplete\PluginManager
40+
{
41+
/**
42+
* Default plugin aliases.
43+
*
44+
* @var array
45+
*/
46+
protected $aliases = [
47+
'none' => 'VuFind\Autocomplete\None',
48+
'eds' => 'VuFind\Autocomplete\Eds',
49+
'oclcidentities' => 'VuFind\Autocomplete\OCLCIdentities',
50+
'search2' => 'VuFind\Autocomplete\Search2',
51+
'search2cn' => 'VuFind\Autocomplete\Search2CN',
52+
'solr' => 'VuFind\Autocomplete\Solr',
53+
'solrauth' => 'VuFind\Autocomplete\SolrAuth',
54+
'solrcn' => 'VuFind\Autocomplete\SolrCN',
55+
'solrreserves' => 'VuFind\Autocomplete\SolrReserves',
56+
'tag' => 'VuFind\Autocomplete\Tag',
57+
// for legacy 1.x compatibility
58+
'noautocomplete' => 'None',
59+
'oclcidentitiesautocomplete' => 'OCLCIdentities',
60+
'solrautocomplete' => 'Solr',
61+
'solrauthautocomplete' => 'SolrAuth',
62+
'solrcnautocomplete' => 'SolrCN',
63+
'solrreservesautocomplete' => 'SolrReserves',
64+
'tagautocomplete' => 'Tag',
65+
'terms' => 'AutocompleteTerms\Autocomplete\Terms',
66+
];
67+
68+
/**
69+
* Default plugin factories.
70+
*
71+
* @var array
72+
*/
73+
protected $factories = [
74+
'VuFind\Autocomplete\None' => 'Zend\ServiceManager\Factory\InvokableFactory',
75+
'VuFind\Autocomplete\Eds' => 'VuFind\Autocomplete\EdsFactory',
76+
'VuFind\Autocomplete\OCLCIdentities' =>
77+
'Zend\ServiceManager\Factory\InvokableFactory',
78+
'VuFind\Autocomplete\Search2' => 'VuFind\Autocomplete\SolrFactory',
79+
'VuFind\Autocomplete\Search2CN' => 'VuFind\Autocomplete\SolrFactory',
80+
'VuFind\Autocomplete\Solr' => 'VuFind\Autocomplete\SolrFactory',
81+
'VuFind\Autocomplete\SolrAuth' => 'VuFind\Autocomplete\SolrFactory',
82+
'VuFind\Autocomplete\SolrCN' => 'VuFind\Autocomplete\SolrFactory',
83+
'VuFind\Autocomplete\SolrReserves' => 'VuFind\Autocomplete\SolrFactory',
84+
'VuFind\Autocomplete\Tag' => 'Zend\ServiceManager\Factory\InvokableFactory',
85+
'AutocompleteTerms\Autocomplete\Terms' => 'AutocompleteTerms\Autocomplete\TermsFactory',
86+
];
87+
88+
/**
89+
* Constructor
90+
*
91+
* Make sure plugins are properly initialized.
92+
*
93+
* @param mixed $configOrContainerInstance Configuration or container instance
94+
* @param array $v3config If $configOrContainerInstance is a
95+
* container, this value will be passed to the parent constructor.
96+
*/
97+
public function __construct($configOrContainerInstance = null,
98+
array $v3config = []
99+
) {
100+
$this->addAbstractFactory('AutocompleteTerms\Autocomplete\PluginFactory');
101+
parent::__construct($configOrContainerInstance, $v3config);
102+
}
103+
104+
/**
105+
* Return the name of the base class or interface that plug-ins must conform
106+
* to.
107+
*
108+
* @return string
109+
*/
110+
protected function getExpectedInterface()
111+
{
112+
return 'VuFind\Autocomplete\AutocompleteInterface';
113+
}
114+
}

0 commit comments

Comments
 (0)