First commit

This commit is contained in:
Theodotos Andreou 2018-01-14 13:10:16 +00:00
commit c6e2478c40
13918 changed files with 2303184 additions and 0 deletions

View file

@ -0,0 +1,35 @@
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM 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 Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CiviCRM_Hook
* @copyright CiviCRM LLC (c) 2004-2017
*/
class CRM_Utils_Hook_Backdrop extends CRM_Utils_Hook_DrupalBase {
}

View file

@ -0,0 +1,35 @@
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM 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 Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CiviCRM_Hook
* @copyright CiviCRM LLC (c) 2004-2017
*/
class CRM_Utils_Hook_Drupal extends CRM_Utils_Hook_DrupalBase {
}

View file

@ -0,0 +1,34 @@
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM 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 Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CiviCRM_Hook
* @copyright CiviCRM LLC (c) 2004-2017
*/
class CRM_Utils_Hook_Drupal6 extends CRM_Utils_Hook_DrupalBase {
}

View file

@ -0,0 +1,35 @@
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM 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 Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CiviCRM_Hook
* @copyright CiviCRM LLC (c) 2004-2017
*/
class CRM_Utils_Hook_Drupal8 extends CRM_Utils_Hook_DrupalBase {
}

View file

@ -0,0 +1,131 @@
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM 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 Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2017
*/
class CRM_Utils_Hook_DrupalBase extends CRM_Utils_Hook {
/**
* @var bool
*/
private $isBuilt = FALSE;
/**
* @var array(string)
*/
private $allModules = NULL;
/**
* @var array(string)
*/
private $civiModules = NULL;
/**
* @var array(string)
*/
private $drupalModules = NULL;
/**
* @see CRM_Utils_Hook::invoke()
*
* @param int $numParams
* Number of parameters to pass to the hook.
* @param unknown $arg1
* Parameter to be passed to the hook.
* @param unknown $arg2
* Parameter to be passed to the hook.
* @param unknown $arg3
* Parameter to be passed to the hook.
* @param unknown $arg4
* Parameter to be passed to the hook.
* @param unknown $arg5
* Parameter to be passed to the hook.
* @param mixed $arg6
* @param string $fnSuffix
* Function suffix, this is effectively the hook name.
*
* @return array|bool
*/
public function invokeViaUF(
$numParams,
&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6,
$fnSuffix) {
$this->buildModuleList();
return $this->runHooks($this->allModules, $fnSuffix,
$numParams, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6
);
}
/**
* Build the list of modules to be processed for hooks.
*/
public function buildModuleList() {
if ($this->isBuilt === FALSE) {
if ($this->drupalModules === NULL) {
if (function_exists('module_list')) {
// copied from user_module_invoke
$this->drupalModules = module_list();
}
}
if ($this->civiModules === NULL) {
$this->civiModules = array();
$this->requireCiviModules($this->civiModules);
}
// CRM-12370
// we should add civicrm's module's just after main civicrm drupal module
// Note: Assume that drupalModules and civiModules may each be array() or NULL
if ($this->drupalModules !== NULL) {
foreach ($this->drupalModules as $moduleName) {
$this->allModules[$moduleName] = $moduleName;
if ($moduleName == 'civicrm') {
if (!empty($this->civiModules)) {
foreach ($this->civiModules as $civiModuleName) {
$this->allModules[$civiModuleName] = $civiModuleName;
}
}
}
}
}
else {
$this->allModules = (array) $this->civiModules;
}
if ($this->drupalModules !== NULL && $this->civiModules !== NULL) {
// both CRM and CMS have bootstrapped, so this is the final list
$this->isBuilt = TRUE;
}
}
}
}

View file

