Changeset 612967
- Timestamp:
- 10/15/2012 10:32:06 PM (13 years ago)
- File:
-
- 1 edited
-
glass/trunk/glass.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
glass/trunk/glass.php
r612275 r612967 58 58 } 59 59 60 /* Check if this page has a featured image and FeaturedImage is on. */ 61 if (has_post_thumbnail($post->ID)) { 62 $featImage = $opt['myrtheGlassFeaturedImage'] or $featImage = 'n'; 63 if ($featImage == 'y') { return true; } 64 } 65 60 66 /* Check if category is allowed or not. */ 61 67 if (is_category() || is_single()) { … … 90 96 } 91 97 98 function featuredImageURL() 99 { 100 if (function_exists('has_post_thumbnail') 101 && has_post_thumbnail($post->ID)) { 102 $fid = get_post_thumbnail_id($post->ID); 103 $img = wp_get_attachment_image_src($fid, 'full'); 104 return $img[0]; 105 } 106 return 'n'; 107 } 108 92 109 /* Add all 'myrtheGlass' defaults to document for JavaScript usage. */ 93 110 function addDefaults() … … 101 118 echo "\n"; 102 119 echo "<script type='text/javascript'> // .oOXOo. Glass plugin.\n"; 103 foreach ($myrtheGlassOptions as $key => $value) 104 if (substr($key, 0, 11) == 'myrtheGlass') 120 foreach ($myrtheGlassOptions as $key => $value) { 121 if (substr($key, 0, 11) == 'myrtheGlass') { 122 if ($key == 'myrtheGlassFeaturedImage' && $value == 'y') 123 $value = $this->featuredImageURL(); /* Sneeky replace. */ 105 124 echo " document.$key='$value';\n"; 125 } 126 } 106 127 /* Add basename for image URLs. */ 107 128 $url = get_settings('home') … … 137 158 'myrtheGlassCategories' => '', 138 159 'myrtheGlassOnFrontPage' => 'y', 160 'myrtheGlassFeaturedImage' => 'n', 139 161 'myrtheGlassPages' => '', 140 162 'myrtheGlassExcludePlatforms' => 'iPod', … … 176 198 if (isset($_POST['update_MyrtheGlassSettings'])) { 177 199 178 /* If OnFrontPage is not selected, it won't bein the $_POST. */200 /* If checkboxes are not selected they are not in the $_POST. */ 179 201 $myrtheGlassOptions['myrtheGlassOnFrontPage'] = 'n'; 202 $myrtheGlassOptions['myrtheGlassFeaturedImage'] = 'n'; 180 203 181 204 /* Update all the updatables from $_POST to own array. */ … … 400 423 echo "</td>\n"; 401 424 425 /* Featured Image, yes or no? */ 426 $key = "myrtheGlassFeaturedImage"; 427 $val = $myrtheGlassOptions[$key]; 428 $expl = "Activate Glass for the Featured Image"; 429 $name = preg_replace('/([A-Z])/', ' $1',$key); 430 $name = preg_replace('/myrthe /', '',$name); 431 432 echo "<tr><td>"; 433 echo "<input type='checkbox' name='$key' id='$key' value='y'"; 434 if ($val == 'y') { echo " checked='checked'"; } 435 echo " /> $name"; 436 echo "</td><td>"; 437 echo "<label for='key'>"; 438 echo "$expl"; 439 echo "</label>"; 440 echo "</td>\n"; 441 402 442 /* Maybe use only specified categories. */ 403 443 $key = "myrtheGlassCategories";
Note: See TracChangeset
for help on using the changeset viewer.