@@ -14,8 +14,7 @@ discard block |
||
14 | 14 | */ |
15 | 15 | |
16 | 16 | /* pData class definition */ |
17 | - class pBarcode128 |
|
18 | - { |
|
17 | + class pBarcode128 { |
|
19 | 18 | var $Codes; |
20 | 19 | var $Reverse; |
21 | 20 | var $Result; |
@@ -23,8 +22,7 @@ discard block |
||
23 | 22 | var $CRC; |
24 | 23 | |
25 | 24 | /* Class creator */ |
26 | - function pBarcode128($BasePath="") |
|
27 | - { |
|
25 | + function pBarcode128($BasePath="") { |
|
28 | 26 | $this->Codes = ""; |
29 | 27 | $this->Reverse = ""; |
30 | 28 | |
@@ -32,8 +30,7 @@ discard block |
||
32 | 30 | |
33 | 31 | if (!$FileHandle) { die("Cannot find barcode database (".$BasePath."128B.db)."); } |
34 | 32 | |
35 | - while (!feof($FileHandle)) |
|
36 | - { |
|
33 | + while (!feof($FileHandle)) { |
|
37 | 34 | $Buffer = fgets($FileHandle,4096); |
38 | 35 | $Buffer = str_replace(chr(10),"",$Buffer); |
39 | 36 | $Buffer = str_replace(chr(13),"",$Buffer); |
@@ -48,8 +45,7 @@ discard block |
||
48 | 45 | } |
49 | 46 | |
50 | 47 | /* Return the projected size of a barcode */ |
51 | - function getSize($TextString,$Format="") |
|
52 | - { |
|
48 | + function getSize($TextString,$Format="") { |
|
53 | 49 | $Angle = isset($Format["Angle"]) ? $Format["Angle"] : 0; |
54 | 50 | $ShowLegend = isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE; |
55 | 51 | $LegendOffset = isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5; |
@@ -76,17 +72,14 @@ discard block |
||
76 | 72 | return(array("Width"=>$AreaWidth,"Height"=>$AreaHeight)); |
77 | 73 | } |
78 | 74 | |
79 | - function encode128($Value,$Format="") |
|
80 | - { |
|
75 | + function encode128($Value,$Format="") { |
|
81 | 76 | $this->Result = "11010010000"; |
82 | 77 | $this->CRC = 104; |
83 | 78 | $TextString = ""; |
84 | 79 | |
85 | - for($i=1;$i<=strlen($Value);$i++) |
|
86 | - { |
|
80 | + for($i=1;$i<=strlen($Value);$i++) { |
|
87 | 81 | $CharCode = ord($this->mid($Value,$i,1)); |
88 | - if ( isset($this->Codes[$CharCode]) ) |
|
89 | - { |
|
82 | + if ( isset($this->Codes[$CharCode]) ) { |
|
90 | 83 | $this->Result = $this->Result.$this->Codes[$CharCode]["Code"]; |
91 | 84 | $this->CRC = $this->CRC + $i*$this->Codes[$CharCode]["ID"]; |
92 | 85 | $TextString = $TextString.chr($CharCode); |
@@ -101,8 +94,7 @@ discard block |
||
101 | 94 | } |
102 | 95 | |
103 | 96 | /* Create the encoded string */ |
104 | - function draw($Object,$Value,$X,$Y,$Format="") |
|
105 | - { |
|
97 | + function draw($Object,$Value,$X,$Y,$Format="") { |
|
106 | 98 | $this->pChartObject = $Object; |
107 | 99 | |
108 | 100 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
@@ -123,21 +115,17 @@ discard block |
||
123 | 115 | |
124 | 116 | $TextString = $this->encode128($Value); |
125 | 117 | |
126 | - if ( $DrawArea ) |
|
127 | - { |
|
118 | + if ( $DrawArea ) { |
|
128 | 119 | $X1 = $X + cos(($Angle-135) * PI / 180) * 10; |
129 | 120 | $Y1 = $Y + sin(($Angle-135) * PI / 180) * 10; |
130 | 121 | |
131 | 122 | $X2 = $X1 + cos($Angle * PI / 180) * (strlen($this->Result)+20); |
132 | 123 | $Y2 = $Y1 + sin($Angle * PI / 180) * (strlen($this->Result)+20); |
133 | 124 | |
134 | - if ( $ShowLegend ) |
|
135 | - { |
|
125 | + if ( $ShowLegend ) { |
|
136 | 126 | $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10); |
137 | 127 | $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10); |
138 | - } |
|
139 | - else |
|
140 | - { |
|
128 | + } else { |
|
141 | 129 | $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+20); |
142 | 130 | $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+20); |
143 | 131 | } |
@@ -150,10 +138,8 @@ discard block |
||
150 | 138 | $this->pChartObject->drawPolygon($Polygon,$Settings); |
151 | 139 | } |
152 | 140 | |
153 | - for($i=1;$i<=strlen($this->Result);$i++) |
|
154 | - { |
|
155 | - if ( $this->mid($this->Result,$i,1) == 1 ) |
|
156 | - { |
|
141 | + for($i=1;$i<=strlen($this->Result);$i++) { |
|
142 | + if ( $this->mid($this->Result,$i,1) == 1 ) { |
|
157 | 143 | $X1 = $X + cos($Angle * PI / 180) * $i; |
158 | 144 | $Y1 = $Y + sin($Angle * PI / 180) * $i; |
159 | 145 | $X2 = $X1 + cos(($Angle+90) * PI / 180) * $Height; |
@@ -164,8 +150,7 @@ discard block |
||
164 | 150 | } |
165 | 151 | } |
166 | 152 | |
167 | - if ( $ShowLegend ) |
|
168 | - { |
|
153 | + if ( $ShowLegend ) { |
|
169 | 154 | $X1 = $X + cos($Angle * PI / 180) * (strlen($this->Result)/2); |
170 | 155 | $Y1 = $Y + sin($Angle * PI / 180) * (strlen($this->Result)/2); |
171 | 156 |
@@ -20,11 +20,12 @@ discard block |
||
20 | 20 | } |
21 | 21 | |
22 | 22 | $roles = user_roles(); |
23 | - if (isset($tid)) { // edit |
|
23 | + if (isset($tid)) { |
|
24 | +// edit |
|
24 | 25 | $template_tid = variable_get('forum_access_default_template_tid', 0); |
25 | 26 | $settings = _forum_access_get_settings($tid); |
26 | - } |
|
27 | - else { // create |
|
27 | + } else { |
|
28 | +// create |
|
28 | 29 | $template_tid = variable_get('forum_access_new_template_tid', NULL); |
29 | 30 | $settings = _forum_access_get_settings($template_tid); |
30 | 31 | } |
@@ -208,9 +209,11 @@ discard block |
||
208 | 209 | drupal_add_css(drupal_get_path('module', 'forum_access') .'/forum_access.css'); |
209 | 210 | |
210 | 211 | // Find our moderator ACL: |
211 | - if (isset($tid)) { // edit, not new |
|
212 | + if (isset($tid)) { |
|
213 | +// edit, not new |
|
212 | 214 | $acl_id = acl_get_id_by_number('forum_access', $tid); |
213 | - if (!$acl_id) { // create one |
|
215 | + if (!$acl_id) { |
|
216 | +// create one |
|
214 | 217 | $acl_id = acl_create_new_acl('forum_access', NULL, $tid); |
215 | 218 | // update every existing node in this forum to use this acl. |
216 | 219 | $result = db_query("SELECT nid FROM {term_node} WHERE tid = %d", $tid); |
@@ -288,8 +291,7 @@ discard block |
||
288 | 291 | $form['forum_access']['interference']['by_content_access'][] = array( |
289 | 292 | '#value' => '<div>'. t("Unless you really know what you're doing, we recommend that you go to the !link page and clear all checkboxes. This will instruct @Content_Access to leave the %content_type nodes alone. However, if you put nodes of other content types into forums as well, then these content types will continue to have this problem.", $variables) .'</div>', |
290 | 293 | ); |
291 | - } |
|
292 | - else { |
|
294 | + } else { |
|
293 | 295 | $form['forum_access']['interference']['by_content_access'][] = array( |
294 | 296 | '#value' => '<div>'. t("The priority of @Content_Access ($ca_priority) is higher than the priority of !Forum_Access ($fa_priority), which means the latter is <strong>completely disabled</strong> for the %content_type type! Unless you really know what you're doing, we recommend that you go to the !link page, change the priority (under %Advanced) to 0, and clear all checkboxes.", $variables) .'</div>', |
295 | 297 | ); |
@@ -297,8 +299,7 @@ discard block |
||
297 | 299 | $form['forum_access']['interference']['by_content_access'][] = array( |
298 | 300 | '#value' => '<div>'. t("Alternatively, you can give !Forum_Access priority over @Content_Access by either raising the priority of !Forum_Access in every forum above the priority of @Content_Access, or by lowering the priority of @Content_Access for the content types in question below the priority of !Forum_Access.", $variables) .'</div>', |
299 | 301 | ); |
300 | - } |
|
301 | - else { |
|
302 | + } else { |
|
302 | 303 | $form['forum_access']['interference'][] = array( |
303 | 304 | '#value' => '<p>'. t('Note: You have installed the !Content_Access module, which has the capability to grant access to content that would otherwise be protected by !Forum_Access. Be careful when configuring @Content_Access!', $variables) .'</p>', |
304 | 305 | ); |
@@ -445,21 +446,17 @@ discard block |
||
445 | 446 | $element[$rid]['#suffix'] = "</span>"; |
446 | 447 | $element[$rid]['#default_value'] = TRUE; |
447 | 448 | $element[$rid]['#disabled'] = TRUE; |
448 | - } |
|
449 | - elseif ($element['#parents'][1] == 'create') { |
|
449 | + } elseif ($element['#parents'][1] == 'create') { |
|
450 | 450 | // Do nothing (Post is always mutable). |
451 | - } |
|
452 | - elseif ($element['#parents'][1] == 'comment_create') { |
|
453 | - } |
|
454 | - elseif ($element['#parents'][1] == 'view' && isset($permissions[$rid]['administer forums'])) { |
|
451 | + } elseif ($element['#parents'][1] == 'comment_create') { |
|
452 | + } elseif ($element['#parents'][1] == 'view' && isset($permissions[$rid]['administer forums'])) { |
|
455 | 453 | $element[$rid]['#title'] = '<em>'. $element[$rid]['#title'] .'</em>'; |
456 | 454 | $element[$rid]['#prefix'] = '<span title="'. t("This role has the '@administer_forums' permission, and granting '@View' enables the role holders to change the settings on this page, including @Access_control!", array('@administer_forums' => $tr('administer forums'), '@View' => t('View'), '@Access_control' => t('Access control'))) .'">'; |
457 | 455 | if (isset($permissions[$rid]['administer nodes'])) { |
458 | 456 | $element[$rid]['#prefix'] = str_replace('">', ' '. t("Because the role also has the '@administer_nodes' permission, it has full access to all nodes either way.", array('@administer_nodes' => $tr('administer nodes'))) .'">', $element[$rid]['#prefix']); |
459 | 457 | } |
460 | 458 | $element[$rid]['#suffix'] = "</span>"; |
461 | - } |
|
462 | - elseif (isset($permissions[$rid]['administer nodes'])) { |
|
459 | + } elseif (isset($permissions[$rid]['administer nodes'])) { |
|
463 | 460 | $element[$rid]['#disabled'] = TRUE; |
464 | 461 | $element[$rid]['#default_value'] = TRUE; |
465 | 462 | $element[$rid]['#prefix'] = '<span title="'. ($rid != $moderator_rid |
@@ -515,8 +512,7 @@ discard block |
||
515 | 512 | if ($settings['priority'] != 0) { |
516 | 513 | $form['interference']['advanced']['#collapsed'] = FALSE; |
517 | 514 | } |
518 | - } |
|
519 | - elseif (is_array(reset($form_state['values']['forum_access']['template']['taxonomy']))) { |
|
515 | + } elseif (is_array(reset($form_state['values']['forum_access']['template']['taxonomy']))) { |
|
520 | 516 | $imv = reset($form_state['values']['forum_access']['template']['taxonomy']); |
521 | 517 | $template_tid = reset($imv); |
522 | 518 | } |
@@ -549,14 +545,12 @@ discard block |
||
549 | 545 | $template_tid = reset(array_values($access['template']['taxonomy'])); |
550 | 546 | if ($access['template']['select_by_default']) { |
551 | 547 | variable_set('forum_access_default_template_tid', $template_tid); |
552 | - } |
|
553 | - elseif (variable_get('forum_access_default_template_tid', 0) == $template_tid) { |
|
548 | + } elseif (variable_get('forum_access_default_template_tid', 0) == $template_tid) { |
|
554 | 549 | variable_del('forum_access_default_template_tid'); |
555 | 550 | } |
556 | 551 | if ($access['template']['load_for_new']) { |
557 | 552 | variable_set('forum_access_new_template_tid', $template_tid); |
558 | - } |
|
559 | - elseif (variable_get('forum_access_new_template_tid', 0) == $template_tid) { |
|
553 | + } elseif (variable_get('forum_access_new_template_tid', 0) == $template_tid) { |
|
560 | 554 | variable_del('forum_access_new_template_tid'); |
561 | 555 | } |
562 | 556 | module_load_include('node.inc', 'forum_access'); |
@@ -598,8 +592,7 @@ discard block |
||
598 | 592 | // We prefer not to save records for node administrators, because these have access anyway. |
599 | 593 | if (isset($permissions[$rid]['administer forums']) && $access['view'][$rid]) { |
600 | 594 | // For forum administrators, View needs to be saved, ... |
601 | - } |
|
602 | - else { |
|
595 | + } else { |
|
603 | 596 | // ... otherwise forget View. |
604 | 597 | $access['view'][$rid] = FALSE; |
605 | 598 | } |
@@ -607,8 +600,7 @@ discard block |
||
607 | 600 | db_query("INSERT INTO {forum_access} (tid, rid, grant_view, grant_update, grant_delete, grant_create, grant_comment_create, priority) VALUES (%d, %d, %d, %d, %d, %d, %d, %d)", |
608 | 601 | $tid, $rid, !empty($access['view'][$rid]), 0, 0, !empty($access['create'][$rid]), !empty($access['comment_create'][$rid]), $fa_priority); |
609 | 602 | } |
610 | - } |
|
611 | - else { |
|
603 | + } else { |
|
612 | 604 | db_query("INSERT INTO {forum_access} (tid, rid, grant_view, grant_update, grant_delete, grant_create, grant_comment_create, priority) VALUES (%d, %d, %d, %d, %d, %d, %d, %d)", |
613 | 605 | $tid, $rid, (bool) $checked, !empty($access['update'][$rid]), !empty($access['delete'][$rid]), !empty($access['create'][$rid]), !empty($access['comment_create'][$rid]), $fa_priority); |
614 | 606 | } |
@@ -620,8 +612,7 @@ discard block |
||
620 | 612 | if (!$is_new && $form_state['values']['form_id'] != 'forum_form_container') { |
621 | 613 | if (!isset($access['update_choice']) || $access['update_choice'] == 2) { |
622 | 614 | node_access_needs_rebuild(TRUE); |
623 | - } |
|
624 | - elseif ($access['update_choice'] == 0) { |
|
615 | + } elseif ($access['update_choice'] == 0) { |
|
625 | 616 | // update immediately (but use the batch functions anyway |
626 | 617 | $save_redirect = $form_state['redirect']; |
627 | 618 | $form_state['redirect'] = $_GET['q']; |
@@ -632,13 +623,13 @@ discard block |
||
632 | 623 | _forum_access_update_batch_operation($tid, 999999, 1, $context); |
633 | 624 | $pending_error_messages = drupal_get_messages('error', TRUE); // still alive, get and clear all 'error' messages |
634 | 625 | unset($pending_error_messages['error'][$our_error_message_index]); // remove our error message |
635 | - foreach ($pending_error_messages['error'] as $message) { // replay any others |
|
626 | + foreach ($pending_error_messages['error'] as $message) { |
|
627 | +// replay any others |
|
636 | 628 | drupal_set_message($message, 'error'); |
637 | 629 | } |
638 | 630 | _forum_access_update_batch_finished(TRUE, array(), array()); |
639 | 631 | $form_state['redirect'] = $save_redirect; |
640 | - } |
|
641 | - else { |
|
632 | + } else { |
|
642 | 633 | // mass update in batch mode, modeled after node.module |
643 | 634 | $limit = $access['update_limit']; |
644 | 635 | $count = db_result(db_query("SELECT COUNT(DISTINCT n.nid) FROM {node} n INNER JOIN {term_node} tn ON tn.vid = n.vid WHERE tn.tid = %d", $tid)); |
@@ -698,8 +689,7 @@ discard block |
||
698 | 689 | if ($success) { |
699 | 690 | drupal_set_message(t('The content access permissions have been updated.')); |
700 | 691 | cache_clear_all(); |
701 | - } |
|
702 | - else { |
|
692 | + } else { |
|
703 | 693 | drupal_set_message(t('The content access permissions have not been properly updated.'), 'error'); |
704 | 694 | } |
705 | 695 | } |
@@ -744,8 +734,7 @@ discard block |
||
744 | 734 | $return['view'] = array(DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID); |
745 | 735 | $return['create'] = array(DRUPAL_AUTHENTICATED_RID); |
746 | 736 | $return['comment_create'] = array(DRUPAL_AUTHENTICATED_RID); |
747 | - } |
|
748 | - else { |
|
737 | + } else { |
|
749 | 738 | $result = db_query("SELECT * FROM {forum_access} where tid = %d", $tid); |
750 | 739 | while ($access = db_fetch_object($result)) { |
751 | 740 | if ($access->grant_view) { |
@@ -763,7 +752,8 @@ discard block |
||
763 | 752 | if ($access->grant_comment_create) { |
764 | 753 | $return['comment_create'][] = $access->rid; |
765 | 754 | } |
766 | - if ($access->rid == DRUPAL_AUTHENTICATED_RID) { // this is our reference |
|
755 | + if ($access->rid == DRUPAL_AUTHENTICATED_RID) { |
|
756 | +// this is our reference |
|
767 | 757 | $return['priority'] = $access->priority; |
768 | 758 | } |
769 | 759 | } |
@@ -831,8 +821,7 @@ discard block |
||
831 | 821 | drupal_set_message(t('Note: In Drupal, access can only be granted, not taken away. Whatever access you grant here will not be reflected in the !Forum_Access_link settings, but !Forum_Access can only allow <i>more</i> access, not less.', $variables) |
832 | 822 | .'<br /><span class="error">'. t('Specifically, any rights granted to the %anonymous_user and/or the %authenticated_user will <b>override</b> the settings of !Forum_Access!', $variables) .'</span>' |
833 | 823 | .'<br />'. t('To avoid conflicts with !Forum_Access settings, you may want to lower the priority of !Content_Access (under %Advanced below) below the priority of !Forum_Access for the content types that you want to be controlled by !Forum_Access.', $variables), 'warning'); |
834 | - } |
|
835 | - else { |
|
824 | + } else { |
|
836 | 825 | $vid = _forum_access_get_vid(); |
837 | 826 | $vocabulary = taxonomy_vocabulary_load($vid); |
838 | 827 | if (isset($vocabulary->nodes[arg(3)])) { |
@@ -926,8 +915,7 @@ discard block |
||
926 | 915 | } |
927 | 916 | watchdog('user', $msg, NULL, WATCHDOG_NOTICE); |
928 | 917 | return $rid; |
929 | - } |
|
930 | - else { |
|
918 | + } else { |
|
931 | 919 | $msg = t('!Forum_Access cannot create the %role role!', $variables); |
932 | 920 | watchdog('user', $msg, NULL, WATCHDOG_WARNING); |
933 | 921 | drupal_set_message($msg .' '. t('Is it already in use?'), 'error'); |
@@ -22,8 +22,7 @@ discard block |
||
22 | 22 | // Strip preformatted code blocks from text during line break processing, replaced below |
23 | 23 | $body = str_replace($code_tag[0], "***pRe_sTrInG$i***", $body); |
24 | 24 | $pre[$i++] = '<pre class="bb-code-block">'. $code_tag[1] .'</pre>'; |
25 | - } |
|
26 | - else |
|
25 | + } else |
|
27 | 26 | $body = str_replace($code_tag[0], '<pre class="bb-code-block">'. $code_tag[1] .'</pre>', $body); |
28 | 27 | } |
29 | 28 | } |
@@ -34,7 +33,8 @@ discard block |
||
34 | 33 | if ($mode == 1) // Line breaks only (starting with PHP 4.0.5, nl2br() is XHTML compliant) |
35 | 34 | $body = nl2br($body); |
36 | 35 | |
37 | - if ($mode == 2) { // Line and paragraph breaks (may not always be XHTML compliant) |
|
36 | + if ($mode == 2) { |
|
37 | +// Line and paragraph breaks (may not always be XHTML compliant) |
|
38 | 38 | $body = preg_replace("/(\r\n|\n|\r)/", "\n", $body); |
39 | 39 | $body = preg_replace("/\n\n+/", "\n\n", $body); |
40 | 40 | $parts = explode("\n\n", $body); |
@@ -51,8 +51,9 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | // Reinsert preformatted code blocks |
54 | - foreach ($pre as $i => $code_tag) |
|
55 | - $body = str_replace("***pRe_sTrInG$i***", $code_tag, $body); |
|
54 | + foreach ($pre as $i => $code_tag) { |
|
55 | + $body = str_replace("***pRe_sTrInG$i***", $code_tag, $body); |
|
56 | + } |
|
56 | 57 | } |
57 | 58 | |
58 | 59 | // Replace any improper quote tags with proper quote tags |
@@ -83,7 +84,8 @@ discard block |
||
83 | 84 | } |
84 | 85 | |
85 | 86 | // begin processing for [size] |
86 | - if (stristr($body, '[size=') !== FALSE) { // prevent useless processing |
|
87 | + if (stristr($body, '[size=') !== FALSE) { |
|
88 | +// prevent useless processing |
|
87 | 89 | $arr = array( |
88 | 90 | 'tag' => 'size', |
89 | 91 | 'pattern' => '#\[\x07=([\d]+)(?::\w+)?\]([^\x07]*)\[/\x07(?::\w+)?\]#esi', |
@@ -93,7 +95,8 @@ discard block |
||
93 | 95 | } // end processing for [size] |
94 | 96 | |
95 | 97 | // begin processing for [color] |
96 | - if (stristr($body, '[color=') !== FALSE) { // prevent useless processing |
|
98 | + if (stristr($body, '[color=') !== FALSE) { |
|
99 | +// prevent useless processing |
|
97 | 100 | $arr = array( |
98 | 101 | 'tag' => 'color', |
99 | 102 | 'pattern' => '#\[\x07=([\#\w]+)(?::\w+)?\]([^\x07]*)\[/\x07(?::\w+)?\]#si', |
@@ -103,7 +106,8 @@ discard block |
||
103 | 106 | } // end processing for [color] |
104 | 107 | |
105 | 108 | // begin processing for [font] |
106 | - if (stristr($body, '[font=') !== FALSE) { // prevent useless processing |
|
109 | + if (stristr($body, '[font=') !== FALSE) { |
|
110 | +// prevent useless processing |
|
107 | 111 | $arr = array( |
108 | 112 | 'tag' => 'font', |
109 | 113 | 'pattern' => '#\[\x07=([\w\s]+)(?::\w+)?\]([^\x07]*)\[/\x07(?::\w+)?\]#si', |
@@ -113,7 +117,8 @@ discard block |
||
113 | 117 | } // end processing for [font] |
114 | 118 | |
115 | 119 | // begin processing for [list] and [*] |
116 | - if (stristr($body, '[list') !== FALSE) { // prevent useless processing |
|
120 | + if (stristr($body, '[list') !== FALSE) { |
|
121 | +// prevent useless processing |
|
117 | 122 | $l_type = array( |
118 | 123 | NULL => array('style' => 'circle', 'tag' => 'ul'), |
119 | 124 | 'c' => array('style' => 'circle', 'tag' => 'ul'), |
@@ -235,8 +240,7 @@ discard block |
||
235 | 240 | // Replacing email addresses with encoded html |
236 | 241 | $body = preg_replace_callback('#\[email(?::\w+)?\]([\w\.\-\+~@]+)\[/email(?::\w+)?\]#si', '_bbcode_encode_mailto', $body); |
237 | 242 | $body = preg_replace_callback('#\[email=(.*?)(?::\w+)?\](.*?)\[/email(?::\w+)?\]#si', '_bbcode_encode_mailto', $body); |
238 | - } |
|
239 | - else { |
|
243 | + } else { |
|
240 | 244 | $body = preg_replace( |
241 | 245 | array('#\[email(?::\w+)?\](.*?)\[/email(?::\w+)?\]#si','#\[email=(.*?)(?::\w+)?\]([\w\s]+)\[/email(?::\w+)?\]#si'), |
242 | 246 | array('<a href="mailto:\\1" class="bb-email">\\1</a>', '<a href="mailto:\\1" class="bb-email">\\2</a>'), |
@@ -330,8 +334,9 @@ discard block |
||
330 | 334 | $link = 'document.write(\'<a href="mailto:' . $matches[1] . '" class="bb-email">' . (isset($matches[2]) ? $matches[2] : $matches[1]) . '</a>\');'; |
331 | 335 | |
332 | 336 | $js_encode = ''; |
333 | - for ($x = 0; $x < strlen($link); $x++) |
|
334 | - $js_encode .= '%' . bin2hex($link{$x}); |
|
337 | + for ($x = 0; $x < strlen($link); $x++) { |
|
338 | + $js_encode .= '%' . bin2hex($link{$x}); |
|
339 | + } |
|
335 | 340 | |
336 | 341 | $link = '<script type="text/javascript">eval(unescape(\''.$js_encode.'\'))</script>'; |
337 | 342 | if (isset($matches[3])) |
@@ -10,8 +10,7 @@ discard block |
||
10 | 10 | if ($long) { |
11 | 11 | include_once(drupal_get_path('module', 'bbcode') .'/bbcode-help.inc'); |
12 | 12 | return _bbcode_filter_tip(); |
13 | - } |
|
14 | - else { |
|
13 | + } else { |
|
15 | 14 | # D5: $output = t('You can use !BBCode tags in the text.', array('!BBCode' => l(t('BBCode'), "filter/tips/$format", NULL, NULL, 'filter-bbcode-' . $delta))); |
16 | 15 | $output = t('You can use !BBCode (opens in new window) tags in the text.', |
17 | 16 | array( |
@@ -50,8 +49,7 @@ discard block |
||
50 | 49 | $elapsed += $timing_stop[0] - $timing_start[0]; |
51 | 50 | $ret .= '<hr />'. l('BBCode', "filter/tips/$format") .' parsed on '.date('r').'<br />Execution time: '.$elapsed.' seconds.<hr />'; |
52 | 51 | return $ret; |
53 | - } |
|
54 | - else |
|
52 | + } else |
|
55 | 53 | return _bbcode_filter_process($text, $format); |
56 | 54 | |
57 | 55 | case 'settings': |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | // Else user may view the page when they are going to create their own profile |
92 | 92 | // or have permission to create it for others. |
93 | 93 | global $user; |
94 | - if ($user->uid == $account->uid || user_access('administer nodes') ){ |
|
94 | + if ($user->uid == $account->uid || user_access('administer nodes') ) { |
|
95 | 95 | return node_access('create', $type); |
96 | 96 | } |
97 | 97 | return FALSE; |
@@ -270,8 +270,7 @@ discard block |
||
270 | 270 | '#title' => t('Use this content type as a content profile for users'), |
271 | 271 | '#default_value' => variable_get('content_profile_use_'. $form['#node_type']->type, FALSE), |
272 | 272 | ); |
273 | - } |
|
274 | - elseif (isset($form['#node']) && $form['#node']->type .'_node_form' == $form_id && is_content_profile($form['#node'])) { |
|
273 | + } elseif (isset($form['#node']) && $form['#node']->type .'_node_form' == $form_id && is_content_profile($form['#node'])) { |
|
275 | 274 | // Customize the redirect target and buttons of our own node forms. |
276 | 275 | if (arg(0) == 'user' && is_numeric(arg(1)) && arg(2) == 'edit' || arg(2) == 'profile') { |
277 | 276 | $form['buttons']['preview']['#access'] = FALSE; |
@@ -382,8 +381,7 @@ discard block |
||
382 | 381 | // This node already exists, redirect to edit page |
383 | 382 | drupal_goto('node/'. $nid .'/edit', 'destination=user/'. $node->uid); |
384 | 383 | } |
385 | - } |
|
386 | - elseif ($op == 'validate' && is_content_profile($node) && user_access('administer nodes')) { |
|
384 | + } elseif ($op == 'validate' && is_content_profile($node) && user_access('administer nodes')) { |
|
387 | 385 | $form = $a3; |
388 | 386 | // Only validate if the user-name changed or we add a new node |
389 | 387 | if (!empty($node->nid) && $form['author']['name']['#default_value'] == $node->name) { |
@@ -394,8 +392,7 @@ discard block |
||
394 | 392 | if ($uid && content_profile_profile_exists($node, $uid)) { |
395 | 393 | form_set_error('name', t('This user already has a content profile of this type. You can only create one profile per user.')); |
396 | 394 | } |
397 | - } |
|
398 | - elseif ($op == 'prepare translation' && is_content_profile($node->translation_source)) { |
|
395 | + } elseif ($op == 'prepare translation' && is_content_profile($node->translation_source)) { |
|
399 | 396 | // Make sure the translated profile belongs to the same user. |
400 | 397 | $node->uid = $node->translation_source->uid; |
401 | 398 | $node->name = $node->translation_source->name; |
@@ -504,8 +501,7 @@ discard block |
||
504 | 501 | $node = content_profile_load($type, $arg[1]); |
505 | 502 | if ($node) { |
506 | 503 | return node_help('node/%/edit', array(1 => $node->nid)); |
507 | - } |
|
508 | - else { |
|
504 | + } else { |
|
509 | 505 | return node_help('node/add/'. $type, array('node', 'add', $type)); |
510 | 506 | } |
511 | 507 | } |
@@ -537,8 +533,7 @@ discard block |
||
537 | 533 | |
538 | 534 | // Working around the bug described at http://drupal.org/node/302873 |
539 | 535 | module_load_include('inc', 'content_profile', 'content_profile.theme'); |
540 | - } |
|
541 | - elseif (user_access('create '. $type .' content') && content_profile_get_settings($type, 'add_link') && !$node && ($uid == $user->uid || user_access('administer nodes'))) { |
|
536 | + } elseif (user_access('create '. $type .' content') && content_profile_get_settings($type, 'add_link') && !$node && ($uid == $user->uid || user_access('administer nodes'))) { |
|
542 | 537 | $content['content_profile_'. $type] = array( |
543 | 538 | '#admin' => $uid != $user->uid, |
544 | 539 | '#theme' => 'content_profile_display_add_link', |
@@ -21,8 +21,7 @@ discard block |
||
21 | 21 | foreach ($form['#content_profile_registration_use_types'] as $type => $typename) { |
22 | 22 | content_profile_registration_add_profile_form($type, $form, $form_state); |
23 | 23 | } |
24 | - } |
|
25 | - elseif ($form_id == 'content_profile_admin_settings') { |
|
24 | + } elseif ($form_id == 'content_profile_admin_settings') { |
|
26 | 25 | $type = $form_state['type']; |
27 | 26 | // Let other modules add registration child elements before us! |
28 | 27 | $form += array('registration' => array()); |
@@ -133,8 +132,7 @@ discard block |
||
133 | 132 | // Set this to the values of one node, as it might be need by some #ahah callbacks |
134 | 133 | $form_add['#node'] = $node_form['#node']; |
135 | 134 | $form_add['type'] = $node_form['type']; |
136 | - } |
|
137 | - else { |
|
135 | + } else { |
|
138 | 136 | foreach (array('uid', 'name', 'author', 'buttons', 'language', '#theme', 'options') as $key) { |
139 | 137 | unset($node_form[$key]); |
140 | 138 | } |
@@ -148,8 +146,7 @@ discard block |
||
148 | 146 | if (count(element_children($form_add[$group_name])) == 0) { |
149 | 147 | unset($form_add[$group_name]); |
150 | 148 | } |
151 | - } |
|
152 | - else { |
|
149 | + } else { |
|
153 | 150 | unset($form_add[$field_name]); |
154 | 151 | } |
155 | 152 | } |
@@ -175,7 +172,7 @@ discard block |
||
175 | 172 | } |
176 | 173 | |
177 | 174 | // Set the enctype, if necessary. |
178 | - if (isset($node_form['#attributes']['enctype'])){ |
|
175 | + if (isset($node_form['#attributes']['enctype'])) { |
|
179 | 176 | $form['#attributes']['enctype'] = $node_form['#attributes']['enctype']; |
180 | 177 | } |
181 | 178 | } |
@@ -213,8 +210,7 @@ discard block |
||
213 | 210 | |
214 | 211 | if (!in_array('other', content_profile_get_settings($type, 'registration_hide'))) { |
215 | 212 | node_validate($node, $form); |
216 | - } |
|
217 | - elseif (module_exists('content')) { |
|
213 | + } elseif (module_exists('content')) { |
|
218 | 214 | content_validate($node); |
219 | 215 | } |
220 | 216 | |
@@ -232,8 +228,7 @@ discard block |
||
232 | 228 | function _content_profile_registration_remove_values($key, $element, &$form_state) { |
233 | 229 | if ((isset($element['#input']) || !empty($element['#tree'])) && isset($form_state['values'][$key])) { |
234 | 230 | unset($form_state['values'][$key]); |
235 | - } |
|
236 | - elseif (empty($element['#input']) && empty($element['#tree'])) { |
|
231 | + } elseif (empty($element['#input']) && empty($element['#tree'])) { |
|
237 | 232 | foreach (element_children($element) as $key) { |
238 | 233 | _content_profile_registration_remove_values($key, $element[$key], $form_state); |
239 | 234 | } |
@@ -96,8 +96,7 @@ discard block |
||
96 | 96 | if ($view->base_table == 'node' && !empty($view->display['default']->display_options['fields'])) { |
97 | 97 | if ($view->type == 'Default') { |
98 | 98 | $views[t('Default Views')][$view->name] = $view->name; |
99 | - } |
|
100 | - else { |
|
99 | + } else { |
|
101 | 100 | $views[t('Existing Views')][$view->name] = $view->name; |
102 | 101 | } |
103 | 102 | } |
@@ -125,8 +124,7 @@ discard block |
||
125 | 124 | '#required' => FALSE, |
126 | 125 | '#description' => t('Provide a comma separated list of arguments to pass to the view.'), |
127 | 126 | ); |
128 | - } |
|
129 | - else { |
|
127 | + } else { |
|
130 | 128 | $form['advanced']['no_view_help'] = array( |
131 | 129 | '#value' => t('<p>The list of nodes that can be referenced can be based on a "Views module" view but no appropriate views were found. <br />Note:</p>') . |
132 | 130 | t('<ul><li>Only views that have fields will work for this purpose.</li><li>This will discard the "Content types" settings above. Use the view\'s "filters" section instead.</li><li>Use the view\'s "fields" section to display additional informations about candidate nodes on node creation/edition form.</li><li>Use the view\'s "sort criteria" section to determine the order in which candidate nodes will be displayed.</li></ul>'), |
@@ -212,8 +210,7 @@ discard block |
||
212 | 210 | if (is_array($item) && !empty($item['nid'])) { |
213 | 211 | if (is_numeric($item['nid'])) { |
214 | 212 | $ids[] = $item['nid']; |
215 | - } |
|
216 | - else { |
|
213 | + } else { |
|
217 | 214 | $error_element = isset($item['_error_element']) ? $item['_error_element'] : ''; |
218 | 215 | if (is_array($item) && isset($item['_error_element'])) unset($item['_error_element']); |
219 | 216 | form_set_error($error_element, t("%name: invalid input.", array('%name' => t($field['widget']['label'])))); |
@@ -487,8 +484,7 @@ discard block |
||
487 | 484 | '#element_validate' => array('_element_validate_integer_positive'), |
488 | 485 | '#required' => TRUE, |
489 | 486 | ); |
490 | - } |
|
491 | - else { |
|
487 | + } else { |
|
492 | 488 | $form['autocomplete_match'] = array('#type' => 'hidden', '#value' => $match); |
493 | 489 | $form['size'] = array('#type' => 'hidden', '#value' => $size); |
494 | 490 | } |
@@ -736,14 +732,12 @@ discard block |
||
736 | 732 | if (!empty($title) && ($n = node_load($nid)) && trim($title) != trim($n->title)) { |
737 | 733 | form_error($element[$field_key], t('%name: title mismatch. Please check your selection.', array('%name' => t($field['widget']['label'])))); |
738 | 734 | } |
739 | - } |
|
740 | - else { |
|
735 | + } else { |
|
741 | 736 | // No explicit nid. |
742 | 737 | $reference = _nodereference_potential_references($field, $value, 'equals', NULL, 1); |
743 | 738 | if (empty($reference)) { |
744 | 739 | form_error($element[$field_key], t('%name: found no valid post with that title.', array('%name' => t($field['widget']['label'])))); |
745 | - } |
|
746 | - else { |
|
740 | + } else { |
|
747 | 741 | // TODO: |
748 | 742 | // the best thing would be to present the user with an additional form, |
749 | 743 | // allowing the user to choose between valid candidates with the same title |
@@ -868,8 +862,7 @@ discard block |
||
868 | 862 | if (!empty($field['advanced_view_args'])) { |
869 | 863 | // TODO: Support Tokens using token.module ? |
870 | 864 | $view_args = array_map('trim', explode(',', $field['advanced_view_args'])); |
871 | - } |
|
872 | - else { |
|
865 | + } else { |
|
873 | 866 | $view_args = array(); |
874 | 867 | } |
875 | 868 | |
@@ -894,8 +887,7 @@ discard block |
||
894 | 887 | |
895 | 888 | // Get the results. |
896 | 889 | $result = $view->execute_display($display, $view_args); |
897 | - } |
|
898 | - else { |
|
890 | + } else { |
|
899 | 891 | $result = FALSE; |
900 | 892 | } |
901 | 893 | |
@@ -933,8 +925,7 @@ discard block |
||
933 | 925 | ); |
934 | 926 | $where[] = 'n.title '. (isset($match_clauses[$match]) ? $match_clauses[$match] : $match_clauses['contains']); |
935 | 927 | $args[] = $string; |
936 | - } |
|
937 | - elseif ($ids) { |
|
928 | + } elseif ($ids) { |
|
938 | 929 | $where[] = 'n.nid IN (' . db_placeholders($ids) . ')'; |
939 | 930 | $args = array_merge($args, $ids); |
940 | 931 | } |
@@ -133,8 +133,7 @@ discard block |
||
133 | 133 | '#rows' => 6, |
134 | 134 | '#description' => t('Advanced usage only: PHP code that returns a keyed array of allowed values. Should not include <?php ?> delimiters. If this field is filled out, the array returned by this code will override the allowed values list above.'), |
135 | 135 | ); |
136 | - } |
|
137 | - else { |
|
136 | + } else { |
|
138 | 137 | $form['allowed_values_fieldset']['advanced_options']['markup_allowed_values_php'] = array( |
139 | 138 | '#type' => 'item', |
140 | 139 | '#title' => t('Code'), |
@@ -514,8 +513,7 @@ discard block |
||
514 | 513 | if ($start != $value) { |
515 | 514 | $error_field = implode('][', $element['#parents']) .']['. $field_key; |
516 | 515 | form_set_error($error_field, t('Only numbers and decimals are allowed in %field.', array('%field' => t($field['widget']['label'])))); |
517 | - } |
|
518 | - else { |
|
516 | + } else { |
|
519 | 517 | form_set_value($element[$field_key], $value, $form_state); |
520 | 518 | } |
521 | 519 | } |
@@ -537,8 +535,7 @@ discard block |
||
537 | 535 | if ($start != $value) { |
538 | 536 | $error_field = implode('][', $element['#parents']) .']['. $field_key; |
539 | 537 | form_set_error($error_field, t('Only numbers are allowed in %field.', array('%field' => t($field['widget']['label'])))); |
540 | - } |
|
541 | - else { |
|
538 | + } else { |
|
542 | 539 | form_set_value($element[$field_key], $value, $form_state); |
543 | 540 | } |
544 | 541 | } |
@@ -561,8 +558,7 @@ discard block |
||
561 | 558 | if ($start != $value) { |
562 | 559 | $error_field = implode('][', $element['#parents']) .']['. $field_key; |
563 | 560 | form_set_error($error_field, t('Only numbers and the decimal character (%decimal) are allowed in %field.', array('%decimal' => $element['#decimal'], '%field' => t($field['widget']['label'])))); |
564 | - } |
|
565 | - else { |
|
561 | + } else { |
|
566 | 562 | $value = str_replace($element['#decimal'], '.', $value); |
567 | 563 | $value = round($value, $element['#scale']); |
568 | 564 | form_set_value($element[$field_key], $value, $form_state); |
@@ -95,8 +95,7 @@ discard block |
||
95 | 95 | '#rows' => 6, |
96 | 96 | '#description' => t('Advanced usage only: PHP code that returns a keyed array of allowed values. Should not include <?php ?> delimiters. If this field is filled out, the array returned by this code will override the allowed values list above.'), |
97 | 97 | ); |
98 | - } |
|
99 | - else { |
|
98 | + } else { |
|
100 | 99 | $form['allowed_values_fieldset']['advanced_options']['markup_allowed_values_php'] = array( |
101 | 100 | '#type' => 'item', |
102 | 101 | '#title' => t('Code'), |
@@ -112,8 +111,7 @@ discard block |
||
112 | 111 | case 'database columns': |
113 | 112 | if (empty($field['max_length']) || $field['max_length'] > 255) { |
114 | 113 | $columns['value'] = array('type' => 'text', 'size' => 'big', 'not null' => FALSE, 'sortable' => TRUE, 'views' => TRUE); |
115 | - } |
|
116 | - else { |
|
114 | + } else { |
|
117 | 115 | $columns['value'] = array('type' => 'varchar', 'length' => $field['max_length'], 'not null' => FALSE, 'sortable' => TRUE, 'views' => TRUE); |
118 | 116 | } |
119 | 117 | if (!empty($field['text_processing'])) { |
@@ -168,8 +166,7 @@ discard block |
||
168 | 166 | foreach ($items as $delta => $item) { |
169 | 167 | if (!empty($field['text_processing'])) { |
170 | 168 | $text = isset($item['value']) ? check_markup($item['value'], $item['format'], FALSE) : ''; |
171 | - } |
|
172 | - else { |
|
169 | + } else { |
|
173 | 170 | $text = isset($item['value']) ? check_plain($item['value']) : ''; |
174 | 171 | } |
175 | 172 | $items[$delta]['safe'] = $text; |
@@ -318,8 +315,7 @@ discard block |
||
318 | 315 | '#element_validate' => array('_element_validate_integer_positive'), |
319 | 316 | '#required' => TRUE, |
320 | 317 | ); |
321 | - } |
|
322 | - else { |
|
318 | + } else { |
|
323 | 319 | $form['rows'] = array( |
324 | 320 | '#type' => 'textfield', |
325 | 321 | '#title' => t('Rows'), |