diff --git a/core/extension.class.php b/core/extension.class.php index 436e17dc..736f624f 100644 --- a/core/extension.class.php +++ b/core/extension.class.php @@ -27,12 +27,12 @@ * } * * public class Hello extends Extension { - * public function onPageRequest(PageRequestEvent $event) { - * global $page, $user; - * send_event(new HelloEvent($user->name)); + * public function onPageRequest(PageRequestEvent $event) { // Every time a page request is sent + * global $user; // Look at the global "currently logged in user" object + * send_event(new HelloEvent($user->name)); // Broadcast a signal saying hello to that user * } - * public function onHello(HelloEvent $event) { - * $this->theme->display_hello($event->username); + * public function onHello(HelloEvent $event) { // When the "Hello" signal is recieved + * $this->theme->display_hello($event->username); // Display a message on the web page * } * } * @@ -40,22 +40,25 @@ * public class HelloTheme extends Themelet { * public function display_hello($username) { * global $page; - * $page->add_block(new Block("Hello!", "Hello there ".html_escape($username)); + * $h_user = html_escape($username); // Escape the data before adding it to the page + * $block = new Block("Hello!", "Hello there $h_user"); // HTML-safe variables start with "h_" + * $page->add_block($block); // Add the block to the page * } * } * * // ext/hello/test.php * public class HelloTest extends SCoreWebTestCase { * public function testHello() { - * $this->get_page("post/list"); - * $this->assert_text("Hello there"); + * $this->get_page("post/list"); // View a page, any page + * $this->assert_text("Hello there"); // Check that the specified text is in that page * } * } * * // themes/mytheme/hello.theme.php - * public class CustomHelloTheme extends HelloTheme { - * public function display_hello(Page $page, User $user) { - * $h_user = html_escape($user->name); + * public class CustomHelloTheme extends HelloTheme { // CustomHelloTheme overrides HelloTheme + * public function display_hello($username) { // the display_hello() function is customised + * global $page; + * $h_user = html_escape($username); * $page->add_block(new Block( * "Hello!", * "Hello there $h_user, look at my snazzy custom theme!" diff --git a/ext/handle_pixel/main.php b/ext/handle_pixel/main.php index b5bb9601..36dbef25 100644 --- a/ext/handle_pixel/main.php +++ b/ext/handle_pixel/main.php @@ -103,7 +103,7 @@ class PixelFileHandler extends DataHandlerExtension { if($size[1] > $size[0]*5) $size[1] = $size[0]*5; // running the call with cmd.exe requires quoting for our paths - $format = '"%s" "%s[0]" -crop %ux%u +repage -flatten -strip -thumbnail %ux%u -quality %u jpg:"%s"'; + $format = '"%s" "%s[0]" -extent %ux%u -flatten -strip -thumbnail %ux%u -quality %u jpg:"%s"'; $cmd = sprintf($format, $convert, $inname, $size[0], $size[1], $w, $h, $q, $outname); $cmd = str_replace("\"convert\"", "convert", $cmd); // quotes are only needed if the path to convert contains a space; some other times, quotes break things, see github bug #27 exec($cmd, $output, $ret);