Default featured image - Version 1.2

Version Description

Download this release

Release Info

Developer janw.oostendorp
Plugin Icon 128x128 Default featured image
Version 1.2
Comparing to
See all releases

Code changes from version 1.1 to 1.2

languages/default-featured-image-nl_NL_1.mo DELETED
Binary file
languages/default-featured-image-nl_NL_1.po DELETED
@@ -1,39 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Default featured Image\n"
4
- "POT-Creation-Date: 2012-12-24 16:42+0100\n"
5
- "PO-Revision-Date: 2012-12-24 16:42+0100\n"
6
- "Last-Translator: Jan Willem Oostendorp <janw.oostendorp@gmail.com>\n"
7
- "Language-Team: Jan Willem Oostendorp <janw.oostendorp@gmail.com>\n"
8
- "Language: nl_NL\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 1.5.3\n"
13
- "X-Poedit-KeywordsList: __;_e\n"
14
- "X-Poedit-Basepath: ../\n"
15
- "X-Poedit-SearchPath-0: .\n"
16
-
17
- #: set-default-featured-image.php:44
18
- msgid "Default featured image"
19
- msgstr "Standaard uitgelichte afbeelding"
20
-
21
- #: set-default-featured-image.php:65 set-default-featured-image.php:67
22
- #: set-default-featured-image.php:90
23
- msgid "Select default featured image"
24
- msgstr "Selecteer een standaard uitgelichte afbeelding"
25
-
26
- #: set-default-featured-image.php:70 set-default-featured-image.php:71
27
- msgid "Don't use a default featured image"
28
- msgstr "Geen standaard uitgelichte afbeelding"
29
-
30
- #: set-default-featured-image.php:91
31
- msgid "Set default featured image"
32
- msgstr "Zet standaard uitgelichte afbeelding"
33
-
34
- #: set-default-featured-image.php:126
35
- msgid "Settings"
36
- msgstr "Instellingen"
37
-
38
- #~ msgid "Select a default featured image"
39
- #~ msgstr "Selecteer een standaard uitgelichte afbeelding"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: janwoostendorp
3
  Tags: media, image
4
  Requires at least: 3.5
5
  Tested up to: 3.8.1
6
- Stable tag: 1.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
3
  Tags: media, image
4
  Requires at least: 3.5
5
  Tested up to: 3.8.1
6
+ Stable tag: 1.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
set-default-featured-image.php CHANGED
@@ -1,12 +1,12 @@
1
  <?php
2
- /*
3
- plugin name: Default featured image
4
- Plugin URI: http://wordpress.org/extend/plugins/default-featured-image/
5
- Description: Allows users to select a default feartured image in the media settings
6
- Version: 1.0
7
- Author: Jan Willem Oostendorp
8
- License: GPLv2 or later
9
- */
10
 
11
  class default_featured_image
12
  {
@@ -43,15 +43,25 @@ class default_featured_image
43
  load_plugin_textdomain(self::L10n, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
44
  }
45
 
46
- function set_dfi_meta_key( $null, $object_id, $meta_key, $single ) {
47
- if ( is_admin() )
48
- return;
49
-
50
- // only affect thumbnails
51
- if ( '_thumbnail_id' != $meta_key )
52
- return;
 
 
 
 
 
 
 
 
 
 
 
53
 
54
- //@see /wp-includes/meta.php get_metadata()
55
  $meta_type = 'post';
56
  $meta_cache = wp_cache_get($object_id, $meta_type . '_meta');
57
 
@@ -71,7 +81,8 @@ class default_featured_image
71
  }
72
 
73
  if ($single)
74
- return get_option( 'dfi_image_id' ); // set the default featured img ID
 
75
  else
76
  return array();
77
  }
@@ -193,9 +204,6 @@ class default_featured_image
193
  if ( $default_thumbnail_id != $post_thumbnail_id )
194
  return $html;
195
 
196
- // allow to set an other ID see the readme.txt for details
197
- $default_thumbnail_id = apply_filters( 'dfi_thumbnail_id', $default_thumbnail_id );
198
-
199
  if (isset($attr['class']) ) {
200
  $attr['class'] .= " default-featured-img";
201
  } else {
1
  <?php
2
+ /**
3
+ * plugin name: Default featured image
4
+ * Plugin URI: http://wordpress.org/extend/plugins/default-featured-image/
5
+ * Description: Allows users to select a default feartured image in the media settings
6
+ * Version: 1.2
7
+ * Author: Jan Willem Oostendorp
8
+ * License: GPLv2 or later
9
+ */
10
 
11
  class default_featured_image
12
  {
43
  load_plugin_textdomain(self::L10n, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
44
  }
45
 
46
+ /**
47
+ * Mostly the same as `get_metadata()` makes sure any postthumbnail function gets checked at
48
+ * the deepest level possible.
49
+ *
50
+ * @see /wp-includes/meta.php get_metadata()
51
+ *
52
+ * @param null $null
53
+ * @param int $object_id ID of the object metadata is for
54
+ * @param string $meta_key Optional. Metadata key. If not specified, retrieve all metadata for
55
+ * the specified object.
56
+ * @param bool $single Optional, default is false. If true, return only the first value of the
57
+ * specified meta_key. This parameter has no effect if meta_key is not specified.
58
+ * @return string|array Single metadata value, or array of values
59
+ */
60
+ function set_dfi_meta_key( $null = null, $object_id, $meta_key, $single ) {
61
+ // only affect thumbnails on the frontend
62
+ if ( is_admin() || '_thumbnail_id' != $meta_key )
63
+ return $null;
64
 
 
65
  $meta_type = 'post';
66
  $meta_cache = wp_cache_get($object_id, $meta_type . '_meta');
67
 
81
  }
82
 
83
  if ($single)
84
+ // allow to set an other ID see the readme.txt for details
85
+ return apply_filters( 'dfi_thumbnail_id', get_option( 'dfi_image_id' ) ); // set the default featured img ID
86
  else
87
  return array();
88
  }
204
  if ( $default_thumbnail_id != $post_thumbnail_id )
205
  return $html;
206
 
 
 
 
207
  if (isset($attr['class']) ) {
208
  $attr['class'] .= " default-featured-img";
209
  } else {