mirror of
https://github.com/e107inc/e107.git
synced 2025-07-28 18:30:53 +02:00
Improved news shortcode handlingImplemented new shortcode override/ directory. Any .sc file found here will override any other shortcode anywhere.
This commit is contained in:
@@ -9,9 +9,9 @@
|
|||||||
* Administration - Database Utilities
|
* Administration - Database Utilities
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_admin/db.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_admin/db.php,v $
|
||||||
* $Revision: 1.8 $
|
* $Revision: 1.9 $
|
||||||
* $Date: 2008-12-30 15:56:12 $
|
* $Date: 2009-01-16 01:02:41 $
|
||||||
* $Author: secretr $
|
* $Author: mcfly_e107 $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -86,6 +86,11 @@ if(isset($_POST['optimize_sql']))
|
|||||||
optimizesql($mySQLdefaultdb);
|
optimizesql($mySQLdefaultdb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isset($_POST['sc_override_scan']))
|
||||||
|
{
|
||||||
|
scan_override();
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($_POST['backup_core']))
|
if(isset($_POST['backup_core']))
|
||||||
{
|
{
|
||||||
backup_core();
|
backup_core();
|
||||||
@@ -190,6 +195,15 @@ $text = "
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<!-- SCAN SC OVERRIDE -->
|
||||||
|
<tr>
|
||||||
|
<td>".DBLAN_55."</td>
|
||||||
|
<td>
|
||||||
|
".$frm->radio('db_execute', 'sc_override_scan').$frm->label(DBLAN_56, 'db_execute', 'sc_override_scan')."
|
||||||
|
<!-- <input class='button' style='width: 100%' type='submit' name='sc_override_scan' value='".DBLAN_36."' /> -->
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div class='buttons-bar center'>
|
<div class='buttons-bar center'>
|
||||||
@@ -223,6 +237,30 @@ function optimizesql($mySQLdefaultdb)
|
|||||||
$emessage->add(DBLAN_11." $mySQLdefaultdb ".DBLAN_12, E_MESSAGE_SUCCESS);
|
$emessage->add(DBLAN_11." $mySQLdefaultdb ".DBLAN_12, E_MESSAGE_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function scan_override()
|
||||||
|
{
|
||||||
|
global $pref, $emessage;
|
||||||
|
|
||||||
|
require_once(e_HANDLER.'file_class.php');
|
||||||
|
$f = new e_file;
|
||||||
|
|
||||||
|
$scList = '';
|
||||||
|
$fList = $f->get_files(e_FILE.'shortcode/override', '\.sc$');
|
||||||
|
if(count($fList))
|
||||||
|
{
|
||||||
|
$tmp = array();
|
||||||
|
foreach($fList as $file)
|
||||||
|
{
|
||||||
|
$tmp[] = strtoupper(substr($file['fname'], 0, -3));
|
||||||
|
}
|
||||||
|
$scList = implode(',', $tmp);
|
||||||
|
unset($tmp);
|
||||||
|
}
|
||||||
|
$pref['sc_override'] = $scList;
|
||||||
|
save_prefs();
|
||||||
|
$emessage->add(DBLAN_57.':<br />'.$pref['sc_override'], E_MESSAGE_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
function plugin_viewscan()
|
function plugin_viewscan()
|
||||||
{
|
{
|
||||||
$error_messages = array(0 => DBLAN_31, 1 => DBLAN_32, 2 => DBLAN_33, 3 => DBLAN_34);
|
$error_messages = array(0 => DBLAN_31, 1 => DBLAN_32, 2 => DBLAN_33, 3 => DBLAN_34);
|
||||||
|
@@ -1,13 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||||
* $Id: news_shortcodes.php,v 1.17 2009-01-15 15:42:24 secretr Exp $
|
* $Id: news_shortcodes.php,v 1.18 2009-01-16 01:02:41 mcfly_e107 Exp $
|
||||||
*
|
*
|
||||||
* News shortcode batch
|
* News shortcode batch
|
||||||
*/
|
*/
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT')) { exit; }
|
||||||
include_once(e_HANDLER.'shortcode_handler.php');
|
//include_once(e_HANDLER.'shortcode_handler.php');
|
||||||
|
|
||||||
|
/*
|
||||||
$codes = array(
|
$codes = array(
|
||||||
'newstitle', 'newsbody', 'newsicon','newsauthor', 'newscomments',
|
'newstitle', 'newsbody', 'newsicon','newsauthor', 'newscomments',
|
||||||
'trackback', 'newsheader', 'newscategory', 'newsdate', 'newscommentlink',
|
'trackback', 'newsheader', 'newscategory', 'newsdate', 'newscommentlink',
|
||||||
@@ -15,7 +16,21 @@ $codes = array(
|
|||||||
'extended', 'captionclass', 'admincaption', 'adminbody', 'newssummary',
|
'extended', 'captionclass', 'admincaption', 'adminbody', 'newssummary',
|
||||||
'newsthumbnail', 'newsimage', 'sticky_icon', 'newstitlelink', 'newscaticon', 'newsinfo'
|
'newsthumbnail', 'newsimage', 'sticky_icon', 'newstitlelink', 'newscaticon', 'newsinfo'
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
|
|
||||||
|
$codes = array();
|
||||||
|
$tmp = get_class_methods('news_shortcodes');
|
||||||
|
foreach($tmp as $c)
|
||||||
|
{
|
||||||
|
if(strpos($c, 'get_') === 0)
|
||||||
|
{
|
||||||
|
$codes[] = substr($c, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($tmp);
|
||||||
|
|
||||||
register_shortcode('news_shortcodes', $codes);
|
register_shortcode('news_shortcodes', $codes);
|
||||||
|
initShortcodeClass('news_shortcodes');
|
||||||
|
|
||||||
class news_shortcodes
|
class news_shortcodes
|
||||||
{
|
{
|
||||||
@@ -26,26 +41,20 @@ class news_shortcodes
|
|||||||
$this->e107 = e107::getInstance();
|
$this->e107 = e107::getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_news_item()
|
function loadNewsItem()
|
||||||
{
|
{
|
||||||
global $newsItemBegin;
|
$e107 = e107::getInstance();
|
||||||
if($newsItemBegin == true)
|
$e107->tp->e_sc->scClasses['news_shortcodes']->news_item = getcachedvars('current_news_item');
|
||||||
{
|
$e107->tp->e_sc->scClasses['news_shortcodes']->param = getcachedvars('current_news_param');
|
||||||
$this->news_item = getcachedvars('current_news_item');
|
|
||||||
$this->param = getcachedvars('current_news_param');
|
|
||||||
$newsItemBegin = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_newstitle()
|
function get_newstitle()
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
return $this->e107->tp->toHTML($this->news_item['news_title'], TRUE, 'TITLE');
|
return $this->e107->tp->toHTML($this->news_item['news_title'], TRUE, 'TITLE');
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_newsbody($parm)
|
function get_newsbody($parm)
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
$news_body = $this->e107->tp->toHTML($this->news_item['news_body'], true, 'BODY, fromadmin', $this->news_item['news_author']);
|
$news_body = $this->e107->tp->toHTML($this->news_item['news_body'], true, 'BODY, fromadmin', $this->news_item['news_author']);
|
||||||
if($this->news_item['news_extended'] && (isset($_POST['preview']) || strpos(e_QUERY, 'extend') !== FALSE) && $parm != 'noextend')
|
if($this->news_item['news_extended'] && (isset($_POST['preview']) || strpos(e_QUERY, 'extend') !== FALSE) && $parm != 'noextend')
|
||||||
{
|
{
|
||||||
@@ -57,7 +66,6 @@ class news_shortcodes
|
|||||||
|
|
||||||
function get_newsicon($parm)
|
function get_newsicon($parm)
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
$category_icon = str_replace('../', '', trim($this->news_item['category_icon']));
|
$category_icon = str_replace('../', '', trim($this->news_item['category_icon']));
|
||||||
if ($category_icon && strstr('images', $category_icon))
|
if ($category_icon && strstr('images', $category_icon))
|
||||||
{
|
{
|
||||||
@@ -74,7 +82,6 @@ class news_shortcodes
|
|||||||
|
|
||||||
function get_newsauthor($parm)
|
function get_newsauthor($parm)
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
if($this->news_item['user_id'])
|
if($this->news_item['user_id'])
|
||||||
{
|
{
|
||||||
if($parm == 'nolink')
|
if($parm == 'nolink')
|
||||||
@@ -91,7 +98,6 @@ class news_shortcodes
|
|||||||
|
|
||||||
function get_newscomments($parm)
|
function get_newscomments($parm)
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
global $pref, $sql;
|
global $pref, $sql;
|
||||||
if($pref['comments_disabled'] == 1)
|
if($pref['comments_disabled'] == 1)
|
||||||
{
|
{
|
||||||
@@ -129,14 +135,12 @@ class news_shortcodes
|
|||||||
function get_trackback($parm)
|
function get_trackback($parm)
|
||||||
{
|
{
|
||||||
global $pref;
|
global $pref;
|
||||||
$this->load_news_item();
|
|
||||||
if(!varsettrue($pref['trackbackEnabled'])) { return ''; }
|
if(!varsettrue($pref['trackbackEnabled'])) { return ''; }
|
||||||
return ($this->param['trackbackbeforestring'] ? $this->param['trackbackbeforestring'] : '')."<a href='".e_HTTP."comment.php?comment.news.".$this->news_item['news_id']."#track'>".$this->param['trackbackstring'].$this->news_item['tb_count'].'</a>'.($this->param['trackbackafterstring'] ? $this->param['trackbackafterstring'] : '');
|
return ($this->param['trackbackbeforestring'] ? $this->param['trackbackbeforestring'] : '')."<a href='".e_HTTP."comment.php?comment.news.".$this->news_item['news_id']."#track'>".$this->param['trackbackstring'].$this->news_item['tb_count'].'</a>'.($this->param['trackbackafterstring'] ? $this->param['trackbackafterstring'] : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_newsheader($parm)
|
function get_newsheader($parm)
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
$category_icon = str_replace("../", "", trim($this->news_item['category_icon']));
|
$category_icon = str_replace("../", "", trim($this->news_item['category_icon']));
|
||||||
if (!$category_icon) return '';
|
if (!$category_icon) return '';
|
||||||
if ($category_icon && strstr("images", $category_icon)) {
|
if ($category_icon && strstr("images", $category_icon)) {
|
||||||
@@ -149,14 +153,12 @@ class news_shortcodes
|
|||||||
|
|
||||||
function get_newscategory($parm)
|
function get_newscategory($parm)
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
$category_name = $this->e107->tp->toHTML($this->news_item['category_name'], FALSE ,'defs');
|
$category_name = $this->e107->tp->toHTML($this->news_item['category_name'], FALSE ,'defs');
|
||||||
return "<a class='".$GLOBALS['NEWS_CSSMODE']."_category' style='".(isset($this->param['catlink']) ? $this->param['catlink'] : "#")."' href='".$e107->url->getUrl('core:news', 'main', 'action=cat&value='.$this->news_item['news_category'])."'>".$category_name."</a>";
|
return "<a class='".$GLOBALS['NEWS_CSSMODE']."_category' style='".(isset($this->param['catlink']) ? $this->param['catlink'] : "#")."' href='".$e107->url->getUrl('core:news', 'main', 'action=cat&value='.$this->news_item['news_category'])."'>".$category_name."</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_newsdate($parm)
|
function get_newsdate($parm)
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
$con = new convert;
|
$con = new convert;
|
||||||
if($parm == '')
|
if($parm == '')
|
||||||
{
|
{
|
||||||
@@ -181,26 +183,22 @@ class news_shortcodes
|
|||||||
|
|
||||||
function get_newscommentlink($parm)
|
function get_newscommentlink($parm)
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
return ($this->news_item['news_allow_comments'] ? $this->param['commentoffstring'] : " <a href='".e_HTTP."comment.php?comment.news.".$this->news_item['news_id']."'>".$this->param['commentlink'].'</a>');
|
return ($this->news_item['news_allow_comments'] ? $this->param['commentoffstring'] : " <a href='".e_HTTP."comment.php?comment.news.".$this->news_item['news_id']."'>".$this->param['commentlink'].'</a>');
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_newscommentcount($parm)
|
function get_newscommentcount($parm)
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
return $this->news_item['news_comment_total'];
|
return $this->news_item['news_comment_total'];
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_emailicon($parm)
|
function get_emailicon($parm)
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
require_once(e_HANDLER.'emailprint_class.php');
|
require_once(e_HANDLER.'emailprint_class.php');
|
||||||
return emailprint::render_emailprint('news', $this->news_item['news_id'], 1);
|
return emailprint::render_emailprint('news', $this->news_item['news_id'], 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_printicon()
|
function get_printicon()
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
require_once(e_HANDLER.'emailprint_class.php');
|
require_once(e_HANDLER.'emailprint_class.php');
|
||||||
return emailprint::render_emailprint('news', $this->news_item['news_id'], 2);
|
return emailprint::render_emailprint('news', $this->news_item['news_id'], 2);
|
||||||
}
|
}
|
||||||
@@ -208,21 +206,18 @@ class news_shortcodes
|
|||||||
function get_pdficon()
|
function get_pdficon()
|
||||||
{
|
{
|
||||||
global $pref;
|
global $pref;
|
||||||
$this->load_news_item();
|
|
||||||
if (!$pref['plug_installed']['pdf']) { return ''; }
|
if (!$pref['plug_installed']['pdf']) { return ''; }
|
||||||
return $this->e107->tp->parseTemplate('{PDF='.LAN_NEWS_24.'^news.'.$this->news_item['news_id'].'}');
|
return $this->e107->tp->parseTemplate('{PDF='.LAN_NEWS_24.'^news.'.$this->news_item['news_id'].'}');
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_newsid()
|
function get_newsid()
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
return $this->news_item['news_id'];
|
return $this->news_item['news_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_adminoptions()
|
function get_adminoptions()
|
||||||
{
|
{
|
||||||
global $imode;
|
global $imode;
|
||||||
$this->load_news_item();
|
|
||||||
if (ADMIN && getperms('H'))
|
if (ADMIN && getperms('H'))
|
||||||
{
|
{
|
||||||
$adop_icon = (file_exists(THEME."images/newsedit.png") ? THEME_ABS."images/newsedit.png" : e_IMAGE_ABS."packs/".$imode."/generic/newsedit.png");
|
$adop_icon = (file_exists(THEME."images/newsedit.png") ? THEME_ABS."images/newsedit.png" : e_IMAGE_ABS."packs/".$imode."/generic/newsedit.png");
|
||||||
@@ -236,7 +231,6 @@ class news_shortcodes
|
|||||||
|
|
||||||
function get_extended($parm)
|
function get_extended($parm)
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
if ($this->news_item['news_extended'] && (strpos(e_QUERY, 'extend') === FALSE || $parm == 'force'))
|
if ($this->news_item['news_extended'] && (strpos(e_QUERY, 'extend') === FALSE || $parm == 'force'))
|
||||||
{
|
{
|
||||||
if (defined('PRE_EXTENDEDSTRING'))
|
if (defined('PRE_EXTENDEDSTRING'))
|
||||||
@@ -261,58 +255,49 @@ class news_shortcodes
|
|||||||
|
|
||||||
function get_captionclass()
|
function get_captionclass()
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
$news_title = $this->e107->tp->toHTML($this->news_item['news_title'], TRUE,'no_hook,emotes_off, no_make_clickable');
|
$news_title = $this->e107->tp->toHTML($this->news_item['news_title'], TRUE,'no_hook,emotes_off, no_make_clickable');
|
||||||
return "<div class='category".$this->news_item['news_category']."'>".($this->news_item['news_render_type'] == 1 ? "<a href='".e_HTTP."comment.php?comment.news.".$this->news_item['news_id']."'>".$news_title."</a>" : $news_title)."</div>";
|
return "<div class='category".$this->news_item['news_category']."'>".($this->news_item['news_render_type'] == 1 ? "<a href='".e_HTTP."comment.php?comment.news.".$this->news_item['news_id']."'>".$news_title."</a>" : $news_title)."</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_admincaption()
|
function get_admincaption()
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
$news_title = $this->e107->tp->toHTML($this->news_item['news_title'], TRUE,'no_hook,emotes_off, no_make_clickable');
|
$news_title = $this->e107->tp->toHTML($this->news_item['news_title'], TRUE,'no_hook,emotes_off, no_make_clickable');
|
||||||
return "<div class='".(defined(ADMINNAME) ? ADMINNAME : "null")."'>".($this->news_item['news_render_type'] == 1 ? "<a href='".e_HTTP."comment.php?comment.news.".$this->news_item['news_id']."'>".$news_title."</a>" : $news_title)."</div>";
|
return "<div class='".(defined(ADMINNAME) ? ADMINNAME : "null")."'>".($this->news_item['news_render_type'] == 1 ? "<a href='".e_HTTP."comment.php?comment.news.".$this->news_item['news_id']."'>".$news_title."</a>" : $news_title)."</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_adminbody($parm)
|
function get_adminbody($parm)
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
$news_body = $this->get_newsbody($parm);
|
$news_body = $this->get_newsbody($parm);
|
||||||
return "<div class='".(defined(ADMINNAME) ? ADMINNAME : 'null')."'>".$news_body.'</div>';
|
return "<div class='".(defined(ADMINNAME) ? ADMINNAME : 'null')."'>".$news_body.'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_newssummary()
|
function get_newssummary()
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
return ($this->news_item['news_summary']) ? $this->news_item['news_summary'].'<br />' : '';
|
return ($this->news_item['news_summary']) ? $this->news_item['news_summary'].'<br />' : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_newsthumbnail()
|
function get_newsthumbnail()
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
return (isset($this->news_item['news_thumbnail']) && $this->news_item['news_thumbnail']) ? "<a href='".$this->e107->url->getUrl('core:news', 'main', "action=item&value1={$this->news_item['news_id']}&value2={$this->news_item['news_category']}")."'><img class='news_image' src='".e_IMAGE_ABS."newspost_images/".$this->news_item['news_thumbnail']."' alt='' style='".$this->param['thumbnail']."' /></a>" : '';
|
return (isset($this->news_item['news_thumbnail']) && $this->news_item['news_thumbnail']) ? "<a href='".$this->e107->url->getUrl('core:news', 'main', "action=item&value1={$this->news_item['news_id']}&value2={$this->news_item['news_category']}")."'><img class='news_image' src='".e_IMAGE_ABS."newspost_images/".$this->news_item['news_thumbnail']."' alt='' style='".$this->param['thumbnail']."' /></a>" : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_newsimage()
|
function get_newsimage()
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
return (isset($this->news_item['news_thumbnail']) && $this->news_item['news_thumbnail']) ? "<a href='".$this->e107->url->getUrl('core:news', 'main', "action=item&value1={$this->news_item['news_id']}&value2={$this->news_item['news_category']}")."'><img class='news_image' src='".e_IMAGE_ABS."newspost_images/".$this->news_item['news_thumbnail']."' alt='' style='".$this->param['thumbnail']."' /></a>" : '';
|
return (isset($this->news_item['news_thumbnail']) && $this->news_item['news_thumbnail']) ? "<a href='".$this->e107->url->getUrl('core:news', 'main', "action=item&value1={$this->news_item['news_id']}&value2={$this->news_item['news_category']}")."'><img class='news_image' src='".e_IMAGE_ABS."newspost_images/".$this->news_item['news_thumbnail']."' alt='' style='".$this->param['thumbnail']."' /></a>" : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_sticky_icon()
|
function get_sticky_icon()
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
return $this->news_item['news_sticky'] ? $this->param['image_sticky'] : '';
|
return $this->news_item['news_sticky'] ? $this->param['image_sticky'] : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_newstitlelink()
|
function get_newstitlelink()
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
return "<a style='".(isset($this->param['itemlink']) ? $this->param['itemlink'] : 'null')."' href='".$this->e107->url->getUrl('core:news', 'main', "action=item&value1={$this->news_item['news_id']}&value2={$this->news_item['news_category']}")."'>".$this->news_item['news_title'].'</a>';
|
return "<a style='".(isset($this->param['itemlink']) ? $this->param['itemlink'] : 'null')."' href='".$this->e107->url->getUrl('core:news', 'main', "action=item&value1={$this->news_item['news_id']}&value2={$this->news_item['news_category']}")."'>".$this->news_item['news_title'].'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_newscaticon()
|
function get_newscaticon()
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
$category_icon = str_replace('../', '', trim($this->news_item['category_icon']));
|
$category_icon = str_replace('../', '', trim($this->news_item['category_icon']));
|
||||||
if (!$category_icon) { return ''; }
|
if (!$category_icon) { return ''; }
|
||||||
if ($category_icon && strstr('images', $category_icon))
|
if ($category_icon && strstr('images', $category_icon))
|
||||||
@@ -330,7 +315,6 @@ class news_shortcodes
|
|||||||
|
|
||||||
function get_newsinfo()
|
function get_newsinfo()
|
||||||
{
|
{
|
||||||
$this->load_news_item();
|
|
||||||
$news_item = $this->news_item;
|
$news_item = $this->news_item;
|
||||||
$param = $this->param;
|
$param = $this->param;
|
||||||
$con = new convert;
|
$con = new convert;
|
||||||
|
@@ -9,9 +9,9 @@
|
|||||||
* News handler
|
* News handler
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/news_class.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/news_class.php,v $
|
||||||
* $Revision: 1.10 $
|
* $Revision: 1.11 $
|
||||||
* $Date: 2009-01-15 15:42:24 $
|
* $Date: 2009-01-16 01:02:41 $
|
||||||
* $Author: secretr $
|
* $Author: mcfly_e107 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT')) { exit; }
|
||||||
@@ -140,7 +140,7 @@ class news {
|
|||||||
|
|
||||||
function render_newsitem($news, $mode = 'default', $n_restrict = '', $NEWS_TEMPLATE = '', $param='')
|
function render_newsitem($news, $mode = 'default', $n_restrict = '', $NEWS_TEMPLATE = '', $param='')
|
||||||
{
|
{
|
||||||
global $e107, $tp, $sql, $override, $pref, $ns, $NEWSSTYLE, $NEWSLISTSTYLE, $news_shortcodes, $loop_uid, $imode, $newsItemBegin;
|
global $e107, $tp, $sql, $override, $pref, $ns, $NEWSSTYLE, $NEWSLISTSTYLE, $news_shortcodes, $loop_uid, $imode;
|
||||||
if ($override_newsitem = $override -> override_check('render_newsitem')) {
|
if ($override_newsitem = $override -> override_check('render_newsitem')) {
|
||||||
$result = call_user_func($override_newsitem, $news, $mode, $n_restrict, $NEWS_TEMPLATE, $param);
|
$result = call_user_func($override_newsitem, $news, $mode, $n_restrict, $NEWS_TEMPLATE, $param);
|
||||||
if ($result == 'return')
|
if ($result == 'return')
|
||||||
@@ -230,8 +230,9 @@ class news {
|
|||||||
$loop_uid = $news['news_author'];
|
$loop_uid = $news['news_author'];
|
||||||
|
|
||||||
require_once(e_FILE.'shortcode/batch/news_shortcodes.php');
|
require_once(e_FILE.'shortcode/batch/news_shortcodes.php');
|
||||||
$newsItemBegin = true;
|
$e107->tp->e_sc->scClasses['news_shortcodes']->news_item = $news;
|
||||||
$text = $e107->tp -> parseTemplate($NEWS_PARSE, TRUE, $news_shortcodes);
|
$e107->tp->e_sc->scClasses['news_shortcodes']->param = $param;
|
||||||
|
$text = $e107->tp->parseTemplate($NEWS_PARSE, true);
|
||||||
|
|
||||||
if ($mode == 'return')
|
if ($mode == 'return')
|
||||||
{
|
{
|
||||||
|
@@ -12,9 +12,9 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/shortcode_handler.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/shortcode_handler.php,v $
|
||||||
| $Revision: 1.22 $
|
| $Revision: 1.23 $
|
||||||
| $Date: 2009-01-15 22:04:45 $
|
| $Date: 2009-01-16 01:02:41 $
|
||||||
| $Author: lisa_ $
|
| $Author: mcfly_e107 $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ function register_shortcode($classFunc, $codes, $path='', $force=false)
|
|||||||
foreach($codes as $code)
|
foreach($codes as $code)
|
||||||
{
|
{
|
||||||
$code = strtoupper($code);
|
$code = strtoupper($code);
|
||||||
if(!$sc->isRegistered($code) || $force == true)
|
if((!$sc->isRegistered($code) || $force == true) && !$sc->isOverride($code))
|
||||||
{
|
{
|
||||||
$sc->registered_codes[$code] = array('type' => 'class', 'path' => $path, 'class' => $classFunc);
|
$sc->registered_codes[$code] = array('type' => 'class', 'path' => $path, 'class' => $classFunc);
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@ function register_shortcode($classFunc, $codes, $path='', $force=false)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$codes = strtoupper($codes);
|
$codes = strtoupper($codes);
|
||||||
if(!$sc->isRegistered($code) || $force == true)
|
if((!$sc->isRegistered($code) || $force == true) && !$sc->isOverride($code))
|
||||||
{
|
{
|
||||||
$sc->registered_codes[$codes] = array('type' => 'func', 'path' => $path, 'function' => $classFunc);
|
$sc->registered_codes[$codes] = array('type' => 'func', 'path' => $path, 'function' => $classFunc);
|
||||||
}
|
}
|
||||||
@@ -65,6 +65,7 @@ class e_shortcode
|
|||||||
var $addedCodes; // Apparently not used
|
var $addedCodes; // Apparently not used
|
||||||
var $registered_codes = array(); // Shortcodes added by plugins
|
var $registered_codes = array(); // Shortcodes added by plugins
|
||||||
var $scClasses = array(); // Batch shortcode classes
|
var $scClasses = array(); // Batch shortcode classes
|
||||||
|
var $scOverride = array(); // Array of codes found in override/ dir
|
||||||
|
|
||||||
function e_shortcode($noload=false)
|
function e_shortcode($noload=false)
|
||||||
{
|
{
|
||||||
@@ -72,16 +73,31 @@ class e_shortcode
|
|||||||
|
|
||||||
$this->parseSCFiles = true; // Default probably never used, but make sure its defined.
|
$this->parseSCFiles = true; // Default probably never used, but make sure its defined.
|
||||||
|
|
||||||
|
//Register any shortcode from the shortcode/override/ directory
|
||||||
|
if($pref['sc_override'])
|
||||||
|
{
|
||||||
|
$tmp = explode(',', $pref['sc_override']);
|
||||||
|
foreach($tmp as $code)
|
||||||
|
{
|
||||||
|
$code = strtoupper(trim($code));
|
||||||
|
$this->registered_codes[$code]['type'] = 'override';
|
||||||
|
$this->scOverride[] = $code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Register any shortcodes that were registered by the theme
|
// Register any shortcodes that were registered by the theme
|
||||||
// $register_sc[] = 'MY_THEME_CODE'
|
// $register_sc[] = 'MY_THEME_CODE'
|
||||||
if(isset($register_sc) && is_array($register_sc))
|
if(isset($register_sc) && is_array($register_sc))
|
||||||
{
|
{
|
||||||
foreach($register_sc as $code)
|
foreach($register_sc as $code)
|
||||||
|
{
|
||||||
|
if(!$this->isRegistered($code))
|
||||||
{
|
{
|
||||||
$code = strtoupper($code);
|
$code = strtoupper($code);
|
||||||
$this->registered_codes[$code]['type'] = 'theme';
|
$this->registered_codes[$code]['type'] = 'theme';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Register all .sc files found in plugin directories (via pref)
|
// Register all .sc files found in plugin directories (via pref)
|
||||||
if(varset($pref['shortcode_list'], '') != '')
|
if(varset($pref['shortcode_list'], '') != '')
|
||||||
@@ -123,6 +139,11 @@ class e_shortcode
|
|||||||
return in_array($code, $this->registered_codes);
|
return in_array($code, $this->registered_codes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isOverride($code)
|
||||||
|
{
|
||||||
|
return in_array($code, $this->scOverride);
|
||||||
|
}
|
||||||
|
|
||||||
function parseCodes($text, $useSCFiles = true, $extraCodes = '')
|
function parseCodes($text, $useSCFiles = true, $extraCodes = '')
|
||||||
{
|
{
|
||||||
$saveParseSCFiles = $this->parseSCFiles; // In case of nested call
|
$saveParseSCFiles = $this->parseSCFiles; // In case of nested call
|
||||||
@@ -237,6 +258,10 @@ class e_shortcode
|
|||||||
$scFile = e_PLUGIN.strtolower($this->registered_codes[$code]['path']).'/'.strtolower($code).'.sc';
|
$scFile = e_PLUGIN.strtolower($this->registered_codes[$code]['path']).'/'.strtolower($code).'.sc';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'override':
|
||||||
|
$scFile = e_FILE.'shortcode/override/'.strtolower($code).'.sc';
|
||||||
|
break;
|
||||||
|
|
||||||
case 'theme':
|
case 'theme':
|
||||||
$scFile = THEME.strtolower($code).'.sc';
|
$scFile = THEME.strtolower($code).'.sc';
|
||||||
break;
|
break;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||||
* $Id: lan_db.php,v 1.4 2008-12-30 13:51:41 secretr Exp $
|
* $Id: lan_db.php,v 1.5 2009-01-16 01:02:41 mcfly_e107 Exp $
|
||||||
*
|
*
|
||||||
* Admin Language File
|
* Admin Language File
|
||||||
*
|
*
|
||||||
@@ -62,4 +62,7 @@ define("DBLAN_51", "Execute Selected");
|
|||||||
define("DBLAN_52", "Delete Duplicate"); //plugin scan
|
define("DBLAN_52", "Delete Duplicate"); //plugin scan
|
||||||
define("DBLAN_53", "Please select action.");
|
define("DBLAN_53", "Please select action.");
|
||||||
define("DBLAN_54", "No Validation errors found.");
|
define("DBLAN_54", "No Validation errors found.");
|
||||||
|
define('DBLAN_55', 'Select to scan shortcode/override directory for new shortcodes');
|
||||||
|
define('DBLAN_56', 'Scan override directory');
|
||||||
|
define('DBLAN_57', 'Shortcode Override list set to');
|
||||||
?>
|
?>
|
||||||
|
Reference in New Issue
Block a user