[gnome-web-wppo] avoid error when analysing dynamic PO files (which doesn't contain bloginfo tags)
- From: Vinicius Scopel Depizzol <vdepizzol src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-web-wppo] avoid error when analysing dynamic PO files (which doesn't contain bloginfo tags)
- Date: Sat, 10 Mar 2012 21:09:40 +0000 (UTC)
commit 6353dea451fdd74dfcf7d78a8c7f8f234b786b14
Author: Vinicius Depizzol <vdepizzol gmail com>
Date: Sat Mar 10 18:04:45 2012 -0300
avoid error when analysing dynamic PO files (which doesn't contain bloginfo tags)
backend.php | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/backend.php b/backend.php
index eba4040..e60576a 100644
--- a/backend.php
+++ b/backend.php
@@ -230,16 +230,18 @@ function wppo_check_for_po_changes($force = false, $coverage = array('dynamic',
*/
$bloginfo = $dom->getElementsByTagName('bloginfo');
- foreach ($bloginfo->item(0)->childNodes as $option) {
- if (get_class($option) == 'DOMElement') {
- $option_node['option_name'] = $option->nodeName;
- $option_node['lang'] = $lang;
- $option_node['translated_value'] = $option->nodeValue;
-
- if (!$wpdb->get_row("SELECT option_name FROM ".WPPO_PREFIX."options WHERE option_name = '". mysql_real_escape_string($option_node['option_name']) ."' AND lang = '". mysql_real_escape_string($lang) ."'")) {
- $wpdb->insert(WPPO_PREFIX."options", $option_node);
- } else {
- $wpdb->update(WPPO_PREFIX."options", $option_node, array('option_name' => $option_node['options_name'], 'lang' => $lang));
+ if ($bloginfo->item(0) != null) {
+ foreach ($bloginfo->item(0)->childNodes as $option) {
+ if (get_class($option) == 'DOMElement') {
+ $option_node['option_name'] = $option->nodeName;
+ $option_node['lang'] = $lang;
+ $option_node['translated_value'] = $option->nodeValue;
+
+ if (!$wpdb->get_row("SELECT option_name FROM ".WPPO_PREFIX."options WHERE option_name = '". mysql_real_escape_string($option_node['option_name']) ."' AND lang = '". mysql_real_escape_string($lang) ."'")) {
+ $wpdb->insert(WPPO_PREFIX."options", $option_node);
+ } else {
+ $wpdb->update(WPPO_PREFIX."options", $option_node, array('option_name' => $option_node['options_name'], 'lang' => $lang));
+ }
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]