1
0

Clean up indentation and variable naming to closer match G3 standards.

This commit is contained in:
Bharat Mediratta 2009-11-27 14:58:01 -08:00
parent 937b4cb99d
commit 9d36e222cb

View File

@ -18,84 +18,73 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
/**
* This is the API for handling comments.
*
* Note: by design, this class does not do any permission checking.
*/
class theme_3nids_Core {
public function fancylink($item, $viewtype="album", $groupImg = true, $displayComment = true, $parentTitleClass = "h2") {
//viewtype = album || dynamic || header
$link = "";
access::required("view", $item);
$photo_size = module::get_var("theme_3nids","photo_size");
if ($photo_size == "full"){
$width = $item->width;
$height = $item->height;
}else{
$width = $item->resize_width;
$height = $item->resize_height;
}
$desriptionMode = module::get_var("theme_3nids", "description");
$description = "";
$tags = tag::item_tags($item);
if(count($tags) && $desriptionMode == "tags"){
$description = " || " . implode(", ", $tags);
}elseif($desriptionMode == "item" && $item->description != ""){
$description = " || " . str_replace("\"",""",$item->description);
}elseif (($desriptionMode == "parent" || $desriptionMode == "item") && $item->parent()->description != ""){
$description = " || " . str_replace("\"",""",$item->parent()->description);
}
$titleMode = module::get_var("theme_3nids", "title");
if ($titleMode == "parent"){
$title = html::clean($item->parent()->title);
}else{
$title = html::clean($item->title);
}
$rel = "";
if ($groupImg == true) {$rel = " rel=\"fancygroup\" ";}
if ($item->is_photo() || ($item->is_movie()) && module::is_active("theme_3nids")){
$fancymodule = "";
if (module::is_active("exif")){
$fancymodule .= "exif::" . url::site("exif/show/{$item->id}") . ";;";}
if (module::is_active("comment") && module::is_active("theme_3nids")){
$fancymodule .= "comment::" . url::site("comments_3nids?item_id={$item->id}") . ";;comment_count::" . comment_3nids::count($item) . ";;" ;}
if ($item->is_photo()){
$link .= "<a href=\"" . url::site("photo_3nids/show/{$item->id}") ."/?w=" . $width . "xewx&h=" . $height . "xehx\" " . $rel . " class=\"fancyclass iframe\" title=\"" . $title . $description ."\" name=\"" . $fancymodule . " \">";
}else{
$link .= "<a href=\"" . url::site("movie_3nids/show/{$item->id}") . "/?w=" . strval(20+($width)) . "xewx&h=" . strval(50+($height)) . "xehx\" " . $rel . " class=\"fancyclass iframe\" title=\"" . $item->parent()->title . $description ."\" name=\"" . $fancymodule . " \">";
}
} elseif( $item->is_album() && $viewtype != "header"){
$link .= "<a href=\"" . $item->url() . "\">";
}
public function fancylink($item, $view_type="album", $group_img = true, $display_comment = true, $parent_title_class = "h2") {
// view_type = album || dynamic || header
$link = "";
access::required("view", $item);
if($viewtype != "header"){
$link .= $item->thumb_img(array("class" => "g-thumbnail")) . "</a>";
if( $item->is_album() && $viewtype == "album" ){
$link .= "<a href=\"" . $item->url() . "?show=" . $item->id . "\"><$parentTitleClass><span></span>" . html::clean($item->title) . "</$parentTitleClass></a>";
} elseif ( !($item->is_album()) && $viewtype == "dynamic") {
$link .= "<a href=\"" . $item->parent()->url() . "?show=" . $item->id . "\" class=\"g-parent-album\"><$parentTitleClass><span></span>" . html::clean($item->parent()->title) . "</$parentTitleClass></a>";
}
if (($item->is_photo() || $item->is_movie()) && $displayComment==true && module::is_active("comment") && module::is_active("theme_3nids")) {
$link .= "<ul class=\"g-metadata\"><li><a href=\"" . url::site("comments_3nids?item_id={$item->id}") ."\" class=\"iframe fancyclass g-hidden\">" . comment_3nids::count($item) . " " . t("comments") . "</a></li></ul>";
}
}else{
$link .= "</a>";
}
return $link;
}
$photo_size = module::get_var("theme_3nids", "photo_size");
if ($photo_size == "full"){
$width = $item->width;
$height = $item->height;
}else{
$width = $item->resize_width;
$height = $item->resize_height;
}
$desriptionMode = module::get_var("theme_3nids", "description");
$description = "";
$tags = tag::item_tags($item);
if(count($tags) && $desriptionMode == "tags"){
$description = " || " . implode(", ", $tags);
}elseif($desriptionMode == "item" && $item->description != ""){
$description = " || " . str_replace("\"","&quot;",$item->description);
}elseif (($desriptionMode == "parent" || $desriptionMode == "item") && $item->parent()->description != ""){
$description = " || " . str_replace("\"","&quot;",$item->parent()->description);
}
$titleMode = module::get_var("theme_3nids", "title");
if ($titleMode == "parent"){
$title = html::clean($item->parent()->title);
}else{
$title = html::clean($item->title);
}
$rel = "";
if ($group_img == true) {$rel = " rel=\"fancygroup\" ";}
if ($item->is_photo() || ($item->is_movie()) && module::is_active("theme_3nids")){
$fancymodule = "";
if (module::is_active("exif")){
$fancymodule .= "exif::" . url::site("exif/show/{$item->id}") . ";;";}
if (module::is_active("comment") && module::is_active("theme_3nids")){
$fancymodule .= "comment::" . url::site("comments_3nids?item_id={$item->id}") . ";;comment_count::" . comment_3nids::count($item) . ";;" ;}
if ($item->is_photo()){
$link .= "<a href=\"" . url::site("photo_3nids/show/{$item->id}") ."/?w=" . $width . "xewx&h=" . $height . "xehx\" " . $rel . " class=\"fancyclass iframe\" title=\"" . $title . $description ."\" name=\"" . $fancymodule . " \">";
}else{
$link .= "<a href=\"" . url::site("movie_3nids/show/{$item->id}") . "/?w=" . strval(20+($width)) . "xewx&h=" . strval(50+($height)) . "xehx\" " . $rel . " class=\"fancyclass iframe\" title=\"" . $item->parent()->title . $description ."\" name=\"" . $fancymodule . " \">";
}
} elseif( $item->is_album() && $view_type != "header"){
$link .= "<a href=\"" . $item->url() . "\">";
}
if($view_type != "header"){
$link .= $item->thumb_img(array("class" => "g-thumbnail")) . "</a>";
if( $item->is_album() && $view_type == "album" ){
$link .= "<a href=\"" . $item->url() . "?show=" . $item->id . "\"><$parent_title_class><span></span>" . html::clean($item->title) . "</$parent_title_class></a>";
} elseif ( !($item->is_album()) && $view_type == "dynamic") {
$link .= "<a href=\"" . $item->parent()->url() . "?show=" . $item->id . "\" class=\"g-parent-album\"><$parent_title_class><span></span>" . html::clean($item->parent()->title) . "</$parent_title_class></a>";
}
if (($item->is_photo() || $item->is_movie()) && $display_comment==true && module::is_active("comment") && module::is_active("theme_3nids")) {
$link .= "<ul class=\"g-metadata\"><li><a href=\"" . url::site("comments_3nids?item_id={$item->id}") ."\" class=\"iframe fancyclass g-hidden\">" . comment_3nids::count($item) . " " . t("comments") . "</a></li></ul>";
}
}else{
$link .= "</a>";
}
return $link;
}
}
?>