';
return $aps_organisation_return;
} // end if organisation
if ($type == "person") {
$aps_person_return = '
';
// create a default image, in case neither email nor url are added - in this case a 1x1 px transparent png
//get image location
$aps_gravatar_default = APSCHEMA_URLPATH . "/images/gravatar_dot.png";
$aps_gravatar_default = urlencode( $aps_gravatar_default );
$aps_new_pretty_date_birth = aps_pretty_date($aps_get_schema_data->person_birthday);
// only one can rule! in this case url trumps email
if($aps_get_schema_data->person_photo_url != '' && $aps_get_schema_data->person_email != '') {
$aps_get_schema_data->person_email = "";
} else { $aps_get_schema_data->person_email = $aps_get_schema_data->person_email; }
//now depending on what source we have show that as image or if no source, show nothing.
if($aps_get_schema_data->person_photo_url != '' && $aps_get_schema_data->person_email == '') {
$aps_person_return .= '';
} elseif ($aps_get_schema_data->person_email != '' && $aps_get_schema_data->person_photo_url == '') {
$aps_gravatar_email = md5( strtolower( trim( $aps_get_schema_data->person_email ) ) );
$aps_person_return .= '';
} else { echo ''; }
$aps_person_return .= '
';
return $aps_person_return;
} // end if person
if ($type == "product") {
//get the star option
$aps_star_option = get_option( '_ap-schema--options' );
$aps_star_option = $aps_star_option['reviewicons'];
if($aps_get_schema_data->product_startype == '') { $aps_get_schema_data->product_startype = $aps_star_option;}
//get the currency symbol
$aps_price_option = get_option( '_ap-schema--options' );
$aps_price_option = $aps_price_option['aps_price'];
//get the star size
$aps_starsize_option = get_option( '_ap-schema--options' );
$aps_starsize_option = $aps_starsize_option['reviewicons_size'];
if ($aps_starsize_option == '') {$aps_starsize_option = '32';}
/***********************
*
* Star generation
*
**********************/
//set defaults
$aps_product_avg_rating = $aps_get_schema_data->product_avg_rating;
$aps_nearest_half = '';
$aps_decimal = '';
//round to neareast half
//https://forums.digitalpoint.com/threads/round-number-to-nearest-half.943055/
if($aps_product_avg_rating >= ($half = ($ceil = ceil($aps_product_avg_rating))- 0.5) + 0.25) {
$aps_nearest_half = $ceil;
} else if($aps_product_avg_rating < $half - 0.25) {
$aps_nearest_half = floor($aps_product_avg_rating); }
else {$aps_nearest_half = $half; }
//get the decimal check variable set
$aps_decimal = $aps_nearest_half;
//floor the nearest half variable
$aps_floored_nearest_half = floor($aps_nearest_half);
//generate stars based on floored value
$star_list = ""; //set variable
$star_url = '';
$i = 0;
$max_count = $aps_floored_nearest_half;
//// Lets max the count out at 100 so people dont add in stupid numbers and crash their site ////
if ( $max_count > 100 ) { $max_count = 100; }
/////////////////////////////////////////////////////////////////////////////////////////////////
while ($i < $max_count ) {
$star_list .= $star_url . '';
++$i;
}
//check if there is a decimal place - not that fucking easy as the ceil/floor return a float, even if the actual number is a whole number!
//http://stackoverflow.com/questions/11041590/whole-number-or-decimal-number
if ( is_numeric( $aps_decimal ) && strpos( $aps_decimal, '.' ) === false ) { $aps_decimal = "false";} else { $aps_decimal = "true";}
if($aps_decimal === "true") { $star_list .= ''; }
//top score possible
//need a new setting for products i think!
$aps_product_top_score = $aps_get_schema_data->product_max_score;
//get the empty star count
$aps_empty_starcount = $aps_product_top_score - $aps_nearest_half;
$aps_empty_starcount = floor($aps_empty_starcount);
//// Lets max the count out at 100 so people dont add in stupid numbers and crash their site ////
if ( $aps_empty_starcount > 100 ) { $aps_empty_starcount = 100; }
/////////////////////////////////////////////////////////////////////////////////////////////////
//add emtpy stars
$empty_star_url = '';
$i = 0;
$empty_max_count = $aps_empty_starcount;
while ($i < $empty_max_count ) {
$star_list .= $empty_star_url . '';
++$i;
}
// END OF STAR GENERATION
$aps_product_return = '
';
return $aps_product_return;
} // end if product
if ($type == "recipe") {
$aps_new_pretty_date_recipe_pub_date = aps_pretty_date($aps_get_schema_data->recipe_pub_date);
//get the star option
$aps_star_option = get_option( '_ap-schema--options' );
$aps_star_option = $aps_star_option['reviewicons'];
if($aps_get_schema_data->recipe_startype == '') { $aps_get_schema_data->recipe_startype = $aps_star_option;}
//get the star size
$aps_starsize_option = get_option( '_ap-schema--options' );
$aps_starsize_option = $aps_starsize_option['reviewicons_size'];
if ($aps_starsize_option == '') {$aps_starsize_option = '32';}
/***********************
* Star generation
**********************/
//set defaults
$aps_recipe_rating = $aps_get_schema_data->recipe_rating;
$aps_nearest_half = '';
$aps_decimal = '';
//round to neareast half
//https://forums.digitalpoint.com/threads/round-number-to-nearest-half.943055/
if($aps_recipe_rating >= ($half = ($ceil = ceil($aps_recipe_rating))- 0.5) + 0.25) {
$aps_nearest_half = $ceil;
} else if($aps_recipe_rating < $half - 0.25) {
$aps_nearest_half = floor($aps_recipe_rating); }
else {$aps_nearest_half = $half; }
//get the decimal check variable set
$aps_decimal = $aps_nearest_half;
//floor the nearest half variable
$aps_floored_nearest_half = floor($aps_nearest_half);
//generate stars based on floored value
$star_list = ""; //set variable
$star_url = '';
$i = 0;
$max_count = $aps_floored_nearest_half;
//// Lets max the count out at 100 so people dont add in stupid numbers and crash their site ////
if ( $max_count > 100 ) { $max_count = 100; }
/////////////////////////////////////////////////////////////////////////////////////////////////
while ($i < $max_count ) {
$star_list .= $star_url . '';
++$i;
}
//check if there is a decimal place - not that fucking easy as the ceil/floor return a float, even if the actual number is a whole number!
//http://stackoverflow.com/questions/11041590/whole-number-or-decimal-number
if ( is_numeric( $aps_decimal ) && strpos( $aps_decimal, '.' ) === false ) { $aps_decimal = "false";} else { $aps_decimal = "true";}
if($aps_decimal === "true") { $star_list .= ''; }
//top score possible
//need a new setting for recipes i think!
$aps_recipe_top_score = $aps_get_schema_data->recipe_rating_max;
//get the empty star count
$aps_empty_starcount = $aps_recipe_top_score - $aps_nearest_half;
$aps_empty_starcount = floor($aps_empty_starcount);
//add emtpy stars
$empty_star_url = '';
$i = 0;
$empty_max_count = $aps_empty_starcount;
//// Lets max the count out at 100 so people dont add in stupid numbers and crash their site ////
if ( $empty_max_count > 100 ) { $empty_max_count = 100; }
/////////////////////////////////////////////////////////////////////////////////////////////////
while ($i < $empty_max_count ) {
$star_list .= $empty_star_url . '';
++$i;
}
// END OF STAR GENERATION
//variable is comma separated string, grab it, explode and list each via for each.
//$aps_recipe_ingredients = explode(',', $aps_get_schema_data->recipe_ingredients);
$aps_recipe_ingredients = unserialize($aps_get_schema_data->recipe_ingredients);
$aps_show_ingredients = "";
foreach ($aps_recipe_ingredients as $ingredients) {
if($ingredients['value'] != '' ) {
$aps_show_ingredients .= '
';
return $aps_recipe_return;
} // end if recipe
if ($type == "review") {
$aps_new_pretty_date_review = aps_pretty_date($aps_get_schema_data->review_pub_date);
//get the star option
$aps_star_option = get_option( '_ap-schema--options' );
$aps_star_option = $aps_star_option['reviewicons'];
if($aps_get_schema_data->review_startype == '') { $aps_get_schema_data->review_startype = $aps_star_option;}
//get the currency symbol
$aps_price_option = get_option( '_ap-schema--options' );
$aps_price_option = $aps_price_option['aps_price'];
//get the star size
$aps_starsize_option = get_option( '_ap-schema--options' );
$aps_starsize_option = $aps_starsize_option['reviewicons_size'];
if ($aps_starsize_option == '') {$aps_starsize_option = '32';}
//get the Google ID
$aps_googleid_option = get_option( '_ap-schema--options' );
$aps_googleid_option = $aps_googleid_option['aps_google_id'];
/***********************
* Star generation
**********************/
//set defaults
$aps_review_rating = $aps_get_schema_data->review_rating;
$aps_nearest_half = '';
$aps_decimal = '';
//round to neareast half
//https://forums.digitalpoint.com/threads/round-number-to-nearest-half.943055/
if($aps_review_rating >= ($half = ($ceil = ceil($aps_review_rating))- 0.5) + 0.25) {
$aps_nearest_half = $ceil;
} else if($aps_review_rating < $half - 0.25) {
$aps_nearest_half = floor($aps_review_rating); }
else {$aps_nearest_half = $half; }
//get the decimal check variable set
$aps_decimal = $aps_nearest_half;
//floor the nearest half variable
$aps_floored_nearest_half = floor($aps_nearest_half);
//generate stars based on floored value
$star_list = ""; //set variable
$star_url = '';
$i = 0;
$max_count = $aps_floored_nearest_half;
//// Lets max the count out at 100 so people dont add in stupid numbers and crash their site ////
if ( $max_count > 100 ) { $max_count = 100; }
/////////////////////////////////////////////////////////////////////////////////////////////////
while ($i < $max_count ) {
$star_list .= $star_url . '';
++$i;
}
//check if there is a decimal place - not that fucking easy as the ceil/floor return a float, even if the actual number is a whole number!
//http://stackoverflow.com/questions/11041590/whole-number-or-decimal-number
if ( is_numeric( $aps_decimal ) && strpos( $aps_decimal, '.' ) === false ) { $aps_decimal = "false";} else { $aps_decimal = "true";}
if($aps_decimal === "true") { $star_list .= ''; }
//top score possible
//need a new setting for reviews i think!
$aps_review_top_score = $aps_get_schema_data->review_rating_max;
//get the empty star count
$aps_empty_starcount = $aps_review_top_score - $aps_nearest_half;
$aps_empty_starcount = floor($aps_empty_starcount);
//add emtpy stars
$empty_star_url = '';
$i = 0;
$empty_max_count = $aps_empty_starcount;
//// Lets max the count out at 100 so people dont add in stupid numbers and crash their site ////
if ( $empty_max_count > 100 ) { $empty_max_count = 100; }
/////////////////////////////////////////////////////////////////////////////////////////////////
while ($i < $empty_max_count ) {
$star_list .= $empty_star_url . '';
++$i;
}
// END OF STAR GENERATION
$aps_review_return = '