1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-16 20:28:28 +01:00

Theme options and fixes. Load Theme JS in the footer by default. New blockquote alt. style added to TinyMce. Updated news shortcodes. Option to hide search form from results page.

This commit is contained in:
Cameron 2016-06-01 18:36:16 -07:00
parent 9080291661
commit cd8ea61bd9
11 changed files with 98 additions and 96 deletions

View File

@ -377,7 +377,7 @@ $text .= "
</tr>
<tr>
<td><label for='sitelogo'>".PRFLAN_214."</label></td>
<td>".$frm->imagepicker('sitelogo',$pref['sitelogo'],'','help='.PRFLAN_226)."</td>
<td>".$frm->imagepicker('sitelogo',$pref['sitelogo'],'','w=200&help='.PRFLAN_226)."</td>
</tr>
<tr>
<td><label for='sitetag'>".PRFLAN_5."</label></td>

View File

@ -332,6 +332,11 @@ class news_shortcodes extends e_shortcode
return $this->sc_newscommentcount($parm);
}
public function sc_news_comment_label($parm=null)
{
return ($this->news_item['news_comment_total'] == 1) ? COMLAN_8 : LAN_COMMENTS;
}
public function sc_news_date($parm=null)
{
return $this->sc_newsdate($parm);
@ -342,6 +347,11 @@ class news_shortcodes extends e_shortcode
return $this->sc_newsavatar($parm);
}
public function sc_news_url($parm=null)
{
return $this->sc_newsurl($parm);
}
public function sc_news_image($parm=null)
{
return $this->sc_newsimage($parm);
@ -885,7 +895,7 @@ class news_shortcodes extends e_shortcode
return "<a style='".(isset($this->param['itemlink']) ? $this->param['itemlink'] : 'null')."' href='{$url}'>".e107::getParser()->toHTML($this->news_item['news_title'], TRUE, "TITLE").'</a>';
}
function sc_newsurl()
function sc_newsurl($parm=null)
{
return e107::getUrl()->create('news/view/item', $this->news_item);
}
@ -976,6 +986,8 @@ class news_shortcodes extends e_shortcode
{
$tmp = explode(",",$this->news_item['news_meta_keywords']);
$words = array();
$class = (!empty($parm['class'])) ? $parm['class'] : 'news-tag';
$separator = (isset($parm['separator'])) ? $parm['separator'] : ', ';
if($parm == 'label')
{
@ -987,7 +999,7 @@ class news_shortcodes extends e_shortcode
{
$start = "";
$end = "";
$sep = ", ";
$sep = $separator;
}
foreach($tmp as $val)
@ -995,10 +1007,11 @@ class news_shortcodes extends e_shortcode
if(trim($val))
{
$url = e107::getUrl()->create('news/list/tag',array('tag'=>$val)); // e_BASE."news.php?tag=".$val
$words[] = "<a class='news-tag' href='".$url."'>".$start.$val.$end."</a>";
$words[] = "<a class='".$class."' href='".$url."'>".$start.$val.$end."</a>";
}
}
if(count($words))
{
return implode($sep,$words);

View File

@ -1777,7 +1777,7 @@ class e107
case 'theme':
// data is e.g. 'jslib/mytheme.js'
if(null !== $zone) $jshandler->headerTheme($data, $zone, $pre, $post);
else $jshandler->headerTheme($data, 5, $pre, $post);
else $jshandler->footerTheme($data, 5, $pre, $post);
break;
case 'inline':

View File

@ -572,6 +572,20 @@ class e_jsmanager
return $this;
}
/**
* Add Theme JS file for inclusion in site footer (preferred), shorthand of footerFile() method
*
* @param string $file_path relative to theme root folder
* @param integer $zone 1-5 (see header.php)
* @return e_jsmanager
*/
public function footerTheme($file_path, $zone = 5, $pre = '', $post = '')
{
$this->footerFile(THEME.trim($file_path, '/'), $zone, $pre, $post);
return $this;
}
/**
* Add Plugin JS file for inclusion in site header, shorthand of headerFile() method
*

View File

@ -383,7 +383,7 @@ class news {
'perms' => '0',
'shortcodes' => array(
'news_title' => array('field'=>'news_title', 'type'=>'text', 'container'=>'span'),
'news_description' => array('field'=>'news_meta_description','type'=>'text', 'container'=>'div'),
'news_description' => array('field'=>'news_meta_description','type'=>'text', 'container'=>'span'),
'news_body' => array('field'=>'news_body', 'type'=>'html', 'container'=>'div'),
'news_summary' => array('field'=>'news_summary', 'type'=>'text', 'container'=>'span'),
)

View File

@ -218,7 +218,7 @@ class e_search
if(e_DEBUG)
{
echo e107::getMessage()->addDebug("Using MYSQL Sort Method")->render();
e107::getDebug()->log("Using MYSQL Sort Method");
}
$this -> query = str_replace('&quot;', '"', $this -> query);

View File

@ -0,0 +1,43 @@
<?php
/*
* e107 Bootstrap CMS
*
* Copyright (C) 2008-2015 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* IMPORTANT: Make sure the redirect script uses the following code to load class2.php:
*
* if (!defined('e107_INIT'))
* {
* require_once("../../class2.php");
* }
*
*/
if (!defined('e107_INIT')) { exit; }
// v2.x Standard - Simple mod-rewrite module.
class news_url // plugin-folder + '_url'
{
function config()
{
$config = array();
$pref = e107::pref('core','eurl_aliases'); // [en][news]
$config['index'] = array(
// 'regex' => '^gallery/?$', // matched against url, and if true, redirected to 'redirect' below.
'sef' => (!empty($pref[e_LAN]['news'])) ? $pref[e_LAN]['news'] : 'news', // used by e107::url(); to create a url from the db table.
'redirect' => '{e_BASE}news.php', // file-path of what to load when the regex returns true.
);
return $config;
}
}

View File

@ -23,7 +23,7 @@ if(!empty($parm))
}
}
$cached = false;
if(false === $cached)
{
@ -87,12 +87,12 @@ if(false === $cached)
$month_links = array();
$sql->db_Mark_Time('News months menu');
if(!$sql->db_Select("news", "news_id, news_datestamp", "news_class IN (".USERCLASS_LIST.") AND news_datestamp > ".intval($start)." AND news_datestamp < ".intval($end)." ORDER BY news_datestamp DESC"))
if(!$sql->select("news", "news_id, news_datestamp", "news_class IN (".USERCLASS_LIST.") AND news_datestamp > ".intval($start)." AND news_datestamp < ".intval($end)." ORDER BY news_datestamp DESC"))
{
e107::getCache()->set($cString, '');
return '';
}
while ($news = $sql->db_Fetch())
while ($news = $sql->fetch())
{
$xmonth = date("n", $news['news_datestamp']);
if ((!isset($month_links[$xmonth]) || !$month_links[$xmonth]))
@ -102,7 +102,10 @@ if(false === $cached)
}
$xmonth_cnt[$xmonth]++;
}
e107::getDebug()->log($month_links);
// go over the link array and create the option fields
$menu_text = array();
$template = e107::getTemplate('news', 'news_menu', 'months');

