@@ -16,132 +16,132 @@ |
||
16 | 16 | */ |
17 | 17 | class extensions implements EventSubscriberInterface |
18 | 18 | { |
19 | - /** @var \tas2580\seourls\event\base */ |
|
20 | - protected $base; |
|
19 | + /** @var \tas2580\seourls\event\base */ |
|
20 | + protected $base; |
|
21 | 21 | |
22 | - /** |
|
23 | - * Constructor |
|
24 | - * |
|
25 | - * @param \tas2580\seourls\event\base $base |
|
26 | - * @access public |
|
27 | - */ |
|
28 | - public function __construct(\tas2580\seourls\event\base $base) |
|
29 | - { |
|
30 | - $this->base = $base; |
|
31 | - } |
|
22 | + /** |
|
23 | + * Constructor |
|
24 | + * |
|
25 | + * @param \tas2580\seourls\event\base $base |
|
26 | + * @access public |
|
27 | + */ |
|
28 | + public function __construct(\tas2580\seourls\event\base $base) |
|
29 | + { |
|
30 | + $this->base = $base; |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
34 | - * Assign functions defined in this class to event listeners in the core |
|
35 | - * |
|
36 | - * @return array |
|
37 | - * @static |
|
38 | - * @access public |
|
39 | - */ |
|
40 | - public static function getSubscribedEvents() |
|
41 | - { |
|
42 | - return array( |
|
43 | - 'rmcgirr83.topfive.sql_pull_topics_data' => 'topfive_sql_pull_topics_data', |
|
44 | - 'rmcgirr83.topfive.modify_tpl_ary' => 'topfive_modify_tpl_ary', |
|
45 | - 'tas2580.sitemap.modify_before_output' => 'sitemap_modify_before_output', |
|
46 | - 'vse.similartopics.modify_topicrow' => 'similartopics_modify_topicrow', |
|
47 | - 'paybas.recenttopics.modify_tpl_ary' => 'recenttopics_modify_tpl_ary' |
|
48 | - ); |
|
49 | - } |
|
33 | + /** |
|
34 | + * Assign functions defined in this class to event listeners in the core |
|
35 | + * |
|
36 | + * @return array |
|
37 | + * @static |
|
38 | + * @access public |
|
39 | + */ |
|
40 | + public static function getSubscribedEvents() |
|
41 | + { |
|
42 | + return array( |
|
43 | + 'rmcgirr83.topfive.sql_pull_topics_data' => 'topfive_sql_pull_topics_data', |
|
44 | + 'rmcgirr83.topfive.modify_tpl_ary' => 'topfive_modify_tpl_ary', |
|
45 | + 'tas2580.sitemap.modify_before_output' => 'sitemap_modify_before_output', |
|
46 | + 'vse.similartopics.modify_topicrow' => 'similartopics_modify_topicrow', |
|
47 | + 'paybas.recenttopics.modify_tpl_ary' => 'recenttopics_modify_tpl_ary' |
|
48 | + ); |
|
49 | + } |
|
50 | 50 | |
51 | - public function recenttopics_modify_tpl_ary($event) |
|
52 | - { |
|
53 | - $tpl_ary = $event['tpl_ary']; |
|
54 | - $u_view_topic = $this->base->generate_topic_link($event['row']['forum_id'], $event['row']['forum_name'], $event['row']['topic_id'], $event['row']['topic_title']); |
|
55 | - $tpl_ary['U_VIEW_TOPIC'] = append_sid($u_view_topic); |
|
56 | - $tpl_ary['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($tpl_ary['REPLIES'], $u_view_topic) . '#p' . $event['row']['topic_last_post_id']); |
|
57 | - $tpl_ary['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($event['row']['forum_id'], $event['row']['forum_name'])); |
|
51 | + public function recenttopics_modify_tpl_ary($event) |
|
52 | + { |
|
53 | + $tpl_ary = $event['tpl_ary']; |
|
54 | + $u_view_topic = $this->base->generate_topic_link($event['row']['forum_id'], $event['row']['forum_name'], $event['row']['topic_id'], $event['row']['topic_title']); |
|
55 | + $tpl_ary['U_VIEW_TOPIC'] = append_sid($u_view_topic); |
|
56 | + $tpl_ary['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($tpl_ary['REPLIES'], $u_view_topic) . '#p' . $event['row']['topic_last_post_id']); |
|
57 | + $tpl_ary['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($event['row']['forum_id'], $event['row']['forum_name'])); |
|
58 | 58 | |
59 | - $event['tpl_ary'] = $tpl_ary; |
|
60 | - } |
|
59 | + $event['tpl_ary'] = $tpl_ary; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Rewrite URLs in tas2580 Sitemap Extension |
|
64 | - * |
|
65 | - * @param object $event The event object |
|
66 | - * @return null |
|
67 | - * @access public |
|
68 | - */ |
|
69 | - public function sitemap_modify_before_output($event) |
|
70 | - { |
|
71 | - // Nothing to rewrite in the sitemap index |
|
72 | - if ($event['type'] == 'sitemapindex') |
|
73 | - { |
|
74 | - return; |
|
75 | - } |
|
62 | + /** |
|
63 | + * Rewrite URLs in tas2580 Sitemap Extension |
|
64 | + * |
|
65 | + * @param object $event The event object |
|
66 | + * @return null |
|
67 | + * @access public |
|
68 | + */ |
|
69 | + public function sitemap_modify_before_output($event) |
|
70 | + { |
|
71 | + // Nothing to rewrite in the sitemap index |
|
72 | + if ($event['type'] == 'sitemapindex') |
|
73 | + { |
|
74 | + return; |
|
75 | + } |
|
76 | 76 | |
77 | - $url_data =$event['url_data'] ; |
|
77 | + $url_data =$event['url_data'] ; |
|
78 | 78 | |
79 | - foreach ($url_data as $id => $data) |
|
80 | - { |
|
81 | - $row = $data['row']; |
|
82 | - if (isset($row['topic_id'])) |
|
83 | - { |
|
84 | - $url_data[$id]['url'] = $this->base->generate_topic_link($row['forum_id'], $row['forum_name'], $row['topic_id'], $row['topic_title'], $data['start'], true); |
|
85 | - } |
|
86 | - else if (isset($row['forum_id'])) |
|
87 | - { |
|
88 | - $url_data[$id]['url'] = $this->base->generate_forum_link($row['forum_id'], $row['forum_name'], $data['start'], true); |
|
89 | - } |
|
90 | - } |
|
79 | + foreach ($url_data as $id => $data) |
|
80 | + { |
|
81 | + $row = $data['row']; |
|
82 | + if (isset($row['topic_id'])) |
|
83 | + { |
|
84 | + $url_data[$id]['url'] = $this->base->generate_topic_link($row['forum_id'], $row['forum_name'], $row['topic_id'], $row['topic_title'], $data['start'], true); |
|
85 | + } |
|
86 | + else if (isset($row['forum_id'])) |
|
87 | + { |
|
88 | + $url_data[$id]['url'] = $this->base->generate_forum_link($row['forum_id'], $row['forum_name'], $data['start'], true); |
|
89 | + } |
|
90 | + } |
|
91 | 91 | |
92 | - $event['url_data'] = $url_data; |
|
93 | - } |
|
92 | + $event['url_data'] = $url_data; |
|
93 | + } |
|
94 | 94 | |
95 | - /** |
|
96 | - * Rewrite URLs in Similar Topics Extension |
|
97 | - * |
|
98 | - * @param object $event The event object |
|
99 | - * @return null |
|
100 | - * @access public |
|
101 | - */ |
|
102 | - public function similartopics_modify_topicrow($event) |
|
103 | - { |
|
104 | - $this->forum_title = $event['row']['forum_name']; |
|
105 | - $this->forum_id = $event['row']['forum_id']; |
|
106 | - $this->topic_title = $event['row']['topic_title']; |
|
107 | - $this->topic_id = $event['row']['topic_id']; |
|
95 | + /** |
|
96 | + * Rewrite URLs in Similar Topics Extension |
|
97 | + * |
|
98 | + * @param object $event The event object |
|
99 | + * @return null |
|
100 | + * @access public |
|
101 | + */ |
|
102 | + public function similartopics_modify_topicrow($event) |
|
103 | + { |
|
104 | + $this->forum_title = $event['row']['forum_name']; |
|
105 | + $this->forum_id = $event['row']['forum_id']; |
|
106 | + $this->topic_title = $event['row']['topic_title']; |
|
107 | + $this->topic_id = $event['row']['topic_id']; |
|
108 | 108 | |
109 | - $topic_row = $event['topic_row']; |
|
110 | - $u_view_topic= $this->base->generate_topic_link($this->forum_id, $this->forum_title, $this->topic_id, $this->topic_title); |
|
111 | - $topic_row['U_VIEW_TOPIC'] = append_sid($u_view_topic); |
|
112 | - $topic_row['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($this->forum_id, $this->forum_title)); |
|
113 | - $topic_row['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($topic_row['TOPIC_REPLIES'], $u_view_topic) . '#p' . $event['row']['topic_last_post_id']); |
|
114 | - $event['topic_row'] = $topic_row; |
|
115 | - } |
|
109 | + $topic_row = $event['topic_row']; |
|
110 | + $u_view_topic= $this->base->generate_topic_link($this->forum_id, $this->forum_title, $this->topic_id, $this->topic_title); |
|
111 | + $topic_row['U_VIEW_TOPIC'] = append_sid($u_view_topic); |
|
112 | + $topic_row['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($this->forum_id, $this->forum_title)); |
|
113 | + $topic_row['U_LAST_POST'] = append_sid($this->base->generate_lastpost_link($topic_row['TOPIC_REPLIES'], $u_view_topic) . '#p' . $event['row']['topic_last_post_id']); |
|
114 | + $event['topic_row'] = $topic_row; |
|
115 | + } |
|
116 | 116 | |
117 | - /** |
|
118 | - * Rewrite URLs in Top 5 Extension |
|
119 | - * |
|
120 | - * @param object $event The event object |
|
121 | - * @return null |
|
122 | - * @access public |
|
123 | - */ |
|
124 | - public function topfive_sql_pull_topics_data($event) |
|
125 | - { |
|
126 | - $sql_array = $event['sql_array']; |
|
127 | - $sql_array['SELECT'] = array_merge($sql_array, array('SELECT' => 'f.forum_name')); |
|
128 | - $sql_array['LEFT_JOIN'] = array_merge($sql_array['LEFT_JOIN'], array('FROM' => array(FORUMS_TABLE => 'f'), 'ON' => 'f.forum_id = t.forum_id')); |
|
129 | - $event['sql_array'] = $sql_array; |
|
130 | - } |
|
117 | + /** |
|
118 | + * Rewrite URLs in Top 5 Extension |
|
119 | + * |
|
120 | + * @param object $event The event object |
|
121 | + * @return null |
|
122 | + * @access public |
|
123 | + */ |
|
124 | + public function topfive_sql_pull_topics_data($event) |
|
125 | + { |
|
126 | + $sql_array = $event['sql_array']; |
|
127 | + $sql_array['SELECT'] = array_merge($sql_array, array('SELECT' => 'f.forum_name')); |
|
128 | + $sql_array['LEFT_JOIN'] = array_merge($sql_array['LEFT_JOIN'], array('FROM' => array(FORUMS_TABLE => 'f'), 'ON' => 'f.forum_id = t.forum_id')); |
|
129 | + $event['sql_array'] = $sql_array; |
|
130 | + } |
|
131 | 131 | |
132 | - /** |
|
133 | - * Rewrite URLs in Top 5 Extension |
|
134 | - * |
|
135 | - * @param object $event The event object |
|
136 | - * @return null |
|
137 | - * @access public |
|
138 | - */ |
|
139 | - public function topfive_modify_tpl_ary($event) |
|
140 | - { |
|
141 | - $tpl_ary = $event['tpl_ary']; |
|
142 | - $replies = $this->base->get_count('topic_posts', $event['row'], $event['row']['forum_id']) - 1; |
|
143 | - $u_view_topic = $this->base->generate_topic_link($event['row']['forum_id'], $event['row']['forum_name'], $event['row']['topic_id'], $event['row']['topic_title']); |
|
144 | - $tpl_ary['U_TOPIC'] = append_sid($this->base->generate_lastpost_link($replies, $u_view_topic) . '#p' . $event['row']['topic_last_post_id']); |
|
145 | - $event['tpl_ary'] = $tpl_ary; |
|
146 | - } |
|
132 | + /** |
|
133 | + * Rewrite URLs in Top 5 Extension |
|
134 | + * |
|
135 | + * @param object $event The event object |
|
136 | + * @return null |
|
137 | + * @access public |
|
138 | + */ |
|
139 | + public function topfive_modify_tpl_ary($event) |
|
140 | + { |
|
141 | + $tpl_ary = $event['tpl_ary']; |
|
142 | + $replies = $this->base->get_count('topic_posts', $event['row'], $event['row']['forum_id']) - 1; |
|
143 | + $u_view_topic = $this->base->generate_topic_link($event['row']['forum_id'], $event['row']['forum_name'], $event['row']['topic_id'], $event['row']['topic_title']); |
|
144 | + $tpl_ary['U_TOPIC'] = append_sid($this->base->generate_lastpost_link($replies, $u_view_topic) . '#p' . $event['row']['topic_last_post_id']); |
|
145 | + $event['tpl_ary'] = $tpl_ary; |
|
146 | + } |
|
147 | 147 | } |