/** To show slider 
 * @return output
*/
function rps_show()
{
    $width = get_option('rps_width');
    $height = get_option('rps_height');
    $post_per_slide = get_option('rps_post_per_slide');
    $total_posts = get_option('rps_total_posts');
    $slider_content = get_option('rps_slider_content');
    $category_ids = get_option('rps_category_ids');
    $post_include_ids = get_option('rps_post_include_ids');
    $post_exclude_ids = get_option('rps_post_exclude_ids');
    $post_title_color = get_option('rps_post_title_color');
    $post_title_bg_color = get_option('rps_post_title_bg_color');
    $slider_speed = get_option('rps_slider_speed');
    $pagination_style = get_option('rps_pagination_style');
    $excerpt_words = get_option('rps_excerpt_words');
    $show_post_date = get_option('rps_show_post_date');
    $post_date_text = get_option('rps_post_date_text');
    $post_date_format = get_option('rps_post_date_format');
    if (empty($post_date_text)) {
        $post_date_text = "Posted On:";
    }
    if (empty($post_date_format)) {
        $post_date_format = "j-F-Y";
    }
    if (empty($slider_speed)) {
        $slider_speed = 7000;
    } else {
        $slider_speed = $slider_speed * 1000;
    }
    if (empty($post_title_color)) {
        $post_title_color = "#666";
    } else {
        $post_title_color = "#" . $post_title_color;
    }
    $post_title_bg_color_js = "";
    if (!empty($post_title_bg_color)) {
        $post_title_bg_color_js = "#" . $post_title_bg_color;
    }
    $excerpt_length = '';
    $excerpt_length = abs(($width - 40) / 20 * (($height - 55) / 15));
    /*if ( ($width) > $height)
    	$excerpt_length = $excerpt_length - (($excerpt_length * 5) /100);
    	else
    	$excerpt_length = $excerpt_length - (($excerpt_length * 30) /100);*/
    $post_details = NULL;
    $args = array('numberposts' => $total_posts, 'offset' => 0, 'category' => $category_ids, 'orderby' => 'post_date', 'order' => 'DESC', 'include' => $post_include_ids, 'exclude' => $post_exclude_ids, 'post_type' => 'post', 'post_status' => 'publish');
    $recent_posts = get_posts($args);
    if (count($recent_posts) < $total_posts) {
        $total_posts = count($recent_posts);
    }
    if ($total_posts % $post_per_slide == 0) {
        $paging = $total_posts / $post_per_slide;
    } else {
        $paging = $total_posts / $post_per_slide + 1;
    }
    foreach ($recent_posts as $key => $val) {
        $post_details[$key]['post_title'] = $val->post_title;
        $post_details[$key]['post_permalink'] = get_permalink($val->ID);
        if ($slider_content == 2) {
            if (!empty($val->post_excerpt)) {
                $post_details[$key]['post_excerpt'] = create_excerpt($val->post_excerpt, $excerpt_length, $post_details[$key]['post_permalink'], $excerpt_words);
            } else {
                $post_details[$key]['post_excerpt'] = create_excerpt($val->post_content, $excerpt_length, $post_details[$key]['post_permalink'], $excerpt_words);
            }
        } elseif ($slider_content == 1) {
            $post_details[$key]['post_first_img'] = get_post_meta($val->ID, '_rps_img_src');
        } elseif ($slider_content == 3) {
            $post_details[$key]['post_first_img'] = get_post_meta($val->ID, '_rps_img_src');
            if (!empty($val->post_excerpt)) {
                $post_details[$key]['post_excerpt'] = create_excerpt($val->post_excerpt, $excerpt_length / 2 - 10, $post_details[$key]['post_permalink'], $excerpt_words);
            } else {
                $post_details[$key]['post_excerpt'] = create_excerpt($val->post_content, $excerpt_length / 2 - 10, $post_details[$key]['post_permalink'], $excerpt_words);
            }
        }
        if ($show_post_date) {
            $post_details[$key]['post_date'] = date_i18n($post_date_format, strtotime($val->post_date));
        }
    }
    //$upload_dir = wp_upload_dir();
    $output = '<!--Automatic Image Slider w/ CSS & jQuery with some customization-->';
    $output .= '<script type="text/javascript">
	$j = jQuery.noConflict();
	$j(document).ready(function() {';
    //Set Default State of each portfolio piece
    if ($pagination_style != '3') {
        $output .= '$j("#rps .paging").show();';
    }
    $output .= '$j("#rps .paging a:first").addClass("active");
	
	$j(".slide").css({"width" : ' . $width . '});
	/*$j("#rps .window").css({"width" : ' . $width . '});*/
	$j("#rps .window").css({"height" : ' . $height . '});

	$j("#rps .col").css({"width" : ' . ($width / $post_per_slide - 2) . '});
	$j("#rps .col").css({"height" : ' . ($height - 4) . '});
	$j("#rps .col p.post-title span").css({"color" : "' . $post_title_color . '"});
	$j("#rps .post-date").css({"top" : ' . ($height - 20) . '});
	$j("#rps .post-date").css({"width" : ' . ($width / $post_per_slide - 12) . '});';
    if (!empty($post_title_bg_color_js)) {
        $output .= '$j("#rps .col p.post-title").css({"background-color" : "' . $post_title_bg_color_js . '"});';
    }
    $output .= 'var imageWidth = $j("#rps .window").width();
	//var imageSum = $j("#rps .slider div").size();
	var imageReelWidth = imageWidth * ' . $paging . ';
	
	//Adjust the image reel to its new size
	$j("#rps .slider").css({"width" : imageReelWidth});

	//Paging + Slider Function
	rotate = function(){	
		var triggerID = $active.attr("rel") - 1; //Get number of times to slide
		//alert(triggerID);
		var sliderPosition = triggerID * 200; //Determines the distance the image reel needs to slide
		//var sliderPosition = imageWidth; //Determines the distance the image reel needs to slide

		$j("#rps .paging a").removeClass("active"); 
		$active.addClass("active");
		
		//Slider Animation
		$j("#rps .slider").stop(true,false).animate({ 
			left: -sliderPosition
		}, 500);
	}; 
	var play;
	//Rotation + Timing Event
	rotateSwitch = function(){		
		play = setInterval(function(){ //Set timer - this will repeat itself every 3 seconds
			$active = $j("#rps .paging a.active").next();
			if ( $active.length === 0) { //If paging reaches the end...
				$active = $j("#rps .paging a:first"); //go back to first
			}
			rotate(); //Trigger the paging and slider function
		}, ' . $slider_speed . ');
	};
	
	rotateSwitch(); //Run function on launch
	
	//On Hover
	$j("#rps .slider a").hover(function() {
		clearInterval(play); //Stop the rotation
	}, function() {
		rotateSwitch(); //Resume rotation
	});	
	
	//On Click
	$j("#rps .paging a").click(function() {	
		$active = $j(this); //Activate the clicked paging
		//Reset Timer
		clearInterval(play); //Stop the rotation
		rotate(); //Trigger rotation immediately
		rotateSwitch(); // Resume rotation
		return false; //Prevent browser jump to link anchor
	});	
});

</script>';
    /* 
    $output .= '<div id="rps">
                <div class="window adjwindow">	
                    <div class="slider">';
    		$p=0;
    		for ( $i = 1; $i <= $total_posts; $i+=$post_per_slide ) {
    			$output .= '<div class="slide">';
    					for ( $j = 1; $j <= $post_per_slide; $j++ ) {
    						$output .= '<div class="col"><p class="post-title"><a href="'.$post_details[$p]['post_permalink'].'"><span>'.$post_details[$p]['post_title'].'</span></a></p>';
    						if ( $slider_content == 2 ){
    							$output .= '<p class="slider-content">'.$post_details[$p]['post_excerpt'];
    							if($show_post_date){
    								$output .= '<div class="post-date">'.$post_date_text.' '.$post_details[$p]['post_date'].'</div>';
    							}
    							$output .= '</p></div>';
    						}elseif ( $slider_content == 1 ){
    							$output .= '<p class="slider-content-img">';
    							if( !empty($post_details[$p]['post_first_img']['0']) ){
    								$rps_img_src_path = $post_details[$p]['post_first_img']['0'];
    								if(!empty($rps_img_src_path)){
    									$output .= '<a href="'.$post_details[$p]['post_permalink'].'"><center><img src="'.$rps_img_src_path.'" /></center></a>';
    								}
    							}
    							if($show_post_date){
    								$output .= '<div class="post-date">'.$post_date_text.' '.$post_details[$p]['post_date'].'</div>';
    							}
    							$output .= '</p></div>';			
    						}elseif ( $slider_content == 3 ){
    							$output .= '<p class="slider-content-both">';
    							if( !empty($post_details[$p]['post_first_img']['0']) || !empty($post_details[$p]['post_excerpt'])){
    								$rps_img_src_path = $post_details[$p]['post_first_img']['0'];
    								if(!empty($rps_img_src_path)){
    									$output .= '<a href="'.$post_details[$p]['post_permalink'].'"><img src="'.$rps_img_src_path.'" align="left" /></a>';
    								}
    								$output .= $post_details[$p]['post_excerpt'];
    							}
    							if($show_post_date){
    								$output .= '<div class="post-date">'.$post_date_text.' '.$post_details[$p]['post_date'].'</div>';
    							}
    							$output .= '</p></div>';			
    						}
    						$p++;
    						if ( $p == $total_posts )
    							$p = 0;
    					}
    					$output .= '<div class="clr"></div>
    				</div>';
    		}
    		$output .= '
                    </div>
                </div>
                <div class="paging">';
    				for ( $p = 1; $p <= $paging; $p++ ) {
    					if( $pagination_style == '2' ){
    						$output .= '<a href="#" rel="'.$p.'">&bull;</a>';
    					}elseif( $pagination_style == '1' ){
    						$output .= '<a href="#" rel="'.$p.'">'.$p.'</a>';
    					}elseif( $pagination_style == '3' ){
    						$output .= '<a href="#" rel="'.$p.'">&nbsp;</a>';
    					}
    				}
                $output .= '</div>
            </div><div class="rps-clr"></div>';  */
    // echo "<pre>";print_r($args['numberposts']);
    $limit = $args['numberposts'];
    include_once "header.php";
    global $wpdb;
    $sql = "SELECT * FROM " . $wpdb->prefix . "agentaccount ";
    $results = $wpdb->get_results($sql);
    // echo "<pre>"; print_r($results);
    $db_ip = $results[0]->host;
    $db_user = $results[0]->db_user;
    $db_pass = $results[0]->password;
    $db_name = $results[0]->db;
    $agent_offcode = $results[0]->agent_offcode;
    $con = mysql_connect($db_ip, $db_user, $db_pass);
    if (!$con) {
        die('Could not connect: ' . mysql_error());
    }
    mysql_select_db($db_name, $con);
    // $sql = "select * from  ".$wpdb->prefix."ntreislist where photocount>0  and officelist='LYNC00FW' order by modified desc limit 6";
    // $sql = "select * from  ".$wpdb->prefix."ntreislist where featured_listings ='1'  order by modified desc limit 6";
    $sql = mysql_query("select MLS,id,directions,city,county from  ntreislist where featured_listings ='1' and officelist='" . $agent_offcode . "' order by modified desc limit {$limit}");
    while ($totalposts = mysql_fetch_assoc($sql)) {
        $total_post[] = $totalposts;
    }
    // $total_post = $wpdb->get_results($sql);
    // echo "<pre>";
    // print_r($total_post);die;
    $total_posts = count($total_post);
    /* if ( $total_posts < 6 ) {
    			$total_posts	= count($total_posts);
    		} */
    // echo $post_per_slide;die;
    if ($total_posts % $post_per_slide == 0) {
        $paging = $total_posts / $post_per_slide;
    } else {
        $paging = $total_posts / $post_per_slide + 1;
    }
    // var_dump($post_per_slide);
    ?>
<style>
	#slider_div{
		width: 3600px !important;
	}
