This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$foo = 'foo'; | |
echo $foo == 'foo' ? 'yes' : 'no'; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'facebook.php'; | |
function facebook_connect(){ | |
// Create our Application instance (replace this with your appId and secret). | |
$facebook = new Facebook(array( | |
'appId' => '145062682199939', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a class="comments" rel="123" href="http://url-to-real-comments-page.com">View Comments</a> | |
<script type="text/javascript"> | |
jQuery(document).ready(function($){ | |
$('.comments').click(function(){ | |
$.ajax({ | |
type: 'get', | |
data: { id: $(this).attr('rel')}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// needed to load WP core | |
include '../../../wp-config.php'; | |
if($_GET): | |
$id = $_GET['id']; | |
query_posts('p='.$id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function dump( $str ){ | |
echo '<pre>'.print_r($str, false).'</pre>'; | |
exit(); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function datetimeFormat( $date, $format ) | |
{ | |
$date = explode('-', $date); | |
$day = explode(' ', $date[2]); | |
$time = explode(':', $day[1]); | |
$day = $day[0]; | |
$mktime = mktime($time[0] , $time[1], $time[2], $date[1], $day, $date[0]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function siteroot() | |
{ | |
global $siteroot; | |
$siteroot = explode('/', $_SERVER['PHP_SELF']); | |
$siteroot = 'http://' . $_SERVER['SERVER_NAME'] . '/' . $siteroot[1]; | |
return $siteroot; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function ago($time) | |
{ | |
$time = strtotime($time); | |
$periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade"); | |
$lengths = array("60", "60", "24", "7", "4.35", "12", "10"); | |
$now = time(); | |
$difference = $now - $time; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function paginate( $total, $perpage ) | |
{ | |
$current = $_GET['page'] != '' ? $_GET['page'] : 1; | |
$paginate = '<div>'; | |
$paginate .= $current > 1 ? '<a href="?page='.($current-1).'"> « Older |</a>' : ''; | |
$paginate .= '<div>'; | |
for($i = 1; $i <= round($total/$perpage); $i++ ){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$start = $_GET['page'] == 1 || $_GET['page'] == '' ? 0 : $_GET['page'] * $perpage; | |
$perpage = 10; | |
$query = "SELECT * FROM table LIMIT $start, $perpage"; | |
$query = mysql_query($query); | |
while($row = mysql_fetch_array($query)): | |
echo '<p>'.$row['id'].' '.$row['data'].'</p>'; | |
endwhile; |
OlderNewer