# HG changeset patch # User Matti Hamalainen # Date 1416490713 -7200 # Node ID d6668b73bb01cafc08ff0c062986bdfd4044ec32 # Parent 133197d0e48a79ed8fbf9a142c7acb8a95203c92 Modularize preview HTML stuff into a function stPrintPreviewElements(). diff -r 133197d0e48a -r d6668b73bb01 msite.inc.php --- a/msite.inc.php Thu Nov 20 14:56:44 2014 +0200 +++ b/msite.inc.php Thu Nov 20 15:38:33 2014 +0200 @@ -726,6 +726,44 @@ } +function stPrintPreviewElements($compo, $entry) +{ + if (($pdata = stGetEntryPreviewData($compo, $entry, FALSE, TRUE)) === FALSE) + return FALSE; + + switch ($pdata["previewType"]) + { + case EPREV_IMAGE: + if ($pdata["previewSize"] === FALSE || $pdata["thumbSize"] === FALSE) + { + echo + "\"Preview\""; + } + else + { + echo + "". + "\"Preview\""; + } + break; + + case EPREV_AUDIO: + if ($pdata["previewSize"] !== FALSE) + { + echo + ""; + } + break; + } + + return TRUE; +} + + // Get link helper function function stGetMainPageLink($id, $name, $show = TRUE) { diff -r 133197d0e48a -r d6668b73bb01 pages/vote.inc.php --- a/pages/vote.inc.php Thu Nov 20 14:56:44 2014 +0200 +++ b/pages/vote.inc.php Thu Nov 20 15:38:33 2014 +0200 @@ -150,38 +150,7 @@ " \n". "
"; - // The preview type can be overriden by the entry - if (($pdata = stGetEntryPreviewData($compo, $entry, FALSE, TRUE)) !== false) - { - switch ($pdata["previewType"]) - { - case EPREV_IMAGE: - if ($pdata["previewSize"] === FALSE || $pdata["thumbSize"] === FALSE) - { - echo - "\"Preview\""; - } - else - { - echo - "". - "\"Preview\""; - } - break; - - case EPREV_AUDIO: - if ($pdata["previewSize"] !== FALSE) - { - echo - ""; - } - break; - } - } + stPrintPreviewElements($compo, $entry); echo "
\n".