require __DIR__ . "/vendor/autoload.php"; \Sentry\init(['dsn' => 'https://393b038b82454903801f308aaf0f0842@o378438.ingest.sentry.io/4504856482807808' ]); /* Plugin Name: Itrening - Kalender Plugin URI: http://www.itrening.com Description: Author: OV Version: 1 Author URI: http://www.itreing.com */ function mailpoet_shortcodes_custom_filter($tag_value) { // $tag_value contains the string after custom: // This function will be called the first time with $tag_value = my_name // The second time with $tag_value = blog_name if ($tag_value === 'my_name') { $replacement = 'Maily'; } if ($tag_value === 'blog_name') { $replacement = get_bloginfo('name'); } return $replacement; } add_filter('wysija_shortcodes', 'mailpoet_shortcodes_custom_filter'); add_shortcode("itmobilkalender", "itrening_mobilkalender"); function itrening_mobilkalender ($atts) { global $wpdb; $atts = shortcode_atts(array( 'il' => '', 'type' => '' ), $atts); $extra = ""; if ($atts['type'] != "") { $extra .= "?event_type=" . urlencode($atts['type']); } return "
"; } add_shortcode("itkalender", "itrening_kalender"); function itrening_kalender ($atts) { global $wpdb; $atts = shortcode_atts(array( 'il' => '', 'type' => '' ), $atts); $extra = ""; if ($atts['type'] != "") { $extra .= "?event_type=" . urlencode($atts['type']); } $iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod"); $iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone"); $iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad"); $Android = stripos($_SERVER['HTTP_USER_AGENT'],"Android"); $ios = false; if ($iPod || $iPhone || $iPad) $ios = true; $output = ""; if ($ios) { $output .= "| {$game['date']} | "; $html .= "{$game['hometeam']} | "; $html .= "{$game['awayteam']} | "; $html .= "{$game['score']} | "; $html .= "
";
$categoryId = $this->get_field_name( 'categories' );
$i = 0;
foreach ($categories as $category) {
print "{$category['name']}
";
$i++;
}
}
// widget update
public function update($new_instance, $old_instance) {
/* ... */
$instance = $old_instance;
$instance['categories'] = array();
if ( isset ( $new_instance['categories'] ) )
{
foreach ( $new_instance['categories'] as $value )
{
if ( '' !== trim( $value ) )
$instance['categories'][$value] = 1;
}
}
return $instance;
}
// widget display
public function widget($args, $instance) {
//settings_fields( 'itrening-settings-group' );
$categories = array ();
if ( isset( $instance[ 'categories' ] ) ) {
$activeCategories = $instance[ 'categories' ];
}
else {
$activeCategories = array ();
}
foreach ($activeCategories as $ac => $v) {
$categories[] = $ac;
}
$param = http_build_query(array("categories" => $categories));
$server = get_option("il") . ".itrening.com";
// print "";
print "