</style>
<?php 
    $output .= '<div id="rps">
            <div class="window adjwindow">	
                <div class="slider" id="slider_div">';
    $p = 0;
    for ($i = 1; $i <= $total_posts; $i += $post_per_slide) {
        // echo "<pre>";print_r($post_per_slide);
        // echo "<pre>";
        //echo $i;
        $output .= '<div class="slide" >';
        for ($j = 1; $j <= $post_per_slide; $j++) {
            // print_r($total_post);
            // echo $slider_content;
            // echo $p;
            $mln = $total_post[$p]['MLS'];
            $sqls = "select imagename from ntreisimages where mlsnum = '" . $mln . "' order by recordListingID, id ASC limit 1";
            $sql_img = mysql_query($sqls);
            $ress = mysql_fetch_assoc($sql_img);
            //$ress = $wpdb->get_results($sqls);
            //print_r($ress);
            $output .= '<div class="col">';
            if ($slider_content == 1) {
                $output .= '<p class="post-title"><a href="' . get_bloginfo('url') . '/viewproperty.php?mls=' . $mln . '">
									<span>' . $total_post[$p]['directions'] . '<br />' . $total_post[$p]['city'] . ',' . $total_post[$p]['county'] . '</span></a></p>';
                $output .= '<p class="slider-content-both">';
                $rps_img_src_path = $ress['imagename'];
                if (!empty($rps_img_src_path)) {
                    $output .= '<a href="' . get_bloginfo('url') . '/viewproperty.php?mls=' . $mln . '"><img src="' . $rps_img_src_path . '" style="width:100px;" align="left" /></a><br clear="all" />';
                } else {
                    //echo 'no images';
                }
                //$output .= $total_post[($i-1)]->area;
                // $output .= $total_post[($i-1)]->street_name;
                // $output .= '<div class="post-date">'.$total_post[($i-1)]->street_name.'</div>';
                $output .= '</p></div>';
            }
            $p++;
            if ($p == $total_posts) {
                $p = 0;
            }
        }
        $output .= '<div class="clr"></div>
				</div>';
    }
    $output .= '
                </div>
            </div>
            <div class="paging">';
    // echo "<pre>pagin".$paging;
    for ($p = 1; $p <= $paging; $p++) {
        if ($pagination_style == '2') {
            $output .= '<a href="#" rel="' . $p . '">&bull;</a>';
        } elseif ($pagination_style == '1') {
            $output .= '<a href="#" rel="' . $p . '">' . $p . '</a>';
        } elseif ($pagination_style == '3') {
            $output .= '<a href="#" rel="' . $p . '">&nbsp;</a>';
        }
    }
    $output .= '</div>
        </div><div class="rps-clr"></div>';
    mysql_select_db(DB_NAME);
    return $output;
}
/** To show slider 
 * @return output
*/
function rps_show($category_ids = null, $total_posts = null, $post_include_ids = null, $post_exclude_ids = null)
{
    $width = get_option('rps_width');
    $height = get_option('rps_height');
    $post_per_slide = get_option('rps_post_per_slide');
    if (empty($total_posts)) {
        $total_posts = get_option('rps_total_posts');
    }
    $slider_content = get_option('rps_slider_content');
    if (empty($category_ids)) {
        $category_ids = get_option('rps_category_ids');
    }
    if (empty($post_include_ids)) {
        $post_include_ids = get_option('rps_post_include_ids');
    }
    if (empty($post_exclude_ids)) {
        $post_exclude_ids = get_option('rps_post_exclude_ids');
    }
    $post_title_color = get_option('rps_post_title_color');
    $post_title_bg_color = get_option('rps_post_title_bg_color');
    $slider_speed = get_option('rps_slider_speed');
    $pagination_style = get_option('rps_pagination_style');
    $excerpt_words = get_option('rps_excerpt_words');
    $show_post_date = get_option('rps_show_post_date');
    $post_date_text = get_option('rps_post_date_text');
    $post_date_format = get_option('rps_post_date_format');
    if (empty($post_date_text)) {
        $post_date_text = "Posted On:";
    }
    if (empty($post_date_format)) {
        $post_date_format = "j-F-Y";
    }
    if (empty($slider_speed)) {
        $slider_speed = 7000;
    } else {
        $slider_speed = $slider_speed * 1000;
    }
    if (empty($post_title_color)) {
        $post_title_color = "#666";
    }
    $post_title_bg_color_js = "";
    if (!empty($post_title_bg_color)) {
        $post_title_bg_color_js = $post_title_bg_color;
    }
    $excerpt_length = '';
    $excerpt_length = abs(($width - 40) / 20 * (($height - 55) / 15));
    /*if ( ($width) > $height)
    	$excerpt_length = $excerpt_length - (($excerpt_length * 5) /100);
    	else
    	$excerpt_length = $excerpt_length - (($excerpt_length * 30) /100);*/
    $post_details = NULL;
    $args = array('numberposts' => $total_posts, 'offset' => 0, 'category' => $category_ids, 'orderby' => 'post_date', 'order' => 'DESC', 'include' => $post_include_ids, 'exclude' => $post_exclude_ids, 'post_type' => 'post', 'post_status' => 'publish');
    $recent_posts = get_posts($args);
    if (count($recent_posts) < $total_posts) {
        $total_posts = count($recent_posts);
    }
    if ($total_posts % $post_per_slide == 0) {
        $paging = $total_posts / $post_per_slide;
    } else {
        $paging = $total_posts / $post_per_slide + 1;
    }
    foreach ($recent_posts as $key => $val) {
        $post_details[$key]['post_title'] = $val->post_title;
        $post_details[$key]['post_permalink'] = get_permalink($val->ID);
        if ($slider_content == 2) {
            if (!empty($val->post_excerpt)) {
                $post_details[$key]['post_excerpt'] = create_excerpt($val->post_excerpt, $excerpt_length, $post_details[$key]['post_permalink'], $excerpt_words);
            } else {
                $post_details[$key]['post_excerpt'] = create_excerpt($val->post_content, $excerpt_length, $post_details[$key]['post_permalink'], $excerpt_words);
            }
        } elseif ($slider_content == 1) {
            $post_details[$key]['post_first_img'] = get_post_meta($val->ID, '_rps_img_src');
        } elseif ($slider_content == 3) {
            $post_details[$key]['post_first_img'] = get_post_meta($val->ID, '_rps_img_src');
            if (!empty($val->post_excerpt)) {
                $post_details[$key]['post_excerpt'] = create_excerpt($val->post_excerpt, $excerpt_length / 2 - 10, $post_details[$key]['post_permalink'], $excerpt_words);
            } else {
                $post_details[$key]['post_excerpt'] = create_excerpt($val->post_content, $excerpt_length / 2 - 10, $post_details[$key]['post_permalink'], $excerpt_words);
            }
        }
        if ($show_post_date) {
            $post_details[$key]['post_date'] = date_i18n($post_date_format, strtotime($val->post_date));
        }
    }
    //$upload_dir = wp_upload_dir();
    $output = '<!--Automatic Image Slider w/ CSS & jQuery with some customization-->';
    $output .= '<script type="text/javascript">
	$j = jQuery.noConflict();
	$j(document).ready(function() {';
    //Set Default State of each portfolio piece
    if ($pagination_style != '3') {
        $output .= '$j("#rps .paging").show();';
    }
    $output .= '$j("#rps .paging a:first").addClass("active");
	
	$j(".slide").css({"width" : ' . $width . '});
	$j("#rps .window").css({"width" : ' . $width . '});
	$j("#rps .window").css({"height" : ' . $height . '});

	$j("#rps .col").css({"width" : ' . ($width / $post_per_slide - 2) . '});
	$j("#rps .col").css({"height" : ' . ($height - 4) . '});
	$j("#rps .col p.post-title span").css({"color" : "' . $post_title_color . '"});
	$j("#rps .post-date").css({"top" : ' . ($height - 20) . '});
	$j("#rps .post-date").css({"width" : ' . ($width / $post_per_slide - 12) . '});';
    if (!empty($post_title_bg_color_js)) {
        $output .= '$j("#rps .col p.post-title").css({"background-color" : "' . $post_title_bg_color_js . '"});';
    }
    $output .= 'var imageWidth = $j("#rps .window").width();
	//var imageSum = $j("#rps .slider div").size();
	var imageReelWidth = imageWidth * ' . $paging . ';
	
	//Adjust the image reel to its new size
	$j("#rps .slider").css({"width" : imageReelWidth});

	//Paging + Slider Function
	rotate = function(){	
		var triggerID = $active.attr("rel") - 1; //Get number of times to slide
		//alert(triggerID);
		var sliderPosition = triggerID * imageWidth; //Determines the distance the image reel needs to slide

		$j("#rps .paging a").removeClass("active"); 
		$active.addClass("active");
		
		//Slider Animation
		$j("#rps .slider").stop(true,false).animate({ 
			left: -sliderPosition
		}, 500 );
	}; 
	var play;
	//Rotation + Timing Event
	rotateSwitch = function(){		
		play = setInterval(function(){ //Set timer - this will repeat itself every 3 seconds
			$active = $j("#rps .paging a.active").next();
			if ( $active.length === 0) { //If paging reaches the end...
				$active = $j("#rps .paging a:first"); //go back to first
			}
			rotate(); //Trigger the paging and slider function
		}, ' . $slider_speed . ');
	};
	
	rotateSwitch(); //Run function on launch
	
	//On Hover
	$j("#rps .slider a").hover(function() {
		clearInterval(play); //Stop the rotation
	}, function() {
		rotateSwitch(); //Resume rotation
	});	
	
	//On Click
	$j("#rps .paging a").click(function() {	
		$active = $j(this); //Activate the clicked paging
		//Reset Timer
		clearInterval(play); //Stop the rotation
		rotate(); //Trigger rotation immediately
		rotateSwitch(); // Resume rotation
		return false; //Prevent browser jump to link anchor
	});	
});

</script>';
    $output .= '<div id="rps">
            <div class="window">	
                <div class="slider">';
    $p = 0;
    for ($i = 1; $i <= $total_posts; $i += $post_per_slide) {
        $output .= '<div class="slide">';
        for ($j = 1; $j <= $post_per_slide; $j++) {
            $output .= '<div class="col"><p class="post-title"><a href="' . $post_details[$p]['post_permalink'] . '"><span>' . __($post_details[$p]['post_title'], 'rps') . '</span></a></p>';
            if ($slider_content == 2) {
                $output .= '<p class="slider-content">' . __($post_details[$p]['post_excerpt'], 'rps');
                if ($show_post_date) {
                    $output .= '<div class="post-date">' . __($post_date_text, 'rps') . ' ' . __($post_details[$p]['post_date'], 'rps') . '</div>';
                }
                $output .= '</p></div>';
            } elseif ($slider_content == 1) {
                $output .= '<p class="slider-content-img">';
                if (!empty($post_details[$p]['post_first_img']['0'])) {
                    $rps_img_src_path = $post_details[$p]['post_first_img']['0'];
                    if (!empty($rps_img_src_path)) {
                        $output .= '<a href="' . $post_details[$p]['post_permalink'] . '"><center><img src="' . $rps_img_src_path . '" alt="' . __($post_details[$p]['post_title'], 'rps') . '" /></center></a>';
                    }
                }
                if ($show_post_date) {
                    $output .= '<div class="post-date">' . __($post_date_text, 'rps') . ' ' . __($post_details[$p]['post_date'], 'rps') . '</div>';
                }
                $output .= '</p></div>';
            } elseif ($slider_content == 3) {
                $output .= '<p class="slider-content-both">';
                if (!empty($post_details[$p]['post_first_img']['0']) || !empty($post_details[$p]['post_excerpt'])) {
                    $rps_img_src_path = $post_details[$p]['post_first_img']['0'];
                    if (!empty($rps_img_src_path)) {
                        $output .= '<a href="' . $post_details[$p]['post_permalink'] . '"><img src="' . $rps_img_src_path . '" alt="' . __($post_details[$p]['post_title'], 'rps') . '" align="left" /></a>';
                    }
                    $output .= __($post_details[$p]['post_excerpt'], 'rps');
                }
                if ($show_post_date) {
                    $output .= '<div class="post-date">' . __($post_date_text, 'rps') . ' ' . __($post_details[$p]['post_date'], 'rps') . '</div>';
                }
                $output .= '</p></div>';
            }
            $p++;
            if ($p == $total_posts) {
                $p = 0;
            }
        }
        $output .= '<div class="clr"></div>
				</div>';
    }
    $output .= '
                </div>
            </div>
            <div class="paging">';
    for ($p = 1; $p <= $paging; $p++) {
        if ($pagination_style == '2') {
            $output .= '<a href="#" rel="' . $p . '">&bull;</a>';
        } elseif ($pagination_style == '1') {
            $output .= '<a href="#" rel="' . $p . '">' . $p . '</a>';
        } elseif ($pagination_style == '3') {
            $output .= '<a href="#" rel="' . $p . '">&nbsp;</a>';
        }
    }
    $output .= '</div>
        </div><div class="rps-clr"></div>';
    return $output;
}
Example #3
0
					<th>Content</th>
					<th>Created</th>
					<th style="white-space:nowrap;">Annotates</th>
				</tr>
			</thead>
			<tbody>
