" . __("Name") . " : | ";
- $option = ['onChange' => "nameIsThere(\"" . $CFG_GLPI['root_doc'] . "\");", 'id' => 'name_reserveip'];
+ $option = ['onChange' => "nameIsThere(\"" . PLUGINADDRESSING_WEBDIR . "\");", 'id' => 'name_reserveip'];
echo Html::input('name_reserveip', $option);
echo " | ";
echo " ";
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..f2c28fe
--- /dev/null
+++ b/index.php
@@ -0,0 +1,28 @@
+.
+ --------------------------------------------------------------------------
+ */
diff --git a/setup.php b/setup.php
index 6ca5678..7444ed6 100644
--- a/setup.php
+++ b/setup.php
@@ -28,9 +28,11 @@
*/
define('PLUGIN_ADDRESSING_VERSION', '3.0.0');
+
if (!defined("PLUGIN_ADDRESSING_DIR")) {
define("PLUGIN_ADDRESSING_DIR", Plugin::getPhpDir("addressing"));
define("PLUGIN_ADDRESSING_DIR_NOFULL", Plugin::getPhpDir("addressing",false));
+ define("PLUGINADDRESSING_WEBDIR", Plugin::getWebDir("addressing"));
}
// Init the hooks of the plugins -Needed
@@ -65,7 +67,7 @@ function plugin_init_addressing() {
if (isset($_SESSION['glpiactiveprofile']['interface'])
&& $_SESSION['glpiactiveprofile']['interface'] == 'central') {
$PLUGIN_HOOKS['add_css']['addressing'] = "addressing.css";
- $PLUGIN_HOOKS["javascript"]['addressing'] = ["/plugins/addressing/addressing.js"];
+ $PLUGIN_HOOKS["javascript"]['addressing'] = [PLUGIN_ADDRESSING_DIR_NOFULL."/addressing.js"];
$PLUGIN_HOOKS['add_javascript']['addressing'] = 'addressing.js';
}
}
diff --git a/tools/move_to_po.php b/tools/move_to_po.php
deleted file mode 100644
index 6c93db0..0000000
--- a/tools/move_to_po.php
+++ /dev/null
@@ -1,313 +0,0 @@
-.
- --------------------------------------------------------------------------
- */
-
-// ----------------------------------------------------------------------
-// Original Author of file: Julien Dombre
-// Purpose of file:
-// ----------------------------------------------------------------------
-
-chdir(dirname($_SERVER["SCRIPT_FILENAME"]));
-
-if ($argv) {
- for ($i=1 ; $i'.$sing_trans.' '.$current_string_plural.'->'.$plural_trans."\n";
- if (!strlen($sing_trans) || !strlen($plural_trans)) {
-// echo "clean\n";
- $sing_trans = '';
- $plural_trans = '';
- }
- $content = "msgstr[0] \"$sing_trans\"\n";
- $content .= "msgstr[1] \"$plural_trans\"\n";
- }
- } else {
- $content='';
- }
- }
- $context = '';
- }
- // Standard replacement
- $content = preg_replace('/charset=CHARSET/','charset=UTF-8',$content);
-
- if (preg_match('/Plural-Forms/',$content)) {
- $content = "\"Plural-Forms: nplurals=2; plural=(n != 1)\\n\"\n";
- }
-
- if (fwrite($po, $content) === FALSE) {
- echo "unable to write in po file";
- exit;
- }
-
- }
-}
-fclose($pot);
-fclose($po);
-
-
-/**
- * @param $string
- * @param $context
- *
- * @return string
- */
-function search_in_dict($string, $context) {
- global $REFLANG, $LANG;
-
- if ($context) {
- $string = "$context/$string";
- }
-
- $ponctmatch = "([\.: \(\)]*)";
- $varmatch = "(%s)*";
-
- if (preg_match("/$varmatch$ponctmatch(.*)$ponctmatch$varmatch$/U",$string,$reg)) {
-// print_r($reg);
- $left = $reg[1];
- $left .= $reg[2];
- $string = $reg[3];
- $right = $reg[4];
- if (isset($reg[5])) {
- $right .= $reg[5];
- }
- }
-
-// echo $left.' <- '.$string.' -> '.$right."\n";
- foreach ($REFLANG as $mod => $data) {
-
- foreach ($data as $key => $val) {
-
- if (!is_array($val)){
- if (!isset($LANG[$mod][$key])) {
- continue;
- }
-
- // Search same case with punc
- if (strcmp($val,$left.$string.$right) === 0) {
- return $LANG[$mod][$key];
- }
- // Search same case with punc
- if (strcasecmp($val,$left.$string.$right) === 0) {
- return $LANG[$mod][$key];
- }
-
- // Search same case with left punc
- if (strcmp($val,$left.$string) === 0) {
- return $LANG[$mod][$key].$right;
- }
- // Search same case with left punc
- if (strcasecmp($val,$left.$string) === 0) {
- return $LANG[$mod][$key].$right;
- }
-
- // Search same case with right punc
- if (strcmp($val,$string.$right) === 0) {
- return $left.$LANG[$mod][$key];
- }
- // Search same case with right punc
- if (strcasecmp($val,$string.$right) === 0) {
- return $left.$LANG[$mod][$key];
- }
-
- // Search same case without punc
- if (strcmp($val,$string) === 0) {
- return $left.$LANG[$mod][$key].$right;
- }
- // Search non case sensitive
- if (strcasecmp($val,$string) === 0) {
- return $left.$LANG[$mod][$key].$right;
- }
- } else {
- //toolbox::logdebug($val);
- //toolbox::logdebug($key);
- //toolbox::logdebug($mod);
- foreach ($val as $k => $v) {
- if (!isset($LANG[$mod][$key][$k])) {
- continue;
- }
-
- // Search same case with punc
- if (strcmp($v,$left.$string.$right) === 0) {
- return $LANG[$mod][$key][$k];
- }
- // Search same case with punc
- if (strcasecmp($v,$left.$string.$right) === 0) {
- return $LANG[$mod][$key][$k];
- }
-
- // Search same case with left punc
- if (strcmp($v,$left.$string) === 0) {
- return $LANG[$mod][$key][$k].$right;
- }
- // Search same case with left punc
- if (strcasecmp($v,$left.$string) === 0) {
- return $LANG[$mod][$key][$k].$right;
- }
-
- // Search same case with right punc
- if (strcmp($v,$string.$right) === 0) {
- return $left.$LANG[$mod][$key][$k];
- }
- // Search same case with right punc
- if (strcasecmp($v,$string.$right) === 0) {
- return $left.$LANG[$mod][$key][$k];
- }
-
- // Search same case without punc
- if (strcmp($v,$string) === 0) {
- return $left.$LANG[$mod][$key][$k].$right;
- }
- // Search non case sensitive
- if (strcasecmp($v,$string) === 0) {
- return $left.$LANG[$mod][$key][$k].$right;
- }
- }
- }
- }
- }
-
- return "";
-}
-?>
\ No newline at end of file
|