@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | $count = 0; // This lets us prepare the key as we want it printed. |
67 | 67 | foreach ($this->view->display_handler->get_handlers('argument') as $arg => $handler) { |
68 | - $options[t('Arguments')]['%' . ++$count] = $handler->ui_name(); |
|
68 | + $options[t('Arguments')]['%'.++$count] = $handler->ui_name(); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $items = array(); |
80 | 80 | $title = t(ucwords($type)); |
81 | 81 | foreach ($options[$type] as $key => $value) { |
82 | - $items[] = $key .' == '. $value; |
|
82 | + $items[] = $key.' == '.$value; |
|
83 | 83 | } |
84 | 84 | $output .= theme('item_list', $items, $title); |
85 | 85 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $form['help'] = array( |
90 | 90 | '#type' => 'markup', |
91 | 91 | '#id' => 'views-tokens-help', |
92 | - '#value' => '<div><fieldset id="views-tokens-help"><legend>' . t('Replacement patterns') . '</legend>' . $output . '</fieldset></div>', |
|
92 | + '#value' => '<div><fieldset id="views-tokens-help"><legend>'.t('Replacement patterns').'</legend>'.$output.'</fieldset></div>', |
|
93 | 93 | ); |
94 | 94 | |
95 | 95 | $form['return'] = array( |
@@ -24,7 +24,7 @@ |
||
24 | 24 | function privatemsg_views_handlers() { |
25 | 25 | return array( |
26 | 26 | 'info' => array( |
27 | - 'path' => drupal_get_path('module', 'privatemsg') . '/views', |
|
27 | + 'path' => drupal_get_path('module', 'privatemsg').'/views', |
|
28 | 28 | ), |
29 | 29 | 'handlers' => array( |
30 | 30 | // field handlers |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | */ |
343 | 343 | function hook_privatemsg_message_view_alter(&$var) { |
344 | 344 | // add a link to each message |
345 | - $vars['message_links'][] = array('title' => t('My link'), 'href' => '/path/to/my/action/'. $vars['message']['mid']); |
|
345 | + $vars['message_links'][] = array('title' => t('My link'), 'href' => '/path/to/my/action/'.$vars['message']['mid']); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | } |
407 | 407 | |
408 | 408 | $args = array_merge(array($author->uid), array_keys($recipients)); |
409 | - $result = db_query('SELECT recipient FROM {pm_block_user} WHERE author = %d AND recipient IN ('. db_placeholders($recipients) .') GROUP BY recipient', $args); |
|
409 | + $result = db_query('SELECT recipient FROM {pm_block_user} WHERE author = %d AND recipient IN ('.db_placeholders($recipients).') GROUP BY recipient', $args); |
|
410 | 410 | while ($row = db_fetch_array($result)) { |
411 | 411 | $recipient = $recipients[$row['recipient']]; |
412 | 412 | // If there's a rule disallowing blocking of this message, send it anyway. |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | should be displayed automatically in the action form', |
459 | 459 | 'callback' => 'privatemsg_thread_change_status', // Function callback that will be executed. |
460 | 460 | 'callback arguments' => array('status' => PRIVATEMSG_READ), // Additional arguments to above function |
461 | - 'undo callback' => 'privatemsg_thread_change_status', // Provide a function which can "undo" the operation. Optional. |
|
461 | + 'undo callback' => 'privatemsg_thread_change_status', // Provide a function which can "undo" the operation. Optional. |
|
462 | 462 | 'undo callback arguments' => array('status' => PRIVATEMSG_UNREAD), // Additional arguments to above function. |
463 | 463 | ), |
464 | 464 | ); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | ), |
39 | 39 | ); |
40 | 40 | $query = _privatemsg_assemble_query(array('tags', 'privatemsg_filter')); |
41 | - $result = pager_query($query['query'] . tablesort_sql($header), 100); |
|
41 | + $result = pager_query($query['query'].tablesort_sql($header), 100); |
|
42 | 42 | |
43 | 43 | $rows = array(); |
44 | 44 | while ($tag = db_fetch_array($result)) { |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | $row['tag'] = check_plain($tag['tag']); |
47 | 47 | $row['count'] = $tag['count']; |
48 | 48 | $row['public'] = $tag['public'] ? t('Yes') : '-'; |
49 | - $row['operations'] = l(t('edit'), 'admin/settings/messages/tags/edit/' . $tag['tag_id']); |
|
50 | - $row['operations'] .= ' ' . l(t('delete'), 'admin/settings/messages/tags/delete/' . $tag['tag_id']); |
|
49 | + $row['operations'] = l(t('edit'), 'admin/settings/messages/tags/edit/'.$tag['tag_id']); |
|
50 | + $row['operations'] .= ' '.l(t('delete'), 'admin/settings/messages/tags/delete/'.$tag['tag_id']); |
|
51 | 51 | |
52 | 52 | $rows[] = $row; |
53 | 53 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $rows[] = array(array('data' => t('No tags available.'), 'colspan' => count($header))); |
58 | 58 | } |
59 | 59 | |
60 | - return theme('table', $header, $rows) . theme('pager'); |
|
60 | + return theme('table', $header, $rows).theme('pager'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | |
314 | 314 | function privatemsg_filter_dropdown(&$form_state, $account) { |
315 | 315 | |
316 | - drupal_add_css(drupal_get_path('module', 'privatemsg_filter') .'/privatemsg_filter.css'); |
|
316 | + drupal_add_css(drupal_get_path('module', 'privatemsg_filter').'/privatemsg_filter.css'); |
|
317 | 317 | |
318 | 318 | $form['filter'] = array( |
319 | 319 | '#type' => 'fieldset', |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | if (isset($filter['author'])) { |
378 | 378 | $string = ''; |
379 | 379 | foreach ($filter['author'] as $author) { |
380 | - $string .= $author->name . ', '; |
|
380 | + $string .= $author->name.', '; |
|
381 | 381 | } |
382 | 382 | $form['filter']['author']['#default_value'] = $string; |
383 | 383 | } |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | $query['tags'][] = $tag; |
442 | 442 | } |
443 | 443 | } |
444 | - $sql = 'SELECT pmt.tag FROM {pm_tags} pmt WHERE pmt.tag_id IN ('. implode(', ', $filter['tags']) .')'; |
|
444 | + $sql = 'SELECT pmt.tag FROM {pm_tags} pmt WHERE pmt.tag_id IN ('.implode(', ', $filter['tags']).')'; |
|
445 | 445 | $result = db_query($sql); |
446 | 446 | while ($row = db_fetch_object($result)) { |
447 | 447 | $query['tags'][] = $row->tag; |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | ); |
536 | 536 | |
537 | 537 | // JS for hiding the submit buttons. |
538 | - drupal_add_js(drupal_get_path('module', 'privatemsg_filter') .'/privatemsg-filter-list.js'); |
|
538 | + drupal_add_js(drupal_get_path('module', 'privatemsg_filter').'/privatemsg-filter-list.js'); |
|
539 | 539 | } |
540 | 540 | } |
541 | 541 | |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | $tags = array(); |
565 | 565 | |
566 | 566 | foreach ($thread['tags'] as $tag_id => $tag) { |
567 | - $tags[] = l(strlen($tag) > 15 ? substr($tag, 0, 13) . '...' : $tag, 'messages', array( |
|
567 | + $tags[] = l(strlen($tag) > 15 ? substr($tag, 0, 13).'...' : $tag, 'messages', array( |
|
568 | 568 | 'attributes' => array('title' => $tag), |
569 | 569 | 'query' => array('tags' => $tag) |
570 | 570 | )); |
@@ -611,11 +611,11 @@ discard block |
||
611 | 611 | |
612 | 612 | // Check if its a filtered view. |
613 | 613 | if ($argument == 'sent') { |
614 | - $fragments['where'][] = "pm.author = %d"; |
|
615 | - $fragments['query_args']['where'][] = $account->uid; |
|
614 | + $fragments['where'][] = "pm.author = %d"; |
|
615 | + $fragments['query_args']['where'][] = $account->uid; |
|
616 | 616 | } |
617 | 617 | if ($argument == 'inbox') { |
618 | - $fragments['having'][] = '((SELECT pmf.author FROM {pm_message} pmf WHERE pmf.mid = pmi.thread_id) = %d AND COUNT(pmi.thread_id) > 1) OR (SELECT COUNT(*) FROM {pm_message} pmf INNER JOIN {pm_index} pmif ON (pmf.mid = pmif.mid) WHERE pmif.thread_id = pmi.thread_id AND pmf.author <> %d) > 0'; |
|
618 | + $fragments['having'][] = '((SELECT pmf.author FROM {pm_message} pmf WHERE pmf.mid = pmi.thread_id) = %d AND COUNT(pmi.thread_id) > 1) OR (SELECT COUNT(*) FROM {pm_message} pmf INNER JOIN {pm_index} pmif ON (pmf.mid = pmif.mid) WHERE pmif.thread_id = pmi.thread_id AND pmf.author <> %d) > 0'; |
|
619 | 619 | $fragments['query_args']['having'][] = $account->uid; |
620 | 620 | $fragments['query_args']['having'][] = $account->uid; |
621 | 621 | } |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | foreach ($filter['tags'] as $tag) { |
628 | 628 | $fragments['inner_join'][] = "INNER JOIN {pm_tags_index} pmti$count ON (pmti$count.thread_id = pmi.thread_id AND pmti$count.uid = pmi.uid)"; |
629 | 629 | $fragments['where'][] = "pmti$count.tag_id = %d"; |
630 | - $fragments['query_args']['where'][] = $tag; |
|
630 | + $fragments['query_args']['where'][] = $tag; |
|
631 | 631 | $count++; |
632 | 632 | } |
633 | 633 | } |
@@ -636,20 +636,20 @@ discard block |
||
636 | 636 | foreach ($filter['author'] as $author) { |
637 | 637 | $fragments['inner_join'][] = "INNER JOIN {pm_index} pmi$count ON (pmi$count.mid = pm.mid)"; |
638 | 638 | $fragments['where'][] = "pmi$count.uid = %d"; |
639 | - $fragments['query_args']['where'][] = $author->uid; |
|
639 | + $fragments['query_args']['where'][] = $author->uid; |
|
640 | 640 | $count++; |
641 | 641 | } |
642 | 642 | } |
643 | 643 | |
644 | 644 | if (isset($filter['search']) && !empty($filter['search'])) { |
645 | 645 | if (variable_get('privatemsg_filter_searchbody', FALSE)) { |
646 | - $fragments['where'][] = "pm.subject LIKE '%s' OR pm.body LIKE '%s'"; |
|
647 | - $fragments['query_args']['where'][] = '%%'. $filter['search'] .'%%'; |
|
648 | - $fragments['query_args']['where'][] = '%%'. $filter['search'] .'%%'; |
|
646 | + $fragments['where'][] = "pm.subject LIKE '%s' OR pm.body LIKE '%s'"; |
|
647 | + $fragments['query_args']['where'][] = '%%'.$filter['search'].'%%'; |
|
648 | + $fragments['query_args']['where'][] = '%%'.$filter['search'].'%%'; |
|
649 | 649 | } |
650 | 650 | else { |
651 | - $fragments['where'][] = "pm.subject LIKE '%s'"; |
|
652 | - $fragments['query_args']['where'][] = '%%'. $filter['search'] .'%%'; |
|
651 | + $fragments['where'][] = "pm.subject LIKE '%s'"; |
|
652 | + $fragments['query_args']['where'][] = '%%'.$filter['search'].'%%'; |
|
653 | 653 | } |
654 | 654 | } |
655 | 655 | } |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | $count = db_result(db_query($query['count'])); |
679 | 679 | $tags = ''; |
680 | 680 | while ($tag = db_fetch_array($results)) { |
681 | - $tags .= $tag['tag'] . ', '; |
|
681 | + $tags .= $tag['tag'].', '; |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | $form['tags'] = array( |
@@ -755,10 +755,10 @@ discard block |
||
755 | 755 | if (!empty($fragment)) { |
756 | 756 | $query = _privatemsg_assemble_query(array('tags_autocomplete', 'privatemsg_filter'), $fragment, $tags); |
757 | 757 | $result = db_query_range($query['query'], $fragment, 0, 10); |
758 | - $prefix = count($tags) ? implode(", ", $tags) .", " : ''; |
|
758 | + $prefix = count($tags) ? implode(", ", $tags).", " : ''; |
|
759 | 759 | // 3: Build proper suggestions and print. |
760 | 760 | while ($tag = db_fetch_object($result)) { |
761 | - $matches[$prefix . $tag->tag .", "] = $tag->tag; |
|
761 | + $matches[$prefix.$tag->tag.", "] = $tag->tag; |
|
762 | 762 | } |
763 | 763 | } |
764 | 764 | // convert to object to prevent drupal bug, see http://drupal.org/node/175361 |
@@ -817,8 +817,8 @@ discard block |
||
817 | 817 | if (!empty($threads)) { |
818 | 818 | // If the tag list needs to be for specific threads. |
819 | 819 | $fragments['select'][] = 'ti.thread_id'; |
820 | - $fragments['inner_join'][] = 'INNER JOIN {pm_tags_index} ti on ti.tag_id = t.tag_id'; |
|
821 | - $fragments['where'][] = 'ti.thread_id IN (' . db_placeholders($threads) . ')'; |
|
820 | + $fragments['inner_join'][] = 'INNER JOIN {pm_tags_index} ti on ti.tag_id = t.tag_id'; |
|
821 | + $fragments['where'][] = 'ti.thread_id IN ('.db_placeholders($threads).')'; |
|
822 | 822 | $fragments['query_args']['where'] += $threads; |
823 | 823 | } |
824 | 824 | else { |
@@ -875,14 +875,14 @@ discard block |
||
875 | 875 | $fragments['select'][] = 'pmt.tag'; |
876 | 876 | $fragments['where'][] = "pmt.tag LIKE '%s'"; |
877 | 877 | // Escape % to get through the placeholder replacement. |
878 | - $fragments['query_args']['where'][] = $search .'%%'; |
|
878 | + $fragments['query_args']['where'][] = $search.'%%'; |
|
879 | 879 | if (!empty($tags)) { |
880 | 880 | // Exclude tags. |
881 | - $fragments['where'][] = "pmt.tag NOT IN (". db_placeholders($tags, 'text') .")"; |
|
881 | + $fragments['where'][] = "pmt.tag NOT IN (".db_placeholders($tags, 'text').")"; |
|
882 | 882 | $fragments['query_args']['where'] += $tags; |
883 | 883 | } |
884 | 884 | // LEFT JOIN to be able to load public, unused tags. |
885 | - $fragments['inner_join'][] = 'LEFT JOIN {pm_tags_index} pmti ON pmt.tag_id = pmti.tag_id AND pmti.uid = %d'; |
|
885 | + $fragments['inner_join'][] = 'LEFT JOIN {pm_tags_index} pmti ON pmt.tag_id = pmti.tag_id AND pmti.uid = %d'; |
|
886 | 886 | $fragments['query_args']['join'][] = $user->uid; |
887 | 887 | // Autocomplete should only display Tags used by that user or public tags. |
888 | 888 | // This is done to avoid information disclosure as part of tag names. |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $is_new = theme_mark(MARK_NEW); |
96 | 96 | $options['fragment'] = 'new'; |
97 | 97 | } |
98 | - $field['data'] = l($thread['subject'], 'messages/view/' . $thread['thread_id'], $options) . $is_new; |
|
98 | + $field['data'] = l($thread['subject'], 'messages/view/'.$thread['thread_id'], $options).$is_new; |
|
99 | 99 | $field['class'] = 'privatemsg-list-subject'; |
100 | 100 | return $field; |
101 | 101 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $options = array(); |
112 | 112 | if (!empty($thread['is_new']) && $thread['is_new'] < $thread['count']) { |
113 | 113 | $options['fragment'] = 'new'; |
114 | - $field['data'] .= '<br />' . l((format_plural($thread['is_new'], '(1 new)', '(@count new)')), 'messages/view/' . $thread['thread_id'], $options); |
|
114 | + $field['data'] .= '<br />'.l((format_plural($thread['is_new'], '(1 new)', '(@count new)')), 'messages/view/'.$thread['thread_id'], $options); |
|
115 | 115 | } |
116 | 116 | $field['class'] = 'privatemsg-list-count'; |
117 | 117 | return $field; |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | function theme_privatemsg_list($form) { |
240 | 240 | $has_posts = !empty($form['#data']); |
241 | 241 | |
242 | - drupal_add_css(drupal_get_path('module', 'privatemsg') .'/styles/privatemsg-list.css'); |
|
242 | + drupal_add_css(drupal_get_path('module', 'privatemsg').'/styles/privatemsg-list.css'); |
|
243 | 243 | |
244 | 244 | // Load the table columns. |
245 | 245 | $columns = array_merge(array('subject', 'last_updated'), array_filter(variable_get('privatemsg_display_fields', array('participants')))); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | function pm_block_user_help($path) { |
22 | 22 | switch ($path) { |
23 | 23 | case 'admin/settings/messages/block': |
24 | - return '<p>' . t('This area is used to define user blocking rules for the Privatemsg module. Rules allow control of who may block messages from whom. By default all users are allowed to block messages from anyone else. However, a site may have groups of users that need to contact or get information to others, for example: the site may have administrative staff or be a forum with moderators. Groups of users are defined by roles, which can be managed on the <a href="@roles">roles configuration page</a>.', array('@roles' => url('admin/user/roles'))) . '</p>'; |
|
24 | + return '<p>'.t('This area is used to define user blocking rules for the Privatemsg module. Rules allow control of who may block messages from whom. By default all users are allowed to block messages from anyone else. However, a site may have groups of users that need to contact or get information to others, for example: the site may have administrative staff or be a forum with moderators. Groups of users are defined by roles, which can be managed on the <a href="@roles">roles configuration page</a>.', array('@roles' => url('admin/user/roles'))).'</p>'; |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * Menu callback for blocked user settings. |
63 | 63 | */ |
64 | 64 | function pm_block_user_settings(&$form_state) { |
65 | - drupal_add_css(drupal_get_path('module', 'pm_block_user') .'/pm_block_user.css'); |
|
65 | + drupal_add_css(drupal_get_path('module', 'pm_block_user').'/pm_block_user.css'); |
|
66 | 66 | // Need to cache form for AHAH, so it can be rebuilt from cache later. |
67 | 67 | $form = array( |
68 | 68 | '#cache' => TRUE, |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | '#value' => t('More'), |
97 | 97 | '#weight' => 1, |
98 | 98 | '#prefix' => '<div id="add-rule-button">', |
99 | - '#suffix' => '<label for="edit-pm-block-actions-more">' . t('Add new rule') . '</label></div>', |
|
99 | + '#suffix' => '<label for="edit-pm-block-actions-more">'.t('Add new rule').'</label></div>', |
|
100 | 100 | '#submit' => array('pm_block_user_more_submit'), |
101 | 101 | '#ahah' => array( |
102 | 102 | 'path' => 'messages/block/js', |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | else { |
165 | 165 | // @todo: add whitelist options/default_value here. |
166 | 166 | } |
167 | - $form['action'] = array( |
|
167 | + $form['action'] = array( |
|
168 | 168 | '#type' => 'radios', |
169 | 169 | '#options' => $options, |
170 | 170 | '#disabled' => $row_disabled, |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | '#value' => t('Remove'), |
182 | 182 | '#attributes' => array('class' => 'remove-action'), |
183 | 183 | '#prefix' => '<div id="remove-rule-button">', |
184 | - '#suffix' => '<label for="edit-remove">' . t('Remove rule') . '</label></div>', |
|
184 | + '#suffix' => '<label for="edit-remove">'.t('Remove rule').'</label></div>', |
|
185 | 185 | '#ahah' => array( |
186 | 186 | 'path' => 'messages/block/js', |
187 | 187 | 'wrapper' => 'block-actions', |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id); |
297 | 297 | $output_form = $form['block_actions']; |
298 | 298 | unset($output_form['#prefix'], $output_form['#suffix']); // Prevent duplicate wrappers. |
299 | - $output = theme('status_messages') . drupal_render($output_form); |
|
299 | + $output = theme('status_messages').drupal_render($output_form); |
|
300 | 300 | |
301 | 301 | // Hack to make behaviours attach to new HTML controls (delete buttons in |
302 | 302 | // this case). |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | } |
525 | 525 | |
526 | 526 | $args = array_merge(array($author->uid), array_keys($recipients)); |
527 | - $result = db_query('SELECT recipient FROM {pm_block_user} WHERE author = %d AND recipient IN ('. db_placeholders($recipients) .') GROUP BY recipient', $args); |
|
527 | + $result = db_query('SELECT recipient FROM {pm_block_user} WHERE author = %d AND recipient IN ('.db_placeholders($recipients).') GROUP BY recipient', $args); |
|
528 | 528 | while ($row = db_fetch_array($result)) { |
529 | 529 | $recipient = $recipients[$row['recipient']]; |
530 | 530 | // If there's a rule disallowing blocking of this message, send it anyway. |
@@ -563,10 +563,10 @@ discard block |
||
563 | 563 | |
564 | 564 | if ($user->uid <> $author->uid) { |
565 | 565 | if ($vars['message']['is_blocked']) { |
566 | - $vars['message_actions']['unblock_author'] = array('title' => t('Unblock author'), 'href' => 'messages/block/'. $author->uid, 'query' => 'destination=messages/view/' . $thread_id); |
|
566 | + $vars['message_actions']['unblock_author'] = array('title' => t('Unblock author'), 'href' => 'messages/block/'.$author->uid, 'query' => 'destination=messages/view/'.$thread_id); |
|
567 | 567 | } |
568 | 568 | else { |
569 | - $vars['message_actions']['block_author'] = array('title' => t('Block author'), 'href' => 'messages/block/'. $author->uid, 'query' => 'destination=messages/view/' . $thread_id); |
|
569 | + $vars['message_actions']['block_author'] = array('title' => t('Block author'), 'href' => 'messages/block/'.$author->uid, 'query' => 'destination=messages/view/'.$thread_id); |
|
570 | 570 | } |
571 | 571 | } |
572 | 572 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | 'boinc_solr_comments_nodetypes' => variable_get('boinc_solr_comments_nodetypes', ''), |
34 | 34 | ); |
35 | 35 | if (empty($default['boinc_solr_comments_nodetypes'])) { |
36 | - $default['boinc_solr_comments_nodetypes'] = array('forum','team_forum','news','page','story'); |
|
36 | + $default['boinc_solr_comments_nodetypes'] = array('forum', 'team_forum', 'news', 'page', 'story'); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | // Define the form |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | var $MOD43; |
25 | 25 | |
26 | 26 | /* Class creator */ |
27 | - function pBarcode39($BasePath="",$EnableMOD43=FALSE) |
|
27 | + function pBarcode39($BasePath = "", $EnableMOD43 = FALSE) |
|
28 | 28 | { |
29 | - $this->MOD43 = $EnableMOD43; |
|
29 | + $this->MOD43 = $EnableMOD43; |
|
30 | 30 | $this->Codes = ""; |
31 | 31 | $this->Reverse = ""; |
32 | 32 | |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | |
37 | 37 | while (!feof($FileHandle)) |
38 | 38 | { |
39 | - $Buffer = fgets($FileHandle,4096); |
|
40 | - $Buffer = str_replace(chr(10),"",$Buffer); |
|
41 | - $Buffer = str_replace(chr(13),"",$Buffer); |
|
42 | - $Values = preg_split("/;/",$Buffer); |
|
39 | + $Buffer = fgets($FileHandle, 4096); |
|
40 | + $Buffer = str_replace(chr(10), "", $Buffer); |
|
41 | + $Buffer = str_replace(chr(13), "", $Buffer); |
|
42 | + $Values = preg_split("/;/", $Buffer); |
|
43 | 43 | |
44 | 44 | $this->Codes[$Values[0]] = $Values[1]; |
45 | 45 | } |
@@ -47,32 +47,32 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | /* Return the projected size of a barcode */ |
50 | - function getSize($TextString,$Format="") |
|
50 | + function getSize($TextString, $Format = "") |
|
51 | 51 | { |
52 | - $Angle = isset($Format["Angle"]) ? $Format["Angle"] : 0; |
|
53 | - $ShowLegend = isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE; |
|
54 | - $LegendOffset = isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5; |
|
52 | + $Angle = isset($Format["Angle"]) ? $Format["Angle"] : 0; |
|
53 | + $ShowLegend = isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE; |
|
54 | + $LegendOffset = isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5; |
|
55 | 55 | $DrawArea = isset($Format["DrawArea"]) ? $Format["DrawArea"] : FALSE; |
56 | 56 | $FontSize = isset($Format["FontSize"]) ? $Format["FontSize"] : 12; |
57 | - $Height = isset($Format["Height"]) ? $Format["Height"] : 30; |
|
57 | + $Height = isset($Format["Height"]) ? $Format["Height"] : 30; |
|
58 | 58 | |
59 | 59 | $TextString = $this->encode39($TextString); |
60 | 60 | $BarcodeLength = strlen($this->Result); |
61 | 61 | |
62 | - if ( $DrawArea ) { $WOffset = 20; } else { $WOffset = 0; } |
|
63 | - if ( $ShowLegend ) { $HOffset = $FontSize+$LegendOffset+$WOffset; } else { $HOffset = 0; } |
|
62 | + if ($DrawArea) { $WOffset = 20; } else { $WOffset = 0; } |
|
63 | + if ($ShowLegend) { $HOffset = $FontSize + $LegendOffset + $WOffset; } else { $HOffset = 0; } |
|
64 | 64 | |
65 | - $X1 = cos($Angle * PI / 180) * ($WOffset+$BarcodeLength); |
|
66 | - $Y1 = sin($Angle * PI / 180) * ($WOffset+$BarcodeLength); |
|
65 | + $X1 = cos($Angle*PI/180)*($WOffset + $BarcodeLength); |
|
66 | + $Y1 = sin($Angle*PI/180)*($WOffset + $BarcodeLength); |
|
67 | 67 | |
68 | - $X2 = $X1 + cos(($Angle+90) * PI / 180) * ($HOffset+$Height); |
|
69 | - $Y2 = $Y1 + sin(($Angle+90) * PI / 180) * ($HOffset+$Height); |
|
68 | + $X2 = $X1 + cos(($Angle + 90)*PI/180)*($HOffset + $Height); |
|
69 | + $Y2 = $Y1 + sin(($Angle + 90)*PI/180)*($HOffset + $Height); |
|
70 | 70 | |
71 | 71 | |
72 | - $AreaWidth = max(abs($X1),abs($X2)); |
|
73 | - $AreaHeight = max(abs($Y1),abs($Y2)); |
|
72 | + $AreaWidth = max(abs($X1), abs($X2)); |
|
73 | + $AreaHeight = max(abs($Y1), abs($Y2)); |
|
74 | 74 | |
75 | - return(array("Width"=>$AreaWidth,"Height"=>$AreaHeight)); |
|
75 | + return(array("Width"=>$AreaWidth, "Height"=>$AreaHeight)); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /* Create the encoded string */ |
@@ -80,19 +80,19 @@ discard block |
||
80 | 80 | { |
81 | 81 | $this->Result = "100101101101"."0"; |
82 | 82 | $TextString = ""; |
83 | - for($i=1;$i<=strlen($Value);$i++) |
|
83 | + for ($i = 1; $i <= strlen($Value); $i++) |
|
84 | 84 | { |
85 | - $CharCode = ord($this->mid($Value,$i,1)); |
|
86 | - if ( $CharCode >= 97 && $CharCode <= 122 ) { $CharCode = $CharCode - 32; } |
|
85 | + $CharCode = ord($this->mid($Value, $i, 1)); |
|
86 | + if ($CharCode >= 97 && $CharCode <= 122) { $CharCode = $CharCode - 32; } |
|
87 | 87 | |
88 | - if ( isset($this->Codes[chr($CharCode)]) ) |
|
88 | + if (isset($this->Codes[chr($CharCode)])) |
|
89 | 89 | { |
90 | 90 | $this->Result = $this->Result.$this->Codes[chr($CharCode)]."0"; |
91 | 91 | $TextString = $TextString.chr($CharCode); |
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
95 | - if ( $this->MOD43 ) |
|
95 | + if ($this->MOD43) |
|
96 | 96 | { |
97 | 97 | $Checksum = $this->checksum($TextString); |
98 | 98 | $this->Result = $this->Result.$this->Codes[$Checksum]."0"; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | /* Create the encoded string */ |
108 | - function draw($Object,$Value,$X,$Y,$Format="") |
|
108 | + function draw($Object, $Value, $X, $Y, $Format = "") |
|
109 | 109 | { |
110 | 110 | $this->pChartObject = $Object; |
111 | 111 | |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | $G = isset($Format["G"]) ? $Format["G"] : 0; |
114 | 114 | $B = isset($Format["B"]) ? $Format["B"] : 0; |
115 | 115 | $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; |
116 | - $Height = isset($Format["Height"]) ? $Format["Height"] : 30; |
|
116 | + $Height = isset($Format["Height"]) ? $Format["Height"] : 30; |
|
117 | 117 | $Angle = isset($Format["Angle"]) ? $Format["Angle"] : 0; |
118 | - $ShowLegend = isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE; |
|
119 | - $LegendOffset = isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5; |
|
120 | - $DrawArea = isset($Format["DrawArea"]) ? $Format["DrawArea"] : FALSE; |
|
118 | + $ShowLegend = isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE; |
|
119 | + $LegendOffset = isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5; |
|
120 | + $DrawArea = isset($Format["DrawArea"]) ? $Format["DrawArea"] : FALSE; |
|
121 | 121 | $AreaR = isset($Format["AreaR"]) ? $Format["AreaR"] : 255; |
122 | 122 | $AreaG = isset($Format["AreaG"]) ? $Format["AreaG"] : 255; |
123 | 123 | $AreaB = isset($Format["AreaB"]) ? $Format["AreaB"] : 255; |
@@ -125,76 +125,76 @@ discard block |
||
125 | 125 | $AreaBorderG = isset($Format["AreaBorderG"]) ? $Format["AreaBorderG"] : $AreaG; |
126 | 126 | $AreaBorderB = isset($Format["AreaBorderB"]) ? $Format["AreaBorderB"] : $AreaB; |
127 | 127 | |
128 | - $TextString = $this->encode39($Value); |
|
128 | + $TextString = $this->encode39($Value); |
|
129 | 129 | |
130 | - if ( $DrawArea ) |
|
130 | + if ($DrawArea) |
|
131 | 131 | { |
132 | - $X1 = $X + cos(($Angle-135) * PI / 180) * 10; |
|
133 | - $Y1 = $Y + sin(($Angle-135) * PI / 180) * 10; |
|
132 | + $X1 = $X + cos(($Angle - 135)*PI/180)*10; |
|
133 | + $Y1 = $Y + sin(($Angle - 135)*PI/180)*10; |
|
134 | 134 | |
135 | - $X2 = $X1 + cos($Angle * PI / 180) * (strlen($this->Result)+20); |
|
136 | - $Y2 = $Y1 + sin($Angle * PI / 180) * (strlen($this->Result)+20); |
|
135 | + $X2 = $X1 + cos($Angle*PI/180)*(strlen($this->Result) + 20); |
|
136 | + $Y2 = $Y1 + sin($Angle*PI/180)*(strlen($this->Result) + 20); |
|
137 | 137 | |
138 | - if ( $ShowLegend ) |
|
138 | + if ($ShowLegend) |
|
139 | 139 | { |
140 | - $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10); |
|
141 | - $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10); |
|
140 | + $X3 = $X2 + cos(($Angle + 90)*PI/180)*($Height + $LegendOffset + $this->pChartObject->FontSize + 10); |
|
141 | + $Y3 = $Y2 + sin(($Angle + 90)*PI/180)*($Height + $LegendOffset + $this->pChartObject->FontSize + 10); |
|
142 | 142 | } |
143 | 143 | else |
144 | 144 | { |
145 | - $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+20); |
|
146 | - $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+20); |
|
145 | + $X3 = $X2 + cos(($Angle + 90)*PI/180)*($Height + 20); |
|
146 | + $Y3 = $Y2 + sin(($Angle + 90)*PI/180)*($Height + 20); |
|
147 | 147 | } |
148 | 148 | |
149 | - $X4 = $X3 + cos(($Angle+180) * PI / 180) * (strlen($this->Result)+20); |
|
150 | - $Y4 = $Y3 + sin(($Angle+180) * PI / 180) * (strlen($this->Result)+20); |
|
149 | + $X4 = $X3 + cos(($Angle + 180)*PI/180)*(strlen($this->Result) + 20); |
|
150 | + $Y4 = $Y3 + sin(($Angle + 180)*PI/180)*(strlen($this->Result) + 20); |
|
151 | 151 | |
152 | - $Polygon = array($X1,$Y1,$X2,$Y2,$X3,$Y3,$X4,$Y4); |
|
153 | - $Settings = array("R"=>$AreaR,"G"=>$AreaG,"B"=>$AreaB,"BorderR"=>$AreaBorderR,"BorderG"=>$AreaBorderG,"BorderB"=>$AreaBorderB); |
|
154 | - $this->pChartObject->drawPolygon($Polygon,$Settings); |
|
152 | + $Polygon = array($X1, $Y1, $X2, $Y2, $X3, $Y3, $X4, $Y4); |
|
153 | + $Settings = array("R"=>$AreaR, "G"=>$AreaG, "B"=>$AreaB, "BorderR"=>$AreaBorderR, "BorderG"=>$AreaBorderG, "BorderB"=>$AreaBorderB); |
|
154 | + $this->pChartObject->drawPolygon($Polygon, $Settings); |
|
155 | 155 | } |
156 | 156 | |
157 | - for($i=1;$i<=strlen($this->Result);$i++) |
|
157 | + for ($i = 1; $i <= strlen($this->Result); $i++) |
|
158 | 158 | { |
159 | - if ( $this->mid($this->Result,$i,1) == 1 ) |
|
159 | + if ($this->mid($this->Result, $i, 1) == 1) |
|
160 | 160 | { |
161 | - $X1 = $X + cos($Angle * PI / 180) * $i; |
|
162 | - $Y1 = $Y + sin($Angle * PI / 180) * $i; |
|
163 | - $X2 = $X1 + cos(($Angle+90) * PI / 180) * $Height; |
|
164 | - $Y2 = $Y1 + sin(($Angle+90) * PI / 180) * $Height; |
|
161 | + $X1 = $X + cos($Angle*PI/180)*$i; |
|
162 | + $Y1 = $Y + sin($Angle*PI/180)*$i; |
|
163 | + $X2 = $X1 + cos(($Angle + 90)*PI/180)*$Height; |
|
164 | + $Y2 = $Y1 + sin(($Angle + 90)*PI/180)*$Height; |
|
165 | 165 | |
166 | - $Settings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha); |
|
167 | - $this->pChartObject->drawLine($X1,$Y1,$X2,$Y2,$Settings); |
|
166 | + $Settings = array("R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha); |
|
167 | + $this->pChartObject->drawLine($X1, $Y1, $X2, $Y2, $Settings); |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
171 | - if ( $ShowLegend ) |
|
171 | + if ($ShowLegend) |
|
172 | 172 | { |
173 | - $X1 = $X + cos($Angle * PI / 180) * (strlen($this->Result)/2); |
|
174 | - $Y1 = $Y + sin($Angle * PI / 180) * (strlen($this->Result)/2); |
|
173 | + $X1 = $X + cos($Angle*PI/180)*(strlen($this->Result)/2); |
|
174 | + $Y1 = $Y + sin($Angle*PI/180)*(strlen($this->Result)/2); |
|
175 | 175 | |
176 | - $LegendX = $X1 + cos(($Angle+90) * PI / 180) * ($Height+$LegendOffset); |
|
177 | - $LegendY = $Y1 + sin(($Angle+90) * PI / 180) * ($Height+$LegendOffset); |
|
176 | + $LegendX = $X1 + cos(($Angle + 90)*PI/180)*($Height + $LegendOffset); |
|
177 | + $LegendY = $Y1 + sin(($Angle + 90)*PI/180)*($Height + $LegendOffset); |
|
178 | 178 | |
179 | - $Settings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Angle"=>-$Angle,"Align"=>TEXT_ALIGN_TOPMIDDLE); |
|
180 | - $this->pChartObject->drawText($LegendX,$LegendY,$TextString,$Settings); |
|
179 | + $Settings = array("R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha, "Angle"=>-$Angle, "Align"=>TEXT_ALIGN_TOPMIDDLE); |
|
180 | + $this->pChartObject->drawText($LegendX, $LegendY, $TextString, $Settings); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
184 | - function checksum( $string ) |
|
184 | + function checksum($string) |
|
185 | 185 | { |
186 | 186 | $checksum = 0; |
187 | - $length = strlen( $string ); |
|
187 | + $length = strlen($string); |
|
188 | 188 | $charset = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%'; |
189 | 189 | |
190 | - for( $i=0; $i < $length; ++$i ) |
|
191 | - $checksum += strpos( $charset, $string[$i] ); |
|
190 | + for ($i = 0; $i < $length; ++$i) |
|
191 | + $checksum += strpos($charset, $string[$i]); |
|
192 | 192 | |
193 | - return substr( $charset, ($checksum % 43), 1 ); |
|
193 | + return substr($charset, ($checksum%43), 1); |
|
194 | 194 | } |
195 | 195 | |
196 | - function left($value,$NbChar) { return substr($value,0,$NbChar); } |
|
197 | - function right($value,$NbChar) { return substr($value,strlen($value)-$NbChar,$NbChar); } |
|
198 | - function mid($value,$Depart,$NbChar) { return substr($value,$Depart-1,$NbChar); } |
|
196 | + function left($value, $NbChar) { return substr($value, 0, $NbChar); } |
|
197 | + function right($value, $NbChar) { return substr($value, strlen($value) - $NbChar, $NbChar); } |
|
198 | + function mid($value, $Depart, $NbChar) { return substr($value, $Depart - 1, $NbChar); } |
|
199 | 199 | } |
200 | 200 | ?> |
201 | 201 | \ No newline at end of file |