Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Extensions
UK Postcodes
Commits
fb56fc17
Commit
fb56fc17
authored
Jan 07, 2021
by
mattwire
Browse files
Regenerate boilerplate
parent
ef4d64cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
civicrmpostcodelookup.civix.php
View file @
fb56fc17
...
...
@@ -7,9 +7,9 @@
* extension.
*/
class
CRM_Civicrmpostcodelookup_ExtensionUtil
{
const
SHORT_NAME
=
"
civicrmpostcodelookup
"
;
const
LONG_NAME
=
"
uk.co.vedaconsulting.module.civicrmpostcodelookup
"
;
const
CLASS_PREFIX
=
"
CRM_Civicrmpostcodelookup
"
;
const
SHORT_NAME
=
'
civicrmpostcodelookup
'
;
const
LONG_NAME
=
'
uk.co.vedaconsulting.module.civicrmpostcodelookup
'
;
const
CLASS_PREFIX
=
'
CRM_Civicrmpostcodelookup
'
;
/**
* Translate a string using the extension's domain.
...
...
@@ -82,7 +82,7 @@ use CRM_Civicrmpostcodelookup_ExtensionUtil as E;
/**
* (Delegated) Implements hook_civicrm_config().
*
* @link http://
wiki
.civicrm.org/
confluence/display/CRMDOC
/hook_civicrm_config
* @link http
s
://
docs
.civicrm.org/
dev/en/latest/hooks
/hook_civicrm_config
*/
function
_civicrmpostcodelookup_civix_civicrm_config
(
&
$config
=
NULL
)
{
static
$configured
=
FALSE
;
...
...
@@ -112,7 +112,7 @@ function _civicrmpostcodelookup_civix_civicrm_config(&$config = NULL) {
*
* @param $files array(string)
*
* @link http://
wiki
.civicrm.org/
confluence/display/CRMDOC
/hook_civicrm_xmlMenu
* @link http
s
://
docs
.civicrm.org/
dev/en/latest/hooks
/hook_civicrm_xmlMenu
*/
function
_civicrmpostcodelookup_civix_civicrm_xmlMenu
(
&
$files
)
{
foreach
(
_civicrmpostcodelookup_civix_glob
(
__DIR__
.
'/xml/Menu/*.xml'
)
as
$file
)
{
...
...
@@ -123,7 +123,7 @@ function _civicrmpostcodelookup_civix_civicrm_xmlMenu(&$files) {
/**
* Implements hook_civicrm_install().
*
* @link http://
wiki
.civicrm.org/
confluence/display/CRMDOC
/hook_civicrm_install
* @link http
s
://
docs
.civicrm.org/
dev/en/latest/hooks
/hook_civicrm_install
*/
function
_civicrmpostcodelookup_civix_civicrm_install
()
{
_civicrmpostcodelookup_civix_civicrm_config
();
...
...
@@ -135,7 +135,7 @@ function _civicrmpostcodelookup_civix_civicrm_install() {
/**
* Implements hook_civicrm_postInstall().
*
* @link http://
wiki
.civicrm.org/
confluence/display/CRMDOC
/hook_civicrm_postInstall
* @link http
s
://
docs
.civicrm.org/
dev/en/latest/hooks
/hook_civicrm_postInstall
*/
function
_civicrmpostcodelookup_civix_civicrm_postInstall
()
{
_civicrmpostcodelookup_civix_civicrm_config
();
...
...
@@ -149,7 +149,7 @@ function _civicrmpostcodelookup_civix_civicrm_postInstall() {
/**
* Implements hook_civicrm_uninstall().
*
* @link http://
wiki
.civicrm.org/
confluence/display/CRMDOC
/hook_civicrm_uninstall
* @link http
s
://
docs
.civicrm.org/
dev/en/latest/hooks
/hook_civicrm_uninstall
*/
function
_civicrmpostcodelookup_civix_civicrm_uninstall
()
{
_civicrmpostcodelookup_civix_civicrm_config
();
...
...
@@ -161,7 +161,7 @@ function _civicrmpostcodelookup_civix_civicrm_uninstall() {
/**
* (Delegated) Implements hook_civicrm_enable().
*
* @link http://
wiki
.civicrm.org/
confluence/display/CRMDOC
/hook_civicrm_enable
* @link http
s
://
docs
.civicrm.org/
dev/en/latest/hooks
/hook_civicrm_enable
*/
function
_civicrmpostcodelookup_civix_civicrm_enable
()
{
_civicrmpostcodelookup_civix_civicrm_config
();
...
...
@@ -175,7 +175,7 @@ function _civicrmpostcodelookup_civix_civicrm_enable() {
/**
* (Delegated) Implements hook_civicrm_disable().
*
* @link http://
wiki
.civicrm.org/
confluence/display/CRMDOC
/hook_civicrm_disable
* @link http
s
://
docs
.civicrm.org/
dev/en/latest/hooks
/hook_civicrm_disable
* @return mixed
*/
function
_civicrmpostcodelookup_civix_civicrm_disable
()
{
...
...
@@ -193,10 +193,11 @@ function _civicrmpostcodelookup_civix_civicrm_disable() {
* @param $op string, the type of operation being performed; 'check' or 'enqueue'
* @param $queue CRM_Queue_Queue, (for 'enqueue') the modifiable list of pending up upgrade tasks
*
* @return mixed based on op. for 'check', returns array(boolean) (TRUE if upgrades are pending)
* for 'enqueue', returns void
* @return mixed
* based on op. for 'check', returns array(boolean) (TRUE if upgrades are pending)
* for 'enqueue', returns void
*
* @link http://
wiki
.civicrm.org/
confluence/display/CRMDOC
/hook_civicrm_upgrade
* @link http
s
://
docs
.civicrm.org/
dev/en/latest/hooks
/hook_civicrm_upgrade
*/
function
_civicrmpostcodelookup_civix_civicrm_upgrade
(
$op
,
CRM_Queue_Queue
$queue
=
NULL
)
{
if
(
$upgrader
=
_civicrmpostcodelookup_civix_upgrader
())
{
...
...
@@ -217,14 +218,15 @@ function _civicrmpostcodelookup_civix_upgrader() {
}
/**
* Search directory tree for files which match a glob pattern
* Search directory tree for files which match a glob pattern
.
*
* Note: Dot-directories (like "..", ".git", or ".svn") will be ignored.
* Note: In Civi 4.3+, delegate to CRM_Utils_File::findFiles()
*
* @param $dir string, base dir
* @param $pattern string, glob pattern, eg "*.txt"
* @return array(string)
* @param string $dir base dir
* @param string $pattern , glob pattern, eg "*.txt"
*
* @return array
*/
function
_civicrmpostcodelookup_civix_find_files
(
$dir
,
$pattern
)
{
if
(
is_callable
([
'CRM_Utils_File'
,
'findFiles'
]))
{
...
...
@@ -243,7 +245,7 @@ function _civicrmpostcodelookup_civix_find_files($dir, $pattern) {
if
(
$dh
=
opendir
(
$subdir
))
{
while
(
FALSE
!==
(
$entry
=
readdir
(
$dh
)))
{
$path
=
$subdir
.
DIRECTORY_SEPARATOR
.
$entry
;
if
(
$entry
{
0
}
==
'.'
)
{
if
(
$entry
[
0
]
==
'.'
)
{
}
elseif
(
is_dir
(
$path
))
{
$todos
[]
=
$path
;
...
...
@@ -254,12 +256,13 @@ function _civicrmpostcodelookup_civix_find_files($dir, $pattern) {
}
return
$result
;
}
/**
* (Delegated) Implements hook_civicrm_managed().
*
* Find any *.mgd.php files, merge their content, and return.
*
* @link http://
wiki
.civicrm.org/
confluence/display/CRMDOC
/hook_civicrm_managed
* @link http
s
://
docs
.civicrm.org/
dev/en/latest/hooks
/hook_civicrm_managed
*/
function
_civicrmpostcodelookup_civix_civicrm_managed
(
&
$entities
)
{
$mgdFiles
=
_civicrmpostcodelookup_civix_find_files
(
__DIR__
,
'*.mgd.php'
);
...
...
@@ -285,7 +288,7 @@ function _civicrmpostcodelookup_civix_civicrm_managed(&$entities) {
*
* Note: This hook only runs in CiviCRM 4.4+.
*
* @link http://
wiki
.civicrm.org/
confluence/display/CRMDOC
/hook_civicrm_caseTypes
* @link http
s
://
docs
.civicrm.org/
dev/en/latest/hooks
/hook_civicrm_caseTypes
*/
function
_civicrmpostcodelookup_civix_civicrm_caseTypes
(
&
$caseTypes
)
{
if
(
!
is_dir
(
__DIR__
.
'/xml/case'
))
{
...
...
@@ -296,8 +299,7 @@ function _civicrmpostcodelookup_civix_civicrm_caseTypes(&$caseTypes) {
$name
=
preg_replace
(
'/\.xml$/'
,
''
,
basename
(
$file
));
if
(
$name
!=
CRM_Case_XMLProcessor
::
mungeCaseType
(
$name
))
{
$errorMessage
=
sprintf
(
"Case-type file name is malformed (%s vs %s)"
,
$name
,
CRM_Case_XMLProcessor
::
mungeCaseType
(
$name
));
CRM_Core_Error
::
fatal
(
$errorMessage
);
// throw new CRM_Core_Exception($errorMessage);
throw
new
CRM_Core_Exception
(
$errorMessage
);
}
$caseTypes
[
$name
]
=
[
'module'
=>
E
::
LONG_NAME
,
...
...
@@ -314,7 +316,7 @@ function _civicrmpostcodelookup_civix_civicrm_caseTypes(&$caseTypes) {
*
* Note: This hook only runs in CiviCRM 4.5+.
*
* @link http://
wiki
.civicrm.org/
confluence/display/CRMDOC
/hook_civicrm_angularModules
* @link http
s
://
docs
.civicrm.org/
dev/en/latest/hooks
/hook_civicrm_angularModules
*/
function
_civicrmpostcodelookup_civix_civicrm_angularModules
(
&
$angularModules
)
{
if
(
!
is_dir
(
__DIR__
.
'/ang'
))
{
...
...
@@ -332,6 +334,25 @@ function _civicrmpostcodelookup_civix_civicrm_angularModules(&$angularModules) {
}
}
/**
* (Delegated) Implements hook_civicrm_themes().
*
* Find any and return any files matching "*.theme.php"
*/
function
_civicrmpostcodelookup_civix_civicrm_themes
(
&
$themes
)
{
$files
=
_civicrmpostcodelookup_civix_glob
(
__DIR__
.
'/*.theme.php'
);
foreach
(
$files
as
$file
)
{
$themeMeta
=
include
$file
;
if
(
empty
(
$themeMeta
[
'name'
]))
{
$themeMeta
[
'name'
]
=
preg_replace
(
':\.theme\.php$:'
,
''
,
basename
(
$file
));
}
if
(
empty
(
$themeMeta
[
'ext'
]))
{
$themeMeta
[
'ext'
]
=
E
::
LONG_NAME
;
}
$themes
[
$themeMeta
[
'name'
]]
=
$themeMeta
;
}
}
/**
* Glob wrapper which is guaranteed to return an array.
*
...
...
@@ -342,7 +363,8 @@ function _civicrmpostcodelookup_civix_civicrm_angularModules(&$angularModules) {
*
* @link http://php.net/glob
* @param string $pattern
* @return array, possibly empty
*
* @return array
*/
function
_civicrmpostcodelookup_civix_glob
(
$pattern
)
{
$result
=
glob
(
$pattern
);
...
...
@@ -357,6 +379,8 @@ function _civicrmpostcodelookup_civix_glob($pattern) {
* 'Mailing', or 'Administer/System Settings'
* @param array $item - the item to insert (parent/child attributes will be
* filled for you)
*
* @return bool
*/
function
_civicrmpostcodelookup_civix_insert_navigation_menu
(
&
$menu
,
$path
,
$item
)
{
// If we are done going down the path, insert menu
...
...
@@ -379,7 +403,7 @@ function _civicrmpostcodelookup_civix_insert_navigation_menu(&$menu, $path, $ite
if
(
!
isset
(
$entry
[
'child'
]))
{
$entry
[
'child'
]
=
[];
}
$found
=
_civicrmpostcodelookup_civix_insert_navigation_menu
(
$entry
[
'child'
],
implode
(
'/'
,
$path
),
$item
,
$key
);
$found
=
_civicrmpostcodelookup_civix_insert_navigation_menu
(
$entry
[
'child'
],
implode
(
'/'
,
$path
),
$item
);
}
}
return
$found
;
...
...
@@ -432,17 +456,11 @@ function _civicrmpostcodelookup_civix_fixNavigationMenuItems(&$nodes, &$maxNavID
/**
* (Delegated) Implements hook_civicrm_alterSettingsFolders().
*
* @link http://
wiki
.civicrm.org/
confluence/display/CRMDOC
/hook_civicrm_alterSettingsFolders
* @link http
s
://
docs
.civicrm.org/
dev/en/latest/hooks
/hook_civicrm_alterSettingsFolders
*/
function
_civicrmpostcodelookup_civix_civicrm_alterSettingsFolders
(
&
$metaDataFolders
=
NULL
)
{
static
$configured
=
FALSE
;
if
(
$configured
)
{
return
;
}
$configured
=
TRUE
;
$settingsDir
=
__DIR__
.
DIRECTORY_SEPARATOR
.
'settings'
;
if
(
is_dir
(
$settingsDir
)
&&
!
in_array
(
$settingsDir
,
$metaDataFolders
))
{
if
(
!
in_array
(
$settingsDir
,
$metaDataFolders
)
&&
is_dir
(
$settingsDir
)
)
{
$metaDataFolders
[]
=
$settingsDir
;
}
}
...
...
@@ -452,10 +470,8 @@ function _civicrmpostcodelookup_civix_civicrm_alterSettingsFolders(&$metaDataFol
*
* Find any *.entityType.php files, merge their content, and return.
*
* @link http://
wiki
.civicrm.org/
confluence/display/CRMDOC
/hook_civicrm_entityTypes
* @link http
s
://
docs
.civicrm.org/
dev/en/latest/hooks
/hook_civicrm_entityTypes
*/
function
_civicrmpostcodelookup_civix_civicrm_entityTypes
(
&
$entityTypes
)
{
$entityTypes
=
array_merge
(
$entityTypes
,
[
]);
$entityTypes
=
array_merge
(
$entityTypes
,
[]);
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment