Hey,
ich sitze nun mit iPlaysier an einem iTunes BB Code dran. Der soll eig wenn man was zwischn [itunes] BEISPIEl[/itunes] das Beispiel hier suchen:
http://www.apple.com/de/search/?q=
Nun immer wenn man das was eingibt kommt er darauf:
http://www.apple.com/de/search/?q=de
Hier das Script von iTunesBBCode.class.php:
|
PHP Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
<?php
require_once(WCF_DIR.'lib/data/message/bbcode/BBCodeParser.class.php');
require_once(WCF_DIR.'lib/data/message/bbcode/BBCode.class.php');
/**
* BBCode for [itunes] Tag
*
* @author Fabian Zühlke
* @package com.woltlab.wcf.data.message.bbcode.itunes
* @licenseGNU Lesser General Public License <http://opensource.org/licenses/lgpl-3.0.html>
*/
class iTunesBBCode implements BBCode {
protected $url = 'http://www.apple.com/de/search/?q=%s';
protected $defaultlang = 'en';
/**
* @see BBCode::getParsedTag()
*/
public function getParsedTag($openingTag, $content, $closingTag, BBCodeParser $parser) {
$lang = WCF::getLanguage()->get('wcf.bbcode.itunes.prefix');
$lang = $lang == 'wcf.bbcode.itunes.prefix' ? $this->defaultlang : $lang;
$lang = isset($openingTag['attributes'][0]) ? $openingTag['attributes'][0] : $lang;
if(strpos($lang, 'http://') === false) {
$url = $content;
// remove base
if(preg_match('/.+\.itunes\.en\/store\/(.+)$/', $content, $hits)) {
$text = $hits[1];
$text = urldecode($text);
} else {
$text = $url;
$url = str_replace(' ', '_', $url);
$url = urlencode($url);
$url = ucfirst($url);
$url = sprintf($this->url, $lang, $url);
}
$text = str_replace('_', ' ', $text);
} else { // url format
$url = $lang;
$text = $content;
}
if ($parser->getOutputType() == 'text/html') {
return '<a href="'.StringUtil::encodeHTML($url).'" class="itunes" style="background-image:url(\''.RELATIVE_WCF_DIR.'icon/wysiwyg/itunesS.png\');background-repeat:no-repeat;background-position:left;padding-left:25px">'.$text.'</a>';
}
else if ($parser->getOutputType() == 'text/plain') {
return $url;
}
}
}
?>
|
Wir freuen uns über jede Antwort.
Lg
comfre und iPlaysier.