コード例 #1
0
function ikit_two_ajax_render_events_past()
{
    $rpp = IKIT_TWO_EVENTS_PAST_POSTS_PER_PAGE;
    // Get the posts
    $paged = $_POST['page'] ? $_POST['page'] : 1;
    $post_count = 0;
    // Filter
    $year = $_POST['y'];
    $category_slug = $_POST['category'];
    $args = array();
    $args['posts_per_page'] = $rpp;
    $args['paged'] = $paged;
    $args['post_status'] = 'publish';
    $args['post_type'] = array(IKIT_POST_TYPE_IKIT_EVENT, IKIT_POST_TYPE_IKIT_EVENT_EXTERNAL);
    $args['orderby'] = 'meta_value';
    $args['meta_key'] = IKIT_CUSTOM_FIELD_IKIT_EVENT_END_DATE;
    if ($category_slug != null) {
        $category = get_category_by_slug($category_slug);
        $args['cat'] = $category->cat_ID;
    }
    $meta_query = array();
    array_push($meta_query, array('key' => IKIT_CUSTOM_FIELD_IKIT_EVENT_END_DATE, 'value' => date_i18n("Y-m-d"), 'compare' => '<', 'type' => 'DATE'));
    if (empty($year) == false) {
        array_push($meta_query, array('key' => IKIT_CUSTOM_FIELD_IKIT_EVENT_END_DATE, 'value' => date_i18n("Y-m-d", mktime(0, 0, 0, 1, 1, $year)), 'compare' => '>', 'type' => 'DATE'));
        array_push($meta_query, array('key' => IKIT_CUSTOM_FIELD_IKIT_EVENT_END_DATE, 'value' => date_i18n("Y-m-d", mktime(0, 0, 0, 12, 31, $year)), 'compare' => '<', 'type' => 'DATE'));
    }
    $args['meta_query'] = $meta_query;
    query_posts($args);
    global $wp_query;
    $num_pages = ceil($wp_query->found_posts / $rpp);
    while (have_posts()) {
        the_post();
        global $id;
        global $post;
        $ikit_event_meta = ikit_event_get_meta($id);
        $event = ikit_event_get_meta_normalized($id, $ikit_event_meta, null);
        $event_location_city = $event['location_city'];
        $event_start_date = $event['start_date'];
        $event_end_date = $event['end_date'];
        $event_image = $event['image'];
        $event_url = $event['permalink'];
        $event_url_target = $event['permalink_target'];
        $external = false;
        $internal = false;
        $event_preview_description = get_post_meta($id, IKIT_CUSTOM_FIELD_IKIT_EVENT_PREVIEW_DESCRIPTION, true);
        if ($ikit_event_meta->service == IKIT_EVENT_SERVICE_EXTERNAL) {
            $external = true;
        } else {
            if ($ikit_event_meta->service == IKIT_EVENT_SERVICE_INTERNAL) {
                $internal = true;
            }
        }
        ?>

        <div class="cat-plugin-fluid-grid-item grid-item event-item">
            <div class="grid-item-inner">

                <?php 
        if ($event_image != null) {
            ?>
                    <a target="<?php 
            echo $event_url_target;
            ?>
" href="<?php 
            echo $event_url;
            ?>
">
                        <div class="event-item-image cat-plugin-anystretch-image" cat_plugin_anystretch_image_url="<?php 
            echo $event_image;
            ?>
"></div>
                    </a>
                <?php 
        }
        ?>

                <div class="event-item-title"><a target="<?php 
        echo $event_url_target;
        ?>
" href="<?php 
        echo $event_url;
        ?>
"><?php 
        the_title();
        ?>
</a></div>

                <?php 
        if (empty($event_preview_description) == false) {
            ?>
                    <div class="event-item-description"><?php 
            echo $event_preview_description;
            ?>
</div>
                <?php 
        }
        ?>

                <?php 
        ikit_two_render_event_item_attributes($post, $external, $internal, $event_start_date, $event_end_date, $event_location_city);
        ?>

            </div>

        </div>

        <?php 
        $post_count++;
    }
    ?>
    <div class="data" page="<?php 
    echo $paged;
    ?>
" num_pages="<?php 
    echo $num_pages;
    ?>
"></div>
    <?php 
    wp_reset_query();
    die;
}
コード例 #2
0
<?php

/**
 * Template Name: Single Event Internal
 */
get_header();
?>