<?php 
    if (!empty($current_book_annotations)) {
        foreach ($current_book_annotations as $row) {
            $slug = $row->slug;
            $version = $row->versions[0];
            $desc_excerpt = create_excerpt($version->description, 10);
            if (strlen($version->description) == strlen($desc_excerpt)) {
                $desc_excerpt = null;
            }
            $content_excerpt = create_excerpt($version->content, 10);
            if (strlen($version->content) == strlen($content_excerpt)) {
                $content_excerpt = null;
            }
            echo '<tr typeof="pages" id="annotation_row_' . $row->content_id . '" class="bottom_border version content_id_' . $row->content_id . ' version_id_' . $version->version_id . ' ' . ($row->is_live ? '' : 'not_live') . '">';
            echo '<td style="white-space:nowrap;">';
            echo '<input type="checkbox" name="content_id_' . $row->content_id . '" value="1">&nbsp; <a href="javascript:;" onclick="edit_row($(this).parents(\'tr\'));" class="generic_button">Edit</a>';
            echo '</td>';
            echo '<td style="display:none" property="id">' . $row->content_id . '</td>';
            echo '<td class="editable boolean" property="is_live" style="text-align:center;width=65px;">' . $row->is_live . "</td>\n";
            echo '<td property="slug">';
            echo '<a href="' . confirm_slash(base_url()) . confirm_slash($book->slug) . $slug . '">' . $slug . '</a>';
            echo '</td>';
            echo '<td style="width:200px;">' . htmlspecialchars($version->title) . '</td>' . "\n";
            if ($desc_excerpt) {
                echo '<td><span class="full">' . htmlspecialchars($version->description) . '</span><span class="clip">' . htmlspecialchars($desc_excerpt) . '</span></td>' . "\n";
Example #4
0
 public function createThumbViewFields($view, $result, $highlight)
 {
     $thums = array();
     foreach ($view as $k => $v) {
         if (array_key_exists(strtolower($v), array_change_key_case($result, CASE_LOWER))) {
             if (isset($result[$v]) && $result[$v] != "") {
                 if (strlen(strip_tags($result[$v])) > 250) {
                     $newres = create_excerpt($result[$v], 250);
                     $thums[$k] = "<p><b class='rslt-key' title='" . $this->title_msg . " " . $v . ".' alt='" . $v . "'>" . htmlspecialchars_decode(formatkey($v)) . " : </b>" . html_entity_decode($newres) . "</p>";
                 } else {
                     $rsdc = "<span>" . html_entity_decode($result[$v]) . "</span>";
                     $thums[$k] = "<p><b class='rslt-key' title='" . $this->title_msg . " " . $v . ".' alt='" . $v . "'>" . htmlspecialchars_decode(formatkey($v)) . " : </b>" . html_entity_decode($rsdc) . "</p>";
                 }
             }
         }
     }
     if ($highlight) {
         $matches = array();
         foreach ($highlight as $hk => $hv) {
             if (is_array($hv)) {
                 $hv = htmlspecialchars_decode(implode(",", $hv));
             }
             $matches[] = " <em><b>" . formatkey($hk) . "</b></em> " . $hv;
         }
         $thums[] = "<p><b>Matches :</b>" . implode(", ", $matches) . "</p>";
     }
     return implode(" ", $thums);
 }
Example #5
0
        } else {
            if (isset($version->homepage)) {
                echo '<a href="' . $version->homepage . '">';
            }
            echo $version->fullname;
            if (isset($version->homepage)) {
                echo '</a>';
            }
        }
        ?>
		on 
		<?php 
        echo $date;
        ?>
		<?php 
        echo !empty($version->content) ? '<br />' . create_excerpt($content, 14) . ' <span style="color:#777777;">' . strlen($content) . ' chars</span>' : '';
        ?>
		<?php 
        echo !empty($version->url) ? '<br />URL: <a href="' . abs_url($version->url, $base_uri) . '">' . $version->url . '</a>' : '';
        ?>
		</li>
	<?php 
    }
    echo '</ol>' . "\n";
}
if ($login_is_super || in_array($book->book_id, $login_book_ids)) {
    ?>
		<input type="submit" value="Delete selected versions" class="generic_button" />&nbsp; &nbsp; <a href="javascript:" onclick="reorderVersionNums()">Re-order version numbers</a>
<?php 
}
?>
Example #6
0
					<th style="white-space:nowrap;">Subtitle</th>
					<!--<th style="white-space:nowrap;">Description</th>-->
					<th style="white-space:nowrap;">URI</th>
					<th style="white-space:nowrap;">Public</th>
					<th style="white-space:nowrap;">In index</th>
					<th style="white-space:nowrap;">Featured</th>
					<th style="white-space:nowrap;">Contributors</th>
					<th style="white-space:nowrap;">Created</th>
				</tr>
			</thead>
			<tbody>