@ -0,0 +1,128 @@
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM 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 Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CiviCRM_Hook
* @copyright CiviCRM LLC (c) 2004-2017
*/
class CRM_Utils_Hook_Joomla extends CRM_Utils_Hook {
/**
* Invoke hooks.
*
* @param int $numParams
* Number of parameters to pass to the hook.
* @param mixed $arg1
* Parameter to be passed to the hook.
* @param mixed $arg2
* Parameter to be passed to the hook.
* @param mixed $arg3
* Parameter to be passed to the hook.
* @param mixed $arg4
* Parameter to be passed to the hook.
* @param mixed $arg5
* Parameter to be passed to the hook.
* @param mixed $arg6
* Parameter to be passed to the hook.
* @param string $fnSuffix
* Function suffix, this is effectively the hook name.
*
* @return mixed
*/
/**
* @param int $numParams
* @param mixed $arg1
* @param mixed $arg2
* @param mixed $arg3
* @param mixed $arg4
* @param mixed $arg5
* @param mixed $arg6
* @param string $fnSuffix
*
* @return mixed
*/
public function invokeViaUF(
$numParams,
&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6,
$fnSuffix
) {
// ensure that we are running in a joomla context
// we've not yet figured out how to bootstrap joomla, so we should
// not execute hooks if joomla is not loaded
if (defined('_JEXEC')) {
//Invoke the Joomla plugin system to observe to civicrm events.
jimport('joomla.plugin.helper');
jimport('cms.plugin.helper');
JPluginHelper::importPlugin('civicrm');
// get app based on cli or web
if (PHP_SAPI != 'cli') {
$app = JFactory::getApplication('administrator');
}
else {
// condition on Joomla version
if (version_compare(JVERSION, '3.0', 'lt')) {
$app = JCli::getInstance();
}
else {
$app = JApplicationCli::getInstance();
}
}
$result = $app->triggerEvent($fnSuffix, array(&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6));
$moduleResult = $this->commonInvoke($numParams,
$arg1, $arg2, $arg3, $arg4, $arg5, $arg6,
$fnSuffix, 'joomla');
if (!empty($moduleResult) && is_array($moduleResult)) {
if (empty($result)) {
$result = $moduleResult;
}
else {
if (is_array($moduleResult)) {
$result = array_merge($result, $moduleResult);
}
}
}
if (!empty($result)) {
// collapse result returned from hooks
// CRM-9XXX
$finalResult = array();
foreach ($result as $res) {
if (!is_array($res)) {
$res = array($res);
}
$finalResult = array_merge($finalResult, $res);
}
$result = $finalResult;
}
return $result;
}
}
}

View file

@ -0,0 +1,77 @@
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM 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 Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CiviCRM_Hook
* @copyright CiviCRM LLC (c) 2004-2017
*/
class CRM_Utils_Hook_Soap extends CRM_Utils_Hook {
/**
* Invoke hooks.
*
* @param int $numParams
* Number of parameters to pass to the hook.
* @param mixed $arg1
* Parameter to be passed to the hook.
* @param mixed $arg2
* Parameter to be passed to the hook.
* @param mixed $arg3
* Parameter to be passed to the hook.
* @param mixed $arg4
* Parameter to be passed to the hook.
* @param mixed $arg5
* Parameter to be passed to the hook.
* @param mixed $arg6
* Parameter to be passed to the hook.
* @param string $fnSuffix
* Function suffix, this is effectively the hook name.
*
* @return mixed
*/
/**
* @param int $numParams
* @param mixed $arg1
* @param mixed $arg2
* @param mixed $arg3
* @param mixed $arg4
* @param mixed $arg5
* @param mixed $arg6
* @param string $fnSuffix
*
* @return mixed
*/
public function invokeViaUF(
$numParams,
&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6,
$fnSuffix
) {
// suppress all hok calls during soap
return NULL;
}
}

View file

