| 1 |
1994
|
darkviper
|
<?php
|
| 2 |
|
|
|
| 3 |
|
|
/**
|
| 4 |
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
| 5 |
|
|
*
|
| 6 |
|
|
* This program is free software: you can redistribute it and/or modify
|
| 7 |
|
|
* it under the terms of the GNU General Public License as published by
|
| 8 |
|
|
* the Free Software Foundation, either version 3 of the License, or
|
| 9 |
|
|
* (at your option) any later version.
|
| 10 |
|
|
*
|
| 11 |
|
|
* This program is distributed in the hope that it will be useful,
|
| 12 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 14 |
|
|
* GNU General Public License for more details.
|
| 15 |
|
|
*
|
| 16 |
|
|
* You should have received a copy of the GNU General Public License
|
| 17 |
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 18 |
|
|
*/
|
| 19 |
|
|
|
| 20 |
|
|
/**
|
| 21 |
|
|
* WbLink.php
|
| 22 |
|
|
*
|
| 23 |
|
|
* @category Addons
|
| 24 |
|
|
* @package Addons_News
|
| 25 |
|
|
* @copyright Manuela v.d.Decken <manuela@isteam.de>
|
| 26 |
|
|
* @author Manuela v.d.Decken <manuela@isteam.de>
|
| 27 |
|
|
* @license http://www.gnu.org/licenses/gpl.html GPL License
|
| 28 |
|
|
* @version 0.0.1
|
| 29 |
|
|
* @revision $Revision: $
|
| 30 |
|
|
* @link $HeadURL: $
|
| 31 |
|
|
* @lastmodified $Date: $
|
| 32 |
|
|
* @since File available since 04.11.2013
|
| 33 |
|
|
* @description This class implements an interface for the wblink-outputfilter
|
| 34 |
|
|
*
|
| 35 |
|
|
* @inherited WbDatabase $oDb
|
| 36 |
|
|
* @inherited WbAdaptor $oReg
|
| 37 |
|
|
*
|
| 38 |
|
|
*/
|
| 39 |
|
|
|
| 40 |
|
|
class m_news_WbLink extends WbLinkAbstract
|
| 41 |
|
|
{
|
| 42 |
|
|
/**
|
| 43 |
|
|
* makeLinkFromTag
|
| 44 |
|
|
* @param type $aReplacement
|
| 45 |
|
|
* @return string
|
| 46 |
|
|
* @description
|
| 47 |
|
|
*/
|
| 48 |
|
|
public function makeLinkFromTag(array $aReplacement)
|
| 49 |
|
|
{
|
| 50 |
|
|
// set link on failure ('#' means, still stay on current page)
|
| 51 |
|
|
$sRetval = '#';
|
| 52 |
|
|
// search `link` from posts table and create absolute URL
|
| 53 |
|
|
$sql = 'SELECT `link` '
|
| 54 |
|
|
. 'FROM `'.$this->oDb->TablePrefix.'mod_news_posts` '
|
| 55 |
2014
|
darkviper
|
. 'WHERE `post_id`='.$aReplacement['item'];
|
| 56 |
1994
|
darkviper
|
if(($sLink = $this->oDb->get_one($sql)))
|
| 57 |
|
|
{
|
| 58 |
|
|
$sLink = trim(str_replace('\\', '/', $sLink), '/');
|
| 59 |
|
|
// test if valid accessfile is available
|
| 60 |
|
|
if(is_readable($this->oReg->AppPath.$this->oReg->PagesDir.$sLink.$this->oReg->PageExtension))
|
| 61 |
|
|
{
|
| 62 |
|
|
$sRetval = $this->oReg->AppUrl.$this->oReg->PagesDir.$sLink.$this->oReg->PageExtension;
|
| 63 |
|
|
}
|
| 64 |
|
|
}
|
| 65 |
|
|
return $sRetval;
|
| 66 |
|
|
}
|
| 67 |
2014
|
darkviper
|
/**
|
| 68 |
|
|
* generateOptionsList
|
| 69 |
|
|
* @param string $sObjectName name of the array to create (default: 'AddonItemsSelectBox')
|
| 70 |
|
|
* @return &array complete definition of a SelectBox
|
| 71 |
|
|
* @description Bild a mulitdimensional Array with complete Option definitions for use in a Select Box
|
| 72 |
|
|
*/
|
| 73 |
|
|
public function &generateOptionsList()
|
| 74 |
|
|
{
|
| 75 |
|
|
$aAddonItems =& $this->_executeListGeneration(
|
| 76 |
|
|
'news',
|
| 77 |
|
|
'mod_news_posts',
|
| 78 |
|
|
'page_id',
|
| 79 |
|
|
'section_id',
|
| 80 |
|
|
'post_id',
|
| 81 |
|
|
'created_when',
|
| 82 |
|
|
'title',
|
| 83 |
|
|
'active'
|
| 84 |
|
|
);
|
| 85 |
|
|
return $aAddonItems;
|
| 86 |
|
|
}
|
| 87 |
1994
|
darkviper
|
} // end of class m_news_WbLink
|