artworkUrl100;
if(ios_app_setting('cache_images_locally') == '1')
{
$upload_dir = wp_upload_dir();
$artwork_url = $upload_dir['baseurl'] . '/ios-app/' . $app->trackId . '/' . basename($app->artworkUrl100);
}
?>
trackName; ?> version; ?>
userRatingCount)) { ?>
Rated averageUserRating; ?> out of 5 by userRatingCount; ?> users.
price == 0) { ?>
Free!
Only $price; ?>!
Latest Release Notes:
releaseNotes); ?>
Description:
description); ?>
screenshotUrls) > 0) { ?>
iPhone Screenshots:
screenshotUrls as $ssurl) {
$ssurl = str_replace(".png", ".320x480-75.jpg", $ssurl);
if(ios_app_setting('cache_images_locally') == '1')
{
$upload_dir = wp_upload_dir();
$ssurl = $upload_dir['baseurl'] . '/ios-app/' . $app->trackId . '/' . basename($ssurl);
}
echo '
';
}
?>
ipadScreenshotUrls) > 0) { ?>
iPad Screenshots:
ipadScreenshotUrls as $ssurl) {
if(ios_app_setting('cache_images_locally') == '1')
{
$upload_dir = wp_upload_dir();
$ssurl = $upload_dir['baseurl'] . '/ios-app/' . $app->trackId . '/' . basename($ssurl);
}
echo '
';
}
?>
''
), $atts ) );
return $id;
}
function ios_app_save_images_locally($app) {
$upload_dir = wp_upload_dir();
if(!is_writeable($upload_dir['basedir'])) {
//Uploads dir isn't writeable. bummer.
ios_app_set_setting('cache_images_locally', '0');
return;
} else {
//Loop through screenshots and the app icons and cache everything
if(!is_dir($upload_dir['basedir'] . '/ios-app/' . $app->trackId)) {
if(!mkdir($upload_dir['basedir'] . '/ios-app/' . $app->trackId, 0755, true))
{
ios_app_set_setting('cache_images_locally', '0');
return;
}
}
$urls_to_cache = array();
$urls_to_cache[] = $app->artworkUrl60;
$urls_to_cache[] = $app->artworkUrl100;
$urls_to_cache[] = $app->artworkUrl512;
foreach($app->screenshotUrls as $ssurl) {
$ssurl2 = str_replace(".png", ".320x480-75.jpg", $ssurl);
$urls_to_cache[] = $ssurl;
$urls_to_cache[] = $ssurl2;
}
foreach($app->ipadScreenshotUrls as $ssurl) {
$ssurl2 = str_replace(".png", ".320x480-75.jpg", $ssurl);
$urls_to_cache[] = $ssurl;
$urls_to_cache[] = $ssurl2;
}
foreach($urls_to_cache as $url) {
$content = ios_app_fopen_or_curl($url);
if($fp = fopen($upload_dir['basedir'] . '/ios-app/' . $app->trackId . '/' . basename($url), "w+"))
{
fwrite($fp, $content);
fclose($fp);
}
else {
//Couldnt write the file. Permissions must be wrong.
ios_app_set_setting('cache_images_locally', '0');
return;
}
}
}
}
$app_display_page_settings = array();
function ios_app_setting($name) {
global $app_display_page_settings;
$app_display_page_settings = get_option('adp_options');
if(!$app_display_page_settings) {
adp_add_defaults();
$app_display_page_settings = get_option('adp_options');
}
return $app_display_page_settings[$name];
}
function ios_app_set_setting($name, $value) {
global $app_display_page_settings;
$app_display_page_settings = get_option('adp_options');
if(!$app_display_page_settings) {
adp_add_defaults();
$app_display_page_settings = get_option('adp_options');
}
$app_display_page_settings[$name] = $value;
}
?>