]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
added plugin hook for image links - allows people to do creative things
authorCash Costello <cash.costello@gmail.com>
Sat, 3 Oct 2009 18:53:57 +0000 (18:53 +0000)
committerCash Costello <cash.costello@gmail.com>
Sat, 3 Oct 2009 18:53:57 +0000 (18:53 +0000)
docs/extending_tidypics.txt
views/default/object/image.php

index 916cfa4eec2f8077ffeb7dbc2a4eec98420184f7..58fba6721fafe3a2f560541a8253f3dc54dcc9ff 100644 (file)
@@ -28,6 +28,7 @@ different css elements and where they are used.
     'tp_watermark', 'gd' \r
     'tp_watermark', 'imagick'\r
     'tp_watermark', 'imagemagick'\r
+3. image link: 'tp_image_link', 'image' - return false for no link or a url otherwise - params passed to this will porbably change in 1.7\r
     \r
     \r
 *** IMAGE MENU EXTENSIONS ***\r
index ae652fdfd35d5b3097b102b7b5de6a5dc6a41549..01beb25f61c71a50569587564e00c0354bcc6969 100644 (file)
                </div>
                <div id="tidypics_image_wrapper">
                        <?php
-                               if (get_plugin_setting('download_link', 'tidypics') != "disabled") {  
+                               // this code controls whether the photo is a hyperlink or not and what it links to 
+                               $image_link = false;
+                               if (get_plugin_setting('download_link', 'tidypics') != "disabled") {
+                                       // admin allows downloads so default to download link
                                        $ts = time();
                                        $token = generate_action_token($ts);
-                                       $download_url = $vars['url'] . "action/tidypics/download?file_guid=" . $image_guid . "&amp;view=inline&amp;__elgg_token={$token}&__elgg_ts={$ts}";
-                                       echo "<a href=\"{$download_url}\" title=\"{$title}\"><img id=\"tidypics_image\"  src=\"{$vars['url']}mod/tidypics/thumbnail.php?file_guid={$image_guid}&amp;size=large\" alt=\"{$title}\" /></a>";
+                                       $image_link = $vars['url'] . "action/tidypics/download?file_guid=" . $image_guid . "&amp;view=inline&amp;__elgg_token={$token}&__elgg_ts={$ts}";
+                               }
+                               // does any plugin want to override the link
+                               $image_link = trigger_plugin_hook('tp_image_link', 'image', $image, $image_link);                               
+                               // add link if set
+                               if ($image_link) {
+                                       echo "<a href=\"{$image_link}\" title=\"{$title}\"><img id=\"tidypics_image\"  src=\"{$vars['url']}mod/tidypics/thumbnail.php?file_guid={$image_guid}&amp;size=large\" alt=\"{$title}\" /></a>";
                                } else {
+                                       // no link for this image
                                        echo "<img id=\"tidypics_image\"  src=\"{$vars['url']}mod/tidypics/thumbnail.php?file_guid={$image_guid}&amp;size=large\" alt=\"{$title}\" />";
                                }
-                       ?>
+                               ?>
                        <div class="clearfloat"></div>
                </div>
 <?php