Current time: 02-08-2013, 08:31 PM    Register | Lost Password?

Contest #1- First member to have 5 referals will get VIP status. You can find your referal link in your UserCP


Post Reply 
Time Added (WCDDLv3)
Author Message
c0rrupt Offline
Administrator


Posts: 276
Joined: Mar 2010
Post: #1
Time Added (WCDDLv3)
Full credit to jomasco for this mod.

time_added Today/Yesterday/Date ex(2012-01-22)
PHP Code: (Select All)
<?php
/*BEGIN_INFO
V1.0 jomasaco - Today/Yesterday/Y-m-d(2012-01-22).
END_INFO*/

if(!defined("WCDDL_GUTS"))
    exit;
$modEnabled true//Change to false to turn it off

function todayesterday($rows) {
foreach(
$rows as $row) {
if(
date("Y-m-d") == date("Y-m-d",strtotime($row->time_added))) {
$row->time_added "Today";
} elseif(
date("Y-m-d",strtotime("yesterday")) == date("Y-m-d",strtotime($row->time_added))) {
$row->time_added "Yesterday";
} else {
$row->time_added date("Y-m-d",strtotime($row->time_added));
}
}
}

if(
$modEnabled
Core::load()->hook('DownloadsGetRows''todayesterday'); 









Other Version Today/Yesterday/X ago ex(3 days ago)
PHP Code: (Select All)
<?php
/*BEGIN_INFO
V1.1 jomasaco - Today/Yesterday/Time ago.
END_INFO*/

if(!defined("WCDDL_GUTS"))
    exit;
$modEnabled true//Change to false to turn it off

function todayesterday($rows) {
foreach(
$rows as $row) {
if(
date("Y-m-d") == date("Y-m-d",strtotime($row->time_added))) {
$row->time_added "Today";
} elseif(
date("Y-m-d",strtotime("yesterday")) == date("Y-m-d",strtotime($row->time_added))) {
$row->time_added "Yesterday";
} else {
$date2 time();
    
$blocks = array(
        array(
'name'=>'year','amount' => 60*60*24*365),
        array(
'name'=>'month','amount' => 60*60*24*31),
        array(
'name'=>'day','amount' => 60*60*24)
        );
   
    
$diff abs(strtotime($row->time_added)-$date2);
    
$result = array();
    foreach(
$blocks as $block)
        {
        if (
$diff/$block['amount'] >= 1)
            {
            
$amount floor($diff/$block['amount']);
            if (
$amount>1) {$plural='s';} else {$plural='';}
            
$result[] = $amount.' '.$block['name'].$plural;
            
$diff -= $amount*$block['amount'];
            }
        }
    
$row->time_added implode(' ',$result).' ago';
}
}
}
if(
$modEnabled
Core::load()->hook('DownloadsGetRows''todayesterday'); 









To use create a new file called wcddl_todayyesterday.php and paste one of the codes in it and upload it to your modules folder.

To call it use the following:
PHP Code: (Select All)
<?php echo $row->time_added?>
11-27-2012 07:54 PM
Visit this user's website Find all posts by this user Quote this message in a reply
pi0tr3k Offline
WCDDL VIP


Posts: 18
Joined: Nov 2012
Post: #2
RE: Time Added (WCDDLv3)
Works like a charm

Thanks a lot
11-28-2012 04:22 AM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)

Affiliates
PhazeDDL WarezUNION WarezOrder Free Full Downloads SuppaDDL CafeDDL-Serves Premium Downloads! free porn downloads @ PornDDL.me
This forum uses Lukasz Tkacz MyBB addons.