<?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        global $id;
        $ikit_event_meta = ikit_event_get_meta($id);
        $event = ikit_event_get_meta_normalized($id, $ikit_event_meta, null);
        $event_link_title = $ikit_event_meta->url_name;
        if (empty($event_link_title)) {
            $event_link_title = 'More Information';
        }
        $start_date_abbr = mysql2date('D, M j, Y', get_gmt_from_date($event['start_date_raw']), false);
        $end_date_abbr = mysql2date('D, M j, Y', get_gmt_from_date($event['end_date_raw']), false);
        ?>


    <?php 
        if (empty($event['image'])) {
            ?>

        <div class="page-header-5">
            <div class="page-header-5-title">
                <?php 
コード例 #3
0
<?php

$ikit_event_meta = ikit_event_get_meta($post->ID);
$event = ikit_event_get_meta_normalized($post->ID, $ikit_event_meta, null);
$event_image = $event['image'];
$event_start_date = $event['start_date'];
$event_end_date = $event['end_date'];
$event_location_city = $event['location_city'];
$internal = false;
if ($ikit_event_meta->service == IKIT_EVENT_SERVICE_INTERNAL) {
    $internal = true;
}
?>

<div class="cat-plugin-fluid-grid-item grid-item">
    <div class="grid-item-inner">

        <div class="search-result">
            <?php 
if ($event_image != null) {
    ?>
                <a href="<?php 
    the_permalink();
    ?>
"><div class="search-result-image cat-plugin-anystretch-image" cat_plugin_anystretch_image_url="<?php 
    echo $event_image;
    ?>
"></div></a>
            <?php 
}
?>
コード例 #4
0
/**
 * Get the image URL for usage in a feed given a post
 * @deprecated
 */
function ikit_one_get_post_feed_image_url($post)
{
    if ($post->post_type == 'post') {
        $feed_image_url = ikit_post_get_image_url($post->ID, IKIT_IMAGE_SIZE_MEDIUM, ikit_one_get_post_image_default());
    } else {
        if ($post->post_type == IKIT_POST_TYPE_IKIT_EVENT) {
            $ikit_event_meta = ikit_event_get_meta($post->ID);
            $feed_image_url = ikit_event_get_image_url($post->ID, $ikit_event_meta, ikit_one_get_event_image_default());
        }
    }
}
コード例 #5
0
function ikit_event_add_meta_box_integration($post)
{
    $event_service = get_post_meta($post->ID, IKIT_CUSTOM_FIELD_IKIT_EVENT_SERVICE, true);
    if ($event_service == IKIT_EVENT_SERVICE_EVENTBRITE) {
        $event_meta = ikit_event_eventbrite_get_meta($post->ID);
        $eventbrite_id = get_post_meta($post->ID, IKIT_CUSTOM_FIELD_IKIT_EVENT_EVENTBRITE_ID, true);
        $eventbrite_sync_data = unserialize(get_post_meta($post->ID, IKIT_CUSTOM_FIELD_IKIT_EVENT_EVENTBRITE_SYNC_DATA, true));
        $eventbrite_sync_enabled = get_post_meta($post->ID, IKIT_CUSTOM_FIELD_IKIT_EVENT_EVENTBRITE_SYNC_ENABLED, true);
        // Sync validation
        if ($eventbrite_sync_enabled) {
            if ($eventbrite_sync_data) {
                // Do nothing, correctly synced
            } else {
                ?>
                <div class="error"><p><strong>Automated member tickets are incorrectly configured with Eventbrite, if you would still like to automate tickets, please verify the following before saving:</strong><ul><li>- The event start date is not in the past</li><li>- There are no tickets currently existing on the event</li></ul></p></div>
                <?php 
            }
        }
        ?>
        <div class="wp-box">
        <div class="inner">

        <table class="widefat">
        <tr>
            <td>
            Service
            </td>
            <td>
            Eventbrite
            </td>
        </tr>
        <tr>
            <td>
                Automate member tickets
                <div class="note">Automatically creates tickets for each member type on Eventbrite. Login will be required for all member type tickets. If you would like to manually create your tickets do not check this box.</div>
            </td>
            <td>
                <input type="checkbox" name="<?php 
        echo IKIT_CUSTOM_FIELD_IKIT_EVENT_EVENTBRITE_SYNC_ENABLED;
        ?>
" <?php 
        if ($eventbrite_sync_enabled) {
            echo 'checked';
        }
        ?>
/>
            </td>
        </tr>
        <tr>
            <td>
            Status
            </td>
            <td>
            <?php 
        echo $event_meta->status;
        ?>
            </td>
        </tr>
        <tr>
            <td>
            Start Datetime
            </td>
            <td>
            <?php 
        echo ikit_date_without_time($event_meta->start_date) . ' ' . $event_meta->start_time;
        ?>
            </td>
        </tr>
        <tr>
            <td>
            End Datetime
            </td>
            <td>
            <?php 
        echo ikit_date_without_time($event_meta->end_date) . ' ' . $event_meta->end_time;
        ?>
            </td>
        </tr>
        </table>

        </div>
        </div>

        <?php 
    } else {
        if ($event_service == IKIT_EVENT_SERVICE_ETOUCHES) {
            $event_meta = ikit_event_get_meta($post->ID);
            ?>

        <div class="wp-box">
        <div class="inner">
        <table class="widefat">
        <tr>
            <td>
            Service
            </td>
            <td>
            etouches
            </td>
        </tr>
        <tr>
            <td>
            Status
            </td>
            <td>
            <?php 
            echo $event_meta->status;
            ?>
            </td>
        </tr>
        <tr>
            <td>
            Start Datetime
            </td>
            <td>
            <?php 
            echo ikit_date_without_time($event_meta->start_date) . ' ' . $event_meta->start_time;
            ?>
            </td>
        </tr>
        <tr>
            <td>
            End Datetime
            </td>
            <td>
            <?php 
            echo ikit_date_without_time($event_meta->end_date) . ' ' . $event_meta->end_time;
            ?>
            </td>
        </tr>
        </table>
        </div>
        </div>

        <?php 
        }
    }
}
コード例 #6
0
function ikit_action_widgets_render($class, $args, $instance, $context)
{
    /**
     * Eye on Design Widget
     */
    if ($class == Ikit_WidgetEyeOnDesign) {
        extract($args);
        echo $before_title;
        ikit_two_render_banner_header('Eye on Design', null, 1, 'http://eyeondesign.aiga.org', '_blank');
        echo $after_title;
        ?>

        <?php 
        foreach ($context['eyeondesign_items'] as $eyeondesign_item) {
            $image_url = null;
            // Assumes structure is <item><image><url>...</url></image></item>
            $image_tag = $eyeondesign_item->get_item_tags('', 'image');
            $image_tag = $image_tag[0]['child'];
            foreach ($image_tag as $child) {
                $image_url = $child['url'][0]['data'];
            }
            ?>

            <?php 
            if ($image_url != null) {
                ?>
                <div class="eyeondesign-item-image"><a target="_blank" href="<?php 
                echo $eyeondesign_item->get_link();
                ?>
"><img src="<?php 
                echo $image_url;
                ?>
"/></a></div>
            <?php 
            }
            ?>

            <a class="link-block" target="_blank" href="<?php 
            echo $eyeondesign_item->get_link();
            ?>
">
                <span class="eyeondesign-item-title"><?php 
            echo $eyeondesign_item->get_title();
            ?>
</span>
            </a>

            <?php 
            break;
        }
    }
    if ($class == Ikit_WidgetSponsors) {
        extract($args);
        echo $before_title;
        $title = $instance['title'];
        if (empty($title)) {
            $title = 'Official Sponsor';
        }
        ikit_two_render_banner_header($title);
        echo $after_title;
        foreach ($context['national_sponsors'] as $sponsor) {
            ?>

            <?php 
            $attachment_image_src = wp_get_attachment_image_src(get_post_meta($sponsor->ID, IKIT_CUSTOM_FIELD_IKIT_SPONSOR_PRIMARY_IMAGE, true), 'full');
            ?>

            <div class="sponsor-item"><a target="_blank" href="<?php 
            echo get_post_meta($sponsor->ID, 'url', true);
            ?>
"><img width="<?php 
            echo round($attachment_image_src[1] / 2);
            ?>
px" src="<?php 
            echo $attachment_image_src[0];
            ?>
"/></a></div>

        <?php 
        }
    }
    /**
     * Local Sponsors Widget
     */
    if ($class == Ikit_WidgetLocalSponsors) {
        extract($args);
        echo $before_title;
        $title = $instance['title'];
        if (empty($title)) {
            $title = 'Local Sponsors';
        }
        ikit_two_render_banner_header($title);
        echo $after_title;
        foreach ($context['local_sponsors_short'] as $sponsor) {
            ?>

            <?php 
            $attachment_image_src = wp_get_attachment_image_src(get_post_meta($sponsor->ID, IKIT_CUSTOM_FIELD_IKIT_SPONSOR_PRIMARY_IMAGE, true), 'full');
            ?>

            <div class="sponsor-item"><a target="_blank" href="<?php 
            echo get_post_meta($sponsor->ID, 'url', true);
            ?>
"><img width="<?php 
            echo round($attachment_image_src[1] / 2);
            ?>
px" src="<?php 
            echo $attachment_image_src[0];
            ?>
"/></a></div>
        <?php 
        }
    }
    /**
     * Sign Up Widget
     */
    if ($class == Ikit_WidgetMailingList) {
        extract($args);
        $mailchimp_signup_form_url = $context['mailchimp_signup_form_url'];
        $custom_title = $instance['title'];
        if (empty($custom_title)) {
            $custom_title = 'Sign Up';
        }
        if (empty($mailchimp_signup_form_url) == false) {
            $title = $custom_title;
            if (!empty($title)) {
                echo $before_title . $title . $after_title;
            }
            ?>

                <form action="<?php 
            echo $mailchimp_signup_form_url;
            ?>
" method="post">

                <div>
                    <table>
                    <tr>
                    <td>
                    <input type="text" value="" placeholder="Email Address" name="EMAIL" class="required email" id="mce-EMAIL">
                    </td>
                    <td>
                    <input type="image" src="<?php 
            echo ikit_get_plugin_url('images/transparent_pixel.png');
            ?>
"></input>
                    </td>
                    </tr>
                    </table>
                </div>

                </form>

            <?php 
        }
    }
    /**
     * Featured Job Widget
     */
    if ($class == Ikit_WidgetFeaturedJob) {
        $num_results = count($context['featured_jobs']);
        $title = 'Latest Job Post';
        if ($num_results > 1) {
            $title = $title . 's';
        }
        echo $before_title;
        ikit_two_render_banner_header($title);
        echo $after_title;
        $post_count = 0;
        ?>
        <div class="job-items">
        <?php 
        foreach ($context['featured_jobs'] as $featured_job) {
            $ikit_job_meta = ikit_job_get_meta($featured_job->ID);
            ?>
            <div class="job-item">
                <a class="link-block" href="<?php 
            echo ikit_sso_get_login_url(get_permalink($featured_job->ID));
            ?>
">
                    <span class="job-item-title"><?php 
            echo $featured_job->post_title;
            ?>
</span>
                    <span class="job-item-company"><?php 
            echo $ikit_job_meta->company_name;
            ?>
</span>
                </a>
            </div>
            <?php 
            $post_count++;
        }
        ?>
        </div>
        <?php 
    }
    /**
     * Featured Portfolio Widget
     */
    if ($class == Ikit_WidgetFeaturedPortfolio) {
        $num_results = count($context['featured_portfolios']);
        $title = 'Featured Portfolio';
        if ($num_results > 1) {
            $title = $title . 's';
        }
        echo $before_title;
        ikit_two_render_banner_header($title);
        echo $after_title;
        ?>

        <div class="portfolio-items">

        <?php 
        foreach ($context['featured_portfolios'] as $featured_portfolio) {
            $ikit_portfolio_meta = ikit_portfolio_get_meta($featured_portfolio->ID);
            $project = $ikit_portfolio_meta[array_rand($ikit_portfolio_meta, 1)];
            // Get a random project for this portfolio
            $project_image = $project->cover_image_url;
            ?>

            <div class="portfolio-item">
            <div class="portfolio-item-image"><a target="_blank" href="<?php 
            echo $project->url;
            ?>
"><img src="<?php 
            echo $project_image;
            ?>
"/></a></div>
            <div class="portfolio-item-author"><a target="_blank" href="<?php 
            echo $project->owner_url;
            ?>
"><?php 
            echo $project->owner_name;
            ?>
</a></div>
            <div class="portfolio-item-project"><a target="_blank" href="<?php 
            echo $project->url;
            ?>
"><?php 
            echo $project->title;
            ?>
</a></div>
            </div>

            <?php 
        }
        ?>
        </div>
        <?php 
    }
    /**
     * New Members
     */
    if ($class == Ikit_WidgetNewMembers) {
        extract($args);
        echo $before_title;
        ikit_two_render_banner_header('New Members');
        echo $after_title;
        ?>

        <?php 
        foreach ($context['members'] as $idx => $member) {
            ?>

            <div class="member-item">
                <div class="member-item-name"><a target="_blank" href="<?php 
            echo ikit_member_profile_url($member);
            ?>
"><?php 
            echo $member->full_name;
            ?>
</a></div>
                <div class="member-item-details">
                    <div class="member-item-type"><?php 
            echo ikit_member_type_display_name($member->member_type);
            ?>
</div>
                    <div class="member-item-date"><?php 
            echo date("F j, Y", strtotime($member->join_date));
            ?>
</div>
                </div>

            </div>

        <?php 
        }
        ?>

        <?php 
    }
    /**
     * I am AIGA Widget
     */
    if ($class == Ikit_WidgetIAmAIGA) {
        extract($args);
        echo $before_title;
        $title = ikit_two_render_banner_header('I am AIGA');
        echo $after_title;
        $member_year = ikit_member_join_year($context['member']);
        ?>

        <div class="member-item-image"><img src="<?php 
        echo str_replace('~/', 'http://my.aiga.org/', $context['member']->avatar);
        ?>
"/></div>
        <div class="member-item-details">
            <div class="member-item-name"><a target="_blank" href="<?php 
        echo ikit_member_profile_url($context['member']);
        ?>
"><?php 
        echo $context['member']->full_name;
        ?>
</a></div>
        </div>

        <?php 
    }
    /**
     * Join AIGA Widget
     */
    if ($class == Ikit_WidgetJoinAIGA) {
        ?>
        <a target="_blank" href="http://www.aiga.org/belong/"><img src="<?php 
        echo $context['selected_promo_image_url'];
        ?>
"/></a>
        <?php 
    }
    /**
     * Page Widget
     */
    if ($class == Ikit_WidgetPage) {
        if (array_key_exists('page', $context)) {
            echo $before_title;
            $title = $instance['title'];
            if (empty($title) == false) {
                ikit_two_render_banner_header($instance['title']);
            }
            echo $after_title;
            echo apply_filters('the_content', $context['page']->post_content);
        }
    }
    /**
     * Twitter Widget
     */
    if ($class == Ikit_Twitter_Widget) {
        if (count($context['twitter_messages']) > 0) {
            echo $before_title;
            $title = ikit_two_render_banner_header('Twitter', null, 1, $context['twitter_url'], '_blank');
            echo $after_title;
            ?>

            <div class="twitter-items">

            <?php 
            for ($i = 0; $i < count($context['twitter_messages']); $i++) {
                $twitter_message = $context['twitter_messages'][$i];
                if ($i < $context['num_twitter_messages']) {
                    ?>
                    <div class="twitter-item">
                        <?php 
                    echo ikit_social_twitter_url_converter(str_replace($context['twitter_username'] . ': ', '', html_entity_decode($twitter_message->text)));
                    ?>
                    </div>
                    <?php 
                }
            }
            ?>

            </div>

            <?php 
        }
    }
    /**
     * Facebook Widget
     */
    if ($class == Ikit_Facebook_Widget) {
        extract($args);
        if (count($context['facebook_status_messages']) > 0) {
            ?>

            <?php 
            echo $before_title;
            ikit_two_render_banner_header('Facebook', null, 1, $context['facebook_url'], '_blank');
            echo $after_title;
            ?>

            <div class="facebook-item">
            <?php 
            foreach ($context['facebook_status_messages'] as $facebook_status_message) {
                ?>

                <?php 
                if (empty($facebook_status_message->message) == false) {
                    ?>
                <div><?php 
                    echo ikit_social_url_converter(html_entity_decode(ikit_truncate($facebook_status_message->message, 256)));
                    ?>
</div>
                <?php 
                } elseif (empty($facebook_status_message->name) == false) {
                    ?>
                <div><?php 
                    echo $facebook_status_message->name;
                    ?>
</div>
                <?php 
                } else {
                    ?>
                  <?php 
                    continue;
                    ?>
                <?php 
                }
                ?>
                <?php 
                if (empty($facebook_status_message->link) == false) {
                    ?>
                <div class="facebook-item-read-more"><a target="_blank" href="<?php 
                    echo $facebook_status_message->link;
                    ?>
">Read more...</a></div>
                <?php 
                }
                ?>


            <?php 
                break;
            }
            ?>
            </div>

        <?php 
        }
    }
    /**
     * Vimeo Widget
     */
    if ($class == Ikit_Vimeo_Widget) {
        extract($args);
        if (count($context['vimeo_videos']) > 0) {
            $vimeo_video = $context['vimeo_videos'][0];
            if ($context['randomize_vimeo']) {
                $vimeo_video = $context['vimeo_videos'][array_rand($context['vimeo_videos'], 1)];
            }
            // Extract the video url
            $vimeo_enclosure = $vimeo_video->get_item_tags('', 'enclosure');
            $vimeo_video_url = $vimeo_enclosure[0]['attribs']['']['url'];
            // Extract the video thumbnail image
            $vimeo_media_content = $vimeo_video->get_item_tags('http://search.yahoo.com/mrss/', 'content');
            $vimeo_video_thumbnail_url = $vimeo_media_content[0]['child']['http://search.yahoo.com/mrss/']['thumbnail'][0]['attribs']['']['url'];
            // Replace thethumbnail url with the hi-res version
            $vimeo_video_thumbnail_url = ikit_social_vimeo_thumbnail_image_resize($vimeo_video_thumbnail_url);
            echo $before_title;
            ikit_two_render_banner_header('Vimeo', null, 1, $context['vimeo_url'], '_blank');
            echo $after_title;
            ?>

            <a target="_blank" href="<?php 
            echo $vimeo_video->get_link();
            ?>
">
                <img class="vimeo-item-thumbnail" src="<?php 
            echo $vimeo_video_thumbnail_url;
            ?>
"/>
            </a>


        <?php 
        }
    }
    /**
     * YouTube Widget
     */
    if ($class == Ikit_YouTube_Widget) {
        extract($args);
        if (count($context['youtube_videos']) > 0) {
            ?>

            <?php 
            $youtube_video = $context['youtube_videos'][0];
            if ($context['randomize_youtube']) {
                $youtube_video = $context['youtube_videos'][array_rand($context['youtube_videos'], 1)];
            }
            // Extract the video url
            $video_url = $youtube_video->get_link();
            $video_id = explode('=', $video_url);
            $video_id = explode("&", $video_id[1]);
            $thumbnail_url = ikit_social_vimeo_thumbnail_image_resize("http://img.youtube.com/vi/" . $video_id[0] . "/0.jpg");
            echo $before_title;
            ikit_two_render_banner_header('YouTube', null, 1, $context['youtube_url'], '_blank');
            echo $after_title;
            ?>

            <a target="_blank" href="<?php 
            echo $youtube_video->get_link();
            ?>
">
                <img class="youtube-item-thumbnail" src="<?php 
            echo $thumbnail_url;
            ?>
"/>
            </a>

        <?php 
        }
    }
    /**
     * Flickr Widget
     */
    if ($class == Ikit_Flickr_Widget) {
        extract($args);
        if (count($context['flickr_images']) > 0) {
            ?>

            <?php 
            $flickr_image = $context['flickr_images'][0];
            if ($context['randomize_flickr']) {
                $flickr_image = $context['flickr_images'][array_rand($context['flickr_images'], 1)];
            }
            $flickr_image_url = ikit_social_flickr_image_from_description($flickr_image->get_description());
            echo $before_title;
            ikit_two_render_banner_header('Flickr', null, 1, $context['flickr_url'], '_blank');
            echo $after_title;
            ?>

            <a target="_blank" href="<?php 
            echo $flickr_image->get_link();
            ?>
">
                <img class="flickr-item-image" src="<?php 
            echo ikit_social_flickr_image_resize($flickr_image_url, 5);
            ?>
"/>
            </a>

        <?php 
        }
    }
    /**
     * Instagram Widget
     */
    if ($class == Ikit_Instagram_Widget) {
        extract($args);
        if (count($context['instagram_photos']) > 0) {
            $instagram_photo = $context['instagram_photos'][0];
            if ($context['randomize_instagram']) {
                $instagram_photo = $context['instagram_photos'][array_rand($context['instagram_photos'], 1)];
            }
            $instagram_image_url = $instagram_photo->images->standard_resolution->url;
            echo $before_title;
            ikit_two_render_banner_header('Instagram', null, 1, $context['instagram_url'], '_blank');
            echo $after_title;
            ?>

            <a target="_blank" href="<?php 
            echo $instagram_photo->link;
            ?>
">
                <img src="<?php 
            echo $instagram_image_url;
            ?>
"/>
            </a>

            <?php 
        }
    }
    /**
     * Video Billboard Widget
     */
    if ($class == Ikit_Video_Billboard_Widget) {
        if ($context['video_id'] != null) {
            $video_image_url = $context['video_image_url'];
            if ($context['custom_video_image_url'] != null) {
                $video_image_url = $context['custom_video_image_url'];
            }
            $video_id = $context['video_id'];
            $video_player_url = null;
            if ($context['video_type'] == 'youtube') {
                $video_player_url = 'http://www.youtube.com/embed/' . $video_id . '?autoplay=1&rel=0&wmode=opaque"';
            } else {
                if ($context['video_type'] == 'vimeo') {
                    $video_player_url = 'http://player.vimeo.com/video/' . $video_id . '?autoplay=1&rel=0&wmode=opaque';
                }
            }
            echo $before_title;
            ikit_two_render_banner_header('Featured Video', null, 2);
            echo $after_title;
            ?>

            <div class="video-item">
                <div class="video-item-image video-item-image-<?php 
            echo $context['video_id'];
            ?>
 cat-plugin-anystretch-image cat-plugin-video-swap"
                    cat_plugin_anystretch_image_url="<?php 
            echo $video_image_url;
            ?>
"
                    cat_plugin_video_swap_button_selector=".video-item-image-<?php 
            echo $context['video_id'];
            ?>
"
                    cat_plugin_video_swap_video_player_url="<?php 
            echo $video_player_url;
            ?>
"
                >
                    <div class="video-item-overlay"></div>
                </div>
                <div class="video-item-title"><?php 
            echo $context['video_title'];
            ?>
</div>

            </div>

            <?php 
        }
    }
    /**
     * News Billboard Widget
     */
    if ($class == Ikit_News_Billboard_Widget) {
        if (count($context['posts']) > 0) {
            echo $before_title;
            ikit_two_render_banner_header('Featured News', null, 2);
            echo $after_title;
            ?>
            <div class="cat-plugin-fluid-grid grid widget-grid page-layout-3"
                cat_plugin_fluid_grid_layout_mode="fitRows"
                cat_plugin_fluid_grid_breakpoint_body_size_num_cols="3,3,3,1"
                cat_plugin_fluid_grid_breakpoint_body_size_classes="<?php 
            echo IKIT_TWO_FLUID_GRID_BREAKPOINT_BODY_SIZE_CLASSES;
            ?>
"
                cat_plugin_fluid_grid_breakpoint_body_class="<?php 
            echo IKIT_TWO_FLUID_GRID_BREAKPOINT_BODY_CLASS;
            ?>
"
            >
            <?php 
            foreach ($context['posts'] as $post) {
                $image = ikit_post_get_image_url($post->ID, IKIT_IMAGE_SIZE_MEDIUM_Z, null);
                $url_target = '_self';
                $url = get_permalink($post->ID);
                $external = false;
                if ($post->post_type == IKIT_POST_TYPE_IKIT_POST_EXTERNAL) {
                    $external = true;
                    $url = get_post_meta($post->ID, IKIT_CUSTOM_FIELD_IKIT_POST_EXTERNAL_LINK_URL, true);
                    $url_target = '_blank';
                }
                $author = ikit_post_get_author($post->ID, get_the_author_meta('display_name', $post->post_author));
                $preview_description = get_post_meta($post->ID, IKIT_CUSTOM_FIELD_POST_PREVIEW_DESCRIPTION, true);
                ?>
                    <div class="cat-plugin-fluid-grid-item grid-item">
                        <div class="grid-item-inner">

                        <?php 
                if ($image) {
                    ?>
                        <a target="<?php 
                    echo $url_target;
                    ?>
" href="<?php 
                    echo $url;
                    ?>
">
                            <div class="news-item-image cat-plugin-anystretch-image" cat_plugin_anystretch_image_url="<?php 
                    echo $image;
                    ?>
"></div>
                        </a>
                        <?php 
                }
                ?>

                        <div class="news-item-title">
                            <a target="<?php 
                echo $url_target;
                ?>
" href="<?php 
                echo $url;
                ?>
">
                                <?php 
                echo $post->post_title;
                ?>
                            </a>
                        </div>

                        <?php 
                if (empty($preview_description) == false) {
                    ?>
                            <div class="news-item-description"><?php 
                    echo $preview_description;
                    ?>
</div>
                        <?php 
                }
                ?>

                        <?php 
                ikit_two_render_news_item_attributes($post, $external, false);
                ?>

                        </div>
                    </div>

                <?php 
            }
            ?>

            </div>

            <?php 
        }
    }
    /**
     * News Widget
     */
    if ($class == Ikit_News_Widget) {
        echo $before_title;
        ikit_two_render_banner_header('News', null, 1, ikit_get_page_permalink_by_slug(IKIT_SLUG_PAGE_NEWS));
        echo $after_title;
        ?>
        <div class="news-items">
        <?php 
        $post_count = 0;
        foreach ($context['posts'] as $post) {
            $news_image = null;
            if ($post_count == 0) {
                $news_image = ikit_post_get_image_url($post->ID, 'full', null);
            } else {
                $news_image = ikit_post_get_image_url($post->ID, IKIT_IMAGE_SIZE_MEDIUM_Z, null);
            }
            $news_url_target = '_self';
            $news_url = get_permalink($post->ID);
            $external = false;
            if ($post->post_type == IKIT_POST_TYPE_IKIT_POST_EXTERNAL) {
                $external = true;
                $news_url = get_post_meta($post->ID, IKIT_CUSTOM_FIELD_IKIT_POST_EXTERNAL_LINK_URL, true);
                $news_url_target = '_blank';
            }
            $news_preview_description = get_post_meta($post->ID, IKIT_CUSTOM_FIELD_POST_PREVIEW_DESCRIPTION, true);
            $news_author = ikit_post_get_author($post->ID, get_the_author_meta('display_name', $post->post_author));
            ?>

            <div class="news-item">

                <?php 
            if ($news_image) {
                ?>
                    <div class="news-item-image"><a target="<?php 
                echo $news_url_target;
                ?>
" href="<?php 
                echo $news_url;
                ?>
"><img src="<?php 
                echo $news_image;
                ?>
"></img></a></div>
                <?php 
            }
            ?>

                <div class="news-item-title">
                    <a target="<?php 
            echo $news_url_target;
            ?>
" href="<?php 
            echo $news_url;
            ?>
">
                        <?php 
            echo $post->post_title;
            ?>
                    </a>
                </div>
                <?php 
            if (empty($news_preview_description) == false) {
                ?>
                    <div class="news-item-description"><?php 
                echo $news_preview_description;
                ?>
</div>
                <?php 
            }
            ?>

                <?php 
            ikit_two_render_news_item_attributes($post, $external, false);
            ?>

            </div>

            <?php 
            $post_count++;
        }
        ?>
        </div>
        <?php 
    }
    /**
     * Events Internal Widget
     */
    if ($class == Ikit_Events_Internal_Widget) {
        echo $before_title;
        ikit_two_render_banner_header('Community Events', null, 1, ikit_get_page_permalink_by_slug(IKIT_SLUG_PAGE_EVENTS) . '?type=' . IKIT_TWO_EVENTS_TYPE_COMMUNITY);
        echo $after_title;
        ?>
        <div class="event-items">
        <?php 
        $post_count = 0;
        foreach ($context['posts'] as $post) {
            $ikit_event_meta = ikit_event_get_meta($post->ID);
            $event = ikit_event_get_meta_normalized($post->ID, $ikit_event_meta, null);
            $event_image = $event['image'];
            $event_start_date = $event['start_date'];
            $event_end_date = $event['end_date'];
            $event_preview_description = get_post_meta($post->ID, IKIT_CUSTOM_FIELD_IKIT_EVENT_PREVIEW_DESCRIPTION, true);
            $event_url = $event['permalink'];
            $event_url_target = $event['permalink_target'];
            $event_location_city = $event['location_city'];
            ?>

            <div class="event-item">

                <?php 
            if ($event_image) {
                ?>
                    <div class="event-item-image"><a target="<?php 
                echo $event_url_target;
                ?>
" href="<?php 
                echo $event_url;
                ?>
"><img src="<?php 
                echo $event_image;
                ?>
"></img></a></div>
                <?php 
            }
            ?>

                <div class="event-item-title">
                    <a target="<?php 
            echo $event_url_target;
            ?>
" href="<?php 
            echo $event_url;
            ?>
"><?php 
            echo $post->post_title;
            ?>
</a>
                </div>

                <?php 
            if (empty($event_preview_description) == false) {
                ?>
                    <div class="event-item-description"><?php 
                echo $event_preview_description;
                ?>
</div>
                <?php 
            }
            ?>

                <?php 
            ikit_two_render_event_item_attributes($post, false, true, $event_start_date, $event_end_date, $event_location_city);
            ?>

            </div>

            <?php 
            $post_count++;
        }
        ?>
        </div>
        <?php 
    }
    /**
     * Events Billboard Widget
     */
    if ($class == Ikit_Events_Billboard_Widget) {
        if (count($context['posts']) > 0) {
            echo $before_title;
            ikit_two_render_banner_header('Featured Events', null, 2);
            echo $after_title;
            ?>

            <div class="event-item-slides-container">

            <div class="event-item-slides cycle-slideshow"
                data-cycle-pager-template="&lt;span&gt;&lt;/span&gt;"
                data-cycle-manual-speed="200"
                data-cycle-paused="true"
                data-cycle-log="false"
                data-cycle-slides=".event-item-slide"
                data-cycle-auto-height="container"
            >
                <?php 
            $post_count = 0;
            foreach ($context['posts'] as $post) {
                $ikit_event_meta = ikit_event_get_meta($post->ID);
                $event = ikit_event_get_meta_normalized($post->ID, $ikit_event_meta, null);
                $event_image = $event['image'];
                $event_start_date = $event['start_date'];
                $event_end_date = $event['end_date'];
                $event_location_city = $event['location_city'];
                $event_url = $event['permalink'];
                $event_url_target = $event['permalink_target'];
                $event_preview_description = get_post_meta($post->ID, IKIT_CUSTOM_FIELD_IKIT_EVENT_PREVIEW_DESCRIPTION, true);
                $event_attributes = $event_start_date;
                if ($event_end_date != $event_start_date) {
                    $event_attributes = $event_attributes . ' - ' . $event_end_date;
                }
                ?>
                    <div class="event-item-slide">
                        <table>
                        <tr>
                        <td class="event-item-image-col">
                            <?php 
                if ($event_image) {
                    ?>
                                <a target="<?php 
                    echo $event_url_target;
                    ?>
" href="<?php 
                    echo $event_url;
                    ?>
">
                                    <div class="event-item-image cat-plugin-anystretch-image" cat_plugin_anystretch_image_url="<?php 
                    echo $event_image;
                    ?>
"></div>
                                </a>
                            <?php 
                }
                ?>
                        </td>

                        <td class="event-item-info-col">
                            <a class="link-block" target="<?php 
                echo $event_url_target;
                ?>
" href="<?php 
                echo $event_url;
                ?>
">
                                <span class="event-item-title">
                                    <?php 
                echo $post->post_title;
                ?>
                                </span>
                                <span class="event-item-attributes">
                                    <?php 
                echo $event_attributes;
                ?>
                                </span>
                            </a>
                            <?php 
                if (empty($event_preview_description) == false) {
                    ?>
                            <div class="event-item-description">
                                <?php 
                    echo $event_preview_description;
                    ?>
                            </div>
                            <?php 
                }
                ?>
                        </td>
                        </tr>
                        </table>
                    </div>
                    <?php 
                $post_count++;
            }
            ?>

                <?php 
            if ($post_count > 1) {
                ?>
                    <div class="event-item-slides-pager cycle-pager"></div>
                <?php 
            }
            ?>

            </div>

            </div>


            <?php 
        }
    }
    /**
     * Events Widget
     */
    if ($class == Ikit_Events_Widget) {
        echo $before_title;
        ikit_two_render_banner_header('AIGA Events', null, 1, ikit_get_page_permalink_by_slug(IKIT_SLUG_PAGE_EVENTS) . '?type=' . IKIT_TWO_EVENTS_TYPE_AIGA);
        echo $after_title;
        ?>
        <div class="event-items">
        <?php 
        $post_count = 0;
        foreach ($context['posts'] as $post) {
            $ikit_event_meta = ikit_event_get_meta($post->ID);
            $event = ikit_event_get_meta_normalized($post->ID, $ikit_event_meta, null);
            $event_image = $event['image'];
            $event_location_city = $event['location_city'];
            $event_start_date = $event['start_date'];
            $event_end_date = $event['end_date'];
            $event_url = $event['permalink'];
            $event_url_target = $event['permalink_target'];
            $external = false;
            $event_preview_description = get_post_meta($post->ID, IKIT_CUSTOM_FIELD_IKIT_EVENT_PREVIEW_DESCRIPTION, true);
            if ($ikit_event_meta->service == IKIT_EVENT_SERVICE_EXTERNAL) {
                $external = true;
            }
            ?>

            <div class="event-item">

                <?php 
            if ($event_image) {
                ?>
                    <div class="event-item-image"><a target="<?php 
                echo $event_url_target;
                ?>
" href="<?php 
                echo $event_url;
                ?>
"><img src="<?php 
                echo $event_image;
                ?>
"></img></a></div>
                <?php 
            }
            ?>

                <div class="event-item-title">
                    <a target="<?php 
            echo $event_url_target;
            ?>
" href="<?php 
            echo $event_url;
            ?>
"><?php 
            echo $post->post_title;
            ?>
</a>
                </div>

                <?php 
            if (empty($event_preview_description) == false) {
                ?>
                    <div class="event-item-description"><?php 
                echo $event_preview_description;
                ?>
</div>
                <?php 
            }
            ?>

                <?php 
            ikit_two_render_event_item_attributes($post, $external, $internal, $event_start_date, $event_end_date, $event_location_city);
            ?>

            </div>

            <?php 
            $post_count++;
        }
        ?>
        </div>
        <?php 
    }
    /**
     * Quote Widget
     */
    if ($class == Ikit_Quote_Widget) {
        // Get a random quote from the list
        if (count($context['quotes']) > 0) {
            $quote = $context['quotes'][array_rand($context['quotes'], 1)];
            ?>

            <div class="quote-item">

                <?php 
            echo $quote['quote_text'];
            ?>

                <?php 
            if (empty($quote['attribution']) == false) {
                ?>

                    <span class="quote-item-attribution">
                        <?php 
                if (empty($quote['attribution_link_url']) == false) {
                    ?>
                            <a target="_blank" href="<?php 
                    echo $quote['attribution_link_url'];
                    ?>
">&ndash;<?php 
                    echo $quote['attribution'];
                    ?>
</a>
                        <?php 
                } else {
                    ?>
                            &ndash;<?php 
                    echo $quote['attribution'];
                    ?>
                        <?php 
                }
                ?>
                    </span>

                <?php 
            }
            ?>

            </div>

            <?php 
        }
    }
}
コード例 #7
0
/**
 * Redirect to Eventbrite given the SSO key, used for auto-generated tickets
 */
function ikit_event_eventbrite_sso_redirect($ikit_event_id, $sso_key)
{
    if (empty($sso_key) == false) {
        // Get event meta
        $ikit_event_meta = ikit_event_get_meta($ikit_event_id);
        // Pull member type
        $xml = ikit_sso_get_user($sso_key);
        // Use access code
        $sync_data = unserialize(get_post_meta($ikit_event_id, IKIT_CUSTOM_FIELD_IKIT_EVENT_EVENTBRITE_SYNC_DATA, true));
        // Determine member type
        $member_type = trim((string) $xml->Name->MEMBER_TYPE);
        $attribute1 = (string) $xml->Name->ATTRIBUTE1;
        // Students use a special attribute
        if ($attribute1 == '1STUDENT' && empty($sync_data[IKIT_MEMBER_TYPE_STUDENT]) == false) {
            // Determine if student ticket still exists
            $student_eventbrite_ticket_id = $sync_data[IKIT_MEMBER_TYPE_STUDENT]['id'];
            $student_eventbrite_ticket_exists = false;
            $eb_client = ikit_event_eventbrite_get_client();
            if ($eb_client != null) {
                $ikit_event_meta = ikit_event_get_meta($ikit_event_id);
                $event_id = $ikit_event_meta->id;
                $eventbrite_event = ikit_event_eventbrite_get_event($eb_client, $ikit_event_meta->id);
                $eventbrite_tickets = $eventbrite_event->tickets;
                foreach ($eventbrite_tickets as $eventbrite_ticket) {
                    $eventbrite_ticket_id = $eventbrite_ticket->ticket->id;
                    if ($student_eventbrite_ticket_id == $eventbrite_ticket_id) {
                        $student_eventbrite_ticket_exists = true;
                        break;
                    }
                }
            }
            // If the student ticket still exists, we show the student the student ticket
            // otherwise just show their member ticket
            if ($student_eventbrite_ticket_exists) {
                $member_type = 'STUDENT';
            }
        }
        $ticket = $sync_data[$member_type];
        // XXX Legacy events pre-20131125 used the missing constant name, TODO fix via update
        if (empty($ticket) && $member_type == 'SUP') {
            $ticket = $sync_data['IKIT_MEMBER_TYPE_SUPPORTER'];
        }
        $code = "";
        if (empty($ticket) == false) {
            $code = $ticket['access_code']['code'];
        }
        $eventbrite_registration_url = $ikit_event_meta->url . '&discount=' . $code;
        // Do a server redirect so users do not see a page load
        wp_redirect($eventbrite_registration_url);
        exit;
    }
}
コード例 #8
0
ファイル: api.php プロジェクト: aiga-chicago/chicago.aiga.org
/**
 * Currently takes no parameters, just returns list of upcoming events
 */
function ikit_api_v1_ikit_event_search()
{
    global $g_options;
    $imus_chapter = $g_options[IKIT_PLUGIN_OPTION_FILTER_IKIT_IMUS_CHAPTER];
    $results = array();
    $args = array();
    $args['posts_per_page'] = 20;
    $args['post_type'] = IKIT_POST_TYPE_IKIT_EVENT;
    $args['order'] = 'ASC';
    $args['orderby'] = 'meta_value_num';
    $args['meta_key'] = IKIT_CUSTOM_FIELD_GENERIC_ORDERING_DISPLAY_PRIORITY;
    $args['meta_query'] = array(array('key' => IKIT_CUSTOM_FIELD_IKIT_EVENT_END_DATE, 'value' => date_i18n("Y-m-d"), 'compare' => '>=', 'type' => 'DATE'), array('key' => IKIT_CUSTOM_FIELD_IKIT_EVENT_STATUS, 'value' => 'Closed', 'compare' => '!=', 'type' => 'CHAR'));
    query_posts($args);
    ?>

    <result>
    <site>
        <code><?php 
    echo $imus_chapter;
    ?>
</code>
        <title><![CDATA[<?php 
    echo ikit_get_blog_title();
    ?>
]]></title>
        <linkUrl><![CDATA[<?php 
    echo get_bloginfo('url');
    ?>
]]></linkUrl>
    </site>
    <events>

    <?php 
    while (have_posts()) {
        the_post();
        global $id;
        $ikit_event_meta = ikit_event_get_meta($id);
        if ($ikit_event_meta->folder_id != IKIT_EVENT_FOLDER_ID_NATIONAL && $ikit_event_meta->folder_id != IKIT_EVENT_FOLDER_ID_NATIONAL_REGISTRATION_TYPE_DISABLED) {
            // Note may not return the full count, because exludes national events
            $event_image_url = ikit_event_get_image_url($id, $ikit_event_meta, null);
            $event_title = null;
            $event_location = null;
            if ($ikit_event_meta->service == IKIT_EVENT_SERVICE_EVENTBRITE) {
                $event_title = $ikit_event_meta->title;
                $event_location = $ikit_event_meta->venue_city;
            } else {
                if ($ikit_event_meta->service == IKIT_EVENT_SERVICE_ETOUCHES) {
                    $event_title = $ikit_event_meta->name;
                    $event_location = $ikit_event_meta->location_city;
                }
            }
            ?>
            <event>
                <id><?php 
            echo $id;
            ?>
</id>
                <title><![CDATA[<?php 
            echo $event_title;
            ?>
]]></title>
                <startDate><?php 
            echo ikit_date_without_time($ikit_event_meta->start_date);
            ?>
</startDate>
                <endDate><?php 
            echo ikit_date_without_time($ikit_event_meta->end_date);
            ?>
</endDate>
                <startTime><?php 
            echo $ikit_event_meta->start_time;
            ?>
</startTime>
                <endTime><?php 
            echo $ikit_event_meta->end_time;
            ?>
</endTime>
                <imageUrl><![CDATA[<?php 
            echo $event_image_url;
            ?>
]]></imageUrl>
                <description><![CDATA[<?php 
            echo $ikit_event_meta->description;
            ?>
]]></description>
                <linkUrl><![CDATA[<?php 
            the_permalink();
            ?>
]]></linkUrl>
                <location><![CDATA[<?php 
            echo $event_location;
            ?>
]]></location>
            </event>

            <?php 
        }
    }
    ?>

    </events>
    </result>

    <?php 
    die;
}