function show_match()
{
    $game = json_decode(get_match($_GET['matchId'], $_GET['region']));
    $champions = get_object_vars(json_decode(get_match_champions()));
    $items = json_decode(get_match_items());
    $sumSpells = json_decode(get_match_sumSpells());
    foreach ($sumSpells->data as $spell) {
        $sumSpells->actualSums[$spell->id] = $spell->name;
    }
    ob_start();
    include plugin_dir_path(__FILE__) . "/match.php";
    return ob_get_clean();
}
예제 #2
0
파일: orlydb.php 프로젝트: Karpec/gizd
function orlyread($rel)
{
    $orlyurl = "http://orlydb.com/?q=" . $rel;
    //get the page content
    $orly_content = get_data($orlyurl);
    //parse for product name
    $orly['time'] = @get_match('/<span class="timestamp">(.*)<\\/span>/isU', $orly_content);
    $orly['section'] = @get_match('/<span class="section"><a [^>]*>(.*)<\\/a><\\/span>/isU', $orly_content);
    $orly['release'] = @get_match('/<span class="release">(.*)<\\/span>/isU', $orly_content);
    $orly['inforight'] = @get_match('/<span class="inforight"><span class="info">(.*)<\\/span><\\/span>/isU', $orly_content);
    $orly['nukeright'] = @get_match('/<span class="nukeright"><span class="nuke">(.*)<\\/span><\\/span>/isU', $orly_content);
    return $orly;
}
예제 #3
0
function menu_admin_menu()
{
    global $menu;
    $option = get_option('setting_admin_menu_roles');
    if (is_array($option) && count($option) > 0) {
        foreach ($option as $key => $value) {
            list($item_url, $item_name) = explode('|', $key);
            if ($value != "custom_name" && ($value == "none" || !current_user_can($value))) {
                remove_menu_page($item_url);
            } else {
                if ($value != "") {
                    if (count($menu) > 0) {
                        foreach ($menu as $key => $item) {
                            if ($item[0] != '') {
                                $menu_url = $item[2];
                                if ($item_url == $menu_url) {
                                    $update_count = get_match("/(\\<span.*\\<\\/span\\>)/is", $item[0], false);
                                    $menu_name = trim(str_replace($update_count, "", $item[0]));
                                    if ($item_name != $menu_name) {
                                        $menu[$key][0] = $item_name . " " . $update_count;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
/**
* get_feed_data($_params)
* returns the parsed feed.
* */
function get_feed_data($_params)
{
    global $user, $config;
    $feed_data = array('items' => array(), 'setup' => array('date' => false, 'author' => false, 'desclen' => 0, 'chantitle' => '', 'chanlink' => ''));
    @ini_set('user_agent', 'GYM Sitemaps &amp; RSS / www.phpBB-SEO.com');
    @ini_set('default_socket_timeout', 5);
    $xml = @file_get_contents($_params['url']);
    if ($xml) {
        // Get encoding
        $encoding = get_match('`encoding=[\'"]([a-z0-9_-]+)[\'"]`Usi', $xml);
        $encoding = !empty($encoding) ? strtolower($encoding) : detect_encoding($xml);
        if (preg_match('`<item>(.*)</item>`si', $xml, $matches)) {
            // Get chan info
            $feed_data['setup']['chantitle'] = get_match('`<title>(.*)</title>`Usi', $xml, $encoding);
            $feed_data['setup']['chanlink'] = get_match('`<link>(.*)</link>`Usi', $xml, $encoding);
            $xml = trim($matches[0]);
            unset($matches);
            preg_match_all('`<item>(.*)</item>`Usi', $xml, $matches);
            unset($matches[0]);
            if (!empty($matches[1]) && is_array($matches[1])) {
                $i = 1;
                foreach ($matches[1] as $key => $item) {
                    if ($i > $_params['limit']) {
                        break;
                    }
                    if ($title = get_match('`<title>(.*)</title>`Usi', $item, $encoding)) {
                        if ($link = get_match('`<link>(.*)</link>`Usi', $item, $encoding)) {
                            $feed_data['items'][$i]['PUBDATE'] = false;
                            if ($pubdate = get_match('`<pubDate>(.*)</pubDate>`Usi', $item, $encoding)) {
                                if (($pubdate = strtotime($pubdate, $user->time_now)) > 0) {
                                    $feed_data['items'][$i]['PUBDATE'] = $user->format_date($pubdate, $config['default_dateformat']);
                                    $feed_data['setup']['date'] = true;
                                }
                            }
                            $feed_data['items'][$i]['DESC'] = false;
                            if ($_params['desc'] && ($description = get_match('`<description>(.*)</description>`Usi', $item, $encoding))) {
                                if (empty($_params['html'])) {
                                    $description = htmlspecialchars($_params['striptags'] ? strip_tags($description) : $description, ENT_COMPAT, 'UTF-8');
                                }
                                $feed_data['items'][$i]['DESC'] = str_replace(array("\r", "\n"), '<br />', $description);
                                $feed_data['setup']['desclen'] += utf8_strlen($feed_data['items'][$i]['DESC']);
                            }
                            $feed_data['items'][$i]['SOURCE'] = false;
                            if ($source = get_match('`<source[\\s]+url="(.*)">(.*)</source>`Usi', $item, $encoding)) {
                                $feed_data['items'][$i]['SOURCE'] = htmlspecialchars($source, ENT_COMPAT, 'UTF-8');
                            }
                            $feed_data['items'][$i]['TITLE'] = htmlspecialchars($title, ENT_COMPAT, 'UTF-8');
                            $feed_data['items'][$i]['LINK'] = htmlspecialchars($link, ENT_COMPAT, 'UTF-8');
                            $feed_data['items'][$i]['IMG'] = $user->img('topic_read', $feed_data['items'][$i]['TITLE'], false, '', 'src');
                            $i++;
                        }
                    }
                    unset($matches[1][$key]);
                }
            }
            unset($matches);
        }
    }
    unset($xml);
    return $feed_data;
}
예제 #5
0
function customFormatGallery($string, $attr)
{
    global $post;
    function get_match($regex, $content)
    {
        preg_match($regex, $content, $matches);
        return $matches[1];
    }
    // Extract the shortcode arguments from the $page or $post
    $shortcode_args = shortcode_parse_atts(get_match('/\\[gallery\\s(.*)\\]/isU', $post->post_content));
    // get the ids specified in the shortcode call
    $ids = $shortcode_args["ids"];
    // get the attachments specified in the "ids" shortcode argument
    $posts = get_posts(array('include' => $ids, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'menu_order ID', 'orderby' => 'post__in'));
    $output = '';
    if ($post->post_name === 'web') {
        foreach ($posts as $imagePost) {
            $post = get_post($imagePost);
            $img = wp_get_attachment_image_src($imagePost->ID, 'full')[0];
            $output .= '<a href="' . $post->post_content . '" target="_blank"><figure data-url="' . $img . '"><div class="bg" style="background-image: url(' . $img . ')"></div><header>' . $post->post_title . '</header><figcaption>' . $post->post_excerpt . '</figcaption></figure></a>';
        }
    } else {
        if ($post->post_name === 'photo' || $post->post_type === 'photo') {
            for ($i = 0; $i < count($posts); $i++) {
                $post = get_post($posts[$i]);
                $full = wp_get_attachment_image_src($posts[$i]->ID, 'full')[0];
                $large = wp_get_attachment_image_src($posts[$i]->ID, 'large')[0];
                $wide = wp_get_attachment_image_src($posts[$i]->ID, 'wide')[0];
                $output .= '
        	<figure id="' . $post->post_title . '" data-id="' . $i . '" data-url-full="' . $full . '" data-url-large="' . $large . '">
        		<picture>
        			<source media="(max-width: 400px), (min-width: 769px) and (max-width: 1024px)" srcset="' . $wide . '" />
        			<img src="' . $large . '" />
        		</picture>
        		<figcaption>' . $post->post_title . '</figcaption>
        	</figure>';
            }
        } else {
            if ($post->post_type === 'post') {
                $output .= '<div class="gallery">';
                for ($i = 0; $i < count($posts); $i++) {
                    $post = get_post($posts[$i]);
                    $full = wp_get_attachment_image_src($posts[$i]->ID, 'full')[0];
                    $large = wp_get_attachment_image_src($posts[$i]->ID, 'large')[0];
                    $wide = wp_get_attachment_image_src($posts[$i]->ID, 'wide')[0];
                    $post_thumb = wp_get_attachment_image_src($posts[$i]->ID, 'post_thumb')[0];
                    $output .= '
        	<figure id="' . $post->post_title . '" data-id="' . $i . '" data-url-full="' . $full . '" data-url-large="' . $large . '">
        		<picture>
        			<source media="(max-width: 400px)" srcset="' . $wide . '" />
        			<source media="(min-width: 401px) and (max-width: 768px)" srcset="' . $large . '" />
        			<img src="' . $post_thumb . '" />
        		</picture>
        		<div class="overlay"></div>
        		<figcaption><h4>' . $post->post_title . '</h4><p>' . $post->post_excerpt . '</p></figcaption>
        	</figure>';
                }
                $output .= '</div>';
            } else {
                return;
            }
        }
    }
    return $output;
}