<?php 
$count = 1;
if (!empty($books)) {
    foreach ($books as $row) {
        $desc_excerpt = create_excerpt($row->description);
        if (strlen($row->description) == strlen($desc_excerpt)) {
            $desc_excerpt = null;
        }
        echo '<tr class="bottom_border" typeof="books">';
        echo '<td style="white-space:nowrap;"><a href="javascript:;" onclick="edit_row($(this).parents(\'tr\'));" class="generic_button">Edit</a> <a style="color:#888888;" href="' . confirm_slash(base_url()) . 'system/dashboard?action=do_delete&delete=' . $row->book_id . '&type=books&zone=all-books#tabs-all-books" onclick="if (!confirm(\'Are you sure you wish to DELETE this book and all associated content?\')) return false;" class="generic_button">Remove</a></td>' . "\n";
        echo '<td property="id" style="display:none;">' . $row->book_id . "</td>\n";
        echo '<td property="book_id" style="display:none;">' . $row->book_id . "</td>\n";
        echo '<td class="editable" property="title" style="width:100px;">' . $row->title . "</td>\n";
        echo '<td class="editable" property="subtitle">' . $row->subtitle . "</td>\n";
        /*if ($desc_excerpt) {
        			echo '<td class="editable textarea excerpt" property="description"><span class="full">'.$row->description.'</span><span class="clip">'.$desc_excerpt.'</span></td>'."\n";
        		} else {
        			echo '<td class="editable textarea" property="description">'.$row->description.'</td>';
        		}	*/
        echo '<td class="editable has_link" property="slug"><a href="' . confirm_slash(base_url()) . $row->slug . '">' . $row->slug . "</a></td>\n";
Example #7
0
echo (isset($book) ? htmlspecialchars(trim(strip_tags($book->title))) . ': ' : '') . (isset($page->version_index) ? htmlspecialchars(trim(strip_tags($title))) : 'Untitled');
?>
" />
<meta property="og:site_name" content="<?php 
if (isset($book)) {
    echo htmlspecialchars(trim(strip_tags($book->title))) . (!empty($book->subtitle) ? ': ' . htmlspecialchars(trim(strip_tags($book->subtitle))) : '');
}
?>
" />
<meta property="og:url" content="<?php 
echo confirm_slash($base_uri) . (isset($page->version_index) ? $page->slug : '');
?>
" />
<meta property="og:description" content="<?php 
if (isset($page->version_index)) {
    echo htmlspecialchars(create_excerpt($page->versions[$page->version_index]->content, 34));
} else {
    echo htmlspecialchars(trim(strip_tags($description)));
}
?>
" />
<meta property="og:image" content="<?php 
echo $app_root;
?>
views/arbors/html5_RDFa/scalar_logo_300x300.png" />
<meta property="og:type" content="article" />
<?php 
if (isset($page) && !empty($page)) {
    ?>
<link rel="canonical" href="<?php 
    echo confirm_slash($base_uri) . $page->slug;
Example #8
0
		<td><a href="<?php 
        echo $page_uri . '.' . $version->version_num;
        ?>
"><?php 
        echo strip_tags($title);
        ?>
</a>
		<?php 
        echo $version->version_num == $page->versions[0]->version_num ? ' (<a href="' . $page_uri . '">Current</a>)' : '';
        ?>
		</td>

		<td>
		<?php 
        echo !empty($content) ? create_excerpt($content, 14) . ' <span style="color:#777777;">[' . strlen($content) . ' chars]</span><br />' : '';
        ?>
		<?php 
        echo !empty($version->url) ? 'URL: <a href="' . abs_url($version->url, $base_uri) . '">' . $version->url . '</a>' : '';
        ?>
		</td>

		<?php 
        echo '<td>';
        if (!empty($version->user->uri)) {
            echo '<a href="' . $version->user->uri . '">';
        }
        echo $version->user->fullname;
        if (isset($version->user->uri)) {
            echo '</a>';
        }
Example #9
0
					<th style="white-space:nowrap;">Title</th>
					<th style="white-space:nowrap;">Subtitle</th>
					<!--<th style="white-space:nowrap;">Description</th>-->
					<th style="white-space:nowrap;">URI</th>
					<th style="white-space:nowrap;">Public</th>
					<th style="white-space:nowrap;">In index</th>
					<th style="white-space:nowrap;">Featured</th>
					<th style="white-space:nowrap;">Contributors</th>
					<th style="white-space:nowrap;">Created</th>
				</tr>
			</thead>
			<tbody>
<?php 
if (!empty($books)) {
    for ($i = 0; $i < $count; $i++) {
        $desc_excerpt = create_excerpt($books[$i]->description);
        if (strlen($books[$i]->description) == strlen($desc_excerpt)) {
            $desc_excerpt = null;
        }
        echo '<tr class="bottom_border" typeof="books">';
        echo '<td style="white-space:nowrap;">';
        echo '<a href="javascript:;" onclick="edit_row($(this).parents(\'tr\'));" class="generic_button">Edit</a> ';
        echo '<a href="javascript:;" onclick="window.location.href=\'' . confirm_slash(base_url()) . 'system/dashboard?book_id=' . $books[$i]->book_id . '&zone=style#tabs-style\';" class="generic_button">Dashboard</a> ';
        echo '<a style="color:#888888;" href="' . confirm_slash(base_url()) . 'system/dashboard?action=do_delete&delete=' . $books[$i]->book_id . '&type=books&zone=all-books#tabs-all-books" onclick="if (!confirm(\'Are you sure you wish to DELETE this book and all associated content?\')) return false;" class="generic_button">Remove</a>';
        echo '</td>' . "\n";
        echo '<td property="id" style="display:none;">' . $books[$i]->book_id . "</td>\n";
        echo '<td property="book_id" style="display:none;">' . $books[$i]->book_id . "</td>\n";
        echo '<td class="editable" property="title" style="width:100px;">' . $books[$i]->title . "</td>\n";
        echo '<td class="editable" property="subtitle">' . $books[$i]->subtitle . "</td>\n";
        /*if ($desc_excerpt) {
        			echo '<td class="editable textarea excerpt" property="description"><span class="full">'.$books[$i]->description.'</span><span class="clip">'.$desc_excerpt.'</span></td>'."\n";