├── README.md └── plugins └── popular-clicks ├── README.md └── plugin.php /README.md: -------------------------------------------------------------------------------- 1 | yourls 2 | ====== 3 | 4 | Extensions for yourls http link shortner: 5 | * http://yourls.org/ 6 | -------------------------------------------------------------------------------- /plugins/popular-clicks/README.md: -------------------------------------------------------------------------------- 1 | Yourls Popular Clicks Plugin 2 | ============================ 3 | 4 | Display the top of the most clicked links during past days. 5 | 6 | Installation 7 | ------------ 8 | 9 | Copy the 'popular-clicks' directory in 'user/plugins/' of 'yourls' installation folder. 10 | 11 | Got to yourls admin page and enable the plugin. 12 | 13 | Customization 14 | ------------- 15 | 16 | Open 'user/plugins/popular-clicks/plugin.php' and update its last part to get your 17 | preferred time interval reports. 18 | -------------------------------------------------------------------------------- /plugins/popular-clicks/plugin.php: -------------------------------------------------------------------------------- 1 | Popular Clicks'; 20 | 21 | function show_top($numdays,$numrows) { 22 | global $ydb; 23 | $base = YOURLS_SITE; 24 | $table_url = YOURLS_DB_TABLE_URL; 25 | $table_log = YOURLS_DB_TABLE_LOG; 26 | $outdata = ''; 27 | 28 | /** 29 | SELECT a.shorturl AS shorturl, count(*) AS clicks, b.url AS longurl 30 | FROM yourls_log a, yourls_url b WHERE a.shorturl=b.keyword AND DATE_SUB(NOW(), 31 | INTERVAL 30 DAY)fetchAll($sql); 36 | 37 | if ($query) { 38 | foreach( $query as $query_result ) { 39 | $outdata .= '' . $query_result['clicks'] . '' 40 | . $query_result['shorturl'] .'' 41 | . '' 42 | . $query_result['longurl'] . ''; 43 | } 44 | } 45 | echo '

Popular Clicks in the Last '. $numdays . ' Days:


' 46 | . '' . $outdata . "
ClicksShort URLLong URL

\n\r"; 47 | } 48 | 49 | // update next lines for addjustments on number of days and number of top links 50 | // example: show_top(1,5) => print the 5 most popular links clicked in the last 1 day 51 | show_top(1,15); // last day 52 | show_top(7,15); // last week 53 | show_top(30,15); // last ~month 54 | show_top(365,15); // last ~year 55 | show_top(1000,15); // ~alltime 56 | } 57 | 58 | --------------------------------------------------------------------------------