예제 #1
0
 function RunModule()
 {
     if (isset($_GET['adv']) && (!isset($_GET['q']) && !isset(self::$types[$_GET['adv']]))) {
         // if we're using advanced search
         $_GET['q'] = $_REQUEST['q'] = $_GET['adv'];
         $_GET['adv'] = $_REQUEST['adv'] = '';
     }
     $query = isset($_GET['q']) ? $_GET['q'] : '';
     $adv = isset($_GET['adv']) ? $_GET['adv'] : '';
     echo '<h1>Search</h1>';
     $this->OutputForm();
     echo '<p>Search Results for ' . $query . '</p>';
     $scores = self::RunSearch($query, $adv);
     foreach ($scores as $row) {
         $score = $row[0];
         $module = $row[1];
         $pkVal = $row[2];
         $info = $row[3];
         $obj = utopia::GetInstance($module);
         $data = $obj->LookupRecord($pkVal);
         $url = $obj->GetURL($pkVal);
         $title = word_trim(html2txt($data[$info[1]]), 10, true);
         $desc = word_trim(html2txt($data[$info[2]]), 30, true);
         echo '<div class="searchResult"><a href="' . $url . '">' . $title . '</a><div>' . $desc . '</div></div>';
     }
 }
예제 #2
0
    /**
     * Display widget
     */
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        global $post, $javo_tso;
        $title = apply_filters('widget_title', $instance['title']);
        $limit = $instance['limit'];
        $length = (int) $instance['length'];
        $thumb = $instance['thumb'];
        $cat = $instance['cat'];
        $post_type = $instance['post_type'];
        echo $before_widget;
        if (!empty($title)) {
            echo $before_title . $title . $after_title;
        }
        if (false === ($javo_recent_photos = get_transient('javo_recent_photos_' . $widget_id))) {
            $args = array('numberposts' => $limit, 'cat' => $cat, 'post_type' => $post_type, 'post_status' => 'publish');
            $javo_recent_photos = query_posts($args);
            set_transient('javo_recent_photos_' . $widget_id, $javo_recent_photos, 60 * 60 * 12);
        }
        ?>

		<div class="widget_posts_wrap">
			<?php 
        switch ($post_type) {
            case "lister":
                //************* listers **************//
                ?>
<ul class='latest-posts listers'><?php 
                $javo_recent_photos = query_posts(array('post_status' => 'publish', 'post_type' => $post_type, 'posts_per_page' => $limit, 'cat' => $cat));
                foreach ($javo_recent_photos as $post) {
                    setup_postdata($post);
                    $author = get_userdata($post->post_author);
                    $avatar = !empty($author) ? get_user_meta($author->ID, "avatar", true) : null;
                    $avatar_meta = wp_get_attachment_image_src($avatar, 'javo-tiny');
                    $avatar_src = $avatar_meta[0];
                    ?>
					<li class="col-xs-4 col-sm-4 col-md-4">
						<?php 
                    if ($thumb == true) {
                        ?>
						<span class='thumb'><a href="<?php 
                        echo get_the_permalink($post->ID);
                        ?>
">
							<?php 
                        //echo get_the_post_thumbnail($post->ID, "javo-tiny"); //get_avatar( get_the_author_meta('ID'), 32 );
                        ?>
							<div class="img-wrap-shadow"><img src='<?php 
                        echo $avatar_src;
                        ?>
'></div>
						</a></span>
						<?php 
                    }
                    ?>
					</li>
				<?php 
                }
                wp_reset_postdata();
                ?>
</ul><?php 
                break;
            case "item":
                //************* item **************//
                ?>
<ul class='latest-posts items list-unstyled'><?php 
                $javo_recent_photos = query_posts(array('post_status' => 'publish', 'post_type' => $post_type, 'posts_per_page' => $limit, 'cat' => $cat));
                foreach ($javo_recent_photos as $post) {
                    setup_postdata($post);
                    ?>
					<li class="col-xs-4 col-sm-4 col-md-4">
						<?php 
                    if ($thumb == true) {
                        ?>
						<span class='thumb'>
							<a href="<?php 
                        the_permalink();
                        ?>
">
							<div class="img-wrap-shadow">
								<?php 
                        if (has_post_thumbnail()) {
                            the_post_thumbnail('javo-tiny');
                        } else {
                            printf('<img src="%s" class="wp-post-image" style="width:80px; height:80px;">', $javo_tso->get('no_image', JAVO_IMG_DIR . '/no-image.png'));
                        }
                        ?>
								</div>
							</a>
						</span>
						<?php 
                    }
                    ?>
					</li>
				<?php 
                }
                wp_reset_postdata();
                ?>
</ul><?php 
                break;
            case "post":
            default:
                //************* Post **************//
                ?>
				<!--<ul class='latest-posts posts'><?php 
                if (!empty($javo_recent_posts)) {
                    foreach ($javo_recent_posts as $post) {
                        setup_postdata($post);
                        ?>
						<li class="col-md-12">
							<?php 
                        if ($thumb == true) {
                            ?>
							<span class='thumb'><a href="<?php 
                            the_permalink();
                            ?>
"><?php 
                            echo get_the_post_thumbnail($post->ID, "javo-tiny");
                            //get_avatar( get_the_author_meta('ID'), 32 );
                            ?>
</a></span>
							<?php 
                        }
                        ?>
							<p><?php 
                        the_title();
                        ?>
 <br/><?php 
                        echo word_trim(get_the_excerpt(), $length, '...');
                        ?>
<a href="<?php 
                        the_permalink();
                        ?>
"><?php 
                        _e("read more", 'javo_fr');
                        ?>
</a></p>
						</li>
					<?php 
                    }
                    wp_reset_postdata();
                }
                ?>
</ul>-->
			<ul class='latest-posts items list-unstyled'>
				<?php 
                $javo_recent_photos_args = array('post_status' => 'publish', 'post_type' => $post_type, 'posts_per_page' => $limit, 'cat' => $cat);
                $javo_recent_photos = new WP_Query($javo_recent_photos_args);
                if ($javo_recent_photos->have_posts()) {
                    while ($javo_recent_photos->have_posts()) {
                        $javo_recent_photos->the_post();
                        $javo_this_permalink = '';
                        switch ($post_type) {
                            case 'jv_events':
                                $javo_this_permalink = javo_url(get_post_meta(get_the_ID(), 'parent_post_id', true));
                                break;
                            case 'review':
                                $javo_this_permalink = javo_url(get_post_meta(get_the_ID(), 'parent_post_id', true));
                                break;
                            default:
                                $javo_this_permalink = get_permalink();
                        }
                        ?>
						<li class="col-xs-4 col-sm-4 col-md-4">
						<?php 
                        if ($thumb == true) {
                            ?>
							<span class='thumb'>
								<a href="<?php 
                            echo $javo_this_permalink;
                            if ($post_type == 'jv_events') {
                                echo '#item-events';
                            } else {
                                if ($post_type == 'review') {
                                    echo '#item-reviews';
                                }
                            }
                            ?>
">
									<div class="img-wrap-shadow">
										<?php 
                            if (has_post_thumbnail()) {
                                the_post_thumbnail('javo-tiny');
                            } else {
                                printf('<img src="%s" class="wp-post-image" style="width:80px; height:80px;">', $javo_tso->get('no_image', JAVO_IMG_DIR . '/no-image.png'));
                            }
                            ?>
									</div>
								</a>
							</span>
							<?php 
                        }
                        ?>
						</li>
						<?php 
                    }
                    // End While
                }
                // End if
                ?>
			</ul>
			<?php 
        }
        ?>
		</div>
		<?php 
        wp_reset_query();
        echo $after_widget;
    }
