registerEvent( 'onPrepareContent', 'botCalDate_1' );
$mainframe->registerEvent( 'onAfterDisplayContent', 'botCalDateEndDiv' );
}else{
$_MAMBOTS->registerFunction( 'onPrepareContent', 'botCalDate' );
$_MAMBOTS->registerFunction( 'onAfterDisplayContent', 'botCalDateEndDiv' );
}
function botCalDate( $published, &$row, &$params, $page=0 ) {
global $database;
if(!$published){
return;
}
// load bot params
$query = "SELECT id"
. "\n FROM #__mambots"
. "\n WHERE element = 'caldatebot'"
. "\n AND folder = 'content'"
;
$database->setQuery( $query );
$id = $database->loadResult();
$mambot = new mosMambot( $database );
$mambot->load( $id );
$bot_params = new mosParameters( $mambot->params );
/*
* Strange that they changed this in 1.0.8 / 1.5
*
if( mainCalDate($params, $bot_params, $row)){
$params->set( 'createdate', 0);
}
*/
return mainCalDate($params, $bot_params, $row);
}
function botCalDate_1( &$row, &$params, $page=0 ) {
global $Itemid, $database;
// Get Plugin info
$plugin =& JPluginHelper::getPlugin('content', 'caldatebot');
// check whether plugin has been unpublished
if (!$plugin->published) {
return;
}
$bot_params = new JParameter( $plugin->params );
if( mainCalDate($params, $bot_params, $row) ){
$row->created='';
}
return $ret;
}
function mainCalDate(&$params, &$bot_params, &$row){
global $Itemid;
if( $bot_params->get( 'disable_ie6' ) && isIE6() ){
return;
}
$show = (!$bot_params->get( 'sections' ) && !$bot_params->get( 'categories') && !$bot_params->get( 'pages' ) );
if($bot_params->get( 'sections')){
$sections = explode(',' , $bot_params->get( 'sections' ) );
if( in_array($row->sectionid, $sections) ){
$show = true;
}
}
if($bot_params->get( 'categories')){
$cats = explode(',' , $bot_params->get( 'categories' ) );
if( in_array($row->catid, $cats) ){
$show = true;
}
}
if($bot_params->get( 'pages')){
$pages = explode(',' , $bot_params->get( 'pages' ) );
if( in_array($Itemid, $pages) ){
$show = true;
}
}
if(!$show){
return;
}
if($params->get( 'createdate' )){
global $mainframe;
$styled_yet = !empty($_REQUEST['cd_styled']);
if(!$styled_yet){
$mainframe->addCustomHeadTag("
");
$_REQUEST['cd_styled'] = true;
}
global $mosConfig_locale;
setlocale(LC_TIME, $mosConfig_locale);
$time = strtotime($row->created);
?>
|
get( 'disable_ie6' ) && isIE6() ){
return '';
}
if(!empty($_REQUEST['cd_end_div_please'])){
return " |
";
$_REQUEST['cd_end_div_please'] = '';
}else{
return "";
}
}
/*
Script Name: Lightweight PHP Browser Detector
Author: Harald Hope, Website: http://TechPatterns.com/
Script Source URI: http://TechPatterns.com/downloads/php_browser_detection.php
Version 1.1.4
Copyright (C) 13 October 2005
Special thanks to Tapio Markula, for his initial inspiration of creating a useable php browser detector.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
Lesser GPL license text:
http://www.gnu.org/licenses/lgpl.txt
Coding conventions:
http://cvs.sourceforge.net/viewcvs.py/phpbb/phpBB2/docs/codingstandards.htm?rev=1.3
*/
/*
basic function, has two tests currently, 'browser', returns shorthand for browser name,
or 'number', which returns browser number, or in mozilla's case, the rv number. You can
also use the 'full' parameter to get back both results at once, in an array.
if you need more precise browser information, get our full featured browser detection script:
http://TechPatterns.com/downloads/browser_detection_php_ar.txt
*/
function isIE6(){
return (browser_detection( 'browser' ) == 'ie' && intval(browser_detection( 'number' )) <= 6);
}
function browser_detection( $which_test )
{
// initialize variables
$browser_name = '';
$browser_number = '';
// get userAgent string
$browser_user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '';
//pack browser array
// values [0]= user agent identifier, lowercase, [1] = dom browser, [2] = shorthand for browser,
$a_browser_types[] = array('opera', true, 'op' );
$a_browser_types[] = array('msie', true, 'ie' );
$a_browser_types[] = array('konqueror', true, 'konq' );
$a_browser_types[] = array('safari', true, 'saf' );
$a_browser_types[] = array('gecko', true, 'moz' );
$a_browser_types[] = array('mozilla/4', false, 'ns4' );
for ($i = 0; $i < count($a_browser_types); $i++)
{
$s_browser = $a_browser_types[$i][0];
$b_dom = $a_browser_types[$i][1];
$browser_name = $a_browser_types[$i][2];
// if the string identifier is found in the string
if (stristr($browser_user_agent, $s_browser))
{
// we are in this case actually searching for the 'rv' string, not the gecko string
// this test will fail on Galeon, since it has no rv number. You can change this to
// searching for 'gecko' if you want, that will return the release date of the browser
if ( $browser_name == 'moz' )
{
$s_browser = 'rv';
}
$browser_number = browser_version( $browser_user_agent, $s_browser );
break;
}
}
// which variable to return
if ( $which_test == 'browser' )
{
return $browser_name;
}
elseif ( $which_test == 'number' )
{
return $browser_number;
}
/* this returns both values, then you only have to call the function once, and get
the information from the variable you have put it into when you called the function */
elseif ( $which_test == 'full' )
{
$a_browser_info = array( $browser_name, $browser_number );
return $a_browser_info;
}
}
// function returns browser number or gecko rv number
// this function is called by above function, no need to mess with it unless you want to add more features
function browser_version( $browser_user_agent, $search_string )
{
$string_length = 8;// this is the maximum length to search for a version number
//initialize browser number, will return '' if not found
$browser_number = '';
// which parameter is calling it determines what is returned
$start_pos = strpos( $browser_user_agent, $search_string );
// start the substring slice 1 space after the search string
$start_pos += strlen( $search_string ) + 1;
// slice out the largest piece that is numeric, going down to zero, if zero, function returns ''.
for ( $i = $string_length; $i > 0 ; $i-- )
{
// is numeric makes sure that the whole substring is a number
if ( is_numeric( substr( $browser_user_agent, $start_pos, $i ) ) )
{
$browser_number = substr( $browser_user_agent, $start_pos, $i );
break;
}
}
return $browser_number;
}
?>