Categories Images - Version 2.4

Version Description

  • Adding language support for Spanish (Thansk so much to Maria Ramos [http://webhostinghub.com]).
  • Adding support for resizing categories images (Thanks so much to Rahil Wazir).
  • Some code enhancements.
Download this release

Release Info

Developer elzahlan
Plugin Icon 128x128 Categories Images
Version 2.4
Comparing to
See all releases

Code changes from version 2.3.2 to 2.4

categories-images.php CHANGED
@@ -1,12 +1,12 @@
1
  <?php
2
- /*
3
- Plugin Name: Categories Images
4
- Plugin URI: http://zahlan.net/blog/2012/06/categories-images/
5
- Description: Categories Images Plugin allow you to add an image to category or any custom term.
6
- Author: Muhammad Said El Zahlan
7
- Version: 2.3.2
8
- Author URI: http://zahlan.net/
9
- */
10
  ?>
11
  <?php
12
  if (!defined('Z_PLUGIN_URL'))
@@ -161,8 +161,16 @@ function z_save_taxonomy_image($term_id) {
161
  update_option('z_taxonomy_image'.$term_id, $_POST['taxonomy_image']);
162
  }
163
 
164
- // output taxonomy image url for the given term_id (NULL by default)
165
- function z_taxonomy_image_url($term_id = NULL, $return_placeholder = FALSE) {
 
 
 
 
 
 
 
 
166
  if (!$term_id) {
167
  if (is_category())
168
  $term_id = get_query_var('cat');
@@ -171,9 +179,18 @@ function z_taxonomy_image_url($term_id = NULL, $return_placeholder = FALSE) {
171
  $term_id = $current_term->term_id;
172
  }
173
  }
174
- $taxonomy_image_url = get_option('z_taxonomy_image'.$term_id);
175
- if ($return_placeholder)
176
- return ($taxonomy_image_url != "") ? $taxonomy_image_url : Z_IMAGE_PLACEHOLDER;
 
 
 
 
 
 
 
 
 
177
  else
178
  return $taxonomy_image_url;
179
  }
1
  <?php
2
+ /**
3
+ * Plugin Name: Categories Images
4
+ * Plugin URI: http://zahlan.net/blog/2012/06/categories-images/
5
+ * Description: Categories Images Plugin allow you to add an image to category or any custom term.
6
+ * Author: Muhammad Said El Zahlan
7
+ * Version: 2.4
8
+ * Author URI: http://zahlan.net/
9
+ */
10
  ?>
11
  <?php
12
  if (!defined('Z_PLUGIN_URL'))
161
  update_option('z_taxonomy_image'.$term_id, $_POST['taxonomy_image']);
162
  }
163
 
164
+ // get attachment ID by image url
165
+ function z_get_attachment_id_by_url($image_src) {
166
+ global $wpdb;
167
+ $query = "SELECT ID FROM {$wpdb->posts} WHERE guid = '$image_src'";
168
+ $id = $wpdb->get_var($query);
169
+ return (!empty($id)) ? $id : NULL;
170
+ }
171
+
172
+ // get taxonomy image url for the given term_id (Place holder image by default)
173
+ function z_taxonomy_image_url($term_id = NULL, $size = NULL, $return_placeholder = FALSE) {
174
  if (!$term_id) {
175
  if (is_category())
176
  $term_id = get_query_var('cat');
179
  $term_id = $current_term->term_id;
180
  }
181
  }
182
+
183
+ $taxonomy_image_url = get_option('z_taxonomy_image'.$term_id);
184
+ $attachment_id = z_get_attachment_id_by_url($taxonomy_image_url);
185
+ if(!empty($attachment_id)) {
186
+ if (empty($size))
187
+ $size = 'full';
188
+ $taxonomy_image_url = wp_get_attachment_image_src($attachment_id, $size);
189
+ $taxonomy_image_url = $taxonomy_image_url[0];
190
+ }
191
+
192
+ if ($return_placeholder)
193
+ return ($taxonomy_image_url != '') ? $taxonomy_image_url : Z_IMAGE_PLACEHOLDER;
194
  else
195
  return $taxonomy_image_url;
196
  }