@ -0,0 +1,132 @@
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM 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 Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CiviCRM_Hook
* @copyright CiviCRM LLC (c) 2004-2017
*/
class CRM_Utils_Hook_UnitTests extends CRM_Utils_Hook {
protected $mockObject;
/**
* @var array $adhocHooks to call
*/
protected $adhocHooks;
protected $civiModules = NULL;
/**
* Call this in CiviUnitTestCase::setUp()
*/
public function reset() {
$this->mockObject = NULL;
$this->adhocHooks = array();
}
/**
* Use a unit-testing mock object to handle hook invocations.
*
* e.g. hook_civicrm_foo === $mockObject->foo()
* Mocks with a magic `__call()` method are called for every hook invokation.
*
* @param object $mockObject
*/
public function setMock($mockObject) {
$this->mockObject = $mockObject;
}
/**
* Register a function to run when invoking a specific hook.
* @param string $hook
* Hook name, e.g civicrm_pre.
* @param array $callable
* Function to call ie array(class, method).
* eg. array($this, mymethod)
*/
public function setHook($hook, $callable) {
$this->adhocHooks[$hook] = $callable;
}
/**
* Invoke standard, mock and ad hoc hooks.
*
* @param int $numParams
* Number of parameters to pass to the hook.
* @param mixed $arg1
* Parameter to be passed to the hook.
* @param mixed $arg2
* Parameter to be passed to the hook.
* @param mixed $arg3
* Parameter to be passed to the hook.
* @param mixed $arg4
* Parameter to be passed to the hook.
* @param mixed $arg5
* Parameter to be passed to the hook.
* @param mixed $arg6
* Parameter to be passed to the hook.
* @param string $fnSuffix
* Function suffix, this is effectively the hook name.
*
* @return mixed
*/
public function invokeViaUF(
$numParams,
&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6,
$fnSuffix) {
$params = array(&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6);
$fResult1 = $fResult2 = $fResult3 = NULL;
// run standard hooks
if ($this->civiModules === NULL) {
$this->civiModules = array();
$this->requireCiviModules($this->civiModules);
}
$fResult1 = $this->runHooks($this->civiModules, $fnSuffix, $numParams, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
// run mock object hooks
if ($this->mockObject && is_callable(array($this->mockObject, $fnSuffix))) {
$fResult2 = call_user_func(array($this->mockObject, $fnSuffix), $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
}
// run adhoc hooks
if (!empty($this->adhocHooks[$fnSuffix])) {
$fResult3 = call_user_func_array($this->adhocHooks[$fnSuffix], $params);
}
$result = array();
foreach (array($fResult1, $fResult2, $fResult3) as $fResult) {
if (!empty($fResult) && is_array($fResult)) {
$result = array_merge($result, $fResult);
}
}
return empty($result) ? TRUE : $result;
}
}

View file

@ -0,0 +1,213 @@
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM 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 Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2017
*/
class CRM_Utils_Hook_WordPress extends CRM_Utils_Hook {
/**
* @var bool
*/
private $isBuilt = FALSE;
/**
* @var array(string)
*/
private $allModules = NULL;
/**
* @var array(string)
*/
private $civiModules = NULL;
/**
* @var array(string)
*/
private $wordpressModules = NULL;
/**
* @var array(string)
*/
private $hooksThatReturn = array(
'civicrm_upgrade',
'civicrm_caseSummary',
'civicrm_dashboard',
);
/**
* Invoke hooks.
*
* @param int $numParams
* Number of parameters to pass to the hook.
* @param mixed $arg1
* Parameter to be passed to the hook.
* @param mixed $arg2
* Parameter to be passed to the hook.
* @param mixed $arg3
* Parameter to be passed to the hook.
* @param mixed $arg4
* Parameter to be passed to the hook.
* @param mixed $arg5
* Parameter to be passed to the hook.
* @param mixed $arg6
* Parameter to be passed to the hook.
* @param string $fnSuffix
* Function suffix, this is effectively the hook name.
*
* @return mixed
*/
public function invokeViaUF(
$numParams,
&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6,
$fnSuffix
) {
// do_action_ref_array is the default way of calling WordPress hooks
// because for the most part no return value is wanted. However, this is
// only generally true, so using do_action_ref_array() is only called for those
// hooks which do not require a return value. We exclude the following, which
// are incompatible with the WordPress Plugin API:
//
// civicrm_upgrade
// http://wiki.civicrm.org/confluence/display/CRMDOC43/hook_civicrm_upgrade
//
// civicrm_caseSummary
// http://wiki.civicrm.org/confluence/display/CRMDOC43/hook_civicrm_caseSummary
//
// civicrm_dashboard
// http://wiki.civicrm.org/confluence/display/CRMDOC43/hook_civicrm_dashboard
// distinguish between types of hook
if (!in_array($fnSuffix, $this->hooksThatReturn)) {
// only pass the arguments that have values
$args = array_slice(
array(&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6),
0,
$numParams
);
// Use WordPress Plugins API to modify $args
//
// Because $args are passed as references to the WordPress callbacks,
// runHooks subsequently receives appropriately modified parameters.
// protect from REST calls
if (function_exists('do_action_ref_array')) {
do_action_ref_array($fnSuffix, $args);
}
}
// The following is based on the logic of the Joomla hook file by allowing
// WordPress callbacks to do their stuff before runHooks gets called.
// It also follows the logic of the Drupal hook file by building the "module"
// (read "plugin") list and then calling runHooks directly. This should avoid
// the need for the post-processing that the Joomla hook file does.
// Note that hooks which require a return value are incompatible with the
// signature of apply_filters_ref_array and must therefore be called in
// global scope, like in Drupal. It's not ideal, but plugins can always route
// these calls to methods in their classes.
// At some point, those hooks could be pre-processed and called via the WordPress
// Plugin API, but it would change their signature and require the CiviCRM docs
// to be rewritten for those calls in WordPress. So it's been done this way for
// now. Ideally these hooks will be deprecated in favour of hooks that do not
// require return values.
// build list of registered plugin codes
$this->buildModuleList();
// Call runHooks the same way Drupal does
$moduleResult = $this->runHooks(
$this->allModules,
$fnSuffix,
$numParams,
$arg1, $arg2, $arg3, $arg4, $arg5, $arg6
);
// finally, return
return empty($moduleResult) ? TRUE : $moduleResult;
}
/**
* Build the list of plugins ("modules" in CiviCRM terminology) to be processed for hooks.
*
* We need to do this to preserve the CiviCRM hook signatures for hooks that require
* a return value, since the WordPress Plugin API seems to be incompatible with them.
*
* Copied and adapted from: CRM/Utils/Hook/Drupal6.php
*/
public function buildModuleList() {
if ($this->isBuilt === FALSE) {
if ($this->wordpressModules === NULL) {
// include custom PHP file - copied from parent->commonBuildModuleList()
$config = CRM_Core_Config::singleton();
if (!empty($config->customPHPPathDir) &&
file_exists("{$config->customPHPPathDir}/civicrmHooks.php")
) {
@include_once "{$config->customPHPPathDir}/civicrmHooks.php";
}
// initialise with the pre-existing 'wordpress' prefix
$this->wordpressModules = array('wordpress');
// Use WordPress Plugin API to build list
// a plugin simply needs to declare its "unique_plugin_code" thus:
// add_filter('civicrm_wp_plugin_codes', 'function_that_returns_my_unique_plugin_code');
// protect from REST calls
if (function_exists('apply_filters')) {
$this->wordpressModules = apply_filters('civicrm_wp_plugin_codes', $this->wordpressModules);
}
}
if ($this->civiModules === NULL) {
$this->civiModules = array();
$this->requireCiviModules($this->civiModules);
}
$this->allModules = array_merge((array) $this->wordpressModules, (array) $this->civiModules);
if ($this->wordpressModules !== NULL && $this->civiModules !== NULL) {
// both CRM and CMS have bootstrapped, so this is the final list
$this->isBuilt = TRUE;
}
}
}
}