-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass.fussball-de.php
56 lines (46 loc) · 1.28 KB
/
class.fussball-de.php
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
52
53
54
55
56
<?php
/**
* Created by PhpStorm.
* User: Cox
* Date: 28.08.2016
* Time: 14:09
*/
class Fussball_De
{
/**
* @var bool
*/
private static $initiated = false;
/**
* init
*/
public static function init()
{
if ( ! self::$initiated) {
self::init_hooks();
}
}
/**
* Initializes WordPress hooks
*/
private static function init_hooks()
{
self::$initiated = true;
add_action('wp_head', function () {
echo "<script type=\"text/javascript\" src='//www.fussball.de/static/egm//js/widget2.js' ></script>\n";
});
add_shortcode('fussball', function ($atts) {
$content = 'Fehler im Shortcode';
if (array_key_exists('widgetid', get_post_custom($atts['id']))) {
$id = get_post_custom($atts['id']) ["widgetid"] [0];
$random = mt_rand();
$content = '';
$content .= '<div id="widget' . $random . '"></div>';
$content .= '<script type="text/javascript">';
$content .= 'new fussballdeWidgetAPI().showWidget("' . 'widget' . $random . '", "' . $id . '"); ';
$content .= '</script>';
}
echo $content;
});
}
}