-
Notifications
You must be signed in to change notification settings - Fork 0
/
ns_humanstxt.php
executable file
·44 lines (36 loc) · 1.02 KB
/
ns_humanstxt.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/**
* @version v3.0
* @package Joomla!®
* @copyright Copyright © 2011 Natural Selection Web Design LLC.
* @support http://nsel.co
* @license GNU/GPL, see license.txt
*/
// no direct access
defined('_JEXEC') or die;
jimport('joomla.plugin.plugin');
class plgSystemns_humanstxt extends JPlugin {
/**
* Constructor.
*/
function plgSystemns_humanstxt(&$subject, $config) {
parent::__construct($subject, $config);
}
/**
* onAfterRoute hook.
*/
function onAfterRoute() {
$app = &JFactory::getApplication();
if ($app->isSite()) {
// check if humans.txt exists
jimport('joomla.filesystem.file');
if (!JFile::exists(JPATH_ROOT.DS.'humans.txt')) {
JFile::copy(JPATH_PLUGINS.'/system/ns_humanstxt/humans.txt', JPATH_ROOT.'/humans.txt');
}
$document = JFactory::getDocument();
$live_site = JURI::base();
$tag = '<link type="text/plain" rel="author" href="' . $live_site . 'humans.txt" />';
$document->addCustomTag($tag);
}
}
}