Code Duplication    Length = 28-30 lines in 2 locations

index.php 1 location

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

viewcat.php 1 location

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