languages/zci-es_ES.mo ADDED
Binary file
languages/zci-es_ES.po ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Categories Images\n"
4
+ "POT-Creation-Date: 2013-06-14 04:42+0200\n"
5
+ "PO-Revision-Date: 2013-10-22 12:28+0100\n"
6
+ "Last-Translator: jelena kovacevic <jecajeca260@gmail.com>\n"
7
+ "Language-Team: Marc Frèrebeau <marc.frerebeau@agama.fr>\n"
8
+ "Language: ar\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.5\n"
13
+ "X-Poedit-KeywordsList: _;__;_e\n"
14
+ "X-Poedit-Basepath: ../\n"
15
+ "X-Poedit-SourceCharset: UTF-8\n"
16
+ "X-Poedit-SearchPath-0: .\n"
17
+
18
+ #: categories-images.php:59 categories-images.php:80 categories-images.php:207
19
+ msgid "Image"
20
+ msgstr "Image"
21
+
22
+ #: categories-images.php:62 categories-images.php:82 categories-images.php:189
23
+ msgid "Upload/Add image"
24
+ msgstr "Subir/Adicionar imagen"
25
+
26
+ #: categories-images.php:83 categories-images.php:190
27
+ msgid "Remove image"
28
+ msgstr "Eliminar imagen"
29
+
30
+ #: categories-images.php:225
31
+ msgid "Thumbnail"
32
+ msgstr "Miniatura"
33
+
34
+ #: categories-images.php:245 categories-images.php:252
35
+ msgid "Categories Images settings"
36
+ msgstr "configuración de Imágenes Categorías"
37
+
38
+ #: categories-images.php:245 categories-images.php:283
39
+ msgid "Categories Images"
40
+ msgstr "Imágenes Categorías"
41
+
42
+ #: categories-images.php:253
43
+ msgid "Excluded Taxonomies"
44
+ msgstr "Taxonomías Excluidas"
45
+
46
+ #: categories-images.php:258
47
+ msgid ""
48
+ "Please select the taxonomies you want to exclude it from Categories Images "
49
+ "plugin"
50
+ msgstr ""
51
+ "Por favor seleccione las taxonomías que desea excluir del plugin Imágenes "
52
+ "Categorías"
53
+
54
+ #: categories-images.php:278
55
+ msgid "You do not have sufficient permissions to access this page."
56
+ msgstr "No tiene los suficientes permisos para acceder esta página."
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: elzahlan
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=G8LC4VSYKYSGA
4
  Tags: Category Image, Category Images, Categories Images, taxonomy image, taxonomy images, taxonomies images, category icon, categories icons, category logo, categories logos, admin, wp-admin, category image plugin, categories images plugin
5
  Requires at least: 2.8
6
- Tested up to: 3.6
7
- Stable tag: 2.3.2
8
 
9
  The Categories Images Plugin allow you to add image with category or taxonomy.
10
 
@@ -57,6 +57,11 @@ Please check the documentation page:
57
 
58
  == Changelog ==
59
 
 
 
 
 
 
60
  = 2.3.2 =
61
  * Adding language support for French.
62
 
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=G8LC4VSYKYSGA
4
  Tags: Category Image, Category Images, Categories Images, taxonomy image, taxonomy images, taxonomies images, category icon, categories icons, category logo, categories logos, admin, wp-admin, category image plugin, categories images plugin
5
  Requires at least: 2.8
6
+ Tested up to: 3.8
7
+ Stable tag: 2.4
8
 
9
  The Categories Images Plugin allow you to add image with category or taxonomy.
10
 
57
 
58
  == Changelog ==
59
 
60
+ = 2.4 =
61
+ * Adding language support for Spanish (Thansk so much to Maria Ramos [http://webhostinghub.com]).
62
+ * Adding support for resizing categories images (Thanks so much to Rahil Wazir).
63
+ * Some code enhancements.
64
+
65
  = 2.3.2 =
66
  * Adding language support for French.
67