Skip to content

Commit 5e03963

Browse files
committed
First release
0 parents  commit 5e03963

13 files changed

+152
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
hashes.json
2+
_build/
3+
_releases/
4+
_data/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Niccolò Scatena (Inforge)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Option/GALiteSource.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
namespace Inforge\HideGALite\Option;
4+
5+
use XF\Option\AbstractOption;
6+
use XF\Util\File;
7+
8+
use function count;
9+
10+
class GALiteSource extends AbstractOption
11+
{
12+
private const DEFAULT_PATH = 'js/nulumia/ga-lite/vendor/ga-lite/src/ga-lite.min.js';
13+
14+
public static function verifyOption(&$value, \XF\Entity\Option $option)
15+
{
16+
$defaultValue = $option->default_value;
17+
18+
if (empty(trim($value)))
19+
$value = $defaultValue;
20+
$value = trim($value);
21+
22+
$prevValue = $option->getPreviousValue('option_value');
23+
if ($value == $prevValue)
24+
return true;
25+
if (strpos($value, 'http') !== false)
26+
return false;
27+
28+
if ($value != $defaultValue && !File::copyFile($defaultValue, $value, false))
29+
return false;
30+
31+
if ($prevValue == $defaultValue)
32+
return true;
33+
34+
File::deleteDirectory(dirname($prevValue));
35+
for ($dir = dirname(dirname($prevValue));
36+
is_readable($dir) && is_dir($dir) && is_writable($dir) && count(scandir($dir)) == 2;
37+
$dir = dirname($dir))
38+
File::deleteDirectory($dir);
39+
40+
return true;
41+
}
42+
}

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# HideGALite
2+
3+
Xenforo 2.x addon that allows to change the path to the Nulumia GA-Lite script
4+
in order to hide it to the adblocker.

_output/options/_metadata.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"ifHgalGALiteSource.json": {
3+
"hash": "637936797b7d391f0bfcfae5fc8ea146"
4+
}
5+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"edit_format": "textbox",
3+
"edit_format_params": "",
4+
"data_type": "string",
5+
"sub_options": [],
6+
"validation_class": "Inforge\\HideGALite\\Option\\GALiteSource",
7+
"validation_method": "verifyOption",
8+
"advanced": true,
9+
"default_value": "js/nulumia/ga-lite/vendor/ga-lite/src/ga-lite.min.js",
10+
"relations": {
11+
"stats": 215
12+
}
13+
}

_output/phrases/_metadata.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"option.ifHgalGALiteSource.txt": {
3+
"global_cache": false,
4+
"version_id": 1000070,
5+
"version_string": "1.0.0",
6+
"hash": "e0f7106f360e38e90673c7fd0b0bd58c"
7+
},
8+
"option_explain.ifHgalGALiteSource.txt": {
9+
"global_cache": false,
10+
"version_id": 1000070,
11+
"version_string": "1.0.0",
12+
"hash": "422ca60f0d9db099aca58aee86983477"
13+
}
14+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GA-Lite script location
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Set the script location for GA-Lite. Applied only if 'Locally hosted' is selected above.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"public/if_hgal_nulumia_galite_google_analytics_scripturl.json": {
3+
"hash": "2981043f47f322fb23c7a64ace072043"
4+
}
5+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"template": "nulumia_galite_google_analytics",
3+
"description": "Change the GA-Lite script URL.",
4+
"execution_order": 500,
5+
"enabled": true,
6+
"action": "str_replace",
7+
"find": "<xf:set var=\"$galiteSource\" value=\"{{ base_url('js/nulumia/ga-lite/vendor/ga-lite/src/ga-lite.min.js') }}\" />",
8+
"replace": "<xf:set var=\"$galiteSource\" value=\"{{ base_url($xf.options.ifHgalGALiteSource) }}\" />"
9+
}

addon.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"legacy_addon_id": "",
3+
"title": "[Inforge] Hide Nulumia GA-Lite",
4+
"description": "Move the js/nulumia folder to another location to hide from adblockers.",
5+
"version_id": 1000070,
6+
"version_string": "1.0.0",
7+
"dev": "Inforge",
8+
"dev_url": "https:/www.inforge.net",
9+
"faq_url": "https://github.com/InforgeNet/HideGALite/issues",
10+
"support_url": "mailto:speedjack95@gmail.com",
11+
"extra_urls": {
12+
"Forum": "https://www.inforge.net/forum",
13+
"GitHub": "https://github.com/InforgeNet/HideGALite",
14+
"Maintainer (Niccolò Scatena)": "mailto:speedjack95@gmail.com"
15+
},
16+
"require": {
17+
"XF": [
18+
2020010,
19+
"XenForo 2.2.0+"
20+
],
21+
"Nulumia/GALite": [
22+
1000072,
23+
"[Nulumia] GA-Lite for Xenforo 1.0.0.2+"
24+
]
25+
},
26+
"icon": "fas fa-eye-slash"
27+
}

build.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"exec": [
3+
"mv _build/upload/src/addons/Inforge/HideGALite/README.md _build/",
4+
"mv _build/upload/src/addons/Inforge/HideGALite/LICENSE _build/"
5+
]
6+
}

0 commit comments

Comments
 (0)