'https://393b038b82454903801f308aaf0f0842@o378438.ingest.sentry.io/4504856482807808' ]); '', '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 .= "
"; } $output .= "
"; $d = [ "type" => $atts['type'] ]; wp_localize_script('javascript', 'it_cal_data', $d); /* $output .= ""; } function getCachableContent($url, $time = 86400) { $basedir = dirname(__FILE__) . "/cache"; $cacheFilename = "$basedir/" . md5($url); if (file_exists($cacheFilename) && time() - filemtime($cacheFilename) < $time) { return file_get_contents($cacheFilename); } else { $content = file_get_contents($url); if ($content) { $fd = fopen($cacheFilename, "w"); if (!$fd) { print "Error writing cache file\n"; print_r(error_get_last()); die; } fwrite($fd, $content); fclose($fd); return $content; } } } add_shortcode("fotball", "itrening_fotball"); function itrening_fotball ($atts) { global $wpdb; extract(shortcode_atts(array( 'il' => '', 'type' => '' ), $atts)); require_once(dirname(__FILE__) . "/simple_html_dom.php"); $ret = ""; $c = getCachableContent("http://www.fotball.no/fotballdata/Klubber1/Lag/?fiksId=976"); $html = new simple_html_dom(); if (!$html->load($c)) { return ""; } $teamNodes = $html->find('tr.teamInfo a'); $ret = ""; $list = array (); foreach ($teamNodes as $teamNode) { $link = $teamNode->href; $c = getCachableContent("http://www.fotball.no$link"); $html2 = new simple_html_dom(); if (!$html2->load($c)) { return ""; } $games = $html2->find('#tblFixtures tr'); foreach ($games as $game) { $g = array (); $gInfo = $game->find('td'); if (count($gInfo) == 0) continue; $g['date'] = $gInfo[0]->innertext; if (!$g['date']) continue; //print_r((error_get_last())); $dp= explode(".", $g['date']); $g['sortdate'] = $dp[2] . "-" . $dp[1] . "-" . $dp[0]; $ht = $gInfo[3]->find('a'); $g['hometeam'] = $ht[0]->innertext; $score = $gInfo[4]->find('a'); $g['score'] = $score[0]->innertext; $at = $gInfo[5]->find('a'); $g['awayteam'] = $at[0]->innertext; $list[] = $g; } } usort($list, "fotballGameSort"); $html = ""; foreach ($list as $game) { $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; } $html .= "
{$game['date']}{$game['hometeam']}{$game['awayteam']}{$game['score']}
"; return $html; } function fotballGameSort ($a, $b) { return strcmp($a['sortdate'], $b['sortdate']); } class PaameldingStatusWidget extends WP_Widget { public function __construct() { // widget actual processes parent::__construct( 'itpaameldingsstatus_widget', // Base ID __('Påmeldingsstatus', 'text_domain'), // Name array( 'description' => __( 'Påmeldingsstatus for itrening', 'text_domain' ), ) // Args ); } public function widget( $args, $instance ) { // outputs the content of the widget } public function form( $instance ) { // outputs the options form on admin } public function update( $new_instance, $old_instance ) { // processes widget options to be saved } } add_action( 'widgets_init', function(){ register_widget( 'PaameldingStatusWidget' ); }); add_shortcode("itpaamelding", "itrening_paamelding"); function itrening_paamelding ($atts) { global $wpdb; extract(shortcode_atts(array( 'id' => '', 'type' => '' ), $atts)); wp_enqueue_script( 'itrening_paamelding', plugins_url('js/paamelding.js', __FILE__), array( 'jquery', 'jquery-ui-datepicker'), 0.1, true); wp_register_style('jquery-ui', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css'); wp_enqueue_style( 'jquery-ui' ); $html = ""; if (isset($_POST['verify_info'])) { $html .= "Bekreft stuff..."; } else { $bdir = dirname(__FILE__); require_once("$bdir/products.php"); $table_name = $wpdb->prefix . "it_paameldte"; $query = $wpdb->prepare( "SELECT * FROM $table_name WHERE eventid=%d ", $id); $results = $wpdb->get_results($query, OBJECT ); foreach ($results as $row) { if ($row->products != '') { $prod = json_decode($row->products); foreach ($prod as $p) { foreach ($products as $k=>$val) { if ($val['uuid'] == $p) { $products[$k]['quantity']--; break; } } } } } wp_register_style( 'paameldingStyles', plugins_url('/css/paamelding.css', __FILE__) ); wp_enqueue_style( 'paameldingStyles' ); $table_name = $wpdb->prefix . "it_camp"; $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table_name WHERE deleted = false AND id=%d", $id, OBJECT ) ); $html .= "
Signup status
"; $html .= "
"; $html .= "
"; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; /* $html .= ""; $html .= ""; $html .= ""; $html .= ""; */ $html .= ""; $html .= ""; $html .= ""; $html .= ""; /* $html .= ""; $html .= ""; $html .= ""; $html .= ""; */ $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; /* $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= "'; $html .=<<< SCRIPT SCRIPT; //$html .= ""; //$html .= ""; $html .= "
Name ".it_helptext("Your name")."
Age ".it_helptext("Your age")."
Sex
Nationality"; // $html .= .it_helptext("An additional fee of 50 NOK applies to all non-norwegian participants because of extra transaction costs.

