1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 03:40:37 +02:00

Social Plugin: {XURL_ICONS} template added.

This commit is contained in:
Cameron
2017-01-23 09:05:25 -08:00
parent f7bef19f1d
commit 55cb8d409e
2 changed files with 62 additions and 13 deletions

View File

@@ -14,6 +14,8 @@ e107::lan('social',false, true);
class social_shortcodes extends e_shortcode
{
public $var;
public function getProviders()
{
@@ -52,18 +54,15 @@ class social_shortcodes extends e_shortcode
public $var;
/**
* {XURL_ICONS: size=2x}
* {XURL_ICONS: type=facebook,twitter,vimeo}
*/
function sc_xurl_icons($parm='')
{
$tp = e107::getParser();
$template = e107::getTemplate('social','social','xurl_icons');
$social = array(
'rss' => array('href'=> (e107::isInstalled('rss_menu') ? e107::url('rss_menu', 'index', array('rss_url'=>'news')) : ''), 'title'=>'RSS/Atom Feed'),
'facebook' => array('href'=> deftrue('XURL_FACEBOOK'), 'title'=>'Facebook'),
@@ -81,6 +80,9 @@ class social_shortcodes extends e_shortcode
$class = (vartrue($parm['size'])) ? 'fa-'.$parm['size'] : '';
// @deprecated - use template.
/*
$tooltipPos = vartrue($parm['tip-pos'], 'top');
if(isset($parm['tip']))
@@ -92,7 +94,7 @@ class social_shortcodes extends e_shortcode
$tooltip = 'e-tip';
}
if(!empty($parm['type']))
*/ if(!empty($parm['type']))
{
$newList = array();
$tmp = explode(",",$parm['type']);
@@ -110,21 +112,51 @@ class social_shortcodes extends e_shortcode
foreach($social as $id => $data)
{
if($data['href'] != '')
if(!empty($data['href']))
{
$data['id'] = $id;
$data['class'] = $class;
$text .= '<a rel="external" href="'.$data['href'].'" data-tooltip-position="'.$tooltipPos.'" class="'.$tooltip.' social-icon social-'.$id.'" title="'.$data['title'].'"><span class="fa fa-fw fa-'.$id.' '.$class.'"></span></a>';
$text .= "\n";
$this->setVars($data);
// $text .= '<a rel="external" href="'.$data['href'].'" data-tooltip-position="'.$tooltipPos.'" class="'.$tooltip.' social-icon social-'.$id.'" title="'.$data['title'].'"><span class="fa fa-fw fa-'.$id.' '.$class.'"></span></a>';
$text .= $tp->parseTemplate($template['item'],true, $this);
$text .= "\n";
}
}
if($text !='')
if(!empty($text))
{
return '<p class="xurl-social-icons hidden-print">'.$text.'</p>';
return $tp->parseTemplate($template['start'],true). $text.$tp->parseTemplate($template['end'],true);
}
}
return null;
}
// ----------- Internal Use only by sc_xurl_icons() ------------------
function sc_xurl_icons_href($parm=null)
{
return $this->var['href'];
}
function sc_xurl_icons_id($parm=null)
{
return $this->var['id'];
}
function sc_xurl_icons_title($parm=null)
{
return $this->var['title'];
}
function sc_xurl_icons_class($parm=null)
{
return $this->var['class'];
}
// ------------------------------------------------
function sc_social_login($parm=null)
{

View File

@@ -0,0 +1,17 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2017 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*/
/**
* {XURL_ICONS} template
*/
$SOCIAL_TEMPLATE['xurl_icons']['start'] = '<p class="xurl-social-icons hidden-print">';
$SOCIAL_TEMPLATE['xurl_icons']['item'] = '<a rel="external" href="{XURL_ICONS_HREF}" data-tooltip-position="top" class="e-tip social-icon social-{XURL_ICONS_ID}" title="{XURL_ICONS_TITLE}"><span class="fa fa-fw fa-{XURL_ICONS_ID} {XURL_ICONS_CLASS}"></span></a>';
$SOCIAL_TEMPLATE['xurl_icons']['end'] = '</p>';