Code Duplication    Length = 28-30 lines in 2 locations

index.php 1 location

@@ 150-177 (lines=28) @@
147
    //by wanikoo
148
    /* setup shot provider information */
149
    $shotImgSrc = $shotImgHref = $shotAttribution = '';
150
    if ($useShots) {
151
        $shotProvider = mb_strtolower($xoopsModuleConfig['shotprovider']);
152
        $shotImgHref = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/visit.php?cid={$cid}&lid={$lid}";
153
        $logourl = trim($logourl);
154
        if (!empty($logourl)) {
155
            if (file_exists(XOOPSMYLINKIMGPATH . "/{$mylinks_theme}")) {
156
                $shotImgSrc = XOOPSMYLINKIMGURL . "/{$mylinks_theme}/shots/" . $myts->htmlSpecialChars($logourl);
157
            } else {
158
                $shotImgSrc = XOOPSMYLINKIMGURL . '/shots/' . $myts->htmlSpecialChars($logourl);
159
            }
160
        } elseif (_NONE != $shotProvider) {
161
            if (file_exists(XOOPS_ROOT_PATH . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $xoopsModule->getVar('dirname') . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'providers' . DIRECTORY_SEPARATOR . mb_strtolower($shotProvider) . '.php')) {
162
                include_once XOOPS_ROOT_PATH . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $xoopsModule->getVar('dirname') . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'providers' . DIRECTORY_SEPARATOR . mb_strtolower($shotProvider) . '.php';
163
                $shotClass = ucfirst($xoopsModule->getVar('dirname')) . ucfirst($shotProvider);
164
                $shotObj = new $shotClass;
165
                $shotObj->setProviderPublicKey($xoopsModuleConfig['shotpubkey']);
166
                $shotObj->setProviderPrivateKey($xoopsModuleConfig['shotprivkey']);
167
                $shotObj->setShotSize(array('width' => $xoopsModuleConfig['shotwidth']));
168
                $shotObj->setSiteUrl($myts->htmlSpecialChars($url));
169
                $shotImgSrc = $shotObj->getProviderUrl();
170
                if ($xoopsModuleConfig['shotattribution']) {
171
                    $shotAttribution = $shotObj->getAttribution(true);
172
                } else {
173
                    $shotAttribution = '';
174
                }
175
            }
176
        }
177
    }
178
    $xoopsTpl->assign('shot_attribution', $shotAttribution);
179
    $xoopsTpl->append('links', array('url'           => $myts->htmlSpecialChars($url),
180
                                     'id'            => $lid,

viewcat.php 1 location

@@ 244-273 (lines=30) @@
241
        //by wanikoo
242
        /* setup shot provider information */
243
        $shotImgSrc = $shotImgHref = '';
244
        if ($useShots) {
245
            $shotProvider = mb_strtolower($xoopsModuleConfig['shotprovider']);
246
            $shotImgHref = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/visit.php?cid={$cid}&lid={$lid}";
247
            $logourl = trim($logourl);
248
            if (!empty($logourl)) {
249
                if (file_exists(XOOPSMYLINKIMGPATH . "/{$mylinks_theme}")) {
250
                    $shotImgSrc = XOOPSMYLINKIMGURL . "/{$mylinks_theme}/shots/" . $myts->htmlSpecialChars($logourl);
251
                } else {
252
                    $shotImgSrc = XOOPSMYLINKIMGURL . '/shots/' . $myts->htmlSpecialChars($logourl);
253
                }
254
            } elseif (_NONE != $shotProvider) {
255
                if (file_exists(XOOPS_ROOT_PATH . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $xoopsModule->getVar('dirname') . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'providers' . DIRECTORY_SEPARATOR . mb_strtolower($shotProvider) . '.php')) {
256
                    include_once XOOPS_ROOT_PATH . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $xoopsModule->getVar('dirname') . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'providers' . DIRECTORY_SEPARATOR . mb_strtolower($shotProvider) . '.php';
257
                    $shotClass = ucfirst($xoopsModule->getVar('dirname')) . ucfirst($shotProvider);
258
                    $shotObj = new $shotClass;
259
                    $shotObj->setProviderPublicKey($xoopsModuleConfig['shotpubkey']);
260
                    $shotObj->setProviderPrivateKey($xoopsModuleConfig['shotprivkey']);
261
                    $shotObj->setShotSize(array('width' => $xoopsModuleConfig['shotwidth']));
262
                    $shotObj->setSiteUrl($myts->htmlSpecialChars($url));
263
                    $shotImgSrc = $shotObj->getProviderUrl();
264
                    if ($xoopsModuleConfig['shotattribution']) {
265
                        if ('' == $shotAttribution) {
266
                            $shotAttribution = $shotObj->getAttribution(true);
267
                        }
268
                    } else {
269
                        $shotAttribution = '';
270
                    }
271
                }
272
            }
273
        }
274
        $xoopsTpl->assign('shot_attribution', $shotAttribution);
275
        $xoopsTpl->append('links', array('url'           => $myts->htmlSpecialChars($url),
276
                                         'id'            => $lid,