mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 11:50:30 +02:00
Moved membersonly shortcodes to their own file.
This commit is contained in:
65
e107_core/shortcodes/batch/membersonly_shortcodes.php
Normal file
65
e107_core/shortcodes/batch/membersonly_shortcodes.php
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class membersonly_shortcodes extends e_shortcode
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @example {MEMBERSONLY_SIGNUP}
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function sc_membersonly_signup()
|
||||||
|
{
|
||||||
|
$pref = e107::pref('core');
|
||||||
|
|
||||||
|
if(intval($pref['user_reg']) === 1)
|
||||||
|
{
|
||||||
|
$srch = array("[", "]");
|
||||||
|
$repl = array("<a class='alert-link' href='" . e_SIGNUP . "'>", "</a>");
|
||||||
|
|
||||||
|
return str_replace($srch, $repl, LAN_MEMBERS_3);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @example {MEMBERSONLY_RETURNTOHOME}
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function sc_membersonly_returntohome()
|
||||||
|
{
|
||||||
|
|
||||||
|
$pref = e107::pref('core');
|
||||||
|
if($pref['membersonly_redirect'] == 'login')
|
||||||
|
{
|
||||||
|
return "<a class='alert-link' href='" . e_HTTP . "index.php'>" . LAN_MEMBERS_4 . "</a>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @example {MEMBERSONLY_RESTRICTED_AREA}
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function sc_membersonly_restricted_area()
|
||||||
|
{
|
||||||
|
return LAN_MEMBERS_1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @example {MEMBERSONLY_LOGIN}
|
||||||
|
* @return string|
|
||||||
|
*/
|
||||||
|
function sc_membersonly_login()
|
||||||
|
{
|
||||||
|
|
||||||
|
$srch = array("[", "]");
|
||||||
|
$repl = array("<a class='alert-link' href='" . e_LOGIN . "'>", "</a>");
|
||||||
|
|
||||||
|
return str_replace($srch, $repl, LAN_MEMBERS_2);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -15,8 +15,6 @@
|
|||||||
require_once("class2.php");
|
require_once("class2.php");
|
||||||
e107::coreLan('membersonly');
|
e107::coreLan('membersonly');
|
||||||
|
|
||||||
//e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE);
|
|
||||||
|
|
||||||
if(deftrue('BOOTSTRAP')) //v2.x
|
if(deftrue('BOOTSTRAP')) //v2.x
|
||||||
{
|
{
|
||||||
$MEMBERSONLY_TEMPLATE = e107::getCoretemplate('membersonly');
|
$MEMBERSONLY_TEMPLATE = e107::getCoretemplate('membersonly');
|
||||||
@@ -43,58 +41,12 @@ if(!defined('e_IFRAME'))
|
|||||||
define('e_IFRAME', true);
|
define('e_IFRAME', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sc = e107::getScBatch('membersonly');
|
||||||
class membersonly
|
$sc->wrapper('membersonly/default');
|
||||||
{
|
|
||||||
|
|
||||||
function sc_membersonly_signup()
|
|
||||||
{
|
|
||||||
|
|
||||||
$pref = e107::pref('core');
|
|
||||||
|
|
||||||
if(intval($pref['user_reg']) === 1)
|
|
||||||
{
|
|
||||||
$srch = array("[", "]");
|
|
||||||
$repl = array("<a class='alert-link' href='" . e_SIGNUP . "'>", "</a>");
|
|
||||||
|
|
||||||
return str_replace($srch, $repl, LAN_MEMBERS_3);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function sc_membersonly_returntohome()
|
|
||||||
{
|
|
||||||
|
|
||||||
$pref = e107::pref('core');
|
|
||||||
if($pref['membersonly_redirect'] == 'login')
|
|
||||||
{
|
|
||||||
return "<a class='alert-link' href='" . e_HTTP . "index.php'>" . LAN_MEMBERS_4 . "</a>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function sc_membersonly_restricted_area()
|
|
||||||
{
|
|
||||||
|
|
||||||
return LAN_MEMBERS_1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function sc_membersonly_login()
|
|
||||||
{
|
|
||||||
|
|
||||||
$srch = array("[", "]");
|
|
||||||
$repl = array("<a class='alert-link' href='" . e_LOGIN . "'>", "</a>");
|
|
||||||
|
|
||||||
return str_replace($srch, $repl, LAN_MEMBERS_2);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
require_once(HEADERF);
|
require_once(HEADERF);
|
||||||
|
|
||||||
$mem = new membersonly;
|
|
||||||
|
|
||||||
$BODY = e107::getParser()->parseTemplate($MEMBERSONLY_TEMPLATE['default']['body'], true, $mem);
|
$BODY = e107::getParser()->parseTemplate($MEMBERSONLY_TEMPLATE['default']['body'], true, $sc);
|
||||||
|
|
||||||
echo $MEMBERSONLY_TEMPLATE['default']['header'];
|
echo $MEMBERSONLY_TEMPLATE['default']['header'];
|
||||||
e107::getRender()->tablerender($MEMBERSONLY_TEMPLATE['default']['caption'], $BODY, 'membersonly');
|
e107::getRender()->tablerender($MEMBERSONLY_TEMPLATE['default']['caption'], $BODY, 'membersonly');
|
||||||
|
Reference in New Issue
Block a user