Просмотр исходного кода

Support New Language Constants Format

own3mall 8 лет назад
Родитель
Сommit
7209b90188
2 измененных файлов с 6 добавлено и 4 удалено
  1. 6 3
      includes/helpers.php
  2. 0 1
      includes/lang.php

+ 6 - 3
includes/helpers.php

@@ -22,6 +22,9 @@
  *
  */
 
+// Globals
+$OGPLangPre = "OGP_LANG_";
+
 // Ignore any request with unwanted values at 'm' or 'p'
 if( isset($_REQUEST['m']) and !preg_match("/^([a-z]|[0-9]|_|-)+$/i", $_REQUEST['m']) )
 	unset($_POST['m'], $_GET['m'], $_REQUEST['m']);
@@ -398,11 +401,12 @@ function getGitHubOrganization($gitHubURL){
 }
 
 function getOGPLangConstantsJSON(){
+	global $OGPLangPre;
 	$finalConsts = array();
+	
 	$consts = get_defined_constants(true);
 	foreach($consts["user"] as $key => $value){
-		$firstCharLower = lcfirst($key);
-		if($firstCharLower[0] === $key[0]){
+		if(startsWith($key, $OGPLangPre)){
 			$finalConsts[$key] = $value;
 		}
 	}
@@ -413,5 +417,4 @@ function getOGPLangConstantsJSON(){
 	
 	return false;
 }
-
 ?>

+ 0 - 1
includes/lang.php

@@ -23,7 +23,6 @@
  */
 
 $lang_modules = array();
-$OGPLangPre = "OGP_LANG_";
 
 function add_lang_module($lang_module)
 {