Code Duplication    Length = 69-69 lines in 2 locations

class/adsense.php 1 location

@@ 162-230 (lines=69) @@
159
    /**
160
     * @return mixed|string
161
     */
162
    public function generateTag()
163
    {
164
        $title = rawurlencode(strtolower($this->getVar('description', 'e')));
165
        $title = xoops_substr($title, 0, 10, '');
166
        // Transformation des ponctuations
167
        $pattern = array(
168
            '/%09/', // Tab
169
            '/%20/', // Space
170
            '/%21/', // !
171
            '/%22/', // "
172
            '/%23/', // #
173
            '/%25/', // %
174
            '/%26/', // &
175
            '/%27/', // '
176
            '/%28/', // (
177
            '/%29/', // )
178
            '/%2C/', // ,
179
            '/%2F/', // /
180
            '/%3A/', // :
181
            '/%3B/', // ;
182
            '/%3C/', // <
183
            '/%3D/', // =
184
            '/%3E/', // >
185
            '/%3F/', // ?
186
            '/%40/', // @
187
            '/%5B/', // [
188
            '/%5C/', // \
189
            '/%5D/', // ]
190
            '/%5E/', // ^
191
            '/%7B/', // {
192
            '/%7C/', // |
193
            '/%7D/', // }
194
            '/%7E/', // ~
195
            "/\./" // .
196
        );
197
        $rep_pat = array('-', '-', '-', '-', '-', '-100', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-at-', '-', '-', '-', '-', '-', '-', '-', '-', '-');
198
        $title   = preg_replace($pattern, $rep_pat, $title);
199
200
        // Transformation des caract�res accentu�s
201
        $pattern = array(
202
            '/%B0/', // °
203
            '/%E8/', // è
204
            '/%E9/', // é
205
            '/%EA/', // ê
206
            '/%EB/', // ë
207
            '/%E7/', // ç
208
            '/%E0/', // à
209
            '/%E2/', // â
210
            '/%E4/', // ä
211
            '/%EE/', // î
212
            '/%EF/', // ï
213
            '/%F9/', // ù
214
            '/%FC/', // ü
215
            '/%FB/', // û
216
            '/%F4/', // ô
217
            '/%F6/', // ö
218
        );
219
        $rep_pat = array('-', 'e', 'e', 'e', 'e', 'c', 'a', 'a', 'a', 'i', 'i', 'u', 'u', 'u', 'o', 'o');
220
        $title   = preg_replace($pattern, $rep_pat, $title);
221
222
        $tableau = explode('-', $title); // Transforme la chaine de caract�res en tableau
223
        $tableau = array_filter($tableau, array($this, 'emptyString')); // Supprime les chaines vides du tableau
224
        $title   = implode('-', $tableau); // Transforme un tableau en chaine de caract�res s�par� par un tiret
225
226
        $title .= time();
227
        $title = md5($title);
228
229
        return $title;
230
    }
231
232
    /**
233
     * @return string

class/customtag.php 1 location

@@ 162-230 (lines=69) @@
159
    /**
160
     * @return mixed|string
161
     */
162
    public function generateTag()
163
    {
164
        $title = rawurlencode(strtolower($this->getVar('description', 'e')));
165
        $title = xoops_substr($title, 0, 10, '');
166
        // Transformation des ponctuations
167
        $pattern = array(
168
            '/%09/', // Tab
169
            '/%20/', // Space
170
            '/%21/', // !
171
            '/%22/', // "
172
            '/%23/', // #
173
            '/%25/', // %
174
            '/%26/', // &
175
            '/%27/', // '
176
            '/%28/', // (
177
            '/%29/', // )
178
            '/%2C/', // ,
179
            '/%2F/', // /
180
            '/%3A/', // :
181
            '/%3B/', // ;
182
            '/%3C/', // <
183
            '/%3D/', // =
184
            '/%3E/', // >
185
            '/%3F/', // ?
186
            '/%40/', // @
187
            '/%5B/', // [
188
            '/%5C/', // \
189
            '/%5D/', // ]
190
            '/%5E/', // ^
191
            '/%7B/', // {
192
            '/%7C/', // |
193
            '/%7D/', // }
194
            '/%7E/', // ~
195
            "/\./" // .
196
        );
197
        $rep_pat = array('-', '-', '-', '-', '-', '-100', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-at-', '-', '-', '-', '-', '-', '-', '-', '-', '-');
198
        $title   = preg_replace($pattern, $rep_pat, $title);
199
200
        // Transformation des caract�res accentu�s
201
        $pattern = array(
202
            '/%B0/', // °
203
            '/%E8/', // è
204
            '/%E9/', // é
205
            '/%EA/', // ê
206
            '/%EB/', // ë
207
            '/%E7/', // ç
208
            '/%E0/', // à
209
            '/%E2/', // â
210
            '/%E4/', // ä
211
            '/%EE/', // î
212
            '/%EF/', // ï
213
            '/%F9/', // ù
214
            '/%FC/', // ü
215
            '/%FB/', // û
216
            '/%F4/', // ô
217
            '/%F6/', // ö
218
        );
219
        $rep_pat = array('-', 'e', 'e', 'e', 'e', 'c', 'a', 'a', 'a', 'i', 'i', 'u', 'u', 'u', 'o', 'o');
220
        $title   = preg_replace($pattern, $rep_pat, $title);
221
222
        $tableau = explode('-', $title); // Transforme la chaine de caract�res en tableau
223
        $tableau = array_filter($tableau, array($this, 'emptyString')); // Supprime les chaines vides du tableau
224
        $title   = implode('-', $tableau); // Transforme un tableau en chaine de caract�res s�par� par un tiret
225
226
        $title .= time();
227
        $title = md5($title);
228
229
        return $title;
230
    }
231
232
    /**
233
     * @return mixed