Please choose \"shared costs\" when making the transaction as this is cheaper and makes transactions go faster."). $html .= "
Email address
Mobile phone
Roommate(s) *".it_helptext("Requested room companion(s)") . "
Room"; $html .= ""; $html .= "
Number of weeks
Period
Late arrival "; $html .= "
Late departure "; $html .= "
Ankomstdato / Date of arrival ".it_helptext("Please notice that check-in is after 12 pm (noon).") . "
Time of arrival ".it_helptext("

Time of arrival will for most be approximately 3 hours after landing at Antalya airport.


Also please notice that morning practice is before first possible check-in at 12 pm (noon).")."

Avreisedato / Date of departure ".it_helptext("Please notice that check-out is before 12 pm (noon).") . "
Time of departure ".it_helptext("Please notice that check-out is before 12 pm (noon). Also notice that you can attend your morning practice, they are all before 12 pm (noon).")."
Level
Partner * ".it_helptext("The person you want to play with. (optional)") . "
Practices ".it_helptext("6 weekly morning practices with some of the best coaches in the world.") . "
Extra practice ".it_helptext("4 weekly extra practices in the afternoon with some of the best coaches in the world.") . "
Klær / Clothing *
Comment * ".it_helptext("If there is something else, note it here.") . "
"; $html .= "
"; $html .= "*) Optional field
"; $html .= "
"; } return $html; } add_action( 'admin_menu', 'it_paamelding_menu' ); function it_paamelding_menu () { // No need for menu at the moment: //add_menu_page( "Påmelding", "Påmelding", "manage_options", "it_paamelding_menuid", "it_paamelding_admin"); } add_action( 'admin_init', 'it_admin_css' ); function it_admin_css ($path) { wp_register_style( 'tablesorterStyles', plugins_url('/css/tablesorter/style.css', __FILE__) ); wp_enqueue_style( 'tablesorterStyles' ); wp_register_style( 'paameldingStyles', plugins_url('/css/paamelding.css', __FILE__) ); wp_enqueue_style( 'paameldingStyles' ); if (isset($_GET['traininggroups'])) { wp_enqueue_script( 'itrening_paamelding', plugins_url('js/paamelding_traning_groups.js', __FILE__), array( 'jquery', "jquery-ui-droppable", "jquery-ui-draggable"), 0.1, true); } } add_action( 'admin_enqueue_scripts', 'it_admin_scripts' ); function it_admin_scripts ($path) { wp_enqueue_script( 'itrening_paamelding', plugins_url('js/jquery.tablesorter.js', __FILE__), array( 'jquery'), 0.1, false); } function it_paamelding_admin () { global $wpdb; wp_enqueue_script( 'itrening_paamelding', plugins_url('js/paamelding_admin.js', __FILE__), array( 'jquery', 'jquery-ui-datepicker', "jquery-ui-droppable", "jquery-ui-draggable"), 0.1, true); wp_register_style('jquery-ui', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css'); wp_enqueue_style( 'jquery-ui' ); $html = ""; if (isset($_GET['del'])) { $table_name = $wpdb->prefix . "it_camp"; $wpdb->update ( $table_name, array( 'deleted' => true ), array('id' => $_GET['del']) ); } if (isset($_GET['eventid']) && isset($_GET['traininggroups'])) { $dir = plugin_dir_path( __FILE__ ); require_once("$dir/paamelding_edit_training_groups.php"); } elseif (isset($_GET['eventid']) && isset($_GET['schedule'])) { $dir = plugin_dir_path( __FILE__ ); require_once("$dir/paamelding_edit_schedule.php"); } elseif (isset($_GET['eventid']) && isset($_GET['rooms'])) { $dir = plugin_dir_path( __FILE__ ); require_once("$dir/paamelding_edit_rooms.php"); } elseif (isset($_GET['eventid']) && isset($_GET['player'])) { $dir = plugin_dir_path( __FILE__ ); require_once("$dir/paamelding_edit_player.php"); } elseif (isset($_GET['eventid']) && isset($_GET['statistics'])) { $dir = plugin_dir_path( __FILE__ ); require_once("$dir/paamelding_statistics.php"); } elseif (isset($_GET['eventid']) && isset($_GET['emails'])) { $dir = plugin_dir_path( __FILE__ ); require_once("$dir/paamelding_emails.php"); } else if (isset($_GET['eventid'])) { $dir = plugin_dir_path( __FILE__ ); require_once("$dir/paamelding_edit.php"); } elseif (count($_POST) > 0) { $table_name = $wpdb->prefix . "it_camp"; $wpdb->show_errors(); $affected_rows = $wpdb->insert( $table_name, array( 'name' => $_POST['name'], 'start_date' => $_POST['start_date'], 'end_date' => $_POST['end_date'], 'price_singleroom' => $_POST['price_singleroom'] , 'price_doubleroom' => $_POST['price_doubleroom'], 'price_trippleroom' => $_POST['price_trippleroom'], 'price_practice' => $_POST['price_practice'], 'price_extra_practice' => $_POST['price_extra_practice'] ) ); if (!$affected_rows) { print "Error in insert sql"; print $wpdb->print_error(); } print "INSERT ID: {$wpdb->insert_id}
"; print_r($id); } else { $html .= "
"; $html .= "

