Changeset 2356
- Timestamp:
- 05/16/08 07:45:14 (6 months ago)
- Files:
-
- branches/release-38/lib/MT/Template/ContextHandlers.pm (modified) (10 diffs)
- branches/release-38/php/lib/block.mtauthoruserpicasset.php (modified) (1 diff)
- branches/release-38/php/lib/function.mtauthorauthiconurl.php (modified) (1 diff)
- branches/release-38/php/lib/function.mtauthorauthtype.php (modified) (1 diff)
- branches/release-38/php/lib/function.mtauthordisplayname.php (modified) (1 diff)
- branches/release-38/php/lib/function.mtauthoremail.php (modified) (1 diff)
- branches/release-38/php/lib/function.mtauthorid.php (modified) (1 diff)
- branches/release-38/php/lib/function.mtauthorname.php (modified) (1 diff)
- branches/release-38/php/lib/function.mtauthorurl.php (modified) (1 diff)
- branches/release-38/php/lib/function.mtauthoruserpic.php (modified) (1 diff)
- branches/release-38/php/lib/function.mtauthoruserpicurl.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/release-38/lib/MT/Template/ContextHandlers.pm
r2333 r2356 6273 6273 sub _hdlr_author_id { 6274 6274 my ($ctx) = @_; 6275 my $author = $ctx->stash('author') 6276 or return $ctx->_no_author_error(); 6275 my $author = $ctx->stash('author'); 6276 unless ($author) { 6277 my $e = $ctx->stash('entry'); 6278 $author = $e->author if $e; 6279 } 6280 return $ctx->_no_author_error() unless $author; 6277 6281 return $author->id; 6278 6282 } … … 6290 6294 sub _hdlr_author_name { 6291 6295 my ($ctx) = @_; 6292 my $author = $ctx->stash('author') 6293 or return $ctx->_no_author_error(); 6296 my $author = $ctx->stash('author'); 6297 unless ($author) { 6298 my $e = $ctx->stash('entry'); 6299 $author = $e->author if $e; 6300 } 6301 return $ctx->_no_author_error() unless $author; 6294 6302 return $author->name; 6295 6303 } … … 6309 6317 my $e = $ctx->stash('entry'); 6310 6318 $a = $e->author if $e; 6311 } 6319 } 6312 6320 return $ctx->_no_author_error() unless $a; 6313 6321 return $a->nickname || MT->translate('(Display Name not set)', $a->id); 6314 } 6322 } 6315 6323 6316 6324 ########################################################################### … … 6326 6334 sub _hdlr_author_email { 6327 6335 my ($ctx, $args) = @_; 6328 my $author = $ctx->stash('author') 6329 or return $ctx->_no_author_error(); 6336 my $author = $ctx->stash('author'); 6337 unless ($author) { 6338 my $e = $ctx->stash('entry'); 6339 $author = $e->author if $e; 6340 } 6341 return $ctx->_no_author_error() unless $author; 6330 6342 my $email = $author->email; 6331 6343 return '' unless defined $email; … … 6343 6355 sub _hdlr_author_url { 6344 6356 my ($ctx) = @_; 6345 my $author = $ctx->stash('author') 6346 or return $ctx->_no_author_error(); 6357 my $author = $ctx->stash('author'); 6358 unless ($author) { 6359 my $e = $ctx->stash('entry'); 6360 $author = $e->author if $e; 6361 } 6362 return $ctx->_no_author_error() unless $author; 6347 6363 my $url = $author->url; 6348 6364 return defined $url ? $url : ''; … … 6360 6376 sub _hdlr_author_auth_type { 6361 6377 my ($ctx) = @_; 6362 my $author = $ctx->stash('author') 6363 or return $ctx->_no_author_error(); 6378 my $author = $ctx->stash('author'); 6379 unless ($author) { 6380 my $e = $ctx->stash('entry'); 6381 $author = $e->author if $e; 6382 } 6383 return $ctx->_no_author_error() unless $author; 6364 6384 my $auth_type = $author->auth_type; 6365 6385 return defined $auth_type ? $auth_type : ''; … … 6399 6419 sub _hdlr_author_auth_icon_url { 6400 6420 my ($ctx, $args) = @_; 6401 my $author = $ctx->stash('author') 6402 or return $ctx->_no_author_error(); 6421 my $author = $ctx->stash('author'); 6422 unless ($author) { 6423 my $e = $ctx->stash('entry'); 6424 $author = $e->author if $e; 6425 } 6426 return $ctx->_no_author_error() unless $author; 6403 6427 my $size = $args->{size} || 'logo_small'; 6404 6428 return $author->auth_icon_url($size); … … 6419 6443 sub _hdlr_author_userpic { 6420 6444 my ($ctx) = @_; 6421 my $author = $ctx->stash('author') 6422 or return $ctx->_no_author_error(); 6445 my $author = $ctx->stash('author'); 6446 unless ($author) { 6447 my $e = $ctx->stash('entry'); 6448 $author = $e->author if $e; 6449 } 6450 return $ctx->_no_author_error() unless $author; 6423 6451 return $author->userpic_html() || ''; 6424 6452 } … … 6437 6465 sub _hdlr_author_userpic_url { 6438 6466 my ($ctx) = @_; 6439 my $author = $ctx->stash('author') 6440 or return $ctx->_no_author_error(); 6467 my $author = $ctx->stash('author'); 6468 unless ($author) { 6469 my $e = $ctx->stash('entry'); 6470 $author = $e->author if $e; 6471 } 6472 return $ctx->_no_author_error() unless $author; 6441 6473 return $author->userpic_url() || ''; 6442 6474 } … … 6465 6497 my ($ctx, $args, $cond) = @_; 6466 6498 6467 my $author = $ctx->stash('author') 6468 or return $ctx->_no_author_error(); 6499 my $author = $ctx->stash('author'); 6500 unless ($author) { 6501 my $e = $ctx->stash('entry'); 6502 $author = $e->author if $e; 6503 } 6504 return $ctx->_no_author_error() unless $author; 6469 6505 my $asset = $author->userpic or return ''; 6470 6506 branches/release-38/php/lib/block.mtauthoruserpicasset.php
r1174 r2356 8 8 function smarty_block_mtauthoruserpicasset($args, $content, &$ctx, &$repeat) { 9 9 $author = $ctx->stash('author'); 10 if (!$author) { 10 if (empty($author)) { 11 $entry = $ctx->stash('entry'); 12 if (!empty($entry)) { 13 $author = $ctx->mt->db->fetch_author($entry['entry_author_id']); 14 } 15 } 16 if (empty($author)) { 11 17 return $ctx->error("No author available"); 12 18 } branches/release-38/php/lib/function.mtauthorauthiconurl.php
r1174 r2356 8 8 function smarty_function_mtauthorauthiconurl($args, &$ctx) { 9 9 $author = $ctx->stash('author'); 10 if (!$author) { 11 return ""; 10 if (empty($author)) { 11 $entry = $ctx->stash('entry'); 12 if (!empty($entry)) { 13 $author = $ctx->mt->db->fetch_author($entry['entry_author_id']); 14 } 15 } 16 17 if (empty($author)) { 18 return $ctx->error("No author available"); 12 19 } 13 20 require_once "function.mtstaticwebpath.php"; branches/release-38/php/lib/function.mtauthorauthtype.php
r1174 r2356 8 8 function smarty_function_mtauthorauthtype($args, &$ctx) { 9 9 $author = $ctx->stash('author'); 10 if (!$author) { 10 if (empty($author)) { 11 $entry = $ctx->stash('entry'); 12 if (!empty($entry)) { 13 $author = $ctx->mt->db->fetch_author($entry['entry_author_id']); 14 } 15 } 16 17 if (empty($author)) { 11 18 return $ctx->error("No author available"); 12 19 } branches/release-38/php/lib/function.mtauthordisplayname.php
r1174 r2356 10 10 // parameters: none 11 11 $author = $ctx->stash('author'); 12 if (empty($author)) { 13 $entry = $ctx->stash('entry'); 14 if (!empty($entry)) { 15 $author = $ctx->mt->db->fetch_author($entry['entry_author_id']); 16 } 17 } 18 if (empty($author)) { 19 return $ctx->error("No author available"); 20 } 12 21 $author_name = $author['author_nickname']; 13 22 $author_name or $author_name = branches/release-38/php/lib/function.mtauthoremail.php
r1174 r2356 8 8 function smarty_function_mtauthoremail($args, &$ctx) { 9 9 $author = $ctx->stash('author'); 10 if (!$author) { 10 if (empty($author)) { 11 $entry = $ctx->stash('entry'); 12 if (!empty($entry)) { 13 $author = $ctx->mt->db->fetch_author($entry['entry_author_id']); 14 } 15 } 16 17 if (empty($author)) { 11 18 return $ctx->error("No author available"); 12 19 } 13 return isset($author['author_email']) ? $author['author_email'] : '';20 return isset($author['author_email']) ? $author['author_email'] : ''; 14 21 } 15 22 ?> branches/release-38/php/lib/function.mtauthorid.php
r1174 r2356 8 8 function smarty_function_mtauthorid($args, &$ctx) { 9 9 $author = $ctx->stash('author'); 10 if (!$author) { 10 if (empty($author)) { 11 $entry = $ctx->stash('entry'); 12 if (!empty($entry)) { 13 $author = $ctx->mt->db->fetch_author($entry['entry_author_id']); 14 } 15 } 16 17 if (empty($author)) { 11 18 return $ctx->error("No author available"); 12 19 } branches/release-38/php/lib/function.mtauthorname.php
r1174 r2356 8 8 function smarty_function_mtauthorname($args, &$ctx) { 9 9 $author = $ctx->stash('author'); 10 if (!$author) { 10 if (empty($author)) { 11 $entry = $ctx->stash('entry'); 12 if (!empty($entry)) { 13 $author = $ctx->mt->db->fetch_author($entry['entry_author_id']); 14 } 15 } 16 17 if (empty($author)) { 11 18 return $ctx->error("No author available"); 12 19 } branches/release-38/php/lib/function.mtauthorurl.php
r1174 r2356 8 8 function smarty_function_mtauthorurl($args, &$ctx) { 9 9 $author = $ctx->stash('author'); 10 if (!$author) { 10 if (empty($author)) { 11 $entry = $ctx->stash('entry'); 12 if (!empty($entry)) { 13 $author = $ctx->mt->db->fetch_author($entry['entry_author_id']); 14 } 15 } 16 17 if (empty($author)) { 11 18 return $ctx->error("No author available"); 12 19 } branches/release-38/php/lib/function.mtauthoruserpic.php
r1174 r2356 8 8 function smarty_function_mtauthoruserpic($args, &$ctx) { 9 9 $author = $ctx->stash('author'); 10 if (!$author) return ''; 10 if (empty($author)) { 11 $entry = $ctx->stash('entry'); 12 if (!empty($entry)) { 13 $author = $ctx->mt->db->fetch_author($entry['entry_author_id']); 14 } 15 } 16 if (empty($author)) { 17 return $ctx->error("No author available"); 18 } 11 19 12 20 $asset_id = isset($author['author_userpic_asset_id']) ? $author['author_userpic_asset_id'] : 0; branches/release-38/php/lib/function.mtauthoruserpicurl.php
r1174 r2356 8 8 function smarty_function_mtauthoruserpicurl($args, &$ctx) { 9 9 $author = $ctx->stash('author'); 10 if (!$author) return ''; 10 if (empty($author)) { 11 $entry = $ctx->stash('entry'); 12 if (!empty($entry)) { 13 $author = $ctx->mt->db->fetch_author($entry['entry_author_id']); 14 } 15 } 16 17 if (empty($author)) { 18 return $ctx->error("No author available"); 19 } 11 20 12 21 $asset_id = isset($author['author_userpic_asset_id']) ? $author['author_userpic_asset_id'] : 0;
