3 // AUTO-GENERATED FILE -- Civix may overwrite any changes made to this file
6 * (Delegated) Implementation of hook_civicrm_config
8 function _clickatell_civix_civicrm_config(&$config = NULL) {
9 static $configured = FALSE;
10 if ($configured) return;
13 $template =& CRM_Core_Smarty
::singleton();
15 $extRoot = dirname( __FILE__
) . DIRECTORY_SEPARATOR
;
16 $extDir = $extRoot . 'templates';
18 if ( is_array( $template->template_dir
) ) {
19 array_unshift( $template->template_dir
, $extDir );
21 $template->template_dir
= array( $extDir, $template->template_dir
);
24 $include_path = $extRoot . PATH_SEPARATOR
. get_include_path( );
25 set_include_path( $include_path );
29 * (Delegated) Implementation of hook_civicrm_xmlMenu
31 * @param $files array(string)
33 function _clickatell_civix_civicrm_xmlMenu(&$files) {
34 foreach (glob(__DIR__
. '/xml/Menu/*.xml') as $file) {
40 * Implementation of hook_civicrm_install
42 function _clickatell_civix_civicrm_install() {
43 _clickatell_civix_civicrm_config();
44 if ($upgrader = _clickatell_civix_upgrader()) {
45 return $upgrader->onInstall();
50 * Implementation of hook_civicrm_uninstall
52 function _clickatell_civix_civicrm_uninstall() {
53 _clickatell_civix_civicrm_config();
54 if ($upgrader = _clickatell_civix_upgrader()) {
55 return $upgrader->onUninstall();
60 * (Delegated) Implementation of hook_civicrm_enable
62 function _clickatell_civix_civicrm_enable() {
63 _clickatell_civix_civicrm_config();
64 if ($upgrader = _clickatell_civix_upgrader()) {
65 if (is_callable(array($upgrader, 'onEnable'))) {
66 return $upgrader->onEnable();
72 * (Delegated) Implementation of hook_civicrm_disable
74 function _clickatell_civix_civicrm_disable() {
75 _clickatell_civix_civicrm_config();
76 if ($upgrader = _clickatell_civix_upgrader()) {
77 if (is_callable(array($upgrader, 'onDisable'))) {
78 return $upgrader->onDisable();
84 * (Delegated) Implementation of hook_civicrm_upgrade
86 * @param $op string, the type of operation being performed; 'check' or 'enqueue'
87 * @param $queue CRM_Queue_Queue, (for 'enqueue') the modifiable list of pending up upgrade tasks
89 * @return mixed based on op. for 'check', returns array(boolean) (TRUE if upgrades are pending)
90 * for 'enqueue', returns void
92 function _clickatell_civix_civicrm_upgrade($op, CRM_Queue_Queue
$queue = NULL) {
93 if ($upgrader = _clickatell_civix_upgrader()) {
94 return $upgrader->onUpgrade($op, $queue);
101 function _clickatell_civix_upgrader() {
102 if (!file_exists(__DIR__
.'/CRM/Clickatell/Upgrader.php')) {
105 return CRM_Clickatell_Upgrader_Base
::instance();
110 * Search directory tree for files which match a glob pattern
112 * @param $dir string, base dir
113 * @param $pattern string, glob pattern, eg "*.txt"
114 * @return array(string)
116 function _clickatell_civix_find_files($dir, $pattern) {
117 $todos = array($dir);
119 while (!empty($todos)) {
120 $subdir = array_shift($todos);
121 foreach (glob("$subdir/$pattern") as $match) {
122 if (!is_dir($match)) {
126 if ($dh = opendir($subdir)) {
127 while (FALSE !== ($entry = readdir($dh))) {
128 $path = $subdir . DIRECTORY_SEPARATOR
. $entry;
129 if ($entry == '.' ||
$entry == '..') {
130 } elseif (is_dir($path)) {
140 * (Delegated) Implementation of hook_civicrm_managed
142 * Find any *.mgd.php files, merge their content, and return.
144 function _clickatell_civix_civicrm_managed(&$entities) {
145 $mgdFiles = _clickatell_civix_find_files(__DIR__
, '*.mgd.php');
146 foreach ($mgdFiles as $file) {
148 foreach ($es as $e) {
149 if (empty($e['module'])) {
150 $e['module'] = 'org.civicrm.sms.clickatell';