Skip to content

Commit

Permalink
Adding gravatar() helper function.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivantcholakov committed Apr 17, 2016
1 parent 6b1e601 commit e0f7af4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
29 changes: 29 additions & 0 deletions helpers/gravatar_helper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');

/**
* @author Ivan Tcholakov <[email protected]>, 2015
* @license The MIT License, http://opensource.org/licenses/MIT
*/

if (!function_exists('gravatar')) {

// This helper function has been added here for compatibility with PyroCMS.
function gravatar($email = '', $size = 50, $rating = 'g', $url_only = false, $default = false) {

$ci = & get_instance();
$ci->load->library('gravatar');

if (@ (string) $default == '') {
$default = null;
}

$gravatar_url = $ci->gravatar->get($email, $size, $default, null, $rating);

if ($url_only) {
return $gravatar_url;
}

return '<img src="'.$gravatar_url.'" alt="Gravatar" class="gravatar" />';
}

}
11 changes: 11 additions & 0 deletions helpers/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>

<p>Directory access is forbidden.</p>

</body>
</html>

0 comments on commit e0f7af4

Please sign in to comment.