PluginProbe
wp-forecast / 9.6
wp-forecast v9.6
10.0 trunk 1.4 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3..5 3..8 3.0 3.1 3.2 3.3 3.4 3.6 All 86 releases
← All changes | shortcodes.php +65 -49 3..59.6 View file →
@@ -1,49 +1,65 @@
1 -<?php
2 -/**
3 - * @author Hans Matzen
4 - * @copyright 2009
5 - * @since 2.4
6 - * @description wp-forecast using wordpress shortcode for more features
7 - * @Docs http://codex.wordpress.org/Shortcode_API
8 - */
9 -
10 -if (!function_exists('wpforecast'))
11 -{
12 - function wpforecast($atts)
13 - {
14 - // parameter einlesen
15 - if ( is_array($atts) )
16 - extract($atts);
17 -
18 - if ($id == '')
19 - $id='A';
20 -
21 - // iframe tag zusammen bauen
22 - $res='<iframe class="wpf-iframe" src="'.get_settings('siteurl').
23 - '/wp-content/plugins/wp-forecast/wp-forecast-show.php?wpfcid='.
24 - $id.'&amp;header=1';
25 -
26 - // falls eine sprache angegeben wurde haengen wir sie hinten dran
27 - if ($lang != '')
28 - $res .= '&amp;lang='.$lang;
29 -
30 - $res .= '" ';
31 -
32 - // falls eine breite angegeben wurde haengen wir sie hinten dran
33 - if ($width != '')
34 - $res .= "width='$width' ";
35 -
36 - // falls eine sprache angegeben wurde haengen wir sie hinten dran
37 - if ($height != '')
38 - $res .= "height='$height' ";
39 -
40 - $res .='>'.__("wp-forecast shortcode: This browser does not support iframes.","wp-forecast_".$lang).'</iframe>';
41 -
42 - return $res;
43 - }
44 -}
45 -// shortcode bei wp anmelden
46 -if (function_exists('add_shortcode'))
47 - add_shortcode('wpforecast','wpforecast');
48 -
49 -?>
1 +<?php
2 +/**
3 + * Function to add the shortcodes for wp-forecast.
4 + *
5 + * @author Hans Matzen
6 + * @copyright 2009-2024
7 + * @since 2.4
8 + * @description wp-forecast using WordPress shortcode for more features
9 + * @Docs http://codex.wordpress.org/Shortcode_API
10 + *
11 + * @package wp-forecast
12 + */
13 +
14 +if ( ! function_exists( 'wpforecast' ) ) {
15 + /**
16 + * Function which adds the wp-forecast weather widget as shortcode.
17 + *
18 + * @param array $atts Parameters for the widget.
19 + */
20 + function wpforecast( $atts ) {
21 + $lang = '';
22 + $width = '';
23 + $height = '';
24 + $id = '';
25 +
26 + // parameter einlesen.
27 + if ( is_array( $atts ) ) {
28 + $lang = ( isset( $atts['lang'] ) ? sanitize_key( $atts['lang'] ) : '' );
29 + $width = ( isset( $atts['width'] ) ? intval( $atts['width'] ) : '' );
30 + $height = ( isset( $atts['height'] ) ? intval( $atts['height'] ) : '' );
31 + $id = ( isset( $atts['id'] ) ? sanitize_key( $atts['id'] ) : 'A' );
32 + }
33 +
34 + // iframe tag zusammen bauen.
35 + $res = '<iframe class="wpf-iframe" src="' . site_url( 'wp-forecast-direct?wpfcid=' . $id . '&amp;header=1', __FILE__ );
36 +
37 + // falls eine sprache angegeben wurde haengen wir sie hinten dran.
38 + if ( '' != $lang ) {
39 + $res .= '&amp;language_override=' . $lang;
40 + }
41 +
42 + $res .= '" ';
43 +
44 + // falls eine breite angegeben wurde haengen wir sie hinten dran.
45 + if ( '' != $width && 0 != $width ) {
46 + $res .= "width='$width' ";
47 + }
48 +
49 + // falls eine sprache angegeben wurde haengen wir sie hinten dran.
50 + if ( '' != $height && 0 != $height ) {
51 + $res .= "height='$height' ";
52 + }
53 +
54 + $res .= '>' . __( 'wp-forecast shortcode: This browser does not support iframes.', 'wp-forecast' ) . '</iframe>';
55 +
56 + return $res;
57 + }
58 +}
59 +// shortcode bei wp anmelden.
60 +if ( function_exists( 'add_shortcode' ) ) {
61 + add_shortcode( 'wpforecast', 'wpforecast' );
62 + add_filter( 'widget_text', 'do_shortcode' );
63 +}
64 +
65 +