Skip to content

Commit

Permalink
fixing Coder Sniffer issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
cisvarun committed Mar 1, 2016
1 parent 2388b64 commit 64e5fc5
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 34 deletions.
13 changes: 6 additions & 7 deletions src/Controller/ProtectedPagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,20 @@ public function protectedPagesList() {
array(
'edit-protected-page' => array(
'title' => $this->t('Edit'),
'url' => Url::fromUri('internal:/admin/config/system/protected_pages/' . $page->pid . '/edit')
'url' => Url::fromUri('internal:/admin/config/system/protected_pages/' . $page->pid . '/edit'),
),
'delete-protected-page' => array(
'title' => $this->t('Delete'),
'url' => Url::fromUri('internal:/admin/config/system/protected_pages/' . $page->pid . '/delete')
'url' => Url::fromUri('internal:/admin/config/system/protected_pages/' . $page->pid . '/delete'),
),
'send-email' => array(
'title' => $this->t('Send E-mail'),
'url' => Url::fromUri('internal:/admin/config/system/protected_pages/' . $page->pid . '/send_email')
)
)
)
'url' => Url::fromUri('internal:/admin/config/system/protected_pages/' . $page->pid . '/send_email'),
),
),
),
);


$operations = $this->renderer->render($operation_drop_button);
$rows[] = array(
'data' =>
Expand Down
12 changes: 6 additions & 6 deletions src/EventSubscriber/ProtectedPagesSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
use Drupal\Core\Routing\RedirectDestinationTrait;

/**
* Redirects user to protected page login screen if current page is password protected.
* Redirects user to protected page login screen.
*/
class ProtectedPagesSubscriber implements EventSubscriberInterface {

use RedirectDestinationTrait;

/**
* Redirects user to protected page login screen if current page is password protected.
* Redirects user to protected page login screen.
*
* @param \Symfony\Component\HttpKernel\Event\PostResponseEvent $event
* @param \Symfony\Component\HttpKernel\Event\FilterResponseEvent $event
* The event to process.
*/
public function checkProtectedPage(FilterResponseEvent $event) {
Expand Down Expand Up @@ -85,7 +85,7 @@ public function checkProtectedPage(FilterResponseEvent $event) {
/**
* {@inheritdoc}
*/
static function getSubscribedEvents() {
public static function getSubscribedEvents() {
$events[KernelEvents::RESPONSE][] = array('checkProtectedPage');
return $events;
}
Expand All @@ -107,12 +107,12 @@ public function protectedPagesIsPageLocked($current_path, $normal_path) {
$conditions['or'][] = array(
'field' => 'path',
'value' => $normal_path,
'operator' => '='
'operator' => '=',
);
$conditions['or'][] = array(
'field' => 'path',
'value' => $current_path,
'operator' => '='
'operator' => '=',
);

$pid = ProtectedPagesStorage::load($fields, $conditions, TRUE);
Expand Down
5 changes: 2 additions & 3 deletions src/Form/ProtectedPagesAddForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#value' => $this->t('Save'),
);


return $form;
}

Expand All @@ -121,12 +120,12 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
$conditions['or'][] = array(
'field' => 'path',
'value' => $normal_path,
'operator' => '='
'operator' => '=',
);
$conditions['or'][] = array(
'field' => 'path',
'value' => $path_alias,
'operator' => '='
'operator' => '=',
);

$pid = ProtectedPagesStorage::load($fields, $conditions, TRUE);
Expand Down
4 changes: 2 additions & 2 deletions src/Form/ProtectedPagesLoginForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
$conditions['general'][] = array(
'field' => 'pid',
'value' => $form_state->getValue('protected_page_pid'),
'operator' => '='
'operator' => '=',
);

$password = ProtectedPagesStorage::load($fields, $conditions, TRUE);
Expand All @@ -143,7 +143,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
$conditions['general'][] = array(
'field' => 'pid',
'value' => $form_state->getValue('protected_page_pid'),
'operator' => '='
'operator' => '=',
);

$password = ProtectedPagesStorage::load($fields, $conditions, TRUE);
Expand Down
7 changes: 2 additions & 5 deletions src/Form/ProtectedPagesSendEmailForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $pid = NU
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
$emails = explode(',', str_replace(array(
"\r",
"\n"
), ',', $form_state->getValue('recipents')));
$emails = explode(',', str_replace(array("\r", "\n"), ',', $form_state->getValue('recipents')));
foreach ($emails as $key => $email) {
$email = trim($email);
if ($email) {
Expand Down Expand Up @@ -148,7 +145,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
'field' => 'pid',
'value' => $form_state->get('pid'),
'=',
'operator' => '='
'operator' => '=',
);

$path = ProtectedPagesStorage::load($fields, $conditions, TRUE);
Expand Down
13 changes: 2 additions & 11 deletions src/Form/ProtectedPagesSettingForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#type' => 'select',
'#title' => t('Global Password Setting'),
'#default_value' => $config->get('password.per_page_or_global'),
//variable_get('protected_pages_user_global_password', 'per_page_or_global'),
'#options' => array(
'per_page_password' => $this->t('Allow per page password'),
'per_page_or_global' => $this->t('Allow per page password or Global password'),
Expand All @@ -153,14 +152,13 @@ public function buildForm(array $form, FormStateInterface $form_state) {
user will need to enter password again. The default session expire time
is 0 (unlimited).'),
'#default_value' => $config->get('password.protected_pages_session_expire_time'),
//variable_get('protected_pages_session_expire_time', 0),
'#required' => TRUE,
'#size' => 10,
'#element_validate' => array(
array(
$this,
'protectedPagesValidateIntegerPositive'
)
'protectedPagesValidateIntegerPositive',
),
),
'#field_suffix' => $this->t('in minutes'),
);
Expand All @@ -176,7 +174,6 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#type' => 'textfield',
'#title' => $this->t('Email subject'),
'#default_value' => $config->get('email.subject'),
//variable_get('protected_pages_email_subject', protected_pages_email_subject()),
'#description' => $this->t('Enter the subject of the email.'),
);

Expand All @@ -185,7 +182,6 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#title' => $this->t('Email content'),
'#rows' => 15,
'#default_value' => $config->get('email.body'),
//variable_get('protected_pages_email_body', protected_pages_email_body()),
'#description' => $this->t('Enter the body of the email. Only [protected-page-url] and [site-name] tokens are available.
Since password is encrypted, therefore we can not provide it by token.'),
);
Expand All @@ -201,37 +197,32 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#type' => 'textfield',
'#title' => $this->t('Password page title'),
'#default_value' => $config->get('others.protected_pages_title'),
//variable_get('protected_pages_title', t('Protected Page -- Enter password')),
'#description' => $this->t('Enter the title of the protected page.'),
);

$form['protected_pages_other_fieldset']['protected_pages_description'] = array(
'#type' => 'textarea',
'#title' => $this->t('Password page description (inside the field set)'),
'#default_value' => $config->get('others.protected_pages_description'),
//variable_get('protected_pages_description', t('The page you are trying to view is password protected. Please enter the password below to proceed.')),
'#description' => $this->t('Enter specific description for the protected page. This description is displayed inside the fieldset. HTML is accepted.'),
);

$form['protected_pages_other_fieldset']['protected_pages_password_label'] = array(
'#type' => 'textfield',
'#title' => $this->t('Password field label'),
'#default_value' => $config->get('others.protected_pages_password_label'),
//variable_get('protected_pages_password_label', t('Enter Password')),
'#description' => $this->t('Enter the text for the password field label.'),
);
$form['protected_pages_other_fieldset']['protected_pages_submit_button_text'] = array(
'#type' => 'textfield',
'#title' => $this->t('Submit Button Text'),
'#default_value' => $config->get('others.protected_pages_submit_button_text'),
//variable_get('protected_pages_submit_button_text', t('Authenticate')),
'#description' => $this->t('Enter the text for the submit button of enter password form.'),
);
$form['protected_pages_other_fieldset']['protected_pages_incorrect_password_msg'] = array(
'#type' => 'textarea',
'#title' => $this->t('Incorrect Password Error Text'),
'#default_value' => $config->get('others.protected_pages_incorrect_password_msg'),
//variable_get('protected_pages_incorrect_password_msg', t('Incorrect password!')),
'#description' => $this->t('This error text will appear if someone enters wrong password in "Enter password screen".'),
);

Expand Down

0 comments on commit 64e5fc5

Please sign in to comment.