View File

@ -259,6 +259,7 @@ class social_shortcodes extends e_shortcode
$twitterAccount = basename(XURL_TWITTER);
$btnClass = varset($parm['btnClass'], 'btn btn-default social-share');
// return print_a($hashtags,true);
foreach($providers as $k=>$val)
@ -289,7 +290,7 @@ class social_shortcodes extends e_shortcode
$opt[$k] = "<a class='".$tooltip." btn ".$butSize." btn-default social-share' target='_blank' title='".$val["title"]."' href='".$shareUrl."'>".$tp->toIcon($val["icon"], array('fw'=>1))."</a>";
$opt[$k] = "<a class='".$btnClass." ".$tooltip." ".$butSize."' target='_blank' title='".$val["title"]."' href='".$shareUrl."'>".$tp->toIcon($val["icon"], array('fw'=>1))."</a>";
}
// Show only Email, Facebook, Twitter and Google.
@ -335,9 +336,9 @@ class social_shortcodes extends e_shortcode
else
{
$class = varset($parm['class'],'btn-group social-share');
$class = varset($parm['class'],'text-center btn-group social-share');
return '<div class="'.$class.' text-center hidden-print">'.implode("\n",$opt)."</div>";
return '<div class="'.$class.' hidden-print">'.implode("\n",$opt)."</div>";
}

View File

@ -453,8 +453,8 @@ class wysiwyg
{title: 'Blocks', items: [
{title: 'Paragraph', block: 'p'},
{title: 'Blockquote', block: 'blockquote'},
{title: 'Blockquote alt.', block: 'blockquote', classes: 'blockquote-alt blockquote__alternative'},
{title: 'Div', block: 'div'},
{title: 'Pre', block: 'pre'},
{title: 'Code Highlighted', block: 'pre', classes: 'prettyprint linenums' }
]},

View File

