@@ -8,6 +8,9 @@ |
||
8 | 8 | |
9 | 9 | if(!function_exists('lcfirst')) |
10 | 10 | { |
11 | + /** |
|
12 | + * @param string $text |
|
13 | + */ |
|
11 | 14 | function lcfirst($text) |
12 | 15 | { |
13 | 16 | return strtolower(substr($text, 0, 1)) . substr($text, 1); |
@@ -6,11 +6,11 @@ |
||
6 | 6 | * @brief Krzip module high class. |
7 | 7 | */ |
8 | 8 | |
9 | -if(!function_exists('lcfirst')) |
|
9 | +if (!function_exists('lcfirst')) |
|
10 | 10 | { |
11 | 11 | function lcfirst($text) |
12 | 12 | { |
13 | - return strtolower(substr($text, 0, 1)) . substr($text, 1); |
|
13 | + return strtolower(substr($text, 0, 1)).substr($text, 1); |
|
14 | 14 | } |
15 | 15 | } |
16 | 16 |
@@ -54,6 +54,9 @@ discard block |
||
54 | 54 | return $config; |
55 | 55 | } |
56 | 56 | |
57 | + /** |
|
58 | + * @param string $property |
|
59 | + */ |
|
57 | 60 | public function addMeta($property, $content, $attr_name = 'property') |
58 | 61 | { |
59 | 62 | if (!$content) return; |
@@ -68,6 +71,10 @@ discard block |
||
68 | 71 | $this->SEO['meta'][] = array('property' => $property, 'content' => $content, 'attr_name' => $attr_name); |
69 | 72 | } |
70 | 73 | |
74 | + /** |
|
75 | + * @param string $rel |
|
76 | + * @param string $href |
|
77 | + */ |
|
71 | 78 | public function addLink($rel, $href) |
72 | 79 | { |
73 | 80 | if (!$href) return; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $oModuleModel = getModel('module'); |
21 | 21 | $config = $oModuleModel->getModuleConfig('seo'); |
22 | 22 | |
23 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
23 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
24 | 24 | $IDN = new idna_convert(array('idn_version' => 2008)); |
25 | 25 | $request_uri = $IDN->encode(Context::get('request_uri')); |
26 | 26 | |
@@ -31,16 +31,16 @@ discard block |
||
31 | 31 | if (!$config->ga_track_subdomain) $config->ga_track_subdomain = 'N'; |
32 | 32 | if ($config->site_image) |
33 | 33 | { |
34 | - $config->site_image_url = $request_uri . 'files/attach/site_image/' . $config->site_image; |
|
34 | + $config->site_image_url = $request_uri.'files/attach/site_image/'.$config->site_image; |
|
35 | 35 | |
36 | 36 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
37 | - if($oCacheHandler->isSupport()) { |
|
37 | + if ($oCacheHandler->isSupport()) { |
|
38 | 38 | $site_image = false; |
39 | 39 | $cache_key = 'seo:site_image'; |
40 | 40 | $site_image = $oCacheHandler->get($cache_key); |
41 | - if(!$site_image) { |
|
42 | - $path = _XE_PATH_ . 'files/attach/site_image/'; |
|
43 | - list($width, $height) = @getimagesize($path . $config->site_image); |
|
41 | + if (!$site_image) { |
|
42 | + $path = _XE_PATH_.'files/attach/site_image/'; |
|
43 | + list($width, $height) = @getimagesize($path.$config->site_image); |
|
44 | 44 | $site_image_dimension = array( |
45 | 45 | 'width' => $width, |
46 | 46 | 'height' => $height |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | foreach ($list as $val) { |
87 | 87 | if ($type == 'meta') { |
88 | 88 | $attr_name = $val['attr_name']; |
89 | - Context::addHtmlHeader('<meta ' . $attr_name . '="' . $val['property'] . '" content="' . $val['content'] . '" />'); |
|
89 | + Context::addHtmlHeader('<meta '.$attr_name.'="'.$val['property'].'" content="'.$val['content'].'" />'); |
|
90 | 90 | } elseif ($type == 'link') { |
91 | - Context::addHtmlHeader('<link rel="' . $val['rel'] . '" href="' . $val['href'] . '" />'); |
|
91 | + Context::addHtmlHeader('<link rel="'.$val['rel'].'" href="'.$val['href'].'" />'); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | </script> |
115 | 115 | GASCRIPT; |
116 | 116 | |
117 | - Context::addHtmlHeader($ga_script . PHP_EOL); |
|
117 | + Context::addHtmlHeader($ga_script.PHP_EOL); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | // Naver Analytics |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | <script src="//wcs.naver.net/wcslog.js"></script> |
125 | 125 | <script>if(!wcs_add){var wcs_add={wa:'{$config->na_id}'};}if(typeof wcs_do!="undefined"){wcs_do();}</script> |
126 | 126 | NASCRIPT; |
127 | - Context::addHtmlFooter($na_script . PHP_EOL); |
|
127 | + Context::addHtmlFooter($na_script.PHP_EOL); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | $seo_config = $this->getConfig(); |
141 | 141 | |
142 | - if($seo_config->enable === 'Y') { |
|
142 | + if ($seo_config->enable === 'Y') { |
|
143 | 143 | foreach ($this->triggers as $trigger) { |
144 | 144 | if (!$oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4])) return TRUE; |
145 | 145 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | $seo_config = $this->getConfig(); |
157 | 157 | |
158 | - if($seo_config->enable === 'Y') { |
|
158 | + if ($seo_config->enable === 'Y') { |
|
159 | 159 | foreach ($this->triggers as $trigger) { |
160 | 160 | if (!$oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4])) { |
161 | 161 | $oModuleController->insertTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4]); |
@@ -24,11 +24,21 @@ discard block |
||
24 | 24 | $IDN = new idna_convert(array('idn_version' => 2008)); |
25 | 25 | $request_uri = $IDN->encode(Context::get('request_uri')); |
26 | 26 | |
27 | - if (!$config) $config = new stdClass; |
|
28 | - if (!$config->enable) $config->enable = 'Y'; |
|
29 | - if (!$config->use_optimize_title) $config->use_optimize_title = 'N'; |
|
30 | - if (!$config->ga_except_admin) $config->ga_except_admin = 'N'; |
|
31 | - if (!$config->ga_track_subdomain) $config->ga_track_subdomain = 'N'; |
|
27 | + if (!$config) { |
|
28 | + $config = new stdClass; |
|
29 | + } |
|
30 | + if (!$config->enable) { |
|
31 | + $config->enable = 'Y'; |
|
32 | + } |
|
33 | + if (!$config->use_optimize_title) { |
|
34 | + $config->use_optimize_title = 'N'; |
|
35 | + } |
|
36 | + if (!$config->ga_except_admin) { |
|
37 | + $config->ga_except_admin = 'N'; |
|
38 | + } |
|
39 | + if (!$config->ga_track_subdomain) { |
|
40 | + $config->ga_track_subdomain = 'N'; |
|
41 | + } |
|
32 | 42 | if ($config->site_image) |
33 | 43 | { |
34 | 44 | $config->site_image_url = $request_uri . 'files/attach/site_image/' . $config->site_image; |
@@ -56,7 +66,9 @@ discard block |
||
56 | 66 | |
57 | 67 | public function addMeta($property, $content, $attr_name = 'property') |
58 | 68 | { |
59 | - if (!$content) return; |
|
69 | + if (!$content) { |
|
70 | + return; |
|
71 | + } |
|
60 | 72 | |
61 | 73 | $oModuleController = getController('module'); |
62 | 74 | $oModuleController->replaceDefinedLangCode($content); |
@@ -70,7 +82,9 @@ discard block |
||
70 | 82 | |
71 | 83 | public function addLink($rel, $href) |
72 | 84 | { |
73 | - if (!$href) return; |
|
85 | + if (!$href) { |
|
86 | + return; |
|
87 | + } |
|
74 | 88 | |
75 | 89 | $this->SEO['link'][] = array('rel' => $rel, 'href' => $href); |
76 | 90 | } |
@@ -81,7 +95,9 @@ discard block |
||
81 | 95 | $logged_info = Context::get('logged_info'); |
82 | 96 | |
83 | 97 | foreach ($this->SEO as $type => $list) { |
84 | - if (!$list || !count($list)) continue; |
|
98 | + if (!$list || !count($list)) { |
|
99 | + continue; |
|
100 | + } |
|
85 | 101 | |
86 | 102 | foreach ($list as $val) { |
87 | 103 | if ($type == 'meta') { |
@@ -141,7 +157,9 @@ discard block |
||
141 | 157 | |
142 | 158 | if($seo_config->enable === 'Y') { |
143 | 159 | foreach ($this->triggers as $trigger) { |
144 | - if (!$oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4])) return TRUE; |
|
160 | + if (!$oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4])) { |
|
161 | + return TRUE; |
|
162 | + } |
|
145 | 163 | } |
146 | 164 | } |
147 | 165 |
@@ -174,6 +174,9 @@ |
||
174 | 174 | $output = executeQuery('syndication.deleteLog', $args); |
175 | 175 | } |
176 | 176 | |
177 | + /** |
|
178 | + * @param string $type |
|
179 | + */ |
|
177 | 180 | function ping($id, $type, $page=1) { |
178 | 181 | $this->ping_message = ''; |
179 | 182 | debugPrint($id); |
@@ -12,16 +12,16 @@ discard block |
||
12 | 12 | var $ping_message = ''; |
13 | 13 | |
14 | 14 | function triggerInsertDocument(&$obj) { |
15 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
15 | + if ($obj->module_srl < 1) return $this->makeObject(); |
|
16 | 16 | |
17 | 17 | $oSyndicationModel = getModel('syndication'); |
18 | 18 | $oModuleModel = getModel('module'); |
19 | 19 | |
20 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
20 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
21 | 21 | |
22 | 22 | $config = $oModuleModel->getModuleConfig('syndication'); |
23 | 23 | |
24 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
24 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
25 | 25 | |
26 | 26 | $target_id = sprintf('%s-%s', $obj->module_srl, $obj->document_srl); |
27 | 27 | $id = $oSyndicationModel->getID('article', $target_id); |
@@ -31,16 +31,16 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | function triggerUpdateDocument(&$obj) { |
34 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
34 | + if ($obj->module_srl < 1) return $this->makeObject(); |
|
35 | 35 | |
36 | 36 | $oSyndicationModel = getModel('syndication'); |
37 | 37 | $oModuleModel = getModel('module'); |
38 | 38 | |
39 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
39 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
40 | 40 | |
41 | 41 | $config = $oModuleModel->getModuleConfig('syndication'); |
42 | 42 | |
43 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
43 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
44 | 44 | |
45 | 45 | $target_id = sprintf('%s-%s', $obj->module_srl, $obj->document_srl); |
46 | 46 | $id = $oSyndicationModel->getID('article', $target_id); |
@@ -50,16 +50,16 @@ discard block |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | function triggerDeleteDocument(&$obj) { |
53 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
53 | + if ($obj->module_srl < 1) return $this->makeObject(); |
|
54 | 54 | |
55 | 55 | $oSyndicationModel = getModel('syndication'); |
56 | 56 | $oModuleModel = getModel('module'); |
57 | 57 | |
58 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
58 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
59 | 59 | |
60 | 60 | $config = $oModuleModel->getModuleConfig('syndication'); |
61 | 61 | |
62 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
62 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
63 | 63 | |
64 | 64 | $this->insertLog($obj->module_srl, $obj->document_srl, $obj->title, $obj->content); |
65 | 65 | |
@@ -75,14 +75,14 @@ discard block |
||
75 | 75 | $oSyndicationModel = getModel('syndication'); |
76 | 76 | $oModuleModel = getModel('module'); |
77 | 77 | |
78 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
78 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
79 | 79 | |
80 | 80 | $config = $oModuleModel->getModuleConfig('syndication'); |
81 | 81 | |
82 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
82 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
83 | 83 | |
84 | 84 | $output = executeQuery('syndication.getExceptModule', $obj); |
85 | - if($output->data->count) return $this->makeObject(); |
|
85 | + if ($output->data->count) return $this->makeObject(); |
|
86 | 86 | |
87 | 87 | |
88 | 88 | $id = $oSyndicationModel->getID('site', $obj->module_srl); |
@@ -93,21 +93,21 @@ discard block |
||
93 | 93 | |
94 | 94 | function triggerMoveDocumentModule(&$obj) |
95 | 95 | { |
96 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
96 | + if ($obj->module_srl < 1) return $this->makeObject(); |
|
97 | 97 | |
98 | 98 | $oSyndicationModel = getModel('syndication'); |
99 | 99 | $oModuleModel = getModel('module'); |
100 | 100 | |
101 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
101 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
102 | 102 | |
103 | 103 | $config = $oModuleModel->getModuleConfig('syndication'); |
104 | 104 | |
105 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
105 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
106 | 106 | |
107 | 107 | $arr_document_srl = explode(',', $obj->document_srls); |
108 | - if(!$arr_document_srl) return $this->makeObject(); |
|
108 | + if (!$arr_document_srl) return $this->makeObject(); |
|
109 | 109 | |
110 | - foreach($arr_document_srl as $document_srl) |
|
110 | + foreach ($arr_document_srl as $document_srl) |
|
111 | 111 | { |
112 | 112 | $target_id = sprintf('%s-%s', $obj->module_srl, $document_srl); |
113 | 113 | $id = $oSyndicationModel->getID('article', $target_id); |
@@ -121,11 +121,11 @@ discard block |
||
121 | 121 | $oSyndicationModel = getModel('syndication'); |
122 | 122 | $oModuleModel = getModel('module'); |
123 | 123 | |
124 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
124 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
125 | 125 | |
126 | 126 | $config = $oModuleModel->getModuleConfig('syndication'); |
127 | 127 | |
128 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
128 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
129 | 129 | |
130 | 130 | $this->insertLog($obj->module_srl, $obj->document_srl, '', ''); |
131 | 131 | |
@@ -140,11 +140,11 @@ discard block |
||
140 | 140 | $oSyndicationModel = getModel('syndication'); |
141 | 141 | $oModuleModel = getModel('module'); |
142 | 142 | |
143 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
143 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
144 | 144 | |
145 | 145 | $config = $oModuleModel->getModuleConfig('syndication'); |
146 | 146 | |
147 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
147 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
148 | 148 | |
149 | 149 | // 신디케이션 삭제 로그 제거 |
150 | 150 | $this->deleteLog($obj->module_srl, $obj->document_srl); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $output = executeQuery('syndication.deleteLog', $args); |
175 | 175 | } |
176 | 176 | |
177 | - function ping($id, $type, $page=1) { |
|
177 | + function ping($id, $type, $page = 1) { |
|
178 | 178 | $this->ping_message = ''; |
179 | 179 | debugPrint($id); |
180 | 180 | $oSyndicationModel = getModel('syndication'); |
@@ -182,14 +182,14 @@ discard block |
||
182 | 182 | $oModuleModel = getModel('module'); |
183 | 183 | $config = $oModuleModel->getModuleConfig('syndication'); |
184 | 184 | |
185 | - if(!$config->syndication_token) |
|
185 | + if (!$config->syndication_token) |
|
186 | 186 | { |
187 | 187 | $this->ping_message = 'Syndication Token empty'; |
188 | 188 | $oSyndicationModel->setResentPingLog($this->ping_message); |
189 | 189 | return false; |
190 | 190 | } |
191 | 191 | |
192 | - if(!$this->checkOpenSSLSupport()) |
|
192 | + if (!$this->checkOpenSSLSupport()) |
|
193 | 193 | { |
194 | 194 | $lang = Context::get('lang'); |
195 | 195 | $this->ping_message = $lang->msg_need_openssl_support; |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | return false; |
198 | 198 | } |
199 | 199 | |
200 | - if(substr($config->site_url,-1)!='/') |
|
200 | + if (substr($config->site_url, -1) != '/') |
|
201 | 201 | { |
202 | 202 | $config->site_url .= '/'; |
203 | 203 | } |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | $buff = FileHandler::getRemoteResource($ping_url, null, 10, 'POST', 'application/x-www-form-urlencoded', $ping_header, array(), array('ping_url'=>$ping_body), $request_config); |
218 | 218 | |
219 | 219 | $xml = new XmlParser(); |
220 | - $xmlDoc= $xml->parse($buff); |
|
220 | + $xmlDoc = $xml->parse($buff); |
|
221 | 221 | |
222 | - if($xmlDoc->result->error_code->body != '000') |
|
222 | + if ($xmlDoc->result->error_code->body != '000') |
|
223 | 223 | { |
224 | - if(!$buff) |
|
224 | + if (!$buff) |
|
225 | 225 | { |
226 | 226 | $this->ping_message = 'Socket connection error. Check your Server Environment.'; |
227 | 227 | } |
@@ -12,16 +12,22 @@ discard block |
||
12 | 12 | var $ping_message = ''; |
13 | 13 | |
14 | 14 | function triggerInsertDocument(&$obj) { |
15 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
15 | + if($obj->module_srl < 1) { |
|
16 | + return $this->makeObject(); |
|
17 | + } |
|
16 | 18 | |
17 | 19 | $oSyndicationModel = getModel('syndication'); |
18 | 20 | $oModuleModel = getModel('module'); |
19 | 21 | |
20 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
22 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
23 | + return $this->makeObject(); |
|
24 | + } |
|
21 | 25 | |
22 | 26 | $config = $oModuleModel->getModuleConfig('syndication'); |
23 | 27 | |
24 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
28 | + if($config->syndication_use!='Y') { |
|
29 | + return $this->makeObject(); |
|
30 | + } |
|
25 | 31 | |
26 | 32 | $target_id = sprintf('%s-%s', $obj->module_srl, $obj->document_srl); |
27 | 33 | $id = $oSyndicationModel->getID('article', $target_id); |
@@ -31,16 +37,22 @@ discard block |
||
31 | 37 | } |
32 | 38 | |
33 | 39 | function triggerUpdateDocument(&$obj) { |
34 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
40 | + if($obj->module_srl < 1) { |
|
41 | + return $this->makeObject(); |
|
42 | + } |
|
35 | 43 | |
36 | 44 | $oSyndicationModel = getModel('syndication'); |
37 | 45 | $oModuleModel = getModel('module'); |
38 | 46 | |
39 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
47 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
48 | + return $this->makeObject(); |
|
49 | + } |
|
40 | 50 | |
41 | 51 | $config = $oModuleModel->getModuleConfig('syndication'); |
42 | 52 | |
43 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
53 | + if($config->syndication_use!='Y') { |
|
54 | + return $this->makeObject(); |
|
55 | + } |
|
44 | 56 | |
45 | 57 | $target_id = sprintf('%s-%s', $obj->module_srl, $obj->document_srl); |
46 | 58 | $id = $oSyndicationModel->getID('article', $target_id); |
@@ -50,16 +62,22 @@ discard block |
||
50 | 62 | } |
51 | 63 | |
52 | 64 | function triggerDeleteDocument(&$obj) { |
53 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
65 | + if($obj->module_srl < 1) { |
|
66 | + return $this->makeObject(); |
|
67 | + } |
|
54 | 68 | |
55 | 69 | $oSyndicationModel = getModel('syndication'); |
56 | 70 | $oModuleModel = getModel('module'); |
57 | 71 | |
58 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
72 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
73 | + return $this->makeObject(); |
|
74 | + } |
|
59 | 75 | |
60 | 76 | $config = $oModuleModel->getModuleConfig('syndication'); |
61 | 77 | |
62 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
78 | + if($config->syndication_use!='Y') { |
|
79 | + return $this->makeObject(); |
|
80 | + } |
|
63 | 81 | |
64 | 82 | $this->insertLog($obj->module_srl, $obj->document_srl, $obj->title, $obj->content); |
65 | 83 | |
@@ -75,14 +93,20 @@ discard block |
||
75 | 93 | $oSyndicationModel = getModel('syndication'); |
76 | 94 | $oModuleModel = getModel('module'); |
77 | 95 | |
78 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
96 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
97 | + return $this->makeObject(); |
|
98 | + } |
|
79 | 99 | |
80 | 100 | $config = $oModuleModel->getModuleConfig('syndication'); |
81 | 101 | |
82 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
102 | + if($config->syndication_use!='Y') { |
|
103 | + return $this->makeObject(); |
|
104 | + } |
|
83 | 105 | |
84 | 106 | $output = executeQuery('syndication.getExceptModule', $obj); |
85 | - if($output->data->count) return $this->makeObject(); |
|
107 | + if($output->data->count) { |
|
108 | + return $this->makeObject(); |
|
109 | + } |
|
86 | 110 | |
87 | 111 | |
88 | 112 | $id = $oSyndicationModel->getID('site', $obj->module_srl); |
@@ -93,19 +117,27 @@ discard block |
||
93 | 117 | |
94 | 118 | function triggerMoveDocumentModule(&$obj) |
95 | 119 | { |
96 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
120 | + if($obj->module_srl < 1) { |
|
121 | + return $this->makeObject(); |
|
122 | + } |
|
97 | 123 | |
98 | 124 | $oSyndicationModel = getModel('syndication'); |
99 | 125 | $oModuleModel = getModel('module'); |
100 | 126 | |
101 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
127 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
128 | + return $this->makeObject(); |
|
129 | + } |
|
102 | 130 | |
103 | 131 | $config = $oModuleModel->getModuleConfig('syndication'); |
104 | 132 | |
105 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
133 | + if($config->syndication_use!='Y') { |
|
134 | + return $this->makeObject(); |
|
135 | + } |
|
106 | 136 | |
107 | 137 | $arr_document_srl = explode(',', $obj->document_srls); |
108 | - if(!$arr_document_srl) return $this->makeObject(); |
|
138 | + if(!$arr_document_srl) { |
|
139 | + return $this->makeObject(); |
|
140 | + } |
|
109 | 141 | |
110 | 142 | foreach($arr_document_srl as $document_srl) |
111 | 143 | { |
@@ -121,11 +153,15 @@ discard block |
||
121 | 153 | $oSyndicationModel = getModel('syndication'); |
122 | 154 | $oModuleModel = getModel('module'); |
123 | 155 | |
124 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
156 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
157 | + return $this->makeObject(); |
|
158 | + } |
|
125 | 159 | |
126 | 160 | $config = $oModuleModel->getModuleConfig('syndication'); |
127 | 161 | |
128 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
162 | + if($config->syndication_use!='Y') { |
|
163 | + return $this->makeObject(); |
|
164 | + } |
|
129 | 165 | |
130 | 166 | $this->insertLog($obj->module_srl, $obj->document_srl, '', ''); |
131 | 167 | |
@@ -140,11 +176,15 @@ discard block |
||
140 | 176 | $oSyndicationModel = getModel('syndication'); |
141 | 177 | $oModuleModel = getModel('module'); |
142 | 178 | |
143 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
179 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
180 | + return $this->makeObject(); |
|
181 | + } |
|
144 | 182 | |
145 | 183 | $config = $oModuleModel->getModuleConfig('syndication'); |
146 | 184 | |
147 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
185 | + if($config->syndication_use!='Y') { |
|
186 | + return $this->makeObject(); |
|
187 | + } |
|
148 | 188 | |
149 | 189 | // 신디케이션 삭제 로그 제거 |
150 | 190 | $this->deleteLog($obj->module_srl, $obj->document_srl); |
@@ -224,8 +264,7 @@ discard block |
||
224 | 264 | if(!$buff) |
225 | 265 | { |
226 | 266 | $this->ping_message = 'Socket connection error. Check your Server Environment.'; |
227 | - } |
|
228 | - else |
|
267 | + } else |
|
229 | 268 | { |
230 | 269 | $this->ping_message = $xmlDoc->result->message->body; |
231 | 270 | } |
@@ -63,6 +63,9 @@ discard block |
||
63 | 63 | return $module_srls; |
64 | 64 | } |
65 | 65 | |
66 | + /** |
|
67 | + * @param string $key |
|
68 | + */ |
|
66 | 69 | function getLang($key, $site_srl) |
67 | 70 | { |
68 | 71 | if(!$this->langs[$site_srl]) |
@@ -438,6 +441,12 @@ discard block |
||
438 | 441 | return $article; |
439 | 442 | } |
440 | 443 | |
444 | + /** |
|
445 | + * @param string $startTime |
|
446 | + * @param string $endTime |
|
447 | + * @param string $type |
|
448 | + * @param string $id |
|
449 | + */ |
|
441 | 450 | function getArticles($module_srl = null, $page=1, $startTime = null, $endTime = null, $type = null, $id = null) { |
442 | 451 | if($this->site_url==null) $this->init(); |
443 | 452 | |
@@ -481,6 +490,12 @@ discard block |
||
481 | 490 | return $result; |
482 | 491 | } |
483 | 492 | |
493 | + /** |
|
494 | + * @param string $startTime |
|
495 | + * @param string $endTime |
|
496 | + * @param string $type |
|
497 | + * @param string $id |
|
498 | + */ |
|
484 | 499 | function getDeleted($module_srl = null, $page = 1, $startTime = null, $endTime = null, $type = null, $id = null) { |
485 | 500 | if($this->site_url==null) $this->init(); |
486 | 501 | |
@@ -538,6 +553,9 @@ discard block |
||
538 | 553 | return $output->data; |
539 | 554 | } |
540 | 555 | |
556 | + /** |
|
557 | + * @param string $type |
|
558 | + */ |
|
541 | 559 | function getID($type, $target_id = null) { |
542 | 560 | if($this->site_url==null) $this->init(); |
543 | 561 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | { |
12 | 12 | private $site_url = null; |
13 | 13 | private $uri_scheme = 'http://'; |
14 | - private $syndication_password= null; |
|
14 | + private $syndication_password = null; |
|
15 | 15 | private $year = null; |
16 | 16 | private $langs = array(); |
17 | 17 | private $granted_modules = array(); |
@@ -20,15 +20,15 @@ discard block |
||
20 | 20 | function init() { |
21 | 21 | $oModuleModel = getModel('module'); |
22 | 22 | $config = $oModuleModel->getModuleConfig('syndication'); |
23 | - if(Context::getSslStatus() == 'always') $this->uri_scheme = 'https://'; |
|
23 | + if (Context::getSslStatus() == 'always') $this->uri_scheme = 'https://'; |
|
24 | 24 | |
25 | 25 | $this->site_url = preg_replace('/\/+$/is', '', $config->site_url); |
26 | 26 | $this->syndication_password = $config->syndication_password; |
27 | 27 | $this->year = $config->year; |
28 | 28 | |
29 | 29 | $output = executeQueryArray('syndication.getGrantedModules'); |
30 | - if($output->data) { |
|
31 | - foreach($output->data as $key => $val) { |
|
30 | + if ($output->data) { |
|
31 | + foreach ($output->data as $key => $val) { |
|
32 | 32 | $this->granted_modules[] = $val->module_srl; |
33 | 33 | } |
34 | 34 | } |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | $args->module_srl = $module_srl; |
42 | 42 | |
43 | 43 | $output = executeQuery('syndication.getExceptModule', $args); |
44 | - if($output->data->count) return TRUE; |
|
44 | + if ($output->data->count) return TRUE; |
|
45 | 45 | |
46 | 46 | $output = executeQuery('syndication.getGrantedModule', $args); |
47 | - if($output->data->count) return TRUE; |
|
47 | + if ($output->data->count) return TRUE; |
|
48 | 48 | |
49 | 49 | return FALSE; |
50 | 50 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $module_srls = array(); |
56 | 56 | if (is_array($output->data)) |
57 | 57 | { |
58 | - foreach($output->data as $val) |
|
58 | + foreach ($output->data as $val) |
|
59 | 59 | { |
60 | 60 | $module_srls[] = $val->module_srl; |
61 | 61 | } |
@@ -65,21 +65,21 @@ discard block |
||
65 | 65 | |
66 | 66 | function getLang($key, $site_srl) |
67 | 67 | { |
68 | - if(!$this->langs[$site_srl]) |
|
68 | + if (!$this->langs[$site_srl]) |
|
69 | 69 | { |
70 | 70 | $this->langs[$site_srl] = array(); |
71 | 71 | $args = new stdClass; |
72 | 72 | $args->site_srl = $site_srl; |
73 | 73 | $args->lang_code = Context::getLangType(); |
74 | 74 | $output = executeQueryArray("syndication.getLang", $args); |
75 | - if(!$output->toBool() || !$output->data) return $key; |
|
75 | + if (!$output->toBool() || !$output->data) return $key; |
|
76 | 76 | |
77 | - foreach($output->data as $value) |
|
77 | + foreach ($output->data as $value) |
|
78 | 78 | { |
79 | 79 | $this->langs[$site_srl][$value->name] = $value->value; |
80 | 80 | } |
81 | 81 | } |
82 | - if($this->langs[$site_srl][$key]) |
|
82 | + if ($this->langs[$site_srl][$key]) |
|
83 | 83 | { |
84 | 84 | return $this->langs[$site_srl][$key]; |
85 | 85 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | function handleLang($title, $site_srl) |
90 | 90 | { |
91 | 91 | $matches = NULL; |
92 | - if(!preg_match("/\\\$user_lang->(.+)/", $title, $matches)) |
|
92 | + if (!preg_match("/\\\$user_lang->(.+)/", $title, $matches)) |
|
93 | 93 | { |
94 | 94 | return $title; |
95 | 95 | } |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | function getSyndicationList() { |
103 | 103 | $oModuleModel = getModel('module'); |
104 | 104 | $config = $oModuleModel->getModuleConfig('syndication'); |
105 | - if(!$config->year || !$config->site_url || !$config->syndication_token) |
|
105 | + if (!$config->year || !$config->site_url || !$config->syndication_token) |
|
106 | 106 | { |
107 | - return $this->makeObject(-1,'msg_check_syndication_config'); |
|
107 | + return $this->makeObject(-1, 'msg_check_syndication_config'); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | $id = Context::get('id'); |
@@ -114,49 +114,49 @@ discard block |
||
114 | 114 | $endTime = Context::get('end-time'); |
115 | 115 | |
116 | 116 | $page = Context::get('page'); |
117 | - if(!$page) |
|
117 | + if (!$page) |
|
118 | 118 | { |
119 | 119 | $page = 1; |
120 | 120 | } |
121 | 121 | $vars = Context::getRequestVars(); |
122 | - if(!$id || !$type) |
|
122 | + if (!$id || !$type) |
|
123 | 123 | { |
124 | - return $this->makeObject(-1,'msg_invalid_request'); |
|
124 | + return $this->makeObject(-1, 'msg_invalid_request'); |
|
125 | 125 | } |
126 | 126 | |
127 | - if(!preg_match('/^tag:([^,]+),([0-9]+):(site|channel|article)(.*)$/i',$id,$matches)) |
|
127 | + if (!preg_match('/^tag:([^,]+),([0-9]+):(site|channel|article)(.*)$/i', $id, $matches)) |
|
128 | 128 | { |
129 | - return $this->makeObject(-1,'msg_invalid_request'); |
|
129 | + return $this->makeObject(-1, 'msg_invalid_request'); |
|
130 | 130 | } |
131 | 131 | |
132 | - if($config->syndication_password != Context::get('syndication_password')) |
|
132 | + if ($config->syndication_password != Context::get('syndication_password')) |
|
133 | 133 | { |
134 | - return $this->makeObject(-1,'msg_invalid_request'); |
|
134 | + return $this->makeObject(-1, 'msg_invalid_request'); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | $url = $matches[1]; |
138 | 138 | $year = $matches[2]; |
139 | 139 | $target = $matches[3]; |
140 | 140 | $id = $matches[4]; |
141 | - if($id && $id{0}==':') |
|
141 | + if ($id && $id{0} == ':') |
|
142 | 142 | { |
143 | 143 | $id = substr($id, 1); |
144 | 144 | } |
145 | 145 | |
146 | 146 | $module_srl = null; |
147 | 147 | $document_srl = null; |
148 | - if($id && strpos($id,'-')!==false) |
|
148 | + if ($id && strpos($id, '-') !== false) |
|
149 | 149 | { |
150 | 150 | list($module_srl, $document_srl) = explode('-', $id); |
151 | 151 | } |
152 | - elseif($id) |
|
152 | + elseif ($id) |
|
153 | 153 | { |
154 | 154 | $module_srl = $id; |
155 | 155 | } |
156 | 156 | |
157 | - if(!$url || !$year || !$target) |
|
157 | + if (!$url || !$year || !$target) |
|
158 | 158 | { |
159 | - return $this->makeObject(-1,'msg_invalid_request'); |
|
159 | + return $this->makeObject(-1, 'msg_invalid_request'); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | $time_zone = substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3); |
@@ -164,12 +164,12 @@ discard block |
||
164 | 164 | |
165 | 165 | $site_module_info = Context::get('site_module_info'); |
166 | 166 | |
167 | - if($target == 'channel' && !$module_srl) |
|
167 | + if ($target == 'channel' && !$module_srl) |
|
168 | 168 | { |
169 | 169 | $target = 'site'; |
170 | 170 | } |
171 | 171 | |
172 | - if($module_srl) |
|
172 | + if ($module_srl) |
|
173 | 173 | { |
174 | 174 | $args = new stdClass; |
175 | 175 | $args->module_srls = $module_srl; |
@@ -178,13 +178,13 @@ discard block |
||
178 | 178 | self::$modules[$module_srl] = $output->data; |
179 | 179 | } |
180 | 180 | |
181 | - if($target == 'channel' && $module_srl) |
|
181 | + if ($target == 'channel' && $module_srl) |
|
182 | 182 | { |
183 | - if($module_info) |
|
183 | + if ($module_info) |
|
184 | 184 | { |
185 | 185 | $args->module_srl = $module_srl; |
186 | 186 | $output = executeQuery('syndication.getExceptModules', $args); |
187 | - if($output->data->count) |
|
187 | + if ($output->data->count) |
|
188 | 188 | { |
189 | 189 | $error = 'target is not founded'; |
190 | 190 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | unset($args); |
198 | 198 | } |
199 | 199 | |
200 | - if(!$error) |
|
200 | + if (!$error) |
|
201 | 201 | { |
202 | 202 | Context::set('target', $target); |
203 | 203 | Context::set('type', $type); |
@@ -208,20 +208,20 @@ discard block |
||
208 | 208 | $oModuleModel = getModel('module'); |
209 | 209 | $site_config = $oModuleModel->getModuleConfig('module'); |
210 | 210 | |
211 | - switch($target) |
|
211 | + switch ($target) |
|
212 | 212 | { |
213 | 213 | case 'site' : |
214 | 214 | $site_info = new stdClass; |
215 | 215 | $site_info->id = $this->getID('site'); |
216 | - $site_info->site_url = getFullSiteUrl($this->uri_scheme . $this->site_url, ''); |
|
216 | + $site_info->site_url = getFullSiteUrl($this->uri_scheme.$this->site_url, ''); |
|
217 | 217 | $site_info->site_title = $this->handleLang($site_module_info->browser_title, $site_module_info->site_srl); |
218 | 218 | $site_info->title = $site_info->site_title; |
219 | 219 | |
220 | - if($module_srl) |
|
220 | + if ($module_srl) |
|
221 | 221 | { |
222 | 222 | $args->module_srl = $module_srl; |
223 | 223 | $site_info->title = $this->handleLang($module_info->browser_title, $module_info->site_srl); |
224 | - if(!$site_info->title) |
|
224 | + if (!$site_info->title) |
|
225 | 225 | { |
226 | 226 | $site_info->title = $site_info->site_title; |
227 | 227 | } |
@@ -229,10 +229,10 @@ discard block |
||
229 | 229 | else |
230 | 230 | { |
231 | 231 | $except_module_output = executeQueryArray('syndication.getExceptModuleSrls'); |
232 | - if(is_array($except_module_output->data)) |
|
232 | + if (is_array($except_module_output->data)) |
|
233 | 233 | { |
234 | 234 | $except_module_srls = array(); |
235 | - foreach($except_module_output->data as $val) |
|
235 | + foreach ($except_module_output->data as $val) |
|
236 | 236 | { |
237 | 237 | $except_module_srls[] = $val->module_srl; |
238 | 238 | } |
@@ -242,25 +242,25 @@ discard block |
||
242 | 242 | |
243 | 243 | $output = executeQuery('syndication.getSiteUpdatedTime', $args); |
244 | 244 | |
245 | - if($output->data) |
|
245 | + if ($output->data) |
|
246 | 246 | { |
247 | 247 | $site_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
248 | 248 | } |
249 | 249 | |
250 | - $site_info->self_href = $this->getSelfHref($site_info->id,$type); |
|
250 | + $site_info->self_href = $this->getSelfHref($site_info->id, $type); |
|
251 | 251 | Context::set('site_info', $site_info); |
252 | 252 | |
253 | 253 | $this->setTemplateFile('site'); |
254 | - switch($type) { |
|
254 | + switch ($type) { |
|
255 | 255 | case 'article' : |
256 | 256 | // 문서 전체를 신디케이션에 추가 |
257 | - Context::set('articles', $this->getArticles($module_srl, $page, $startTime, $endTime, 'article',$site_info->id)); |
|
257 | + Context::set('articles', $this->getArticles($module_srl, $page, $startTime, $endTime, 'article', $site_info->id)); |
|
258 | 258 | $next_url = Context::get('articles')->next_url; |
259 | 259 | |
260 | 260 | break; |
261 | 261 | case 'deleted' : |
262 | 262 | // 문서 전체를 신디케이션에서 삭제 |
263 | - Context::set('deleted', $this->getArticles($module_srl, $page, $startTime, $endTime, 'deleted',$site_info->id)); |
|
263 | + Context::set('deleted', $this->getArticles($module_srl, $page, $startTime, $endTime, 'deleted', $site_info->id)); |
|
264 | 264 | $next_url = Context::get('deleted')->next_url; |
265 | 265 | break; |
266 | 266 | default : |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | } |
270 | 270 | |
271 | 271 | // 다음 페이지가 있다면 다시 신디케이션 호출 |
272 | - if($next_url) |
|
272 | + if ($next_url) |
|
273 | 273 | { |
274 | 274 | $oSyndicationController = getController('syndication'); |
275 | 275 | $oSyndicationController->ping(Context::get('id'), Context::get('type'), ++$page); |
@@ -282,10 +282,10 @@ discard block |
||
282 | 282 | $channel_info->title = $this->handleLang($module_info->browser_title, $module_info->site_srl); |
283 | 283 | $channel_info->updated = date("Y-m-d\\TH:i:s").$time_zone; |
284 | 284 | $channel_info->self_href = $this->getSelfHref($channel_info->id, $type); |
285 | - $channel_info->site_url = getFullSiteUrl($this->uri_scheme . $this->site_url, ''); |
|
285 | + $channel_info->site_url = getFullSiteUrl($this->uri_scheme.$this->site_url, ''); |
|
286 | 286 | $channel_info->alternative_href = $this->getChannelAlternativeHref($module_info->module_srl); |
287 | 287 | $channel_info->summary = $module_info->description; |
288 | - if($module_info->module == "textyle") |
|
288 | + if ($module_info->module == "textyle") |
|
289 | 289 | { |
290 | 290 | $channel_info->type = "blog"; |
291 | 291 | $channel_info->rss_href = getFullSiteUrl($module_info->domain, '', 'mid', $module_info->mid, 'act', 'rss'); |
@@ -295,17 +295,17 @@ discard block |
||
295 | 295 | $channel_info->type = "web"; |
296 | 296 | } |
297 | 297 | $except_module_srls = $this->getExceptModuleSrls(); |
298 | - if($except_module_srls) |
|
298 | + if ($except_module_srls) |
|
299 | 299 | { |
300 | - $args->except_modules = implode(',',$except_module_srls); |
|
300 | + $args->except_modules = implode(',', $except_module_srls); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | $output = executeQuery('syndication.getSiteUpdatedTime', $args); |
304 | - if($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
304 | + if ($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
305 | 305 | Context::set('channel_info', $channel_info); |
306 | 306 | |
307 | 307 | $this->setTemplateFile('channel'); |
308 | - switch($type) { |
|
308 | + switch ($type) { |
|
309 | 309 | case 'article' : |
310 | 310 | Context::set('articles', $this->getArticles($module_srl, $page, $startTime, $endTime, 'article', $channel_info->id)); |
311 | 311 | break; |
@@ -323,29 +323,29 @@ discard block |
||
323 | 323 | $channel_info->id = $this->getID('channel', $module_info->module_srl); |
324 | 324 | $channel_info->title = $this->handleLang($module_info->browser_title, $module_info->site_srl); |
325 | 325 | $channel_info->site_title = $site_config->siteTitle; |
326 | - if(!$channel_info->site_title) { |
|
326 | + if (!$channel_info->site_title) { |
|
327 | 327 | $channel_info->site_title = $channel_info->title; |
328 | 328 | } |
329 | 329 | $channel_info->updated = date("Y-m-d\\TH:i:s").$time_zone; |
330 | 330 | $channel_info->self_href = $this->getSelfHref($channel_info->id, $type); |
331 | - $channel_info->site_url = getFullSiteUrl($this->uri_scheme . $this->site_url, ''); |
|
331 | + $channel_info->site_url = getFullSiteUrl($this->uri_scheme.$this->site_url, ''); |
|
332 | 332 | $channel_info->alternative_href = $this->getChannelAlternativeHref($module_info->module_srl); |
333 | 333 | $channel_info->webmaster_name = $member_config->webmaster_name; |
334 | 334 | $channel_info->webmaster_email = $member_config->webmaster_email; |
335 | 335 | |
336 | 336 | $except_module_srls = $this->getExceptModuleSrls(); |
337 | - if($except_module_srls) |
|
337 | + if ($except_module_srls) |
|
338 | 338 | { |
339 | - $args->except_modules = implode(',',$except_module_srls); |
|
339 | + $args->except_modules = implode(',', $except_module_srls); |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | $output = executeQuery('syndication.getSiteUpdatedTime', $args); |
343 | - if($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
343 | + if ($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
344 | 344 | Context::set('channel_info', $channel_info); |
345 | 345 | Context::set('member_config', $member_config); |
346 | 346 | |
347 | 347 | $this->setTemplateFile('channel'); |
348 | - switch($type) { |
|
348 | + switch ($type) { |
|
349 | 349 | case "article" : |
350 | 350 | $articles = new stdClass; |
351 | 351 | $articles->list = array($this->getArticle($document_srl)); |
@@ -371,15 +371,15 @@ discard block |
||
371 | 371 | |
372 | 372 | // @DEPRECATED |
373 | 373 | function getChannels() { |
374 | - if($module_srls) $args->module_srls = $module_srls; |
|
375 | - if(count($this->granted_modules)) $args->except_module_srls = implode(',',$this->granted_modules); |
|
374 | + if ($module_srls) $args->module_srls = $module_srls; |
|
375 | + if (count($this->granted_modules)) $args->except_module_srls = implode(',', $this->granted_modules); |
|
376 | 376 | $output = executeQueryArray('syndication.getModules', $args); |
377 | 377 | |
378 | - $time_zone = substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3); |
|
378 | + $time_zone = substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3); |
|
379 | 379 | Context::set('time_zone', $time_zone); |
380 | 380 | |
381 | - if($output->data) { |
|
382 | - foreach($output->data as $module_info) { |
|
381 | + if ($output->data) { |
|
382 | + foreach ($output->data as $module_info) { |
|
383 | 383 | unset($obj); |
384 | 384 | $obj = new stdClass; |
385 | 385 | $obj->id = $this->getID('channel', $module_info->module_srl); |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | $obj->self_href = $this->getSelfHref($obj->id, 'channel'); |
389 | 389 | $obj->alternative_href = $this->getChannelAlternativeHref($module_info); |
390 | 390 | $obj->summary = $module_info->description; |
391 | - if($module_info->module == "textyle") |
|
391 | + if ($module_info->module == "textyle") |
|
392 | 392 | { |
393 | 393 | $obj->type = "blog"; |
394 | 394 | $obj->rss_href = getFullSiteUrl($module_info->domain, '', 'mid', $module_info->mid, 'act', 'rss'); |
@@ -405,15 +405,15 @@ discard block |
||
405 | 405 | } |
406 | 406 | |
407 | 407 | function getArticle($document_srl) { |
408 | - if($this->site_url==null) $this->init(); |
|
408 | + if ($this->site_url == null) $this->init(); |
|
409 | 409 | |
410 | 410 | $oDocumentModel = getModel('document'); |
411 | - $oDocument = $oDocumentModel->getDocument($document_srl,false,false); |
|
412 | - if(!$oDocument->isExists()) return; |
|
411 | + $oDocument = $oDocumentModel->getDocument($document_srl, false, false); |
|
412 | + if (!$oDocument->isExists()) return; |
|
413 | 413 | |
414 | 414 | $val = $oDocument->getObjectVars(); |
415 | 415 | |
416 | - $time_zone = substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3); |
|
416 | + $time_zone = substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3); |
|
417 | 417 | Context::set('time_zone', $time_zone); |
418 | 418 | |
419 | 419 | $mdoule_info = self::$modules[$oDocument->get('module_srl')]; |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | $article->nick_name = (!$oDocument->get('nick_name')) ? $oDocument->get('user_name') : $oDocument->get('nick_name'); |
428 | 428 | $article->title = $oDocument->getTitle(); |
429 | 429 | $article->content = $oDocument->get('content'); |
430 | - if($val->category_srl) { |
|
430 | + if ($val->category_srl) { |
|
431 | 431 | $category = $oDocumentModel->getCategory($val->category_srl); |
432 | 432 | $category_title = $category->title; |
433 | 433 | $article->category = new stdClass(); |
@@ -438,14 +438,14 @@ discard block |
||
438 | 438 | return $article; |
439 | 439 | } |
440 | 440 | |
441 | - function getArticles($module_srl = null, $page=1, $startTime = null, $endTime = null, $type = null, $id = null) { |
|
442 | - if($this->site_url==null) $this->init(); |
|
441 | + function getArticles($module_srl = null, $page = 1, $startTime = null, $endTime = null, $type = null, $id = null) { |
|
442 | + if ($this->site_url == null) $this->init(); |
|
443 | 443 | |
444 | 444 | $args = new stdClass; |
445 | - if($module_srl) $args->module_srl = $module_srl; |
|
446 | - if($startTime) $args->start_date = $this->getDate($startTime); |
|
447 | - if($endTime) $args->end_date = $this->getDate($endTime); |
|
448 | - if(count($this->granted_modules)) $args->except_module_srls = implode(',',$this->granted_modules); |
|
445 | + if ($module_srl) $args->module_srl = $module_srl; |
|
446 | + if ($startTime) $args->start_date = $this->getDate($startTime); |
|
447 | + if ($endTime) $args->end_date = $this->getDate($endTime); |
|
448 | + if (count($this->granted_modules)) $args->except_module_srls = implode(',', $this->granted_modules); |
|
449 | 449 | $args->page = $page; |
450 | 450 | $output = executeQueryArray('syndication.getDocumentList', $args); |
451 | 451 | $cur_page = $output->page_navigation->cur_page; |
@@ -455,23 +455,23 @@ discard block |
||
455 | 455 | $result->next_url = null; |
456 | 456 | $result->list = array(); |
457 | 457 | |
458 | - $time_zone = substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3); |
|
458 | + $time_zone = substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3); |
|
459 | 459 | Context::set('time_zone', $time_zone); |
460 | 460 | |
461 | - if($cur_page<$total_page) { |
|
461 | + if ($cur_page < $total_page) { |
|
462 | 462 | $next_url = $this->getSelfHref($id, $type); |
463 | - if($startTime) $next_url .= '&startTime='.$startTime; |
|
464 | - if($endTime) $next_url .= '&endTime='.$endTime; |
|
465 | - $result->next_url = $next_url.'&page='.($cur_page+1); |
|
463 | + if ($startTime) $next_url .= '&startTime='.$startTime; |
|
464 | + if ($endTime) $next_url .= '&endTime='.$endTime; |
|
465 | + $result->next_url = $next_url.'&page='.($cur_page + 1); |
|
466 | 466 | } |
467 | 467 | |
468 | - if($output->data) { |
|
469 | - foreach($output->data as $key => $val) { |
|
468 | + if ($output->data) { |
|
469 | + foreach ($output->data as $key => $val) { |
|
470 | 470 | $article = new stdClass(); |
471 | 471 | $article->id = $this->getID('article', $val->module_srl.'-'.$val->document_srl); |
472 | 472 | $article->updated = date("Y-m-d\\TH:i:s", ztime($val->last_update)).$time_zone; |
473 | 473 | $article->published = date("Y-m-d\\TH:i:s", ztime($val->regdate)).$time_zone; |
474 | - $article->alternative_href = getFullSiteUrl($this->uri_scheme . $this->site_url, '', 'document_srl', $val->document_srl); |
|
474 | + $article->alternative_href = getFullSiteUrl($this->uri_scheme.$this->site_url, '', 'document_srl', $val->document_srl); |
|
475 | 475 | $article->channel_alternative_href = $this->getChannelAlternativeHref($val->module_srl); |
476 | 476 | $article->nick_name = (!$val->nick_name) ? $val->user_name : $val->nick_name; |
477 | 477 | $article->content = $val->content; |
@@ -482,12 +482,12 @@ discard block |
||
482 | 482 | } |
483 | 483 | |
484 | 484 | function getDeleted($module_srl = null, $page = 1, $startTime = null, $endTime = null, $type = null, $id = null) { |
485 | - if($this->site_url==null) $this->init(); |
|
485 | + if ($this->site_url == null) $this->init(); |
|
486 | 486 | |
487 | 487 | $args = new stdClass; |
488 | - if($module_srl) $args->module_srl= $module_srl; |
|
489 | - if($startTime) $args->start_date = $this->getDate($startTime); |
|
490 | - if($endTime) $args->end_date = $this->getDate($endTime); |
|
488 | + if ($module_srl) $args->module_srl = $module_srl; |
|
489 | + if ($startTime) $args->start_date = $this->getDate($startTime); |
|
490 | + if ($endTime) $args->end_date = $this->getDate($endTime); |
|
491 | 491 | $args->page = $page; |
492 | 492 | |
493 | 493 | $output = executeQueryArray('syndication.getDeletedList', $args); |
@@ -499,21 +499,21 @@ discard block |
||
499 | 499 | $result->next_url = null; |
500 | 500 | $result->list = array(); |
501 | 501 | |
502 | - $time_zone = substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3); |
|
502 | + $time_zone = substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3); |
|
503 | 503 | Context::set('time_zone', $time_zone); |
504 | 504 | |
505 | - if($cur_page<$total_page) { |
|
505 | + if ($cur_page < $total_page) { |
|
506 | 506 | $next_url = $this->getSelfHref($id, $type); |
507 | - if($startTime) $next_url .= '&startTime='.$startTime; |
|
508 | - if($endTime) $next_url .= '&endTime='.$endTime; |
|
509 | - $result->next_url = $next_url . '&page='.($cur_page+1); |
|
507 | + if ($startTime) $next_url .= '&startTime='.$startTime; |
|
508 | + if ($endTime) $next_url .= '&endTime='.$endTime; |
|
509 | + $result->next_url = $next_url.'&page='.($cur_page + 1); |
|
510 | 510 | } |
511 | 511 | |
512 | - if($output->data) { |
|
513 | - foreach($output->data as $key => $val) { |
|
512 | + if ($output->data) { |
|
513 | + foreach ($output->data as $key => $val) { |
|
514 | 514 | $val->id = $this->getID('article', $val->module_srl.'-'.$val->document_srl); |
515 | 515 | $val->deleted = date("Y-m-d\\TH:i:s", ztime($val->regdate)).$time_zone; |
516 | - $val->alternative_href = getFullSiteUrl($this->uri_scheme . $this->site_url, '', 'document_srl', $val->document_srl); |
|
516 | + $val->alternative_href = getFullSiteUrl($this->uri_scheme.$this->site_url, '', 'document_srl', $val->document_srl); |
|
517 | 517 | $val->channel_id = $this->getID('channel', $val->module_srl.'-'.$val->document_srl); |
518 | 518 | $output->data[$key] = $val; |
519 | 519 | } |
@@ -527,10 +527,10 @@ discard block |
||
527 | 527 | $args = new stdClass; |
528 | 528 | $args->document_srl = $document_srl; |
529 | 529 | $output = executeQueryArray('syndication.getDeletedList', $args); |
530 | - foreach($output->data as $key => $val) { |
|
530 | + foreach ($output->data as $key => $val) { |
|
531 | 531 | $val->id = $this->getID('article', $val->module_srl.'-'.$val->document_srl); |
532 | 532 | $val->deleted = date("Y-m-d\\TH:i:s", ztime($val->regdate)).$time_zone; |
533 | - $val->alternative_href = getFullSiteUrl($this->uri_scheme . $this->site_url, '', 'document_srl', $val->document_srl); |
|
533 | + $val->alternative_href = getFullSiteUrl($this->uri_scheme.$this->site_url, '', 'document_srl', $val->document_srl); |
|
534 | 534 | $val->channel_id = $this->getID('channel', $val->module_srl.'-'.$val->document_srl); |
535 | 535 | $output->data[$key] = $val; |
536 | 536 | } |
@@ -539,42 +539,42 @@ discard block |
||
539 | 539 | } |
540 | 540 | |
541 | 541 | function getID($type, $target_id = null) { |
542 | - if($this->site_url==null) $this->init(); |
|
542 | + if ($this->site_url == null) $this->init(); |
|
543 | 543 | |
544 | - return sprintf('tag:%s,%d:%s', $this->site_url, $this->year, $type) . ($target_id?':'.$target_id:''); |
|
544 | + return sprintf('tag:%s,%d:%s', $this->site_url, $this->year, $type).($target_id ? ':'.$target_id : ''); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | function getChannelAlternativeHref($module_srl) { |
548 | 548 | static $module_info = array(); |
549 | - if(!isset($module_info[$module_srl])) { |
|
549 | + if (!isset($module_info[$module_srl])) { |
|
550 | 550 | $args = new stdClass; |
551 | 551 | $args->module_srl = $module_srl; |
552 | 552 | $output = executeQuery('syndication.getModuleSiteInfo', $args); |
553 | - if($output->data) $module_info[$module_srl] = $output->data; |
|
553 | + if ($output->data) $module_info[$module_srl] = $output->data; |
|
554 | 554 | else $module_info[$module_srl] = null; |
555 | 555 | } |
556 | 556 | |
557 | - if(is_null($module_info[$module_srl])) return $this->site_url; |
|
557 | + if (is_null($module_info[$module_srl])) return $this->site_url; |
|
558 | 558 | |
559 | 559 | $domain = $module_info[$module_srl]->domain; |
560 | 560 | $url = getFullSiteUrl($domain, '', 'mid', $module_info[$module_srl]->mid); |
561 | - if(substr($url,0,1)=='/') $domain = $this->uri_scheme . $this->site_url . $url; |
|
561 | + if (substr($url, 0, 1) == '/') $domain = $this->uri_scheme.$this->site_url.$url; |
|
562 | 562 | return $url; |
563 | 563 | } |
564 | 564 | |
565 | 565 | function getSelfHref($id, $type = null) { |
566 | - if($this->site_url==null) $this->init(); |
|
566 | + if ($this->site_url == null) $this->init(); |
|
567 | 567 | |
568 | - return sprintf('%s/?module=syndication&act=getSyndicationList&id=%s&type=%s&syndication_password=%s', $this->uri_scheme . $this->site_url, $id, $type, $this->syndication_password); |
|
568 | + return sprintf('%s/?module=syndication&act=getSyndicationList&id=%s&type=%s&syndication_password=%s', $this->uri_scheme.$this->site_url, $id, $type, $this->syndication_password); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | /** |
572 | 572 | * 문서의 고유 URL 반환 |
573 | 573 | */ |
574 | 574 | function getAlternativeHref($document_srl, $module_srl) { |
575 | - if($this->site_url==null) $this->init(); |
|
575 | + if ($this->site_url == null) $this->init(); |
|
576 | 576 | |
577 | - if(!self::$modules[$module_srl]) { |
|
577 | + if (!self::$modules[$module_srl]) { |
|
578 | 578 | $args = new stdClass; |
579 | 579 | $args->module_srls = $module_srl; |
580 | 580 | $output = executeQuery('syndication.getModules', $args); |
@@ -586,20 +586,20 @@ discard block |
||
586 | 586 | |
587 | 587 | $domain = $module_info->domain; |
588 | 588 | $url = getFullSiteUrl($domain, '', 'mid', $module_info->mid, 'document_srl', $document_srl); |
589 | - if(substr($url,0,1)=='/') $domain = $this->uri_scheme . $this->site_url.$url; |
|
589 | + if (substr($url, 0, 1) == '/') $domain = $this->uri_scheme.$this->site_url.$url; |
|
590 | 590 | return $url; |
591 | 591 | } |
592 | 592 | |
593 | 593 | function getDate($date) { |
594 | 594 | $time = strtotime($date); |
595 | - if($time == -1) $time = ztime(str_replace(array('-','T',':'),'',$date)); |
|
595 | + if ($time == -1) $time = ztime(str_replace(array('-', 'T', ':'), '', $date)); |
|
596 | 596 | return date('YmdHis', $time); |
597 | 597 | } |
598 | 598 | |
599 | 599 | function getResentPingLogPath() |
600 | 600 | { |
601 | 601 | $target_filename = _XE_PATH_.'files/cache/tmp/syndication_ping_log'; |
602 | - if(!file_exists($target_filename)) |
|
602 | + if (!file_exists($target_filename)) |
|
603 | 603 | { |
604 | 604 | FileHandler::writeFile($target_filename, ''); |
605 | 605 | } |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | $args->message = urlencode($msg); |
616 | 616 | |
617 | 617 | $list = $this->getResentPingLog(); |
618 | - if(count($list)>=10) |
|
618 | + if (count($list) >= 10) |
|
619 | 619 | { |
620 | 620 | array_pop($list); |
621 | 621 | } |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | $file_path = $this->getResentPingLogPath(); |
631 | 631 | $str = FileHandler::readFile($file_path); |
632 | 632 | $list = array(); |
633 | - if($str) |
|
633 | + if ($str) |
|
634 | 634 | { |
635 | 635 | $list = unserialize($str); |
636 | 636 | } |
@@ -20,7 +20,9 @@ discard block |
||
20 | 20 | function init() { |
21 | 21 | $oModuleModel = getModel('module'); |
22 | 22 | $config = $oModuleModel->getModuleConfig('syndication'); |
23 | - if(Context::getSslStatus() == 'always') $this->uri_scheme = 'https://'; |
|
23 | + if(Context::getSslStatus() == 'always') { |
|
24 | + $this->uri_scheme = 'https://'; |
|
25 | + } |
|
24 | 26 | |
25 | 27 | $this->site_url = preg_replace('/\/+$/is', '', $config->site_url); |
26 | 28 | $this->syndication_password = $config->syndication_password; |
@@ -41,10 +43,14 @@ discard block |
||
41 | 43 | $args->module_srl = $module_srl; |
42 | 44 | |
43 | 45 | $output = executeQuery('syndication.getExceptModule', $args); |
44 | - if($output->data->count) return TRUE; |
|
46 | + if($output->data->count) { |
|
47 | + return TRUE; |
|
48 | + } |
|
45 | 49 | |
46 | 50 | $output = executeQuery('syndication.getGrantedModule', $args); |
47 | - if($output->data->count) return TRUE; |
|
51 | + if($output->data->count) { |
|
52 | + return TRUE; |
|
53 | + } |
|
48 | 54 | |
49 | 55 | return FALSE; |
50 | 56 | } |
@@ -72,7 +78,9 @@ discard block |
||
72 | 78 | $args->site_srl = $site_srl; |
73 | 79 | $args->lang_code = Context::getLangType(); |
74 | 80 | $output = executeQueryArray("syndication.getLang", $args); |
75 | - if(!$output->toBool() || !$output->data) return $key; |
|
81 | + if(!$output->toBool() || !$output->data) { |
|
82 | + return $key; |
|
83 | + } |
|
76 | 84 | |
77 | 85 | foreach($output->data as $value) |
78 | 86 | { |
@@ -82,8 +90,9 @@ discard block |
||
82 | 90 | if($this->langs[$site_srl][$key]) |
83 | 91 | { |
84 | 92 | return $this->langs[$site_srl][$key]; |
93 | + } else { |
|
94 | + return $key; |
|
85 | 95 | } |
86 | - else return $key; |
|
87 | 96 | } |
88 | 97 | |
89 | 98 | function handleLang($title, $site_srl) |
@@ -92,8 +101,7 @@ discard block |
||
92 | 101 | if(!preg_match("/\\\$user_lang->(.+)/", $title, $matches)) |
93 | 102 | { |
94 | 103 | return $title; |
95 | - } |
|
96 | - else |
|
104 | + } else |
|
97 | 105 | { |
98 | 106 | return $this->getLang($matches[1], $site_srl); |
99 | 107 | } |
@@ -148,8 +156,7 @@ discard block |
||
148 | 156 | if($id && strpos($id,'-')!==false) |
149 | 157 | { |
150 | 158 | list($module_srl, $document_srl) = explode('-', $id); |
151 | - } |
|
152 | - elseif($id) |
|
159 | + } elseif($id) |
|
153 | 160 | { |
154 | 161 | $module_srl = $id; |
155 | 162 | } |
@@ -188,8 +195,7 @@ discard block |
||
188 | 195 | { |
189 | 196 | $error = 'target is not founded'; |
190 | 197 | } |
191 | - } |
|
192 | - else |
|
198 | + } else |
|
193 | 199 | { |
194 | 200 | $error = 'target is not founded'; |
195 | 201 | } |
@@ -225,8 +231,7 @@ discard block |
||
225 | 231 | { |
226 | 232 | $site_info->title = $site_info->site_title; |
227 | 233 | } |
228 | - } |
|
229 | - else |
|
234 | + } else |
|
230 | 235 | { |
231 | 236 | $except_module_output = executeQueryArray('syndication.getExceptModuleSrls'); |
232 | 237 | if(is_array($except_module_output->data)) |
@@ -289,8 +294,7 @@ discard block |
||
289 | 294 | { |
290 | 295 | $channel_info->type = "blog"; |
291 | 296 | $channel_info->rss_href = getFullSiteUrl($module_info->domain, '', 'mid', $module_info->mid, 'act', 'rss'); |
292 | - } |
|
293 | - else |
|
297 | + } else |
|
294 | 298 | { |
295 | 299 | $channel_info->type = "web"; |
296 | 300 | } |
@@ -301,7 +305,9 @@ discard block |
||
301 | 305 | } |
302 | 306 | |
303 | 307 | $output = executeQuery('syndication.getSiteUpdatedTime', $args); |
304 | - if($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
308 | + if($output->data) { |
|
309 | + $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
310 | + } |
|
305 | 311 | Context::set('channel_info', $channel_info); |
306 | 312 | |
307 | 313 | $this->setTemplateFile('channel'); |
@@ -340,7 +346,9 @@ discard block |
||
340 | 346 | } |
341 | 347 | |
342 | 348 | $output = executeQuery('syndication.getSiteUpdatedTime', $args); |
343 | - if($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
349 | + if($output->data) { |
|
350 | + $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
351 | + } |
|
344 | 352 | Context::set('channel_info', $channel_info); |
345 | 353 | Context::set('member_config', $member_config); |
346 | 354 | |
@@ -371,8 +379,12 @@ discard block |
||
371 | 379 | |
372 | 380 | // @DEPRECATED |
373 | 381 | function getChannels() { |
374 | - if($module_srls) $args->module_srls = $module_srls; |
|
375 | - if(count($this->granted_modules)) $args->except_module_srls = implode(',',$this->granted_modules); |
|
382 | + if($module_srls) { |
|
383 | + $args->module_srls = $module_srls; |
|
384 | + } |
|
385 | + if(count($this->granted_modules)) { |
|
386 | + $args->except_module_srls = implode(',',$this->granted_modules); |
|
387 | + } |
|
376 | 388 | $output = executeQueryArray('syndication.getModules', $args); |
377 | 389 | |
378 | 390 | $time_zone = substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3); |
@@ -392,8 +404,7 @@ discard block |
||
392 | 404 | { |
393 | 405 | $obj->type = "blog"; |
394 | 406 | $obj->rss_href = getFullSiteUrl($module_info->domain, '', 'mid', $module_info->mid, 'act', 'rss'); |
395 | - } |
|
396 | - else |
|
407 | + } else |
|
397 | 408 | { |
398 | 409 | $obj->type = "web"; |
399 | 410 | } |
@@ -405,11 +416,15 @@ discard block |
||
405 | 416 | } |
406 | 417 | |
407 | 418 | function getArticle($document_srl) { |
408 | - if($this->site_url==null) $this->init(); |
|
419 | + if($this->site_url==null) { |
|
420 | + $this->init(); |
|
421 | + } |
|
409 | 422 | |
410 | 423 | $oDocumentModel = getModel('document'); |
411 | 424 | $oDocument = $oDocumentModel->getDocument($document_srl,false,false); |
412 | - if(!$oDocument->isExists()) return; |
|
425 | + if(!$oDocument->isExists()) { |
|
426 | + return; |
|
427 | + } |
|
413 | 428 | |
414 | 429 | $val = $oDocument->getObjectVars(); |
415 | 430 | |
@@ -439,13 +454,23 @@ discard block |
||
439 | 454 | } |
440 | 455 | |
441 | 456 | function getArticles($module_srl = null, $page=1, $startTime = null, $endTime = null, $type = null, $id = null) { |
442 | - if($this->site_url==null) $this->init(); |
|
457 | + if($this->site_url==null) { |
|
458 | + $this->init(); |
|
459 | + } |
|
443 | 460 | |
444 | 461 | $args = new stdClass; |
445 | - if($module_srl) $args->module_srl = $module_srl; |
|
446 | - if($startTime) $args->start_date = $this->getDate($startTime); |
|
447 | - if($endTime) $args->end_date = $this->getDate($endTime); |
|
448 | - if(count($this->granted_modules)) $args->except_module_srls = implode(',',$this->granted_modules); |
|
462 | + if($module_srl) { |
|
463 | + $args->module_srl = $module_srl; |
|
464 | + } |
|
465 | + if($startTime) { |
|
466 | + $args->start_date = $this->getDate($startTime); |
|
467 | + } |
|
468 | + if($endTime) { |
|
469 | + $args->end_date = $this->getDate($endTime); |
|
470 | + } |
|
471 | + if(count($this->granted_modules)) { |
|
472 | + $args->except_module_srls = implode(',',$this->granted_modules); |
|
473 | + } |
|
449 | 474 | $args->page = $page; |
450 | 475 | $output = executeQueryArray('syndication.getDocumentList', $args); |
451 | 476 | $cur_page = $output->page_navigation->cur_page; |
@@ -460,8 +485,12 @@ discard block |
||
460 | 485 | |
461 | 486 | if($cur_page<$total_page) { |
462 | 487 | $next_url = $this->getSelfHref($id, $type); |
463 | - if($startTime) $next_url .= '&startTime='.$startTime; |
|
464 | - if($endTime) $next_url .= '&endTime='.$endTime; |
|
488 | + if($startTime) { |
|
489 | + $next_url .= '&startTime='.$startTime; |
|
490 | + } |
|
491 | + if($endTime) { |
|
492 | + $next_url .= '&endTime='.$endTime; |
|
493 | + } |
|
465 | 494 | $result->next_url = $next_url.'&page='.($cur_page+1); |
466 | 495 | } |
467 | 496 | |
@@ -482,12 +511,20 @@ discard block |
||
482 | 511 | } |
483 | 512 | |
484 | 513 | function getDeleted($module_srl = null, $page = 1, $startTime = null, $endTime = null, $type = null, $id = null) { |
485 | - if($this->site_url==null) $this->init(); |
|
514 | + if($this->site_url==null) { |
|
515 | + $this->init(); |
|
516 | + } |
|
486 | 517 | |
487 | 518 | $args = new stdClass; |
488 | - if($module_srl) $args->module_srl= $module_srl; |
|
489 | - if($startTime) $args->start_date = $this->getDate($startTime); |
|
490 | - if($endTime) $args->end_date = $this->getDate($endTime); |
|
519 | + if($module_srl) { |
|
520 | + $args->module_srl= $module_srl; |
|
521 | + } |
|
522 | + if($startTime) { |
|
523 | + $args->start_date = $this->getDate($startTime); |
|
524 | + } |
|
525 | + if($endTime) { |
|
526 | + $args->end_date = $this->getDate($endTime); |
|
527 | + } |
|
491 | 528 | $args->page = $page; |
492 | 529 | |
493 | 530 | $output = executeQueryArray('syndication.getDeletedList', $args); |
@@ -504,8 +541,12 @@ discard block |
||
504 | 541 | |
505 | 542 | if($cur_page<$total_page) { |
506 | 543 | $next_url = $this->getSelfHref($id, $type); |
507 | - if($startTime) $next_url .= '&startTime='.$startTime; |
|
508 | - if($endTime) $next_url .= '&endTime='.$endTime; |
|
544 | + if($startTime) { |
|
545 | + $next_url .= '&startTime='.$startTime; |
|
546 | + } |
|
547 | + if($endTime) { |
|
548 | + $next_url .= '&endTime='.$endTime; |
|
549 | + } |
|
509 | 550 | $result->next_url = $next_url . '&page='.($cur_page+1); |
510 | 551 | } |
511 | 552 | |
@@ -539,7 +580,9 @@ discard block |
||
539 | 580 | } |
540 | 581 | |
541 | 582 | function getID($type, $target_id = null) { |
542 | - if($this->site_url==null) $this->init(); |
|
583 | + if($this->site_url==null) { |
|
584 | + $this->init(); |
|
585 | + } |
|
543 | 586 | |
544 | 587 | return sprintf('tag:%s,%d:%s', $this->site_url, $this->year, $type) . ($target_id?':'.$target_id:''); |
545 | 588 | } |
@@ -550,20 +593,29 @@ discard block |
||
550 | 593 | $args = new stdClass; |
551 | 594 | $args->module_srl = $module_srl; |
552 | 595 | $output = executeQuery('syndication.getModuleSiteInfo', $args); |
553 | - if($output->data) $module_info[$module_srl] = $output->data; |
|
554 | - else $module_info[$module_srl] = null; |
|
596 | + if($output->data) { |
|
597 | + $module_info[$module_srl] = $output->data; |
|
598 | + } else { |
|
599 | + $module_info[$module_srl] = null; |
|
600 | + } |
|
555 | 601 | } |
556 | 602 | |
557 | - if(is_null($module_info[$module_srl])) return $this->site_url; |
|
603 | + if(is_null($module_info[$module_srl])) { |
|
604 | + return $this->site_url; |
|
605 | + } |
|
558 | 606 | |
559 | 607 | $domain = $module_info[$module_srl]->domain; |
560 | 608 | $url = getFullSiteUrl($domain, '', 'mid', $module_info[$module_srl]->mid); |
561 | - if(substr($url,0,1)=='/') $domain = $this->uri_scheme . $this->site_url . $url; |
|
609 | + if(substr($url,0,1)=='/') { |
|
610 | + $domain = $this->uri_scheme . $this->site_url . $url; |
|
611 | + } |
|
562 | 612 | return $url; |
563 | 613 | } |
564 | 614 | |
565 | 615 | function getSelfHref($id, $type = null) { |
566 | - if($this->site_url==null) $this->init(); |
|
616 | + if($this->site_url==null) { |
|
617 | + $this->init(); |
|
618 | + } |
|
567 | 619 | |
568 | 620 | return sprintf('%s/?module=syndication&act=getSyndicationList&id=%s&type=%s&syndication_password=%s', $this->uri_scheme . $this->site_url, $id, $type, $this->syndication_password); |
569 | 621 | } |
@@ -572,7 +624,9 @@ discard block |
||
572 | 624 | * 문서의 고유 URL 반환 |
573 | 625 | */ |
574 | 626 | function getAlternativeHref($document_srl, $module_srl) { |
575 | - if($this->site_url==null) $this->init(); |
|
627 | + if($this->site_url==null) { |
|
628 | + $this->init(); |
|
629 | + } |
|
576 | 630 | |
577 | 631 | if(!self::$modules[$module_srl]) { |
578 | 632 | $args = new stdClass; |
@@ -586,13 +640,17 @@ discard block |
||
586 | 640 | |
587 | 641 | $domain = $module_info->domain; |
588 | 642 | $url = getFullSiteUrl($domain, '', 'mid', $module_info->mid, 'document_srl', $document_srl); |
589 | - if(substr($url,0,1)=='/') $domain = $this->uri_scheme . $this->site_url.$url; |
|
643 | + if(substr($url,0,1)=='/') { |
|
644 | + $domain = $this->uri_scheme . $this->site_url.$url; |
|
645 | + } |
|
590 | 646 | return $url; |
591 | 647 | } |
592 | 648 | |
593 | 649 | function getDate($date) { |
594 | 650 | $time = strtotime($date); |
595 | - if($time == -1) $time = ztime(str_replace(array('-','T',':'),'',$date)); |
|
651 | + if($time == -1) { |
|
652 | + $time = ztime(str_replace(array('-','T',':'),'',$date)); |
|
653 | + } |
|
596 | 654 | return date('YmdHis', $time); |
597 | 655 | } |
598 | 656 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $oModuleController->insertTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after'); |
39 | 39 | |
40 | 40 | $oAddonAdminModel = getAdminModel('addon'); |
41 | - if($oAddonAdminModel->getAddonInfoXml('catpcha')){ |
|
41 | + if ($oAddonAdminModel->getAddonInfoXml('catpcha')) { |
|
42 | 42 | $oAddonAdminController = &addonAdminController::getInstance(); |
43 | 43 | $oAddonAdminController->doActivate('catpcha'); |
44 | 44 | $oAddonAdminController->makeCacheFile(); |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | |
48 | 48 | function checkUpdate() { |
49 | 49 | $oModuleModel = getModel('module'); |
50 | - if(!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) return true; |
|
51 | - if(!$oModuleModel->getTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after')) return true; |
|
52 | - if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) return true; |
|
50 | + if (!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) return true; |
|
51 | + if (!$oModuleModel->getTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after')) return true; |
|
52 | + if (!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) return true; |
|
53 | 53 | |
54 | 54 | return false; |
55 | 55 | } |
@@ -58,18 +58,18 @@ discard block |
||
58 | 58 | $oModuleModel = getModel('module'); |
59 | 59 | $oModuleController = getController('module'); |
60 | 60 | |
61 | - if(!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')){ |
|
61 | + if (!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) { |
|
62 | 62 | $oModuleController->insertTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after'); |
63 | 63 | } |
64 | - if(!$oModuleModel->getTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after')){ |
|
64 | + if (!$oModuleModel->getTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after')) { |
|
65 | 65 | $oModuleController->insertTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after'); |
66 | 66 | } |
67 | - if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')){ |
|
67 | + if (!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) { |
|
68 | 68 | $oModuleController->insertTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after'); |
69 | 69 | } |
70 | 70 | |
71 | 71 | $oAddonAdminModel = getAdminModel('addon'); |
72 | - if($oAddonAdminModel->getAddonInfoXml('catpcha')){ |
|
72 | + if ($oAddonAdminModel->getAddonInfoXml('catpcha')) { |
|
73 | 73 | $oAddonAdminController = &addonAdminController::getInstance(); |
74 | 74 | $oAddonAdminController->doActivate('catpcha'); |
75 | 75 | $oAddonAdminController->makeCacheFile(); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | function checkOpenSSLSupport() |
83 | 83 | { |
84 | - if(!in_array('ssl', stream_get_transports())) { |
|
84 | + if (!in_array('ssl', stream_get_transports())) { |
|
85 | 85 | return FALSE; |
86 | 86 | } |
87 | 87 | return TRUE; |
@@ -47,9 +47,15 @@ |
||
47 | 47 | |
48 | 48 | function checkUpdate() { |
49 | 49 | $oModuleModel = getModel('module'); |
50 | - if(!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) return true; |
|
51 | - if(!$oModuleModel->getTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after')) return true; |
|
52 | - if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) return true; |
|
50 | + if(!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) { |
|
51 | + return true; |
|
52 | + } |
|
53 | + if(!$oModuleModel->getTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after')) { |
|
54 | + return true; |
|
55 | + } |
|
56 | + if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) { |
|
57 | + return true; |
|
58 | + } |
|
53 | 59 | |
54 | 60 | return false; |
55 | 61 | } |
@@ -21,28 +21,28 @@ discard block |
||
21 | 21 | $oSyndicationModel = getModel('syndication'); |
22 | 22 | Context::set('ping_log', $oSyndicationModel->getResentPingLog()); |
23 | 23 | |
24 | - if(!$module_config->syndication_use) |
|
24 | + if (!$module_config->syndication_use) |
|
25 | 25 | { |
26 | 26 | $module_config->syndication_use = 'Y'; |
27 | 27 | } |
28 | 28 | |
29 | - if(!$module_config->site_url) |
|
29 | + if (!$module_config->site_url) |
|
30 | 30 | { |
31 | - $module_config->site_url = Context::getDefaultUrl()?Context::getDefaultUrl():getFullUrl(); |
|
31 | + $module_config->site_url = Context::getDefaultUrl() ?Context::getDefaultUrl() : getFullUrl(); |
|
32 | 32 | } |
33 | 33 | |
34 | - if(!$module_config->year) |
|
34 | + if (!$module_config->year) |
|
35 | 35 | { |
36 | 36 | $module_config->year = date("Y"); |
37 | 37 | } |
38 | 38 | |
39 | - if(!isset($module_config->syndication_password)) |
|
39 | + if (!isset($module_config->syndication_password)) |
|
40 | 40 | { |
41 | 41 | $module_config->syndication_password = uniqid(); |
42 | 42 | } |
43 | 43 | |
44 | 44 | Context::set('syndication_use', $module_config->syndication_use); |
45 | - Context::set('site_url', preg_replace('/^(http|https):\/\//i','',$module_config->site_url)); |
|
45 | + Context::set('site_url', preg_replace('/^(http|https):\/\//i', '', $module_config->site_url)); |
|
46 | 46 | Context::set('year', $module_config->year); |
47 | 47 | Context::set('syndication_token', $module_config->syndication_token); |
48 | 48 | Context::set('syndication_password', $module_config->syndication_password); |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | |
51 | 51 | $output = executeQueryArray('syndication.getExceptModules'); |
52 | 52 | $except_module_list = array(); |
53 | - if($output->data && count($output->data) > 0) |
|
53 | + if ($output->data && count($output->data) > 0) |
|
54 | 54 | { |
55 | - foreach($output->data as $item) |
|
55 | + foreach ($output->data as $item) |
|
56 | 56 | { |
57 | 57 | $except_module_list[] = $item; |
58 | 58 | } |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | |
63 | 63 | //Security |
64 | 64 | $security = new Security(); |
65 | - $security->encodeHTML('services..service','except_module..ping'); |
|
66 | - $security->encodeHTML('except_module..mid','except_module..browser_title'); |
|
65 | + $security->encodeHTML('services..service', 'except_module..ping'); |
|
66 | + $security->encodeHTML('except_module..mid', 'except_module..browser_title'); |
|
67 | 67 | |
68 | 68 | $this->setTemplatePath($this->module_path.'tpl'); |
69 | 69 | $this->setTemplateFile('config'); |
@@ -21,36 +21,36 @@ discard block |
||
21 | 21 | |
22 | 22 | $config = new stdClass; |
23 | 23 | $config->syndication_use = Context::get('syndication_use'); |
24 | - $config->site_url = preg_replace('/\/+$/is','',Context::get('site_url')); |
|
24 | + $config->site_url = preg_replace('/\/+$/is', '', Context::get('site_url')); |
|
25 | 25 | $config->year = Context::get('year'); |
26 | 26 | $config->syndication_token = Context::get('syndication_token'); |
27 | 27 | $config->syndication_password = urlencode(Context::get('syndication_password')); |
28 | 28 | |
29 | - if(!$config->site_url) return $this->makeObject(-1,'msg_site_url_is_null'); |
|
30 | - if(!$config->syndication_token) return $this->makeObject(-1,'msg_syndication_token_is_null'); |
|
29 | + if (!$config->site_url) return $this->makeObject(-1, 'msg_site_url_is_null'); |
|
30 | + if (!$config->syndication_token) return $this->makeObject(-1, 'msg_syndication_token_is_null'); |
|
31 | 31 | |
32 | - $oModuleController->updateModuleConfig('syndication',$config); |
|
32 | + $oModuleController->updateModuleConfig('syndication', $config); |
|
33 | 33 | |
34 | 34 | $except_module = Context::get('except_module'); |
35 | 35 | $output = executeQuery('syndication.deleteExceptModules'); |
36 | - if(!$output->toBool()) return $output; |
|
36 | + if (!$output->toBool()) return $output; |
|
37 | 37 | |
38 | - if ($except_module){ |
|
39 | - $modules = explode(',',$except_module); |
|
40 | - for($i=0,$c=count($modules);$i<$c;$i++) { |
|
38 | + if ($except_module) { |
|
39 | + $modules = explode(',', $except_module); |
|
40 | + for ($i = 0, $c = count($modules); $i < $c; $i++) { |
|
41 | 41 | $args->module_srl = $modules[$i]; |
42 | - $output = executeQuery('syndication.insertExceptModule',$args); |
|
43 | - if(!$output->toBool()) return $output; |
|
42 | + $output = executeQuery('syndication.insertExceptModule', $args); |
|
43 | + if (!$output->toBool()) return $output; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | - if(!$this->checkOpenSSLSupport()) |
|
47 | + if (!$this->checkOpenSSLSupport()) |
|
48 | 48 | { |
49 | 49 | return $this->makeObject(-1, 'msg_need_openssl_support'); |
50 | 50 | } |
51 | 51 | |
52 | 52 | $this->setMessage('success_applied'); |
53 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) { |
|
53 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) { |
|
54 | 54 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSyndicationAdminConfig'); |
55 | 55 | $this->setRedirectUrl($returnUrl); |
56 | 56 | return; |
@@ -62,18 +62,18 @@ discard block |
||
62 | 62 | $oModuleModel = getModel('module'); |
63 | 63 | |
64 | 64 | $oSyndicationController = getController('syndication'); |
65 | - $oSyndicationModel= getModel('syndication'); |
|
65 | + $oSyndicationModel = getModel('syndication'); |
|
66 | 66 | |
67 | 67 | $module_config = $oModuleModel->getModuleConfig('syndication'); |
68 | 68 | |
69 | 69 | $site_url = trim(Context::get('site_url')); |
70 | - if(!$module_config->site_url) return $this->makeObject(-1,'msg_site_url_is_null'); |
|
71 | - if(!$module_config->syndication_token) return $this->makeObject(-1,'msg_syndication_token_is_null'); |
|
70 | + if (!$module_config->site_url) return $this->makeObject(-1, 'msg_site_url_is_null'); |
|
71 | + if (!$module_config->syndication_token) return $this->makeObject(-1, 'msg_syndication_token_is_null'); |
|
72 | 72 | |
73 | 73 | $id = $oSyndicationModel->getID('site'); |
74 | 74 | |
75 | 75 | // site_url 정보와 token 정보를 이용해서 ping 전송 테스트 |
76 | - if($oSyndicationController->ping($id, 'site')===FALSE) |
|
76 | + if ($oSyndicationController->ping($id, 'site') === FALSE) |
|
77 | 77 | { |
78 | 78 | $this->setError(-1); |
79 | 79 | $this->setMessage($oSyndicationController->ping_message); |
@@ -26,21 +26,29 @@ discard block |
||
26 | 26 | $config->syndication_token = Context::get('syndication_token'); |
27 | 27 | $config->syndication_password = urlencode(Context::get('syndication_password')); |
28 | 28 | |
29 | - if(!$config->site_url) return $this->makeObject(-1,'msg_site_url_is_null'); |
|
30 | - if(!$config->syndication_token) return $this->makeObject(-1,'msg_syndication_token_is_null'); |
|
29 | + if(!$config->site_url) { |
|
30 | + return $this->makeObject(-1,'msg_site_url_is_null'); |
|
31 | + } |
|
32 | + if(!$config->syndication_token) { |
|
33 | + return $this->makeObject(-1,'msg_syndication_token_is_null'); |
|
34 | + } |
|
31 | 35 | |
32 | 36 | $oModuleController->updateModuleConfig('syndication',$config); |
33 | 37 | |
34 | 38 | $except_module = Context::get('except_module'); |
35 | 39 | $output = executeQuery('syndication.deleteExceptModules'); |
36 | - if(!$output->toBool()) return $output; |
|
40 | + if(!$output->toBool()) { |
|
41 | + return $output; |
|
42 | + } |
|
37 | 43 | |
38 | 44 | if ($except_module){ |
39 | 45 | $modules = explode(',',$except_module); |
40 | 46 | for($i=0,$c=count($modules);$i<$c;$i++) { |
41 | 47 | $args->module_srl = $modules[$i]; |
42 | 48 | $output = executeQuery('syndication.insertExceptModule',$args); |
43 | - if(!$output->toBool()) return $output; |
|
49 | + if(!$output->toBool()) { |
|
50 | + return $output; |
|
51 | + } |
|
44 | 52 | } |
45 | 53 | } |
46 | 54 | |
@@ -67,8 +75,12 @@ discard block |
||
67 | 75 | $module_config = $oModuleModel->getModuleConfig('syndication'); |
68 | 76 | |
69 | 77 | $site_url = trim(Context::get('site_url')); |
70 | - if(!$module_config->site_url) return $this->makeObject(-1,'msg_site_url_is_null'); |
|
71 | - if(!$module_config->syndication_token) return $this->makeObject(-1,'msg_syndication_token_is_null'); |
|
78 | + if(!$module_config->site_url) { |
|
79 | + return $this->makeObject(-1,'msg_site_url_is_null'); |
|
80 | + } |
|
81 | + if(!$module_config->syndication_token) { |
|
82 | + return $this->makeObject(-1,'msg_syndication_token_is_null'); |
|
83 | + } |
|
72 | 84 | |
73 | 85 | $id = $oSyndicationModel->getID('site'); |
74 | 86 | |
@@ -77,8 +89,7 @@ discard block |
||
77 | 89 | { |
78 | 90 | $this->setError(-1); |
79 | 91 | $this->setMessage($oSyndicationController->ping_message); |
80 | - } |
|
81 | - else |
|
92 | + } else |
|
82 | 93 | { |
83 | 94 | $this->setMessage('msg_success_ping_test'); |
84 | 95 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | if (Context::getResponseMethod() != 'HTML') return; |
45 | 45 | if (Context::get('module') == 'admin') return; |
46 | 46 | |
47 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
47 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
48 | 48 | |
49 | 49 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
50 | 50 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $piece->image = array(); |
89 | 89 | $piece->author = null; |
90 | 90 | |
91 | - if(stristr($_SERVER['HTTP_USER_AGENT'], 'facebookexternalhit') != FALSE) { |
|
91 | + if (stristr($_SERVER['HTTP_USER_AGENT'], 'facebookexternalhit') != FALSE) { |
|
92 | 92 | $single_image = true; |
93 | 93 | } |
94 | 94 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | if ($is_article) { |
109 | 109 | if (!$oDocument->isSecret()) { |
110 | 110 | $piece->document_title = $oDocument->getTitleText(); |
111 | - $piece->url = getFullUrl('', 'mid', $current_module_info->mid, 'document_srl',$document_srl); |
|
111 | + $piece->url = getFullUrl('', 'mid', $current_module_info->mid, 'document_srl', $document_srl); |
|
112 | 112 | $piece->type = 'article'; |
113 | 113 | $piece->description = trim(str_replace(' ', ' ', $oDocument->getContentText(400))); |
114 | 114 | $piece->author = $oDocument->getNickName(); |
@@ -116,12 +116,12 @@ discard block |
||
116 | 116 | if (count($tags)) $piece->tags = $tags; |
117 | 117 | |
118 | 118 | $document_images = false; |
119 | - if($oCacheHandler->isSupport()) { |
|
120 | - $cache_key_document_images = 'seo:document_images:' . $document_srl; |
|
119 | + if ($oCacheHandler->isSupport()) { |
|
120 | + $cache_key_document_images = 'seo:document_images:'.$document_srl; |
|
121 | 121 | $document_images = $oCacheHandler->get($cache_key_document_images); |
122 | 122 | } |
123 | 123 | |
124 | - if($document_images === false && $oDocument->hasUploadedFiles()) { |
|
124 | + if ($document_images === false && $oDocument->hasUploadedFiles()) { |
|
125 | 125 | $image_ext = array('bmp', 'gif', 'jpg', 'jpeg', 'png'); |
126 | 126 | $document_images = array(); |
127 | 127 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | if (!in_array(strtolower($ext), $image_ext)) continue; |
134 | 134 | list($width, $height) = @getimagesize($file->uploaded_filename); |
135 | - if($width < 100 && $height < 100) continue; |
|
135 | + if ($width < 100 && $height < 100) continue; |
|
136 | 136 | |
137 | 137 | $image = array( |
138 | 138 | 'filepath' => $file->uploaded_filename, |
@@ -140,35 +140,35 @@ discard block |
||
140 | 140 | 'height' => $height |
141 | 141 | ); |
142 | 142 | |
143 | - if($file->cover_image === 'Y') { |
|
143 | + if ($file->cover_image === 'Y') { |
|
144 | 144 | array_unshift($document_images, $image); |
145 | 145 | } else { |
146 | 146 | $document_images[] = $image; |
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
150 | - if($oCacheHandler->isSupport()) { |
|
150 | + if ($oCacheHandler->isSupport()) { |
|
151 | 151 | $oCacheHandler->put($cache_key_document_images, $document_images); |
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
155 | - if($document_images) $piece->image = $document_images; |
|
155 | + if ($document_images) $piece->image = $document_images; |
|
156 | 156 | } else { |
157 | 157 | $piece->url = getFullUrl('', 'mid', $current_module_info->mid); |
158 | 158 | } |
159 | 159 | } else { |
160 | 160 | if (!$is_index) { |
161 | 161 | $page = (Context::get('page') > 1) ? Context::get('page') : null; |
162 | - $piece->url = getNotEncodedFullUrl('mid', $current_module_info->mid, 'page',$page); |
|
162 | + $piece->url = getNotEncodedFullUrl('mid', $current_module_info->mid, 'page', $page); |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
166 | 166 | $piece->title = $this->getBrowserTitle($piece->document_title); |
167 | 167 | |
168 | - if($oCacheHandler->isSupport()) { |
|
168 | + if ($oCacheHandler->isSupport()) { |
|
169 | 169 | $cache_key = 'seo:site_image'; |
170 | 170 | $site_image = $oCacheHandler->get($cache_key); |
171 | - if($site_image) { |
|
171 | + if ($site_image) { |
|
172 | 172 | $site_image['url'] = $config->site_image_url; |
173 | 173 | } |
174 | 174 | $piece->image[] = $site_image; |
@@ -185,8 +185,8 @@ discard block |
||
185 | 185 | $this->addMeta('og:site_name', $config->site_name); |
186 | 186 | $this->addMeta('og:title', $piece->title); |
187 | 187 | $this->addMeta('og:description', $piece->description); |
188 | - if($is_article) { |
|
189 | - if(Context::getLangType() !== $oDocument->getLangCode()) { |
|
188 | + if ($is_article) { |
|
189 | + if (Context::getLangType() !== $oDocument->getLangCode()) { |
|
190 | 190 | $this->addMeta('og:locale:alternate', $locales[$oDocument->getLangCode()]); |
191 | 191 | } |
192 | 192 | $this->addMeta('article:published_time', $oDocument->getRegdate('c')); |
@@ -197,15 +197,15 @@ discard block |
||
197 | 197 | } |
198 | 198 | |
199 | 199 | foreach ($piece->image as $img) { |
200 | - if(!$img['url']) { |
|
201 | - if(!$img['filepath']) continue; |
|
202 | - $img['url'] = $request_uri . $img['filepath']; |
|
200 | + if (!$img['url']) { |
|
201 | + if (!$img['filepath']) continue; |
|
202 | + $img['url'] = $request_uri.$img['filepath']; |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | $this->addMeta('og:image', $img['url']); |
206 | 206 | $this->addMeta('og:image:width', $img['width']); |
207 | 207 | $this->addMeta('og:image:height', $img['height']); |
208 | - if($single_image) break; |
|
208 | + if ($single_image) break; |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | $this->canonical_url = $piece->url; |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | function triggerAfterFileDeleteFile($data) |
219 | 219 | { |
220 | 220 | $document_srl = $data->upload_target_srl; |
221 | - if(!$document_srl) return $this->makeObject(); |
|
221 | + if (!$document_srl) return $this->makeObject(); |
|
222 | 222 | |
223 | 223 | $this->deleteCacheDocumentImages($document_srl); |
224 | 224 | } |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | private function deleteCacheDocumentImages($document_srl) |
239 | 239 | { |
240 | 240 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
241 | - if($oCacheHandler->isSupport()) { |
|
242 | - $cache_key_document_images = 'seo:document_images:' . $document_srl; |
|
241 | + if ($oCacheHandler->isSupport()) { |
|
242 | + $cache_key_document_images = 'seo:document_images:'.$document_srl; |
|
243 | 243 | $oCacheHandler->delete($cache_key_document_images); |
244 | 244 | } |
245 | 245 | } |
@@ -4,10 +4,14 @@ discard block |
||
4 | 4 | function getBrowserTitle($document_title = null) |
5 | 5 | { |
6 | 6 | $site_module_info = Context::get('site_module_info'); |
7 | - if ($site_module_info->site_srl != 0) return Context::getBrowserTitle(); |
|
7 | + if ($site_module_info->site_srl != 0) { |
|
8 | + return Context::getBrowserTitle(); |
|
9 | + } |
|
8 | 10 | |
9 | 11 | $config = $this->getConfig(); |
10 | - if ($config->use_optimize_title != 'Y') return Context::getBrowserTitle(); |
|
12 | + if ($config->use_optimize_title != 'Y') { |
|
13 | + return Context::getBrowserTitle(); |
|
14 | + } |
|
11 | 15 | |
12 | 16 | $current_module_info = Context::get('current_module_info'); |
13 | 17 | $is_index = ($current_module_info->module_srl == $site_module_info->module_srl) ? true : false; |
@@ -16,7 +20,9 @@ discard block |
||
16 | 20 | $piece['[:site_name:]'] = $config->site_name; |
17 | 21 | $piece['[:site_slogan:]'] = $config->site_slogan; |
18 | 22 | $piece['[:module_title:]'] = $current_module_info->browser_title; |
19 | - if ($document_title) $piece['[:document_title:]'] = $document_title; |
|
23 | + if ($document_title) { |
|
24 | + $piece['[:document_title:]'] = $document_title; |
|
25 | + } |
|
20 | 26 | |
21 | 27 | if ($config->use_optimize_title == 'Y') { |
22 | 28 | $title = array(); |
@@ -27,7 +33,9 @@ discard block |
||
27 | 33 | } else { |
28 | 34 | if ($is_index) { |
29 | 35 | $title[] = $piece['[:site_name:]']; |
30 | - if ($piece['[:site_slogan:]']) $title[] = $piece['[:site_slogan:]']; |
|
36 | + if ($piece['[:site_slogan:]']) { |
|
37 | + $title[] = $piece['[:site_slogan:]']; |
|
38 | + } |
|
31 | 39 | } else { |
32 | 40 | $title[] = $piece['[:module_title:]']; |
33 | 41 | $title[] = $piece['[:site_name:]']; |
@@ -41,8 +49,12 @@ discard block |
||
41 | 49 | |
42 | 50 | function triggerBeforeDisplay(&$output_content) |
43 | 51 | { |
44 | - if (Context::getResponseMethod() != 'HTML') return; |
|
45 | - if (Context::get('module') == 'admin') return; |
|
52 | + if (Context::getResponseMethod() != 'HTML') { |
|
53 | + return; |
|
54 | + } |
|
55 | + if (Context::get('module') == 'admin') { |
|
56 | + return; |
|
57 | + } |
|
46 | 58 | |
47 | 59 | require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
48 | 60 | |
@@ -113,7 +125,9 @@ discard block |
||
113 | 125 | $piece->description = trim(str_replace(' ', ' ', $oDocument->getContentText(400))); |
114 | 126 | $piece->author = $oDocument->getNickName(); |
115 | 127 | $tags = $oDocument->get('tag_list'); |
116 | - if (count($tags)) $piece->tags = $tags; |
|
128 | + if (count($tags)) { |
|
129 | + $piece->tags = $tags; |
|
130 | + } |
|
117 | 131 | |
118 | 132 | $document_images = false; |
119 | 133 | if($oCacheHandler->isSupport()) { |
@@ -126,13 +140,19 @@ discard block |
||
126 | 140 | $document_images = array(); |
127 | 141 | |
128 | 142 | foreach ($oDocument->getUploadedFiles() as $file) { |
129 | - if ($file->isvalid != 'Y') continue; |
|
143 | + if ($file->isvalid != 'Y') { |
|
144 | + continue; |
|
145 | + } |
|
130 | 146 | |
131 | 147 | $ext = array_pop(explode('.', $file->uploaded_filename)); |
132 | 148 | |
133 | - if (!in_array(strtolower($ext), $image_ext)) continue; |
|
149 | + if (!in_array(strtolower($ext), $image_ext)) { |
|
150 | + continue; |
|
151 | + } |
|
134 | 152 | list($width, $height) = @getimagesize($file->uploaded_filename); |
135 | - if($width < 100 && $height < 100) continue; |
|
153 | + if($width < 100 && $height < 100) { |
|
154 | + continue; |
|
155 | + } |
|
136 | 156 | |
137 | 157 | $image = array( |
138 | 158 | 'filepath' => $file->uploaded_filename, |
@@ -152,7 +172,9 @@ discard block |
||
152 | 172 | } |
153 | 173 | } |
154 | 174 | |
155 | - if($document_images) $piece->image = $document_images; |
|
175 | + if($document_images) { |
|
176 | + $piece->image = $document_images; |
|
177 | + } |
|
156 | 178 | } else { |
157 | 179 | $piece->url = getFullUrl('', 'mid', $current_module_info->mid); |
158 | 180 | } |
@@ -198,27 +220,35 @@ discard block |
||
198 | 220 | |
199 | 221 | foreach ($piece->image as $img) { |
200 | 222 | if(!$img['url']) { |
201 | - if(!$img['filepath']) continue; |
|
223 | + if(!$img['filepath']) { |
|
224 | + continue; |
|
225 | + } |
|
202 | 226 | $img['url'] = $request_uri . $img['filepath']; |
203 | 227 | } |
204 | 228 | |
205 | 229 | $this->addMeta('og:image', $img['url']); |
206 | 230 | $this->addMeta('og:image:width', $img['width']); |
207 | 231 | $this->addMeta('og:image:height', $img['height']); |
208 | - if($single_image) break; |
|
232 | + if($single_image) { |
|
233 | + break; |
|
234 | + } |
|
209 | 235 | } |
210 | 236 | |
211 | 237 | $this->canonical_url = $piece->url; |
212 | 238 | |
213 | 239 | $this->applySEO(); |
214 | 240 | |
215 | - if ($config->use_optimize_title == 'Y') Context::setBrowserTitle($piece->title); |
|
241 | + if ($config->use_optimize_title == 'Y') { |
|
242 | + Context::setBrowserTitle($piece->title); |
|
243 | + } |
|
216 | 244 | } |
217 | 245 | |
218 | 246 | function triggerAfterFileDeleteFile($data) |
219 | 247 | { |
220 | 248 | $document_srl = $data->upload_target_srl; |
221 | - if(!$document_srl) return $this->makeObject(); |
|
249 | + if(!$document_srl) { |
|
250 | + return $this->makeObject(); |
|
251 | + } |
|
222 | 252 | |
223 | 253 | $this->deleteCacheDocumentImages($document_srl); |
224 | 254 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | { |
4 | 4 | function init() |
5 | 5 | { |
6 | - $this->setTemplatePath($this->module_path . 'tpl'); |
|
6 | + $this->setTemplatePath($this->module_path.'tpl'); |
|
7 | 7 | $this->setTemplateFile(str_replace('dispSeo', '', $this->act)); |
8 | 8 | } |
9 | 9 | |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | function dispSeoAdminSetting() |
16 | 16 | { |
17 | 17 | $vars = Context::getRequestVars(); |
18 | - if(!$vars->setting_section) Context::set('setting_section', 'general'); |
|
18 | + if (!$vars->setting_section) Context::set('setting_section', 'general'); |
|
19 | 19 | |
20 | 20 | $config = $this->getConfig(); |
21 | 21 |
@@ -15,7 +15,9 @@ |
||
15 | 15 | function dispSeoAdminSetting() |
16 | 16 | { |
17 | 17 | $vars = Context::getRequestVars(); |
18 | - if(!$vars->setting_section) Context::set('setting_section', 'general'); |
|
18 | + if(!$vars->setting_section) { |
|
19 | + Context::set('setting_section', 'general'); |
|
20 | + } |
|
19 | 21 | |
20 | 22 | $config = $this->getConfig(); |
21 | 23 |