예제 #3
0
function quilted_custom_preprocess_node_profile(&$vars)
{
    if (arg(0) == 'user' && is_numeric(arg(1))) {
        $vars['template_files'] = array('node-profile', 'node-profile-page');
        $vars['page'] = 1;
    }
    $vars['user_url'] = drupal_get_path_alias('user/' . $vars['node']->uid);
    if (!$vars['page']) {
        $vars['template_files'] = array('node-profile-teaser');
    }
    // set up $profile_photo
    if ($vars['user']->content_profile['profile']->field_profile_photo[0]['filepath']) {
        $image_filepath = $vars['user']->content_profile['profile']->field_profile_photo[0]['filepath'];
    } else {
        $image_filepath = path_to_theme() . '/images/default-user-icon.png';
    }
    if ($vars['node']->field_profile_image[0]['filepath']) {
        $image_filepath = $vars['node']->field_profile_image[0]['filepath'];
    } else {
        $image_filepath = path_to_theme() . '/images/default-user-icon.png';
    }
    $link_options = array('html' => TRUE);
    $vars['image'] = l(theme('imagecache', 'profile_small', $image_filepath, $alt, $title, $attributes), $vars['user_url'], $link_options);
    if ($vars['page']) {
        $vars['image_large'] = theme('imagecache', 'profile_regular', $image_filepath, $alt, $title, $attributes);
    } else {
        // put the link on the hover image
        $vars['image_large'] = l(theme('imagecache', 'profile_regular', $image_filepath, $alt, $title, $attributes), $vars['user_url'], $link_options);
    }
    $vars['name'] = l($vars['node']->title, $vars['user_url']);
    $org_node = node_load($vars['node']->field_profile_organization[0]['nid']);
    // dpr($org_node);
    if ($vars['node']->field_profile_organization[0]['nid']) {
        $vars['org_node_link'] = l($org_node->title, 'node/' . $vars['node']->field_profile_organization[0]['nid']);
    }
    if ($org_node->field_organization_url[0]['url']) {
        $vars['org_link'] = l($org_node->title, $org_node->field_organization_url[0]['url']);
    }
    $vars['position'] = $vars['node']->field_profile_position[0]['view'];
    $vars['bio'] = $vars['node']->content['body']['#value'];
    $read_more_link_options = array('html' => TRUE, 'attributes' => array('class' => 'read-more'));
    $vars['more_link'] = l(t("Read more&nbsp;&raquo;"), $vars['user_url'], $read_more_link_options);
    $vars['bio_chopped'] = word_trim($vars['node']->content['body']['#value'], 15, $ellipsis = TRUE) . " " . $vars['more_link'];
}
예제 #4
0
											<h6><?php 
            echo the_time("n / j /Y");
            ?>