@ -143,6 +143,8 @@ class search extends e_shortcode
{
$tp = e107::getParser();
$value = isset($_GET['q']) ? $tp->post_toForm($_GET['q']) : "";
$text = "<div class='input-group'>
<input class='tbox form-control m_search' type='text' id='q' name='q' size='35' value='".$value."' maxlength='50' />
@ -822,7 +824,9 @@ class search extends e_shortcode
$ns->tablerender(LAN_SEARCH_11." ".$res_display." ".LAN_SEARCH_13." ".(isset($_GET[$advanced_caption['id']]) ? $advanced_caption['title'][$_GET[$advanced_caption['id']]] : $this->search_info[$key]['qtype']), $text, 'search_result');
}
}
}
}
@ -1286,93 +1290,17 @@ $text .= $SEARCH_VARS->SEARCH_MESSAGE ? $tp->simpleParse($SEARCH_TABLE_MSG, $SEA
//$text .= preg_replace("/\{(.*?)\}/e", '$\1', $SEARCH_BOT_TABLE);
$text .= $tp->simpleParse($SEARCH_BOT_TABLE, $SEARCH_VARS);
e107::getRender()->tablerender(PAGE_NAME." ".SITENAME, $text, 'search_head');
if(!isset($_GET['nf'])) // no form flag.
{
e107::getRender()->tablerender(PAGE_NAME." ".SITENAME, $text, 'search_head');
}
// parse search
$SEARCH_VARS = new e_vars();
if ($perform_search)
{
$srchObj->renderResults();
/*
$_GET['q'] = rawurlencode($_GET['q']);
$_GET['t'] = preg_replace('/[^\w\-]/i', '', $_GET['t']);
foreach ($search_info as $key => $a)
{
if (isset($searchtype[$key]) || isset($searchtype['all']))
{
unset($text);
//if (file_exists($search_info[$key]['sfile']))
{
$pre_title = ($search_info[$key]['pre_title'] == 2) ? $search_info[$key]['pre_title_alt'] : $search_info[$key]['pre_title'];
$search_chars = $search_info[$key]['chars'];
$search_res = $search_info[$key]['results'];
e107::getAddon();
if(vartrue($search_info[$key]['sfile']) && file_exists($search_info[$key]['sfile'])) // Legacy
{
$text .= '<div class="search-block">';
@require_once($search_info[$key]['sfile']);
$text .= '</div>';
}
else// New v2 standard. @see chatbox_menu/e_search.php
{
$className = $key."_search";
$obj = new $className;
$where = (method_exists($obj,'where')) ? $obj->where($_GET) : "";
$ps = $obj->parsesearch($search_info[$key]['table'], $search_info[$key]['return_fields'], $search_info[$key]['search_fields'], $search_info[$key]['weights'], 'self', varset($search_info[$key]['no_results'],LAN_198), $where , $search_info[$key]['order']);
$text .= '<div class="search-block">';
$text .= $ps['text'];
$text .= '</div>';
$results = $ps['results'];
}
$parms = $results.",".$search_res.",".$_GET['r'].",".e_REQUEST_SELF."?q=".$_GET['q']."&t=".$key."&r=[FROM]";
$core_parms = array('r' => '', 'q' => '', 't' => '', 's' => '');
foreach ($_GET as $pparm_key => $pparm_value)
{
$temp = preg_replace('/[^\w_]/i','',$pparm_key);
$temp1 = preg_replace('/[^\w_ +]/i','',$pparm_value); // Filter 'non-word' charcters in search term
if (($temp == $pparm_key) && !isset($core_parms[$pparm_key]))
{
$parms .= "&".$pparm_key."=".$temp1;
}
}
if ($results > $search_res)
{
$nextprev = ($results > $search_res) ? $tp -> parseTemplate("{NEXTPREV={$parms}}") : "";
$text .= "<div class='nextprev search form-inline'>".$nextprev."</div>";
}
if ($results > 0)
{
$res_from = $_GET['r'] + 1;
$res_to = ($_GET['r'] + $search_res) > $results ? $results : ($_GET['r'] + $search_res);
$res_display = $res_from." - ".$res_to." ".LAN_SEARCH_12." ".$results;
}
else
{
$res_display = "";
}
$ns->tablerender(LAN_SEARCH_11." ".$res_display." ".LAN_SEARCH_13." ".(isset($_GET[$advanced_caption['id']]) ? $advanced_caption['title'][$_GET[$advanced_caption['id']]] : $search_info[$key]['qtype']), $text, 'search_result');
}
}
}*/
}