Påmelding

"; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $table_name = $wpdb->prefix . "it_camp"; $results = $wpdb->get_results( "SELECT * FROM $table_name WHERE deleted = false ORDER BY id DESC" ); foreach ($results as $row) { $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; } $html .= "
ArrangementStartdato
{$row->name}{$row->start_date}[Slett]
"; $html .= "

Opprett nytt arrangement

"; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= "
Beskrivelse
Startdato (yyyy-mm-dd)
Sluttdato (yyyy-mm-dd)
Pris: Enkeltrom/dag
Pris: Dobbelrom/dag
Pris: Trippelrom/dag
Pris: Trening/dag
Pris: Ekstratrening/dag
"; $html .= "
"; } print $html; } $it_paamelding_db_version = "0.3"; function it_paamelding_db_install() { global $wpdb; global $it_paamelding_db_version; if ($it_paamelding_db_version != get_option( "it_paamelding_db_version") ) { require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); $table_name = $wpdb->prefix . "it_paameldte"; $sql = "CREATE TABLE $table_name ( id int NOT NULL AUTO_INCREMENT, name tinytext NOT NULL, age int, sex varchar(2), email tinytext, mobile tinytext, roommate text, roomtype int, arrival_date date, arrival_time tinytext, departure_date date, departure_time tinytext, level int, partner tinytext, practice bool, extra_practice bool, totalprice int, orderid tinytext, eventid int, paymenttoken tinytext, orderstarted datetime default now(), ordercompleted datedate, payed bool default false, nationality tinytext, paymentref tinytext, paymentconfirmemailsent bool default false, comment text, useragent text, lastdaytraining bool default true, products text, day_options varchar(128), late_arrival bool default false, late_departure bool default false, PRIMARY KEY id (id) );"; dbDelta( $sql ); $table_name = $wpdb->prefix . "it_camp"; $sql = "CREATE TABLE $table_name ( id int NOT NULL AUTO_INCREMENT, name tinytext NOT NULL, start_date date, end_date date, price_singleroom int, price_doubleroom int, price_trippleroom int, price_practice int, price_extra_practice int, deleted bool default false, PRIMARY KEY id (id) );"; dbDelta( $sql ); $table_name = $wpdb->prefix . "it_training_groups"; $sql = "CREATE TABLE $table_name ( id int NOT NULL AUTO_INCREMENT, updated timestamp DEFAULT CURRENT_TIMESTAMP, eventid int, groupsetup text, extra_practice bool default false, PRIMARY KEY id (id) );"; print $sql; //require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); dbDelta( $sql ); update_option( "it_paamelding_db_version", $it_paamelding_db_version ); } } function mobileSummary($categories) { print "
"; } add_action( 'plugins_loaded', 'it_paamelding_db_install' ); class wp_itrening_summary extends WP_Widget { // constructor public function __construct () { parent::WP_Widget(false, $name = __('Itrening summary', 'wp_widget_plugin') ); /* ... */ } // widget form creation public function form($instance) { if ( isset( $instance[ 'categories' ] ) ) { $activeCategories = $instance[ 'categories' ]; } else { $activeCategories = array (); } $il = get_option('il'); if (!$il) return; // Widget admin form $server = $il . "itrening.com"; $categories = json_decode(file_get_contents("https://$server/wordpress/categories.php"), true); if (!$categories) { print ""; return; } print "