<span>&bull;</span><?php 
            echo the_time("h:i A");
            ?>
</h6>
											<h5><a href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a></h5>
											<p><?php 
            echo word_trim(get_the_excerpt(), 19);
            ?>
</p>
											<p><a href="<?php 
            the_permalink();
            ?>
" class="more-link"><?php 
            printf(__('Read more', 'bordeaux'));
            ?>
</a></p>
										</div>
										<?php 
        }
    } else {
        ?>
										<p><?php 
예제 #5
0
function outputRandomTestimonial($atts)
{
    //load shortcode attributes into an array
    extract(shortcode_atts(array('testimonials_link' => get_option('testimonials_link'), 'count' => 1, 'word_limit' => false, 'body_class' => 'testimonial_body', 'author_class' => 'testimonial_author', 'show_title' => 0, 'short_version' => false, 'use_excerpt' => false, 'category' => '', 'show_thumbs' => '', 'show_rating' => false, 'theme' => '', 'show_date' => false, 'show_other' => false, 'width' => false), $atts));
    $show_thumbs = $show_thumbs == '' ? get_option('testimonials_image') : $show_thumbs;
    //load testimonials into an array
    $i = 0;
    $loop = new WP_Query(array('post_type' => 'testimonial', 'posts_per_page' => '-1', 'easy-testimonial-category' => $category));
    while ($loop->have_posts()) {
        $loop->the_post();
        $postid = get_the_ID();
        $testimonials[$i]['date'] = get_the_date('M. j, Y');
        //load rating
        //if set, append english text to it
        $testimonials[$i]['rating'] = get_post_meta($postid, '_ikcf_rating', true);
        $testimonial['num_stars'] = '';
        //reset num stars (Thanks Steve@IntegrityConsultants!)
        if (strlen($testimonials[$i]['rating']) > 0) {
            $testimonials[$i]['num_stars'] = $testimonials[$i]['rating'];
            $testimonials[$i]['rating'] = '<p class="easy_t_ratings" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"><meta itemprop="worstRating" content = "1"/><span itemprop="ratingValue">' . $testimonials[$i]['rating'] . '</span>/<span itemprop="bestRating">5</span> Stars.</p>';
        }
        if ($use_excerpt) {
            $testimonials[$i]['content'] = get_the_excerpt();
        } else {
            $testimonials[$i]['content'] = get_the_content();
        }
        //if nothing is set for the short content, use the long content
        if (strlen($testimonials[$i]['content']) < 2) {
            $temp_post_content = get_post($postid);
            if ($use_excerpt) {
                $testimonials[$i]['content'] = $temp_post_content->post_excerpt;
                if ($testimonials[$i]['content'] == '') {
                    $testimonials[$i]['content'] = wp_trim_excerpt($temp_post_content->post_content);
                }
            } else {
                $testimonials[$i]['content'] = $temp_post_content->post_content;
            }
        }
        if ($word_limit) {
            $testimonials[$i]['content'] = word_trim($testimonials[$i]['content'], 65, TRUE);
        }
        if (strlen($show_rating) > 2) {
            if ($show_rating == "before") {
                $testimonials[$i]['content'] = $testimonials[$i]['rating'] . ' ' . $testimonials[$i]['content'];
            }
            if ($show_rating == "after") {
                $testimonials[$i]['content'] = $testimonials[$i]['content'] . ' ' . $testimonials[$i]['rating'];
            }
        }
        if ($show_thumbs) {
            $testimonials[$i]['image'] = build_testimonial_image($postid);
        }
        $testimonials[$i]['title'] = get_the_title($postid);
        $testimonials[$i]['postid'] = $postid;
        $testimonials[$i]['client'] = get_post_meta($postid, '_ikcf_client', true);
        $testimonials[$i]['position'] = get_post_meta($postid, '_ikcf_position', true);
        $testimonials[$i]['other'] = get_post_meta($postid, '_ikcf_other', true);
        $i++;
    }
    wp_reset_query();
    $randArray = UniqueRandomNumbersWithinRange(0, $i - 1, $count);
    ob_start();
    foreach ($randArray as $key => $rand) {
        if (isset($testimonials[$rand])) {
            $this_testimonial = $testimonials[$rand];
            if (!$short_version) {
                echo build_single_testimonial($this_testimonial, $show_thumbs, $show_title, $this_testimonial['postid'], $author_class, $body_class, $testimonials_link, $theme, $show_date, $show_rating, $show_other, $width);
            } else {
                echo $this_testimonial['content'];
            }
        }
    }
    $content = ob_get_contents();
    ob_end_clean();
    return apply_filters('easy_t_random_testimonials_html', $content);
}
예제 #6
0
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $cat = $instance['cat'];
        $count = $instance['count'];
        $type = $instance['type'];
        $lenght = $instance['lenght'];
        ?>
						<!-- BEGIN .sidebar-block-1 -->
						<?php 
        echo $before_widget;
        ?>
								<?php 
        $category_id = get_cat_ID($cat);
        $category_link = get_category_link($category_id);
        ?>
							<div class="title"><h3> <?php 
        if ($title) {
            echo $title;
        }
        ?>
</h3><a href="<?php 
        echo $category_link;
        ?>
"><?php 
        printf(__('show all', 'bordeaux'));
        ?>
</a></div>

								<?php 
        if ($type == 1 or $type == "") {
            ?>
		
									<!-- BEGIN .latest-news -->
									<div class="latest-news random-items">
										<?php 
            $args = array('category_name' => $cat, 'posts_per_page' => $count);
            $the_query = new WP_Query($args);
            ?>
										<?php 
            $counter = 1;
            ?>
										<?php 
            if ($the_query->have_posts()) {
                while ($the_query->have_posts()) {
                    $the_query->the_post();
                    ?>
											<!-- BEGIN .latest-news-item -->
											<?php 
                    $image = get_post_thumb($the_query->post->ID, 60, 60);
                    ?>
											
											<div class="news-item <?php 
                    if ($counter == $count) {
                        echo "last";
                    }
                    ?>
">
												<div class="image">
													<a href="<?php 
                    the_permalink();
                    ?>
"><img src="<?php 
                    if ($image['src']) {
                        echo $image['src'];
                    }
                    ?>
" alt="" width="60" height="60" /></a>
												</div>
												<div class="text">
													<h5><a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h5>
													<p><a href="<?php 
                    the_permalink();
                    ?>
" class="more-link"><?php 
                    printf(__('Read more', 'bordeaux'));
                    ?>
</a></p>
												</div>
											
											<!-- END .latest-news-item -->
											</div>
											<?php 
                    $counter++;
                    ?>
										<?php 
                }
            } else {
                ?>
										<p><?php 
                printf(__('No posts where found', 'bordeaux'));
                ?>
</p>
										<?php 
            }
            ?>

									<!-- END .latest-news-->
									</div>
								<?php 
        } else {
            ?>
								<!-- BEGIN .latest-events -->
								<div class="latest-news">
									<?php 
            $args = array('category_name' => $cat, 'posts_per_page' => $count);
            $the_query = new WP_Query($args);
            ?>
									<?php 
            $counter = 1;
            ?>
									<?php 
            if ($the_query->have_posts()) {
                while ($the_query->have_posts()) {
                    $the_query->the_post();
                    ?>
											<div class="news-item <?php 
                    if ($counter == $count) {
                        echo "last";
                    }
                    ?>
">
												<p class="news-title"><a href="<?php 
                    the_permalink();
                    ?>
" class="title"><?php 
                    the_title();
                    ?>
</a></p>
												<p><?php 
                    echo word_trim(get_the_excerpt(), $lenght);
                    ?>
</p>
												<p class="last"><a href="<?php 
                    the_permalink();
                    ?>
" class="more-link"><?php 
                    printf(__('Read more', 'bordeaux'));
                    ?>
</a></p>
											<!-- END .latest-news-item -->
											</div>
									<?php 
                    $counter++;
                    ?>
									<?php 
                }
            } else {
                ?>
									<p><?php 
                printf(__('No posts where found', 'bordeaux'));
                ?>
</p>
									<?php 
            }
            ?>
									
								<!-- END .latest-news -->
								</div>								
								<?php 
        }
        ?>
							
						<!-- END .block-1 -->
						<?php 
        echo $after_widget;
        ?>
        <?php 
    }