Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(NFC) Lint .inc files and ensure that the eval usage in tests/phpunit… #71

Merged
merged 1 commit into from
Apr 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions drush/civicrm.drush.inc
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ function drush_civicrm_install_validate() {
return TRUE;
}


/**
* Implementation of command 'civicrm-install'
*/
Expand Down Expand Up @@ -707,7 +706,8 @@ function drush_civicrm_upgrade_db() {

// new since CiviCRM 4.1
if (is_callable(array(
$upgrade, 'setPrint'))) {
$upgrade, 'setPrint',
))) {
$upgrade->setPrint(TRUE);
}

Expand All @@ -728,7 +728,6 @@ function drush_civicrm_update_cfg_validate() {
return _civicrm_init();
}


/**
* Implementation of command 'civicrm-update-cfg'
*/
Expand Down
2 changes: 0 additions & 2 deletions modules/civicrm_engage/civicrm_engage.admin.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php


function civicrm_engage_admin_settings($form, $form_state) {
$config = config('civicrm_engage.settings');
$form['#config'] = 'civicrm_engage.settings';
Expand Down Expand Up @@ -130,7 +129,6 @@ function civicrm_engage_admin_load_data($form_state = NULL) {
return $form;
}


function civicrm_engage_admin_load_data_submit($form, &$form_state) {
if ($form_state['values']['contact_subtypes'] == 1) {
civicrm_engage_load_contact_subtypes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function civicrm_member_roles_drush_command() {
);
return $items;
}

/**
* (Drush callback)
*
Expand Down
6 changes: 4 additions & 2 deletions modules/civicrm_rules/civicrm_rules.contact-eval.inc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
* @{
*/
require_once 'civicrm_rules_utils.inc';
function civicrm_rules_rules_action_contact_send_email($to, $subject, $message, $from = NULL, $settings, RulesState$state, RulesPlugin$element) {

function civicrm_rules_rules_action_contact_send_email($to, $subject, $message, $from = NULL, $settings, RulesState $state, RulesPlugin $element) {

$to = str_replace(array("\r", "\n"), ',', $to);
$toEmails = explode(',', $to);
Expand All @@ -51,7 +52,8 @@ function civicrm_rules_rules_action_contact_send_email($to, $subject, $message,
foreach ($toEmails as $toEmail) {
$params = array();
$params['from'] = !empty($from) ? str_replace(array(
"\r", "\n"), '', $from) : 'Admin';
"\r", "\n",
), '', $from) : 'Admin';
$params['toEmail'] = $toEmail;
$params['subject'] = $subject;
$params['text'] = is_array($message) ? implode("\n", $message) : $message;
Expand Down
1 change: 1 addition & 0 deletions modules/civicrm_rules/civicrm_rules.event-eval.inc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
*/

require_once 'civicrm_rules_utils.inc';

function civicrm_rules_condition_event_node(&$entityobj, $roleID, $field) {
//just a hack for our site
//SELECT * FROM `content_type_og_node` WHERE `field_civicrm_event_value` =993
Expand Down
8 changes: 5 additions & 3 deletions modules/civicrm_rules/civicrm_rules.mailing-eval.inc
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@
*/

require_once 'civicrm_rules_utils.inc';

function civicrm_rules_rules_action_mailing_send_email($to,
$subject,
$message,
$from = NULL,
$settings,
RulesState$state,
RulesPlugin$element
RulesState $state,
RulesPlugin $element
) {
if (isset($state->variables['mailing']) && $state->variables['mailing']->id) {
$to = str_replace(array("\r", "\n"), ',', $to);
Expand All @@ -59,7 +60,8 @@ function civicrm_rules_rules_action_mailing_send_email($to,

$params = array();
$params['from'] = !empty($from) ? str_replace(array(
"\r", "\n"), '', $from) : 'Admin';
"\r", "\n",
), '', $from) : 'Admin';
$params['subject'] = CRM_Utils_Token::replaceMailingTokens($subject, $state->variables['mailing'], NULL, $tokens);
$params['html'] = CRM_Utils_Token::replaceMailingTokens($message, $state->variables['mailing'], NULL, $tokens);

Expand Down
1 change: 1 addition & 0 deletions modules/civicrm_rules/civicrm_rules_admin_form.inc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

function civicrm_rules_admin_settings($form_state = NULL) {

$form['civicrm_rules_post_entities'] = array(
Expand Down
6 changes: 4 additions & 2 deletions modules/civicrm_rules/civicrm_rules_condition.inc
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ function civicrm_rules_condition_parameter($label, $type = 'contact') {
'type' => 'list<integer>',
'label' => t('Participant role'),
'options list' => 'civicrm_rules_get_participant_role_options',
));
),
);
}

if ($type == 'event') {
Expand All @@ -94,7 +95,8 @@ function civicrm_rules_condition_parameter($label, $type = 'contact') {
'type' => 'list<integer>',
'label' => t('CiviCRM event type'),
'options list' => 'civicrm_rules_get_event_type_options',
));
),
);
}

return $default;
Expand Down
1 change: 0 additions & 1 deletion modules/civicrm_rules/civicrm_rules_utils.inc
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ function _civicrm_rules_load_mailing($mailingID) {
return $mailing;
}


/**
* function to return labels for checkboxes & stuff
*/
Expand Down
20 changes: 12 additions & 8 deletions modules/civicrmtheme/plugins/access/civicrmtheme_layout_access.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
*/

class CivicrmLayoutAccess extends LayoutAccess {

/**
* Constructor for a Layout access rule.
*/
function __construct($plugin_name, array $data = array()) {
public function __construct($plugin_name, array $data = array()) {
parent::__construct($plugin_name, $data);
$this->settings += array(
'civicrm' => array(),
Expand All @@ -18,10 +19,10 @@ class CivicrmLayoutAccess extends LayoutAccess {
/**
* {@inheritdoc}
*/
function summary() {
public function summary() {
$civicrm = array(
'admin' => t('Admin'),
'public' => t('Public')
'public' => t('Public'),
);
$names = array();
foreach ($this->settings['civicrm'] as $civi) {
Expand All @@ -36,7 +37,7 @@ class CivicrmLayoutAccess extends LayoutAccess {
/**
* {@inheritdoc}
*/
function checkAccess() {
public function checkAccess() {
if (arg(0) != 'civicrm') {
return FALSE;
}
Expand All @@ -55,17 +56,19 @@ class CivicrmLayoutAccess extends LayoutAccess {
$item = CRM_Core_Menu::get($path);

// Check path for public or not and use layout if matches settings
switch(CRM_Utils_Array::value('is_public', $item)) {
switch (CRM_Utils_Array::value('is_public', $item)) {
case TRUE:
if (in_array('public', $this->settings['civicrm'])) {
return TRUE;
}
break;

case FALSE:
if (in_array('admin', $this->settings['civicrm'])) {
return TRUE;
}
break;

default:
return FALSE;
}
Expand All @@ -74,11 +77,11 @@ class CivicrmLayoutAccess extends LayoutAccess {
/**
* {@inheritdoc}
*/
function form(&$form, &$form_state) {
public function form(&$form, &$form_state) {
parent::form($form, $form_state);
$options = array(
'admin' => t('Admin'),
'public' => t('Public')
'public' => t('Public'),
);
$form['civicrm'] = array(
'#title' => t('CiviCRM pages'),
Expand All @@ -92,8 +95,9 @@ class CivicrmLayoutAccess extends LayoutAccess {
/**
* {@inheritdoc}
*/
function formSubmit($form, &$form_state) {
public function formSubmit($form, &$form_state) {
parent::formSubmit($form, $form_state);
$this->settings['civicrm'] = array_keys(array_filter($form_state['values']['civicrm']));
}

}
3 changes: 2 additions & 1 deletion modules/views/civicrm/civicrm_handler_field_activity.inc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
* @ingroup civicrm_field_handlers
*/
class civicrm_handler_field_activity extends civicrm_handler_field {
static $_recordType;
public static $_recordType;

public function construct() {
parent::construct();
if (!self::$_recordType) {
Expand Down
1 change: 1 addition & 0 deletions modules/views/civicrm/civicrm_handler_field_backdropid.inc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @ingroup civicrm_field_handlers
*/
class civicrm_handler_field_backdropid extends views_handler_field {

public function construct() {
parent::construct();
if (!civicrm_initialize()) {
Expand Down
1 change: 1 addition & 0 deletions modules/views/civicrm/civicrm_handler_field_component.inc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @ingroup civicrm_field_handlers
*/
class civicrm_handler_field_component extends views_handler_field {

public function render($values) {
$value = $this->get_value($values);
return CRM_Core_Component::getComponentName($value);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

class civicrm_handler_field_contact_image extends views_handler_field {

public function option_definition() {
$options = parent::option_definition();
$options['url_only'] = array(
Expand Down
5 changes: 3 additions & 2 deletions modules/views/civicrm/civicrm_handler_field_country.inc
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@
*
*/
class civicrm_handler_field_country extends civicrm_handler_field_address {
static $_countries;
static $_countries_full;
public static $_countries;
public static $_countries_full;

public function construct() {
parent::construct();
if (!self::$_countries) {
Expand Down
3 changes: 2 additions & 1 deletion modules/views/civicrm/civicrm_handler_field_county.inc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
*
*/
class civicrm_handler_field_county extends civicrm_handler_field_address {
static $_counties;
public static $_counties;

public function construct() {
parent::construct();
if (!self::$_counties) {
Expand Down
1 change: 1 addition & 0 deletions modules/views/civicrm/civicrm_handler_field_custom.inc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @ingroup civicrm_field_handlers
*/
class civicrm_handler_field_custom extends views_handler_field {

public function construct() {
parent::construct();
civicrm_initialize();
Expand Down
4 changes: 3 additions & 1 deletion modules/views/civicrm/civicrm_handler_field_custom_file.inc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
* @ingroup civicrm_field_handlers
*/
class civicrm_handler_field_custom_file extends views_handler_field {

public function construct() {
parent::construct();
civicrm_initialize();
Expand All @@ -53,7 +54,8 @@ class civicrm_handler_field_custom_file extends views_handler_field {
);

if ($fileType && in_array($fileType, array(
"image/jpeg", "image/pjpeg", "image/gif", "image/x-png", "image/png"))) {
"image/jpeg", "image/pjpeg", "image/gif", "image/x-png", "image/png",
))) {
$uri = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_File',
$value,
'uri'
Expand Down
1 change: 1 addition & 0 deletions modules/views/civicrm/civicrm_handler_field_email.inc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
* @ingroup civicrm_field_handlers
*/
class civicrm_handler_field_email extends civicrm_handler_field_location {

public function option_definition() {
$options = parent::option_definition();
$options['link_to_user'] = array('default' => 'mailto');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
*
*/
class civicrm_handler_field_encounter_medium extends views_handler_field {
static $_encounter_medium;
public static $_encounter_medium;

public function construct() {
parent::construct();
if (!self::$_encounter_medium) {
Expand Down
4 changes: 3 additions & 1 deletion modules/views/civicrm/civicrm_handler_field_file.inc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
* @ingroup civicrm_field_handlers
*/
class civicrm_handler_field_file extends views_handler_field {

public function construct() {
parent::construct();
civicrm_initialize();
Expand All @@ -56,7 +57,8 @@ class civicrm_handler_field_file extends views_handler_field {
);

if ($fileType && in_array($fileType, array(
"image/jpeg", "image/pjpeg", "image/gif", "image/x-png", "image/png"))) {
"image/jpeg", "image/pjpeg", "image/gif", "image/x-png", "image/png",
))) {
$uri = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_File',
$fileId,
'uri'
Expand Down
2 changes: 1 addition & 1 deletion modules/views/civicrm/civicrm_handler_field_im.inc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* @ingroup civicrm_field_handlers
*/
class civicrm_handler_field_im extends civicrm_handler_field_location {
static $_provider;
public static $_provider;

public function construct() {
parent::construct();
Expand Down
1 change: 1 addition & 0 deletions modules/views/civicrm/civicrm_handler_field_link.inc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @ingroup civicrm_field_handlers
*/
class civicrm_handler_field_link extends civicrm_handler_field {

public function construct() {
parent::construct();
$this->additional_fields['id'] = 'id';
Expand Down
1 change: 1 addition & 0 deletions modules/views/civicrm/civicrm_handler_field_link_edit.inc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @ingroup civicrm_field_handlers
*/
class civicrm_handler_field_link_edit extends civicrm_handler_field_link {

/**
* An example of field level access control.
*/
Expand Down
6 changes: 3 additions & 3 deletions modules/views/civicrm/civicrm_handler_field_location.inc
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
* @ingroup civicrm_field_handlers
*/
class civicrm_handler_field_location extends civicrm_handler_field {
static $_locationTypes;
static $_locationOps;
static $location_op;
public static $_locationTypes;
public static $_locationOps;
public static $location_op;

public function construct() {
parent::construct();
Expand Down
1 change: 1 addition & 0 deletions modules/views/civicrm/civicrm_handler_field_mail.inc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @ingroup civicrm_field_handlers
*/
class civicrm_handler_field_mail extends civicrm_handler_field {

public function option_definition() {
$options = parent::option_definition();
$options['link_to_civicrm'] = array('default' => 'mailto');
Expand Down
1 change: 1 addition & 0 deletions modules/views/civicrm/civicrm_handler_field_markup.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*
*/
class civicrm_handler_field_markup extends views_handler_field {

public function option_definition() {
$options = parent::option_definition();

Expand Down
1 change: 1 addition & 0 deletions modules/views/civicrm/civicrm_handler_field_money.inc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @ingroup civicrm_field_handlers
*/
class civicrm_handler_field_money extends views_handler_field {

public function construct() {
parent::construct();
if (!civicrm_initialize()) {
Expand Down
Loading