"; $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 "

"; } } // register widget add_action('widgets_init', function() { register_widget("wp_itrening_summary"); }); /** Step 2 (from text above). */ add_action( 'admin_menu', 'itrening_plugin_menu' ); /** Step 1. */ function itrening_plugin_menu() { add_options_page( 'iTrening - Innstillinger', 'iTrening', 'manage_options', 'itrening-settings', 'itrening_options' ); add_action( 'admin_init', 'itrening_register_settings' ); } function itrening_register_settings() { register_setting( 'itrening-settings-group', 'il' ); } /** Step 3. */ function itrening_options() { if ( !current_user_can( 'manage_options' ) ) { wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); } echo '
'; echo '

Innstillinger for iTrening!

'; print '
'; settings_fields( 'itrening-settings-group' ); //do_settings( 'itrening-settings-group' ); do_settings_fields( 'itrening-settings-group', 'group'); print ""; print ""; print ""; print ""; print ""; print "
Idrettslag"; $val = get_option("il"); print "
"; print submit_button(); print "
"; echo '
'; } add_action( 'wp_enqueue_scripts', 'itrening_scripts' ); function itrening_scripts () { // settings_fields( 'itrening-settings-group' ); //wp_enqueue_style( 'style-name', get_stylesheet_uri() ); wp_enqueue_script( 'easyxdm', plugins_url( 'easyXDM/easyXDM.debug.js' , __FILE__ ), array(), '1.0.1', true ); wp_enqueue_script( 'javascript', plugins_url( 'javascript.js' , __FILE__ ), array("jquery"), '1.0.4', true ); $server = get_option('il') . ".itrening.com"; $data = array('popup_url' => "https://$server/ajax/openPopup.php", 'base_url' => "https://$server", ); wp_localize_script('javascript', 'php_data', $data); } function it_http_post_raw($params, $DEBUG) { $params['USER'] = "oveien-facilitator_api1.gmail.com"; $params['PWD'] = "1383939164"; $params['SIGNATURE'] = "ABZAeRwVhRS4Ma.NZcZAsC1YWjE.AErObpY4okfIfLJaLzEw9-23jDEE"; $params["VERSION"] = "63.0"; if ($DEBUG) { $host = "ssl://api-3t.sandbox.paypal.com"; $path = "/nvp"; $port = 443; } else { $host = "ssl://api-3t.paypal.com"; $path = "/nvp"; $port = 443; } $req = ""; foreach ($params as $key=>$val) { $req .= "$key=" . urlencode($val) . "&"; } $req = trim($req, "&"); $ch = curl_init( "https://api-3t.sandbox.paypal.com/nvp" ); curl_setopt( $ch, CURLOPT_POST, 1); curl_setopt( $ch, CURLOPT_POSTFIELDS, $req); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt( $ch, CURLOPT_HEADER, 0); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec( $ch ); $params = explode("&", $result); $val = array(); foreach ($params as $param) { list($key, $value) = explode("=", $param); $val[$key] = urldecode($value); } return $val; } function it_helptext ($text) { return " [?]"; } ?> https://www.skeispinning.no/wp-sitemap-posts-page-1.xml