';
if(isset($array_Userphoto['0']) || isset($array_UserDescription['0'])) {
if(isset($array_Userphoto['0'])) {
echo '';
} // END if(isset($array_Userphoto['0']))
if(isset($array_UserDescription['0'])) {
echo '' . $obj_User->display_name . '';
echo '' . $array_UserDescription['0'] . '';
} // END if(isset($array_UserDescription['0']))
} else {
echo __('We are sorry, but the author did\'t entered any information in his profile.', $this->var_sTextdomain);
} // END if(isset($array_Userphoto['0']) || isset($array_UserDescription['0']))
echo '
';
} // END private function about_the_author_output($args = array(), $position)
/**
* Insert a field to userdetails to upload an author user photo.
*
* @since 0.1
*/
function userimage_in_profile() {
global $current_screen;
if($current_screen->id == 'profile' || $current_screen->id == 'user-edit') {
global $profileuser;
global $current_user;
$array_UserPhoto = get_user_meta($profileuser->ID, 'userphoto');
$var_sUserPhoto = (isset($array_UserPhoto['0'])) ? $array_UserPhoto['0'] : '';
echo '
' . __('Avatar', $this->var_sTextdomain) . '
';
echo '
' . __('Upload a foto for your user profile. If you don\'t want to use a photo, leave this field blank.', $this->var_sTextdomain) . '
';
} // END if($current_screen->id == 'profile' || $current_screen->id == 'user-edit')
} // END function userimage_in_profile()
/**
* Updating user_meta
*
* @since 0.1
*/
function userimage_update() {
global $current_screen;
if($current_screen->id == 'profile' || $current_screen->id == 'user-edit') {
global $profileuser;
global $current_user;
if(!empty($_REQUEST['userphoto'])) {
$array_ImageMeta = $this->get_thumbnail_by_guid($_REQUEST['userphoto'], 'userphoto');
if($array_ImageMeta) {
$var_sUserPhoto = (string) $array_ImageMeta['url'];
} else {
$var_sUserPhoto = (string) $_REQUEST['userphoto'];
} // END if($array_ImageMeta)
update_user_meta($current_user->ID, 'userphoto', $var_sUserPhoto);
} else {
delete_user_meta($current_user->ID, 'userphoto');
} // END if(!empty($_REQUEST['userphoto']))
} // END if($current_screen->id == 'profile' || $current_screen->id == 'user-edit')
} // END function userimage_update()
/**
* Adding uploadscript to users profile page
*
* @since 0.1
*/
function load_uploadscripts() {
global $current_screen;
if($current_screen->id == 'profile' || $current_screen->id == 'user-edit') {
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');
wp_register_script('about-the-author-upload', $this->get_url('/js/jquery-upload-min.js'), array(
'jquery',
'media-upload',
'thickbox'
));
wp_enqueue_script('about-the-author-upload');
wp_localize_script('about-the-author-upload', 'about_the_author_localizing_upload_js', array(
'use_this_image' => __('Use This Image', $this->var_sTextdomain)
));
wp_enqueue_style('thickbox');
} // END if($current_screen->id == 'profile' || $current_screen->id == 'user-edit')
} // END function load_uploadscripts()
/**
* Adding the CSS
*
* @since 0.1
*/
function load_css() {
wp_register_style('about-the-author-css', $this->get_url('/css/about-the-author.css'));
wp_enqueue_style('about-the-author-css');
}
/**
* Getting the right thumbnailsize
*
* @since 0.1
*
* @param unknown_type $var_sGuid
* @param unknown_type $var_sThumbnail
* @return boolean|multitype:string NULL
*/
function get_thumbnail_by_guid($var_sGuid, $var_sThumbnail) {
global $_wp_additional_image_sizes;
/**
* Check if we have a thumbnailimage and not the original.
* If we do, remove the dimensions to get the original file.
*
* @since 0.1
*
* @var regex $var_sPattern
*/
$var_sPattern = '/-[0-9\/]+x[0-9\/]+/';
if(preg_match($var_sPattern, $var_sGuid)) {
$var_sGuid = preg_replace($var_sPattern, '', $var_sGuid);
} // END if(preg_match($var_sPattern, $var_sGuid))
/**
* Asking the DB
*
* @since 0.1
*/
global $wpdb;
$var_qry = '
SELECT
' . $wpdb->postmeta . '.meta_value as post_meta_value
FROM
' . $wpdb->posts . ',
' . $wpdb->postmeta . '
WHERE
' . $wpdb->posts . '.guid = "' . $var_sGuid . '"
AND ' . $wpdb->postmeta . '.post_id = ' . $wpdb->posts . '.ID
AND ' . $wpdb->postmeta . '.meta_key = "_wp_attachment_metadata";';
$array_ImageMeta = unserialize($wpdb->get_var($var_qry));
/**
* Check if the returned thumbnail has the right dimensions.
* If not, return false.
*
* @since 0.1
*/
if($_wp_additional_image_sizes[$var_sThumbnail]['width'] == $array_ImageMeta['sizes'][$var_sThumbnail]['width']) {
$array_Logo = array(
'url' => substr($var_sGuid, 0, strrpos($var_sGuid, '/')) . '/' . $array_ImageMeta['sizes'][$var_sThumbnail]['file'],
'width' => $array_ImageMeta['sizes'][$var_sThumbnail]['width'],
'height' => $array_ImageMeta['sizes'][$var_sThumbnail]['height']
);
} else {
return false;
} // END if($_wp_additional_image_sizes[$var_sThumbnail]['width'] == $array_ImageMeta['sizes'][$var_sThumbnail]['width'])
return $array_Logo;
} // END function get_thumbnail_by_guid($var_sGuid)
/**
* A little notice on pluginupdates ....
*
* @since 0.1
*/
function update_notice() {
$url = 'http://plugins.trac.wordpress.org/browser/about-the-author/trunk/readme.txt?format=txt';
$data = '';
if(ini_get('allow_url_fopen')) {
$data = file_get_contents($url);
} else {
if(function_exists('curl_init')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
} // END if(function_exists('curl_init'))
} // END if(ini_get('allow_url_fopen'))
if($data) {
$matches = null;
$regexp = '~==\s*Changelog\s*==\s*=\s*[0-9.]+\s*=(.*)(=\s*' . preg_quote(ABOUT_THE_AUTHOR_VERSION) . '\s*=|$)~Uis';
if(preg_match($regexp, $data, $matches)) {
$changelog = (array) preg_split('~[\r\n]+~', trim($matches[1]));
echo '