From: eileen Date: Thu, 2 May 2019 02:37:57 +0000 (+1200) Subject: IDE re-format of tools directory X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b7c0a88f00c3003c0794c0003ac74dde8ca60293;p=civicrm-core.git IDE re-format of tools directory We didn't fix array syntax on this one yet --- diff --git a/tools/bin/scripts/ImportTags.php b/tools/bin/scripts/ImportTags.php index 95c0ac018a..df222ccaad 100644 --- a/tools/bin/scripts/ImportTags.php +++ b/tools/bin/scripts/ImportTags.php @@ -24,8 +24,7 @@ */ - -require_once ('bin/cli.php'); +require_once('bin/cli.php'); require_once 'CRM/Core/BAO/Tag.php'; /** @@ -41,7 +40,7 @@ class tagsImporter extends civicrm_cli { die("you need to profide a csv file (1st column parent name, 2nd tag name"); } $this->file = $this->args[0]; - $this->tags = array_flip(CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', array('onlyActive' => FALSE))); + $this->tags = array_flip(CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', ['onlyActive' => FALSE])); } //format expected: parent name, tag @@ -70,12 +69,17 @@ class tagsImporter extends civicrm_cli { echo "\n- exists already: " . $param['name']; return; } - $key = array('tag' => ''); + $key = ['tag' => '']; if ($param['parent']) { if (array_key_exists($param['parent'], $this->tags)) { $param['parent_id'] = $this->tags[$param['parent']]; } - else $param['parent_id'] = $this->addTag(array(parent => '', name => $param['parent'])); + else { + $param['parent_id'] = $this->addTag([ + parent => '', + name => $param['parent'], + ]); + } $tag = CRM_Core_BAO_Tag::add($param, $key); echo "\n" . $tag->id . ": create " . $param['name'] . " below " . $param['parent']; } diff --git a/tools/bin/scripts/NormalizePhone.php b/tools/bin/scripts/NormalizePhone.php index 331e3a6bad..f4bfaf16f0 100644 --- a/tools/bin/scripts/NormalizePhone.php +++ b/tools/bin/scripts/NormalizePhone.php @@ -44,7 +44,7 @@ function run() { require_once 'Console/Getopt.php'; $shortOptions = "n:p:k:pre"; - $longOptions = array('name=', 'pass=', 'key=', 'prefix='); + $longOptions = ['name=', 'pass=', 'key=', 'prefix=']; $getopt = new Console_Getopt(); $args = $getopt->readPHPArgv(); @@ -52,12 +52,12 @@ function run() { array_shift($args); list($valid, $dontCare) = $getopt->getopt2($args, $shortOptions, $longOptions); - $vars = array( + $vars = [ 'name' => 'n', 'pass' => 'p', 'key' => 'k', 'prefix' => 'pre', - ); + ]; foreach ($vars as $var => $short) { $$var = NULL; @@ -100,9 +100,10 @@ AND phone NOT REGEXP '^[[:digit:]]{3}-[[:digit:]]{3}-[[:digit:]]{4}$' $dao = &CRM_Core_DAO::executeQuery($query); $updateQuery = "UPDATE civicrm_phone SET phone = %1 where id = %2"; - $params = array(1 => array('', 'String'), - 2 => array(0, 'Integer'), - ); + $params = [ + 1 => ['', 'String'], + 2 => [0, 'Integer'], + ]; $totalPhone = $validPhone = $nonPrefixedPhone = 0; while ($dao->fetch()) { $newPhone = processPhone($dao->phone, $prefix); diff --git a/tools/bin/scripts/ckeditorConfigScraper.php b/tools/bin/scripts/ckeditorConfigScraper.php index e95a66552b..ba95cfb4a1 100644 --- a/tools/bin/scripts/ckeditorConfigScraper.php +++ b/tools/bin/scripts/ckeditorConfigScraper.php @@ -3,14 +3,14 @@ * Scrape all config options from the CKEditor documentation site. */ $content = file_get_contents('http://docs.ckeditor.com/?print=/api/CKEDITOR.config'); -$matches = $output = array(); +$matches = $output = []; preg_match_all("#name expandable'>([^<]+)\s?:\s?(.*)([\s\S]*?)#", $content, $matches); foreach ($matches[1] as $i => $name) { - $output[] = array( + $output[] = [ 'id' => $name, 'type' => strip_tags($matches[2][$i]), - 'description' => str_replace(array("\n", '. ...'), array(' ', '.'), $matches[3][$i]), - ); + 'description' => str_replace(["\n", '. ...'], [' ', '.'], $matches[3][$i]), + ]; } if ($output) { $location = str_replace('tools/bin/scripts', '', __DIR__); diff --git a/tools/bin/scripts/cli.php b/tools/bin/scripts/cli.php index 9ac2f36482..823e82ee71 100644 --- a/tools/bin/scripts/cli.php +++ b/tools/bin/scripts/cli.php @@ -25,13 +25,12 @@ /** * A PHP shell script - - On drupal if you have a symlink to your civi module, don't forget to create a new file - settings_location.php - Enter the following code (substitute the actual location of your /sites directory) - - + * + * On drupal if you have a symlink to your civi module, don't forget to create a new file - settings_location.php + * Enter the following code (substitute the actual location of your /sites directory) + * */ $include_path = "../packages/:" . get_include_path(); set_include_path($include_path); @@ -49,19 +48,19 @@ class civicrm_CLI { // set_include_path( $include_path ); require_once 'Console/Getopt.php'; $shortOptions = "s:u:p:k:"; - $longOptions = array('site=', 'user', 'pass'); + $longOptions = ['site=', 'user', 'pass']; $getopt = new Console_Getopt(); $args = $getopt->readPHPArgv(); array_shift($args); list($valid, $this->args) = $getopt->getopt2($args, $shortOptions, $longOptions); - $vars = array( + $vars = [ 'user' => 'u', 'pass' => 'p', 'key' => 'k', 'site' => 's', - ); + ]; foreach ($vars as $var => $short) { $$var = NULL; @@ -102,7 +101,7 @@ class civicrm_CLI { $_SERVER['PHP_SELF'] = "/index.php"; $_SERVER['HTTP_HOST'] = $this->site; $_REQUEST['key'] = $this->key; - require_once ("./civicrm.config.php"); + require_once("./civicrm.config.php"); } } diff --git a/tools/bin/scripts/memcache.php b/tools/bin/scripts/memcache.php index 918dc7a486..a7dff160fd 100644 --- a/tools/bin/scripts/memcache.php +++ b/tools/bin/scripts/memcache.php @@ -8,6 +8,6 @@ define('CIVICRM_USE_MEMCACHE', 1); $config = CRM_Core_Config::singleton(); $cache = CRM_Utils_Cache::singleton(); -$cache->set('CRM_Core_Config' .CRM_Core_Config::domainID(), $config); +$cache->set('CRM_Core_Config' . CRM_Core_Config::domainID(), $config); CRM_Core_Error::debug('get', $cache->get('CRM_Core_Config' . CRM_Core_Config::domainID())); diff --git a/tools/bin/scripts/set-version.php b/tools/bin/scripts/set-version.php index 711c196483..4b7a6d6071 100755 --- a/tools/bin/scripts/set-version.php +++ b/tools/bin/scripts/set-version.php @@ -44,7 +44,7 @@ switch (@$argv[2]) { echo "Changing version from $oldVersion to $newVersion...\n"; $verName = makeVerName($newVersion); -$phpFile = initFile("CRM/Upgrade/Incremental/php/{$verName}.php", function() use ($verName) { +$phpFile = initFile("CRM/Upgrade/Incremental/php/{$verName}.php", function () use ($verName) { ob_start(); global $camelNumber; $camelNumber = $verName; @@ -53,7 +53,7 @@ $phpFile = initFile("CRM/Upgrade/Incremental/php/{$verName}.php", function() use return ob_get_clean(); }); -$sqlFile = initFile("CRM/Upgrade/Incremental/sql/{$newVersion}.mysql.tpl", function() use ($newVersion) { +$sqlFile = initFile("CRM/Upgrade/Incremental/sql/{$newVersion}.mysql.tpl", function () use ($newVersion) { return "{* file to handle db changes in $newVersion during upgrade *}\n"; }); diff --git a/tools/bin/scripts/testProcess.php b/tools/bin/scripts/testProcess.php index ecfc0f9f6a..077836aa98 100644 --- a/tools/bin/scripts/testProcess.php +++ b/tools/bin/scripts/testProcess.php @@ -1,5 +1,6 @@ run(104, 1, 'Substance Abuse', '15 Day Review'); -$params = array('clientID' => 104, +$params = [ + 'clientID' => 104, 'creatorID' => 108, 'standardTimeline' => 1, 'activityTypeName' => 'Open Case', 'dueDateTime' => time(), 'caseID' => 1, -); +]; require_once 'CRM/Case/XMLProcessor/Process.php'; $xmlProcessor = new CRM_Case_XMLProcessor_Process(); diff --git a/tools/bin/scripts/updateNameCache.php b/tools/bin/scripts/updateNameCache.php index f47685e1d4..6d2f8fc20d 100644 --- a/tools/bin/scripts/updateNameCache.php +++ b/tools/bin/scripts/updateNameCache.php @@ -26,7 +26,6 @@ */ - /* * This script recaches the display_name and sort_name values * @@ -42,7 +41,7 @@ class CRM_UpdateNameCache { function __construct() { // you can run this program either from an apache command, or from the cli if (php_sapi_name() == "cli") { - require_once ("cli.php"); + require_once("cli.php"); $cli = new civicrm_cli(); //if it doesn't die, it's authenticated } @@ -81,9 +80,9 @@ class CRM_UpdateNameCache { $prefixes = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id'); $suffixes = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id'); - $tokens = array(); + $tokens = []; CRM_Utils_Hook::tokens($tokens); - $tokenFields = array(); + $tokenFields = []; foreach ($tokens as $category => $catTokens) { foreach ($catTokens as $token) { $tokenFields[] = $token; @@ -100,12 +99,13 @@ class CRM_UpdateNameCache { while ($dao->fetch()) { $contactID = $dao->id; - $params = array('first_name' => $dao->first_name, + $params = [ + 'first_name' => $dao->first_name, 'middle_name' => $dao->middle_name, 'last_name' => $dao->last_name, 'prefix_id' => $dao->prefix_id, 'suffix_id' => $dao->suffix_id, - ); + ]; $params['individual_prefix'] = $prefixes[$dao->prefix_id]; $params['individual_suffix'] = $suffixes[$dao->suffix_id]; diff --git a/tools/drupal/modules/civicrm_webtest/civicrm_webtest.install b/tools/drupal/modules/civicrm_webtest/civicrm_webtest.install index cba6b799f2..9e4ae1695e 100644 --- a/tools/drupal/modules/civicrm_webtest/civicrm_webtest.install +++ b/tools/drupal/modules/civicrm_webtest/civicrm_webtest.install @@ -4,7 +4,7 @@ * Implementation of hook_enable */ function civicrm_webtest_enable() { - user_role_grant_permissions(1, array( + user_role_grant_permissions(1, [ 'access CiviMail subscribe/unsubscribe pages', 'access all custom data', 'access uploaded files', @@ -12,7 +12,7 @@ function civicrm_webtest_enable() { 'profile create', 'profile view', 'register for events', - )); + ]); $roles = user_roles(); if (!in_array('civicrm_webtest_user', $roles)) { @@ -20,87 +20,88 @@ function civicrm_webtest_enable() { $role->name = 'civicrm_webtest_user'; user_role_save($role); $rid = $role->rid; - } else { + } + else { $rid = array_search('civicrm_webtest_user', $roles); } - user_role_grant_permissions($rid, array( + user_role_grant_permissions($rid, [ // FIXME: whoa, why do we bother with users if both need admin rights? - 'access AJAX API', + 'access AJAX API', // 'access all cases and activities', - 'access all custom data', - 'access CiviContribute', - 'access CiviCRM', - 'access CiviEvent', - // 'access CiviGrant', - 'access CiviMail', - 'access CiviMail subscribe/unsubscribe pages', - 'access CiviMember', - 'access CiviPledge', - 'access CiviReport', - 'access Contact Dashboard', - 'access contact reference fields', - 'access deleted contacts', - // 'access my cases and activities', - 'access Report Criteria', - 'save Report Criteria', - 'access uploaded files', - // 'add cases', - 'add contacts', - // 'administer CiviCase', - 'administer CiviCRM', - 'administer dedupe rules', - 'administer Reports', - 'administer reserved groups', - 'administer reserved reports', - 'administer reserved tags', - 'administer Tagsets', - 'delete activities', - 'delete contacts', - // 'delete in CiviCase', - 'delete in CiviContribute', - 'delete in CiviEvent', - // 'delete in CiviGrant', - 'delete in CiviMail', - 'delete in CiviMember', - 'delete in CiviPledge', - 'edit all contacts', - 'view my contact', - 'edit my contact', - 'edit all events', - 'edit contributions', - 'edit event participants', - 'edit message templates', - // 'edit grants', - 'edit groups', - 'edit memberships', - 'edit pledges', - 'import contacts', - 'make online contributions', - 'manage tags', - 'merge duplicate contacts', - 'profile create', - 'profile edit', - 'profile listings', - 'profile listings and forms', - 'profile view', - 'register for events', - 'translate CiviCRM', - 'view all activities', - 'view all contacts', - 'view all notes', - 'view event info', - 'view event participants', - 'view public CiviMail content', - 'administer payment processors', - 'create manual batch', - 'edit own manual batches', - 'edit all manual batches', - 'view own manual batches', - 'view all manual batches', - 'delete own manual batches', - 'delete all manual batches', - 'export own manual batches', - 'export all manual batches', - )); + 'access all custom data', + 'access CiviContribute', + 'access CiviCRM', + 'access CiviEvent', + // 'access CiviGrant', + 'access CiviMail', + 'access CiviMail subscribe/unsubscribe pages', + 'access CiviMember', + 'access CiviPledge', + 'access CiviReport', + 'access Contact Dashboard', + 'access contact reference fields', + 'access deleted contacts', + // 'access my cases and activities', + 'access Report Criteria', + 'save Report Criteria', + 'access uploaded files', + // 'add cases', + 'add contacts', + // 'administer CiviCase', + 'administer CiviCRM', + 'administer dedupe rules', + 'administer Reports', + 'administer reserved groups', + 'administer reserved reports', + 'administer reserved tags', + 'administer Tagsets', + 'delete activities', + 'delete contacts', + // 'delete in CiviCase', + 'delete in CiviContribute', + 'delete in CiviEvent', + // 'delete in CiviGrant', + 'delete in CiviMail', + 'delete in CiviMember', + 'delete in CiviPledge', + 'edit all contacts', + 'view my contact', + 'edit my contact', + 'edit all events', + 'edit contributions', + 'edit event participants', + 'edit message templates', + // 'edit grants', + 'edit groups', + 'edit memberships', + 'edit pledges', + 'import contacts', + 'make online contributions', + 'manage tags', + 'merge duplicate contacts', + 'profile create', + 'profile edit', + 'profile listings', + 'profile listings and forms', + 'profile view', + 'register for events', + 'translate CiviCRM', + 'view all activities', + 'view all contacts', + 'view all notes', + 'view event info', + 'view event participants', + 'view public CiviMail content', + 'administer payment processors', + 'create manual batch', + 'edit own manual batches', + 'edit all manual batches', + 'view own manual batches', + 'view all manual batches', + 'delete own manual batches', + 'delete all manual batches', + 'export own manual batches', + 'export all manual batches', + ]); } diff --git a/tools/extensions/org.civicrm.angularex/angularex.civix.php b/tools/extensions/org.civicrm.angularex/angularex.civix.php index 79958c9e40..69dee259d3 100644 --- a/tools/extensions/org.civicrm.angularex/angularex.civix.php +++ b/tools/extensions/org.civicrm.angularex/angularex.civix.php @@ -10,22 +10,25 @@ */ function _angularex_civix_civicrm_config(&$config = NULL) { static $configured = FALSE; - if ($configured) return; + if ($configured) { + return; + } $configured = TRUE; $template =& CRM_Core_Smarty::singleton(); - $extRoot = dirname( __FILE__ ) . DIRECTORY_SEPARATOR; + $extRoot = dirname(__FILE__) . DIRECTORY_SEPARATOR; $extDir = $extRoot . 'templates'; - if ( is_array( $template->template_dir ) ) { - array_unshift( $template->template_dir, $extDir ); - } else { - $template->template_dir = array( $extDir, $template->template_dir ); + if (is_array($template->template_dir)) { + array_unshift($template->template_dir, $extDir); + } + else { + $template->template_dir = [$extDir, $template->template_dir]; } - $include_path = $extRoot . PATH_SEPARATOR . get_include_path( ); - set_include_path( $include_path ); + $include_path = $extRoot . PATH_SEPARATOR . get_include_path(); + set_include_path($include_path); } /** @@ -72,7 +75,7 @@ function _angularex_civix_civicrm_uninstall() { function _angularex_civix_civicrm_enable() { _angularex_civix_civicrm_config(); if ($upgrader = _angularex_civix_upgrader()) { - if (is_callable(array($upgrader, 'onEnable'))) { + if (is_callable([$upgrader, 'onEnable'])) { return $upgrader->onEnable(); } } @@ -86,7 +89,7 @@ function _angularex_civix_civicrm_enable() { function _angularex_civix_civicrm_disable() { _angularex_civix_civicrm_config(); if ($upgrader = _angularex_civix_upgrader()) { - if (is_callable(array($upgrader, 'onDisable'))) { + if (is_callable([$upgrader, 'onDisable'])) { return $upgrader->onDisable(); } } @@ -113,9 +116,10 @@ function _angularex_civix_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) { * @return CRM_Angularex_Upgrader */ function _angularex_civix_upgrader() { - if (!file_exists(__DIR__.'/CRM/Angularex/Upgrader.php')) { + if (!file_exists(__DIR__ . '/CRM/Angularex/Upgrader.php')) { return NULL; - } else { + } + else { return CRM_Angularex_Upgrader_Base::instance(); } } @@ -131,12 +135,12 @@ function _angularex_civix_upgrader() { * @return array(string) */ function _angularex_civix_find_files($dir, $pattern) { - if (is_callable(array('CRM_Utils_File', 'findFiles'))) { + if (is_callable(['CRM_Utils_File', 'findFiles'])) { return CRM_Utils_File::findFiles($dir, $pattern); } - $todos = array($dir); - $result = array(); + $todos = [$dir]; + $result = []; while (!empty($todos)) { $subdir = array_shift($todos); foreach (_angularex_civix_glob("$subdir/$pattern") as $match) { @@ -148,7 +152,8 @@ function _angularex_civix_find_files($dir, $pattern) { while (FALSE !== ($entry = readdir($dh))) { $path = $subdir . DIRECTORY_SEPARATOR . $entry; if ($entry{0} == '.') { - } elseif (is_dir($path)) { + } + elseif (is_dir($path)) { $todos[] = $path; } } @@ -202,11 +207,11 @@ function _angularex_civix_civicrm_caseTypes(&$caseTypes) { CRM_Core_Error::fatal($errorMessage); // throw new CRM_Core_Exception($errorMessage); } - $caseTypes[$name] = array( + $caseTypes[$name] = [ 'module' => 'org.civicrm.angularex', 'name' => $name, 'file' => $file, - ); + ]; } } @@ -224,7 +229,7 @@ function _angularex_civix_civicrm_caseTypes(&$caseTypes) { */ function _angularex_civix_glob($pattern) { $result = glob($pattern); - return is_array($result) ? $result : array(); + return is_array($result) ? $result : []; } /** @@ -245,25 +250,30 @@ function _angularex_civix_insert_navigation_menu(&$menu, $path, $item, $parentId // If we are done going down the path, insert menu if (empty($path)) { - if (!$navId) $navId = CRM_Core_DAO::singleValueQuery("SELECT max(id) FROM civicrm_navigation"); - $navId ++; - $menu[$navId] = array ( - 'attributes' => array_merge($item, array( - 'label' => CRM_Utils_Array::value('name', $item), - 'active' => 1, - 'parentID' => $parentId, - 'navID' => $navId, - )) - ); - return true; - } else { + if (!$navId) { + $navId = CRM_Core_DAO::singleValueQuery("SELECT max(id) FROM civicrm_navigation"); + } + $navId++; + $menu[$navId] = [ + 'attributes' => array_merge($item, [ + 'label' => CRM_Utils_Array::value('name', $item), + 'active' => 1, + 'parentID' => $parentId, + 'navID' => $navId, + ]), + ]; + return TRUE; + } + else { // Find an recurse into the next level down - $found = false; + $found = FALSE; $path = explode('/', $path); $first = array_shift($path); foreach ($menu as $key => &$entry) { if ($entry['attributes']['name'] == $first) { - if (!$entry['child']) $entry['child'] = array(); + if (!$entry['child']) { + $entry['child'] = []; + } $found = _angularex_civix_insert_navigation_menu($entry['child'], implode('/', $path), $item, $key); } } @@ -279,11 +289,13 @@ function _angularex_civix_insert_navigation_menu(&$menu, $path, $item, $parentId */ function _angularex_civix_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) { static $configured = FALSE; - if ($configured) return; + if ($configured) { + return; + } $configured = TRUE; $settingsDir = __DIR__ . DIRECTORY_SEPARATOR . 'settings'; - if(is_dir($settingsDir) && !in_array($settingsDir, $metaDataFolders)) { + if (is_dir($settingsDir) && !in_array($settingsDir, $metaDataFolders)) { $metaDataFolders[] = $settingsDir; } } diff --git a/tools/extensions/org.civicrm.angularex/angularex.php b/tools/extensions/org.civicrm.angularex/angularex.php index 064f725453..225edb358a 100644 --- a/tools/extensions/org.civicrm.angularex/angularex.php +++ b/tools/extensions/org.civicrm.angularex/angularex.php @@ -115,9 +115,9 @@ function angularex_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) { * @param $angularModule */ function angularex_civicrm_angularModules(&$angularModule) { - $angularModule['example'] = array( + $angularModule['example'] = [ 'ext' => 'org.civicrm.angularex', - 'js' => array('js/*.js'), - 'partials' => array('partials'), - ); + 'js' => ['js/*.js'], + 'partials' => ['partials'], + ]; } diff --git a/tools/extensions/org.civicrm.demoqueue/CRM/Demoqueue/Page/DemoQueue.php b/tools/extensions/org.civicrm.demoqueue/CRM/Demoqueue/Page/DemoQueue.php index df73fb08ba..a63c4eea01 100644 --- a/tools/extensions/org.civicrm.demoqueue/CRM/Demoqueue/Page/DemoQueue.php +++ b/tools/extensions/org.civicrm.demoqueue/CRM/Demoqueue/Page/DemoQueue.php @@ -9,33 +9,33 @@ class CRM_Demoqueue_Page_DemoQueue extends CRM_Core_Page { const QUEUE_NAME = 'demo-queue'; function run() { - $queue = CRM_Queue_Service::singleton()->create(array( + $queue = CRM_Queue_Service::singleton()->create([ 'type' => 'Sql', 'name' => self::QUEUE_NAME, 'reset' => TRUE, - )); + ]); for ($i = 0; $i < 5; $i++) { $queue->createItem(new CRM_Queue_Task( - array('CRM_Demoqueue_Page_DemoQueue', 'doMyWork'), // callback - array($i, "Task $i takes $i second(s)"), // arguments + ['CRM_Demoqueue_Page_DemoQueue', 'doMyWork'], // callback + [$i, "Task $i takes $i second(s)"], // arguments "Task $i" // title )); if ($i == 2) { $queue->createItem(new CRM_Queue_Task( - array('CRM_Demoqueue_Page_DemoQueue', 'addMoreWork'), // callback - array(), // arguments + ['CRM_Demoqueue_Page_DemoQueue', 'addMoreWork'], // callback + [], // arguments "Add More Work" // title )); } } - $runner = new CRM_Queue_Runner(array( + $runner = new CRM_Queue_Runner([ 'title' => ts('Demo Queue Runner'), 'queue' => $queue, - 'onEnd' => array('CRM_Demoqueue_Page_DemoQueue', 'onEnd'), + 'onEnd' => ['CRM_Demoqueue_Page_DemoQueue', 'onEnd'], 'onEndUrl' => CRM_Utils_System::url('civicrm/demo-queue/done'), - )); + ]); $runner->runAllViaWeb(); // does not return } @@ -65,12 +65,12 @@ class CRM_Demoqueue_Page_DemoQueue extends CRM_Core_Page { sleep(1); for ($i = 0; $i < 5; $i++) { $ctx->queue->createItem(new CRM_Queue_Task( - array('CRM_Demoqueue_Page_DemoQueue', 'doMyWork'), // callback - array($i, "Extra task $i takes $i second(s)"), // arguments + ['CRM_Demoqueue_Page_DemoQueue', 'doMyWork'], // callback + [$i, "Extra task $i takes $i second(s)"], // arguments "Extra Task $i" // title - ), array( + ), [ 'weight' => -1, - )); + ]); } return TRUE; // success } diff --git a/tools/extensions/org.civicrm.demoqueue/CRM/Demoqueue/Page/DemoQueueDone.php b/tools/extensions/org.civicrm.demoqueue/CRM/Demoqueue/Page/DemoQueueDone.php index 6f1eb17782..3f9fd4e427 100644 --- a/tools/extensions/org.civicrm.demoqueue/CRM/Demoqueue/Page/DemoQueueDone.php +++ b/tools/extensions/org.civicrm.demoqueue/CRM/Demoqueue/Page/DemoQueueDone.php @@ -6,9 +6,9 @@ require_once 'CRM/Core/Page.php'; * Class CRM_Demoqueue_Page_DemoQueueDone */ class CRM_Demoqueue_Page_DemoQueueDone extends CRM_Core_Page { - function run() { - // Example: Set the page-title dynamically; alternatively, declare a static title in xml/Menu/*.xml - CRM_Utils_System::setTitle(ts('DemoQueueDone')); - parent::run(); - } + function run() { + // Example: Set the page-title dynamically; alternatively, declare a static title in xml/Menu/*.xml + CRM_Utils_System::setTitle(ts('DemoQueueDone')); + parent::run(); + } } diff --git a/tools/extensions/org.civicrm.demoqueue/demoqueue.civix.php b/tools/extensions/org.civicrm.demoqueue/demoqueue.civix.php index cfc2973f96..2f643279de 100644 --- a/tools/extensions/org.civicrm.demoqueue/demoqueue.civix.php +++ b/tools/extensions/org.civicrm.demoqueue/demoqueue.civix.php @@ -9,17 +9,18 @@ function _demoqueue_civix_civicrm_config(&$config) { $template =& CRM_Core_Smarty::singleton(); - $extRoot = dirname( __FILE__ ) . DIRECTORY_SEPARATOR; + $extRoot = dirname(__FILE__) . DIRECTORY_SEPARATOR; $extDir = $extRoot . 'templates'; - if ( is_array( $template->template_dir ) ) { - array_unshift( $template->template_dir, $extDir ); - } else { - $template->template_dir = array( $extDir, $template->template_dir ); + if (is_array($template->template_dir)) { + array_unshift($template->template_dir, $extDir); + } + else { + $template->template_dir = [$extDir, $template->template_dir]; } - $include_path = $extRoot . PATH_SEPARATOR . get_include_path( ); - set_include_path( $include_path ); + $include_path = $extRoot . PATH_SEPARATOR . get_include_path(); + set_include_path($include_path); } /** diff --git a/tools/scripts/check-angular.php b/tools/scripts/check-angular.php index b0d44d3003..79a97aa097 100755 --- a/tools/scripts/check-angular.php +++ b/tools/scripts/check-angular.php @@ -5,7 +5,7 @@ eval(`cv php:boot`); global $civicrm_root; $realArgs = $argv; $diffCmd = FALSE; -$files = array(); +$files = []; array_shift($realArgs); foreach ($realArgs as $arg) { @@ -52,7 +52,7 @@ function compareFile($file, $diffCmd) { echo "File \"$file\" appears to have consistency issues. Created $newFile.\n"; file_put_contents($newFile, $newMarkup); if ($diffCmd) { - passthru($diffCmd . ' ' . escapeshellarg($file) . ' ' . escapeshellarg($newFile)); + passthru($diffCmd . ' ' . escapeshellarg($file) . ' ' . escapeshellarg($newFile)); } } -} \ No newline at end of file +} diff --git a/tools/scripts/civimail-spooler/civimail-spooler.php b/tools/scripts/civimail-spooler/civimail-spooler.php index 85ad8fd3da..8c79fb8c79 100644 --- a/tools/scripts/civimail-spooler/civimail-spooler.php +++ b/tools/scripts/civimail-spooler/civimail-spooler.php @@ -1,5 +1,6 @@ ] [-t ]\n"); print (" -b Run this process continuously\n"); print (" -c Path to CiviCRM civicrm.settings.php\n"); @@ -34,7 +35,6 @@ if (isset($options['b'])) { * process into the background and provide init.d scripts */ - CRM_Mailing_BAO_MailingJob::runJobs(); sleep($config->mailerPeriod); } diff --git a/tools/scripts/solr/createSolrJSON.php b/tools/scripts/solr/createSolrJSON.php index 005c6555c7..d567aa6991 100644 --- a/tools/scripts/solr/createSolrJSON.php +++ b/tools/scripts/solr/createSolrJSON.php @@ -42,10 +42,10 @@ define('CHUNK_SIZE', 128); function &splitContactIDs(&$contactIDs) { // contactIDs could be a real large array, so we split it up into // smaller chunks and then general xml for each chunk - $chunks = array(); - $current = 0; - $chunks[$current] = array(); - $count = 0; + $chunks = []; + $current = 0; + $chunks[$current] = []; + $count = 0; foreach ($contactIDs as $cid) { $chunks[$current][] = $cid; @@ -53,7 +53,7 @@ function &splitContactIDs(&$contactIDs) { if ($count == CHUNK_SIZE) { $current++; - $chunks[$current] = array(); + $chunks[$current] = []; $count = 0; } } @@ -81,7 +81,7 @@ function &generateSolrJSON($values) { foreach ($tokens as $n => $v) { if (is_array($v)) { - $str = array(); + $str = []; foreach ($v as $el) { $el = escapeJsonString($el); $str[] = "\"$el\""; @@ -115,8 +115,8 @@ function &generateSolrJSON($values) { * @return mixed */ function escapeJsonString($value) { - $escapers = array("\\", "/", "\"", "\n", "\r", "\t", "\x08", "\x0c"); - $replacements = array("\\\\", "\\/", "\\\"", "\\n", "\\r", "\\t", "\\f", "\\b"); + $escapers = ["\\", "/", "\"", "\n", "\r", "\t", "\x08", "\x0c"]; + $replacements = ["\\\\", "\\/", "\\\"", "\\n", "\\r", "\\t", "\\f", "\\b"]; return str_replace($escapers, $replacements, $value); } @@ -127,10 +127,10 @@ function escapeJsonString($value) { * @return array */ function getValues(&$contactIDs, &$values) { - $values = array(); + $values = []; foreach ($contactIDs as $cid) { - $values[$cid] = array(); + $values[$cid] = []; } getContactInfo($contactIDs, $values); @@ -178,7 +178,8 @@ SELECT $selectString, $whereField as contact_id * @param $values */ function getContactInfo(&$contactIDs, &$values) { - $fields = array('sort_name' => NULL, + $fields = [ + 'sort_name' => NULL, 'display_name' => NULL, 'contact_type' => NULL, 'legal_identifier' => NULL, @@ -190,7 +191,7 @@ function getContactInfo(&$contactIDs, &$values) { 'organization_name' => NULL, 'legal_name' => NULL, 'job_title' => NULL, - ); + ]; getTableInfo($contactIDs, $values, 'civicrm_contact', $fields, 'id'); } @@ -312,10 +313,17 @@ LEFT JOIN civicrm_country co ON a.country_id = co.id WHERE c.id IN ( $ids ) "; - $fields = array('location_type', 'street_address', 'supplemental_address_1', - 'supplemental_address_2', 'supplemental_address_3', 'city', 'postal_code', - 'state', 'country', - ); + $fields = [ + 'location_type', + 'street_address', + 'supplemental_address_1', + 'supplemental_address_2', + 'supplemental_address_3', + 'city', + 'postal_code', + 'state', + 'country', + ]; $dao = &CRM_Core_DAO::executeQuery($sql); while ($dao->fetch()) { $address = ''; @@ -352,7 +360,7 @@ function appendValue(&$values, $contactID, $name, $value) { else { if (!is_array($values[$contactID][$name])) { $save = $values[$contactID][$name]; - $values[$contactID][$name] = array(); + $values[$contactID][$name] = []; $values[$contactID][$name][] = $save; } $values[$contactID][$name][] = $value; @@ -366,7 +374,7 @@ function run(&$contactIDs) { $chunks = &splitContactIDs($contactIDs); foreach ($chunks as $chunk) { - $values = array(); + $values = []; getValues($chunk, $values); $xml = &generateSolrJSON($values); echo $xml; @@ -385,7 +393,7 @@ EOT; $dao = &CRM_Core_DAO::executeQuery($sql); -$contactIDs = array(); +$contactIDs = []; while ($dao->fetch()) { $contactIDs[] = $dao->id; } diff --git a/tools/scripts/solr/createSolrXML.php b/tools/scripts/solr/createSolrXML.php index f11a20a653..b0f207dc31 100644 --- a/tools/scripts/solr/createSolrXML.php +++ b/tools/scripts/solr/createSolrXML.php @@ -42,10 +42,10 @@ define('CHUNK_SIZE', 128); function &splitContactIDs(&$contactIDs) { // contactIDs could be a real large array, so we split it up into // smaller chunks and then general xml for each chunk - $chunks = array(); - $current = 0; - $chunks[$current] = array(); - $count = 0; + $chunks = []; + $current = 0; + $chunks[$current] = []; + $count = 0; foreach ($contactIDs as $cid) { $chunks[$current][] = $cid; @@ -53,7 +53,7 @@ function &splitContactIDs(&$contactIDs) { if ($count == CHUNK_SIZE) { $current++; - $chunks[$current] = array(); + $chunks[$current] = []; $count = 0; } } @@ -103,10 +103,10 @@ EOT; * @return array */ function getValues(&$contactIDs, &$values) { - $values = array(); + $values = []; foreach ($contactIDs as $cid) { - $values[$cid] = array(); + $values[$cid] = []; } getContactInfo($contactIDs, $values); @@ -146,7 +146,7 @@ SELECT $selectString, $whereField as contact_id if (!$name) { $name = $fld; } - $values[$dao->contact_id][] = array($name, $dao->$fld); + $values[$dao->contact_id][] = [$name, $dao->$fld]; } } } @@ -156,34 +156,38 @@ SELECT $selectString, $whereField as contact_id * @param $values */ function getContactInfo(&$contactIDs, &$values) { - $fields = array('sort_name' => NULL, + $fields = [ + 'sort_name' => NULL, 'display_name' => NULL, 'contact_type' => NULL, 'legal_identifier' => NULL, 'external_identifier' => NULL, 'source' => 'contact_source', - ); + ]; getTableInfo($contactIDs, $values, 'civicrm_contact', $fields, 'id'); - $fields = array('first_name' => NULL, + $fields = [ + 'first_name' => NULL, 'last_name' => NULL, 'middle_name' => NULL, 'job_title' => NULL, - ); + ]; getTableInfo($contactIDs, $values, 'civicrm_individual', $fields, 'contact_id'); - $fields = array('household_name' => NULL); + $fields = ['household_name' => NULL]; getTableInfo($contactIDs, $values, 'civicrm_household', $fields, 'contact_id'); - $fields = array('organization_name' => NULL, + $fields = [ + 'organization_name' => NULL, 'legal_name' => NULL, 'sic_code' => NULL, - ); + ]; getTableInfo($contactIDs, $values, 'civicrm_organization', $fields, 'contact_id'); - $fields = array('note' => 'note_body', + $fields = [ + 'note' => 'note_body', 'subject' => 'note_subject', - ); + ]; getTableInfo($contactIDs, $values, 'civicrm_note', $fields, 'entity_id', "entity_table = 'civicrm_contact'"); } @@ -215,17 +219,28 @@ WHERE l.entity_table = 'civicrm_contact' AND l.entity_id IN ( $ids ) "; - $fields = array('location_name', 'street_address', 'supplemental_address_1', - 'supplemental_address_2', 'supplemental_address_3', 'city', 'postal_code', 'county', 'state', - 'country', 'email', 'phone', 'im', - ); + $fields = [ + 'location_name', + 'street_address', + 'supplemental_address_1', + 'supplemental_address_2', + 'supplemental_address_3', + 'city', + 'postal_code', + 'county', + 'state', + 'country', + 'email', + 'phone', + 'im', + ]; $dao = CRM_Core_DAO::executeQuery($sql); while ($dao->fetch()) { foreach ($fields as $fld) { if (empty($dao->$fld)) { continue; } - $values[$dao->contact_id][] = array($fld, $dao->$fld); + $values[$dao->contact_id][] = [$fld, $dao->$fld]; } } } @@ -237,7 +252,7 @@ function run(&$contactIDs) { $chunks = &splitContactIDs($contactIDs); foreach ($chunks as $chunk) { - $values = array(); + $values = []; getValues($chunk, $values); $xml = &generateSolrXML($values); echo $xml; @@ -255,7 +270,7 @@ FROM civicrm_contact EOT; $dao = CRM_Core_DAO::executeQuery($sql); -$contactIDs = array(); +$contactIDs = []; while ($dao->fetch()) { $contactIDs[] = $dao->id; } diff --git a/tools/scripts/solr/createSyncJSON.php b/tools/scripts/solr/createSyncJSON.php index f4b3bf62e6..95d4fac75f 100644 --- a/tools/scripts/solr/createSyncJSON.php +++ b/tools/scripts/solr/createSyncJSON.php @@ -42,10 +42,10 @@ define('CHUNK_SIZE', 128); function &splitContactIDs(&$contactIDs) { // contactIDs could be a real large array, so we split it up into // smaller chunks and then general xml for each chunk - $chunks = array(); - $current = 0; - $chunks[$current] = array(); - $count = 0; + $chunks = []; + $current = 0; + $chunks[$current] = []; + $count = 0; foreach ($contactIDs as $k => $v) { $chunks[$current][$k] = $v; @@ -53,7 +53,7 @@ function &splitContactIDs(&$contactIDs) { if ($count == CHUNK_SIZE) { $current++; - $chunks[$current] = array(); + $chunks[$current] = []; $count = 0; } } @@ -74,7 +74,7 @@ function &splitContactIDs(&$contactIDs) { * @return array */ function getValues(&$contactIDs, &$values, &$allContactIDs, &$addditionalContactIDs) { - $values = array(); + $values = []; getContactInfo($contactIDs, $values); getAddressInfo($contactIDs, $values); @@ -103,8 +103,8 @@ function getValues(&$contactIDs, &$values, &$allContactIDs, &$addditionalContact * @param bool $flat */ function getTableInfo(&$contactIDs, &$values, $tableName, &$fields, - $whereField, $additionalWhereCond = NULL, - $flat = FALSE + $whereField, $additionalWhereCond = NULL, + $flat = FALSE ) { $selectString = implode(',', array_keys($fields)); $idString = implode(',', $contactIDs); @@ -121,7 +121,7 @@ SELECT $selectString, $whereField as contact_id $dao = &CRM_Core_DAO::executeQuery($sql); while ($dao->fetch()) { - $contact = array(); + $contact = []; foreach ($fields as $fld => $name) { $name = $name ? $name : $fld; if (empty($dao->$fld)) { @@ -141,7 +141,8 @@ SELECT $selectString, $whereField as contact_id * @param $values */ function getContactInfo(&$contactIDs, &$values) { - $fields = array('id' => NULL, + $fields = [ + 'id' => NULL, 'sort_name' => NULL, 'display_name' => NULL, 'contact_type' => NULL, @@ -154,7 +155,7 @@ function getContactInfo(&$contactIDs, &$values) { 'organization_name' => NULL, 'legal_name' => NULL, 'job_title' => NULL, - ); + ]; getTableInfo($contactIDs, $values, 'civicrm_contact', $fields, 'id', NULL, TRUE); } @@ -177,11 +178,12 @@ AND entity_table = 'civicrm_contact' $dao = &CRM_Core_DAO::executeQuery($sql); while ($dao->fetch()) { - $note = array('id' => $dao->id, + $note = [ + 'id' => $dao->id, 'contact_id' => $dao->contact_id, 'subject' => empty($dao->subject) ? NULL : $dao->subject, 'note' => empty($dao->note) ? NULL : $dao->note, - ); + ]; appendValue($values, $dao->id, 'note', $note); } @@ -213,12 +215,13 @@ AND p.phone IS NOT NULL $dao = &CRM_Core_DAO::executeQuery($sql); while ($dao->fetch()) { - $phone = array('id' => $dao->id, + $phone = [ + 'id' => $dao->id, 'contact_id' => $dao->contact_id, 'location_type' => empty($dao->location_type) ? NULL : $dao->location_type, 'phone' => $dao->phone, 'phone_type' => empty($dao->phone_type) ? NULL : $dao->phone_type, - ); + ]; appendValue($values, $dao->id, 'phone', $phone); } @@ -247,11 +250,12 @@ AND e.email IS NOT NULL $dao = &CRM_Core_DAO::executeQuery($sql); while ($dao->fetch()) { - $email = array('id' => $dao->id, + $email = [ + 'id' => $dao->id, 'contact_id' => $dao->contact_id, 'location_type' => empty($dao->location_type) ? NULL : $dao->location_type, 'email' => $dao->email, - ); + ]; appendValue($values, $dao->id, 'email', $email); } $dao->free(); @@ -279,14 +283,22 @@ LEFT JOIN civicrm_country co ON a.country_id = co.id WHERE c.id IN ( $ids ) "; - $fields = array('id', 'contact_id', - 'location_type', 'street_address', 'supplemental_address_1', - 'supplemental_address_2', 'supplemental_address_3', 'city', 'postal_code', - 'state', 'country', - ); + $fields = [ + 'id', + 'contact_id', + 'location_type', + 'street_address', + 'supplemental_address_1', + 'supplemental_address_2', + 'supplemental_address_3', + 'city', + 'postal_code', + 'state', + 'country', + ]; $dao = &CRM_Core_DAO::executeQuery($sql); while ($dao->fetch()) { - $address = array(); + $address = []; foreach ($fields as $fld) { if (empty($dao->$fld)) { $address[$fld] = NULL; @@ -308,7 +320,7 @@ WHERE c.id IN ( $ids ) */ function getRelationshipInfo(&$contactIDs, &$values, &$allContactIDs, &$additionalContacts) { // handle relationships only once - static $_relationshipsHandled = array(); + static $_relationshipsHandled = []; $ids = implode(',', $contactIDs); @@ -324,15 +336,15 @@ function getRelationshipInfo(&$contactIDs, &$values, &$allContactIDs, &$addition "; $relationshipFields = getDBFields('CRM_Contact_DAO_Relationship'); - $fields = array_keys($relationshipFields); - $dao = &CRM_Core_DAO::executeQuery($sql); + $fields = array_keys($relationshipFields); + $dao = &CRM_Core_DAO::executeQuery($sql); while ($dao->fetch()) { if (isset($_relationshipsHandled[$dao->id])) { continue; } $_relationshipsHandled[$dao->id] = $dao->id; - $relationship = array(); + $relationship = []; foreach ($fields as $fld) { if (empty($dao->$fld)) { $relationship[$fld] = NULL; @@ -343,9 +355,10 @@ function getRelationshipInfo(&$contactIDs, &$values, &$allContactIDs, &$addition } appendValue($values, $dao->id, 'relationship', $relationship); - addAdditionalContacts(array($dao->contact_id_a, - $dao->contact_id_b, - ), + addAdditionalContacts([ + $dao->contact_id_a, + $dao->contact_id_b, + ], $allContactIDs, $additionalContacts ); } @@ -359,7 +372,7 @@ function getRelationshipInfo(&$contactIDs, &$values, &$allContactIDs, &$addition * @param $additionalContacts */ function getActivityInfo(&$contactIDs, &$values, &$allContactIDs, &$additionalContacts) { - static $_activitiesHandled = array(); + static $_activitiesHandled = []; $ids = implode(',', $contactIDs); @@ -381,7 +394,7 @@ function getActivityInfo(&$contactIDs, &$values, &$allContactIDs, &$additionalCo $activityFields = &getDBFields('CRM_Activity_DAO_Activity'); $fields = array_keys($activityFields); - $activityIDs = array(); + $activityIDs = []; $dao = &CRM_Core_DAO::executeQuery($sql); while ($dao->fetch()) { if (isset($_activitiesHandled[$dao->id])) { @@ -390,7 +403,7 @@ function getActivityInfo(&$contactIDs, &$values, &$allContactIDs, &$additionalCo $_activitiesHandled[$dao->id] = $dao->id; $activityIDs[] = $dao->id; - $activity = array(); + $activity = []; foreach ($fields as $fld) { if (empty($dao->$fld)) { $activity[$fld] = NULL; @@ -401,7 +414,7 @@ function getActivityInfo(&$contactIDs, &$values, &$allContactIDs, &$additionalCo } appendValue($values, $dao->id, 'activity', $activity); - addAdditionalContacts(array($dao->source_contact_id), + addAdditionalContacts([$dao->source_contact_id], $allContactIDs, $additionalContacts ); } @@ -414,14 +427,15 @@ function getActivityInfo(&$contactIDs, &$values, &$allContactIDs, &$additionalCo $activityIDString = implode(",", $activityIDs); // now get all assignee contact ids and target contact ids for this activity - $sql = "SELECT * FROM civicrm_activity_assignment WHERE activity_id IN ($activityIDString)"; - $aaDAO = &CRM_Core_DAO::executeQuery($sql); - $activityContacts = array(); + $sql = "SELECT * FROM civicrm_activity_assignment WHERE activity_id IN ($activityIDString)"; + $aaDAO = &CRM_Core_DAO::executeQuery($sql); + $activityContacts = []; while ($aaDAO->fetch()) { - $activityAssignee = array('id' => $aaDAO->id, + $activityAssignee = [ + 'id' => $aaDAO->id, 'assignee_contact_id' => $aaDAO->assignee_contact_id, 'activity_id' => $aaDAO->activity_id, - ); + ]; appendValue($values, $aaDAO->id, 'activity_assignment', $activityAssignee); $activityContacts[] = $aaDAO->assignee_contact_id; } @@ -430,10 +444,11 @@ function getActivityInfo(&$contactIDs, &$values, &$allContactIDs, &$additionalCo $sql = "SELECT * FROM civicrm_activity_target WHERE activity_id IN ($activityIDString)"; $atDAO = &CRM_Core_DAO::executeQuery($sql); while ($atDAO->fetch()) { - $activityTarget = array('id' => $atDAO->id, + $activityTarget = [ + 'id' => $atDAO->id, 'target_contact_id' => $atDAO->target_contact_id, 'activity_id' => $atDAO->activity_id, - ); + ]; appendValue($values, $atDAO->id, 'activity_target', $activityTarget); $activityContacts[] = $atDAO->target_contact_id; } @@ -455,7 +470,7 @@ function appendValue(&$values, $id, $name, $value, $ignored = FALSE) { } if (!isset($values[$name])) { - $values[$name] = array(); + $values[$name] = []; $values[$name][] = array_keys($value); } $values[$name][] = array_values($value); @@ -467,24 +482,25 @@ function appendValue(&$values, $id, $name, $value, $ignored = FALSE) { * @return mixed */ function getDBFields($daoName) { - static $_fieldsRetrieved = array(); + static $_fieldsRetrieved = []; if (!isset($_fieldsRetrieved[$daoName])) { - $_fieldsRetrieved[$daoName] = array(); + $_fieldsRetrieved[$daoName] = []; $daoFile = str_replace('_', - DIRECTORY_SEPARATOR, - $daoName - ) . '.php'; - include_once ($daoFile); + DIRECTORY_SEPARATOR, + $daoName + ) . '.php'; + include_once($daoFile); $daoFields = &$daoName::fields(); require_once 'CRM/Utils/Array.php'; foreach ($daoFields as $key => & $value) { - $_fieldsRetrieved[$daoName][$value['name']] = array('uniqueName' => $key, + $_fieldsRetrieved[$daoName][$value['name']] = [ + 'uniqueName' => $key, 'type' => $value['type'], 'title' => CRM_Utils_Array::value('title', $value, NULL), - ); + ]; } } return $_fieldsRetrieved[$daoName]; @@ -514,7 +530,7 @@ function addAdditionalContacts($contactIDs, &$allContactIDs, &$additionalContact function run(&$values, &$contactIDs, &$allContactIDs) { $chunks = &splitContactIDs($contactIDs); - $additionalContactIDs = array(); + $additionalContactIDs = []; foreach ($chunks as $chunk) { getValues($chunk, $values, $allContactIDs, $additionalContactIDs); @@ -539,12 +555,12 @@ LIMIT 10 $dao = &CRM_Core_DAO::executeQuery($sql); -$contactIDs = array(); +$contactIDs = []; while ($dao->fetch()) { $contactIDs[$dao->id] = $dao->id; } -$values = array(); +$values = []; run($values, $contactIDs, $contactIDs); $json = json_encode($values); diff --git a/tools/scripts/tpl-lint b/tools/scripts/tpl-lint index 4fe5925e2c..04b6f85675 100755 --- a/tools/scripts/tpl-lint +++ b/tools/scripts/tpl-lint @@ -3,7 +3,7 @@ // FIXME: Make this a proper app with unit-tests -$civi_pkgs_dir = dirname( dirname( dirname( __FILE__ ) ) ) . DIRECTORY_SEPARATOR . 'packages'; +$civi_pkgs_dir = dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'packages'; require_once $civi_pkgs_dir . DIRECTORY_SEPARATOR . 'simple_html_dom.php'; exit(main($argv)); @@ -19,7 +19,7 @@ function main($argv) { $files = $argv; array_shift($files); // skip program name foreach ($files as $file) { - check_tpl($file, function($code, $message) use ($file) { + check_tpl($file, function ($code, $message) use ($file) { printf("[%s] %s\n", $file, $message); }); }