From e51c4a38ad463d5cc26f0e940523126b89c91e4d Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 24 Jan 2018 16:54:52 -0500 Subject: [PATCH] Fix util/php2po - Remove use - Simplify object handling - Fix wrong `|| die()` structure --- util/php2po.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) mode change 100644 => 100755 util/php2po.php diff --git a/util/php2po.php b/util/php2po.php old mode 100644 new mode 100755 index cc3b00e718..e28c91daff --- a/util/php2po.php +++ b/util/php2po.php @@ -1,3 +1,4 @@ +#!/usr/bin/env php */ -use Friendica\App; - DEFINE("NORM_REGEXP", "|[\\\]|"); -if(! class_exists('App')) { - class TmpA { - public $strings = []; - } - $a = new TmpA(); -} +$a = new stdClass(); if ($argc<2 || in_array('-h', $argv) || in_array('--h', $argv)) { print "Usage: ".$argv[0]." [-p ] \n\n"; @@ -93,8 +87,14 @@ print "\nLoading base message.po..."; // load base messages.po and extract msgids $base_msgids = []; $norm_base_msgids = []; -$base_f = file("util/messages.po") || die("No base messages.po\n"); -$_f = 0; $_mid = ""; $_mids = []; +$base_f = file("util/messages.po"); +if (!$base_f) { + die("No base messages.po\n"); +} + +$_f = 0; +$_mid = ""; +$_mids = []; foreach( $base_f as $l) { $l = trim($l); //~ print $l."\n";