<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[22619] trunk/wp-includes: Add abstract methods back to WP_Image_Editor and refresh phpdoc.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/22619">22619</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2012-11-16 22:02:21 +0000 (Fri, 16 Nov 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add abstract methods back to WP_Image_Editor and refresh phpdoc.

Props DH-Shredder, markoheijnen, kurtpayne, nacin
see <a href="http://core.trac.wordpress.org/ticket/6821">#6821</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesclasswpimageeditorgdphp">trunk/wp-includes/class-wp-image-editor-gd.php</a></li>
<li><a href="#trunkwpincludesclasswpimageeditorimagickphp">trunk/wp-includes/class-wp-image-editor-imagick.php</a></li>
<li><a href="#trunkwpincludesclasswpimageeditorphp">trunk/wp-includes/class-wp-image-editor.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesclasswpimageeditorgdphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class-wp-image-editor-gd.php (22618 => 22619)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-wp-image-editor-gd.php        2012-11-16 21:52:48 UTC (rev 22618)
+++ trunk/wp-includes/class-wp-image-editor-gd.php        2012-11-16 22:02:21 UTC (rev 22619)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * Checks to see if current environment supports GD
</del><ins>+         * Checks to see if current environment supports GD.
</ins><span class="cx">          *
</span><span class="cx">          * @since 3.5.0
</span><span class="cx">          * @access public
</span><span class="lines">@@ -40,9 +40,9 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * Loads image from $this-&gt;file into new GD Resource
</del><ins>+         * Loads image from $this-&gt;file into new GD Resource.
</ins><span class="cx">          *
</span><del>-         * @since 3.5
</del><ins>+         * @since 3.5.0
</ins><span class="cx">          * @access protected
</span><span class="cx">          *
</span><span class="cx">          * @return boolean|\WP_Error
</span><span class="lines">@@ -72,7 +72,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * Sets or updates current image size
</del><ins>+         * Sets or updates current image size.
</ins><span class="cx">          *
</span><span class="cx">          * @since 3.5.0
</span><span class="cx">          * @access protected
</span><span class="lines">@@ -91,7 +91,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * Checks to see if editor supports mime-type specified
</del><ins>+         * Checks to see if editor supports the mime-type specified.
</ins><span class="cx">          *
</span><span class="cx">          * @since 3.5.0
</span><span class="cx">          * @access public
</span><span class="lines">@@ -107,8 +107,11 @@
</span><span class="cx"> 
</span><span class="cx">         /**
</span><span class="cx">          * Resizes current image.
</span><del>-         * Wrapper around _resize, since _resize returns a GD Resource
</del><ins>+         * Wraps _resize, since _resize returns a GD Resource.
</ins><span class="cx">          *
</span><ins>+         * @since 3.5.0
+         * @access public
+         *
</ins><span class="cx">          * @param int $max_w
</span><span class="cx">          * @param int $max_h
</span><span class="cx">          * @param boolean $crop
</span><span class="lines">@@ -153,6 +156,9 @@
</span><span class="cx">          * Processes current image and saves to disk
</span><span class="cx">          * multiple sizes from single source.
</span><span class="cx">          *
</span><ins>+         * @since 3.5.0
+         * @access public
+         *
</ins><span class="cx">          * @param array $sizes { {width, height}, ... }
</span><span class="cx">          * @return array
</span><span class="cx">          */
</span><span class="lines">@@ -192,7 +198,7 @@
</span><span class="cx">          * @param int $src_h The height to crop.
</span><span class="cx">          * @param int $dst_w Optional. The destination width.
</span><span class="cx">          * @param int $dst_h Optional. The destination height.
</span><del>-         * @param int $src_abs Optional. If the source crop points are absolute.
</del><ins>+         * @param boolean $src_abs Optional. If the source crop points are absolute.
</ins><span class="cx">          * @return boolean|WP_Error
</span><span class="cx">          */
</span><span class="cx">         public function crop( $src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false ) {
</span><span class="lines">@@ -250,8 +256,11 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * Flips current image
</del><ins>+         * Flips current image.
</ins><span class="cx">          *
</span><ins>+         * @since 3.5.0
+         * @access public
+         *
</ins><span class="cx">          * @param boolean $horz Horizonal Flip
</span><span class="cx">          * @param boolean $vert Vertical Flip
</span><span class="cx">          * @returns boolean|WP_Error
</span><span class="lines">@@ -277,8 +286,11 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * Saves current in-memory image to file
</del><ins>+         * Saves current in-memory image to file.
</ins><span class="cx">          *
</span><ins>+         * @since 3.5.0
+         * @access public
+         *
</ins><span class="cx">          * @param string $destfilename
</span><span class="cx">          * @param string $mime_type
</span><span class="cx">          * @return array|WP_Error {'path'=&gt;string, 'file'=&gt;string, 'width'=&gt;int, 'height'=&gt;int, 'mime-type'=&gt;string}
</span><span class="lines">@@ -335,8 +347,11 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * Returns stream of current image
</del><ins>+         * Returns stream of current image.
</ins><span class="cx">          *
</span><ins>+         * @since 3.5.0
+         * @access public
+         *
</ins><span class="cx">          * @param string $mime_type
</span><span class="cx">          */
</span><span class="cx">         public function stream( $mime_type = null ) {
</span></span></pre></div>
<a id="trunkwpincludesclasswpimageeditorimagickphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class-wp-image-editor-imagick.php (22618 => 22619)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-wp-image-editor-imagick.php        2012-11-16 21:52:48 UTC (rev 22618)
+++ trunk/wp-includes/class-wp-image-editor-imagick.php        2012-11-16 22:02:21 UTC (rev 22619)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * Loads image from $this-&gt;file into new Imagick Object
</del><ins>+         * Loads image from $this-&gt;file into new Imagick Object.
</ins><span class="cx">          *
</span><span class="cx">          * @since 3.5.0
</span><span class="cx">          * @access protected
</span><span class="lines">@@ -109,7 +109,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * Sets or updates current image size
</del><ins>+         * Sets or updates current image size.
</ins><span class="cx">          *
</span><span class="cx">          * @since 3.5.0
</span><span class="cx">          * @access protected
</span><span class="lines">@@ -138,7 +138,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * Checks to see if editor supports mime-type specified
</del><ins>+         * Checks to see if editor supports the mime-type specified.
</ins><span class="cx">          *
</span><span class="cx">          * @since 3.5.0
</span><span class="cx">          * @access public
</span><span class="lines">@@ -163,6 +163,9 @@
</span><span class="cx">         /**
</span><span class="cx">          * Resizes current image.
</span><span class="cx">          *
</span><ins>+         * @since 3.5.0
+         * @access public
+         *
</ins><span class="cx">          * @param int $max_w
</span><span class="cx">          * @param int $max_h
</span><span class="cx">          * @param boolean $crop
</span><span class="lines">@@ -199,6 +202,9 @@
</span><span class="cx">          * Processes current image and saves to disk
</span><span class="cx">          * multiple sizes from single source.
</span><span class="cx">          *
</span><ins>+         * @since 3.5.0
+         * @access public
+         *
</ins><span class="cx">          * @param array $sizes
</span><span class="cx">          * @return array
</span><span class="cx">          */
</span><span class="lines">@@ -246,11 +252,10 @@
</span><span class="cx">          * @param int $src_h The height to crop.
</span><span class="cx">          * @param int $dst_w Optional. The destination width.
</span><span class="cx">          * @param int $dst_h Optional. The destination height.
</span><del>-         * @param int $src_abs Optional. If the source crop points are absolute.
</del><ins>+         * @param boolean $src_abs Optional. If the source crop points are absolute.
</ins><span class="cx">          * @return boolean|WP_Error
</span><span class="cx">          */
</span><span class="cx">         public function crop( $src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false ) {
</span><del>-                // Not sure this is compatible.
</del><span class="cx">                 if ( $src_abs ) {
</span><span class="cx">                         $src_w -= $src_x;
</span><span class="cx">                         $src_h -= $src_y;
</span><span class="lines">@@ -302,14 +307,14 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * Flips current image
</del><ins>+         * Flips current image.
</ins><span class="cx">          *
</span><span class="cx">          * @since 3.5.0
</span><span class="cx">          * @access public
</span><span class="cx">          *
</span><del>-         * @param boolean $horz Horizontal Flip
</del><ins>+         * @param boolean $horz Horizonal Flip
</ins><span class="cx">          * @param boolean $vert Vertical Flip
</span><del>-         * @returns boolean
</del><ins>+         * @returns boolean|WP_Error
</ins><span class="cx">          */
</span><span class="cx">         public function flip( $horz, $vert ) {
</span><span class="cx">                 try {
</span><span class="lines">@@ -326,8 +331,11 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * Saves current image to file
</del><ins>+         * Saves current image to file.
</ins><span class="cx">          *
</span><ins>+         * @since 3.5.0
+         * @access public
+         *
</ins><span class="cx">          * @param string $destfilename
</span><span class="cx">          * @param string $mime_type
</span><span class="cx">          * @return array|WP_Error {'path'=&gt;string, 'file'=&gt;string, 'width'=&gt;int, 'height'=&gt;int, 'mime-type'=&gt;string}
</span><span class="lines">@@ -385,8 +393,11 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * Streams current image to browser
</del><ins>+         * Streams current image to browser.
</ins><span class="cx">          *
</span><ins>+         * @since 3.5.0
+         * @access public
+         *
</ins><span class="cx">          * @param string $mime_type
</span><span class="cx">          * @return boolean|WP_Error
</span><span class="cx">          */
</span></span></pre></div>
<a id="trunkwpincludesclasswpimageeditorphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class-wp-image-editor.php (22618 => 22619)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-wp-image-editor.php        2012-11-16 21:52:48 UTC (rev 22618)
+++ trunk/wp-includes/class-wp-image-editor.php        2012-11-16 22:02:21 UTC (rev 22619)
</span><span class="lines">@@ -62,8 +62,7 @@
</span><span class="cx">                         array( 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD' ) );
</span><span class="cx"> 
</span><span class="cx">                 if ( ! $required_methods )
</span><del>-                        $required_methods = apply_filters( 'wp_image_editor_default_methods',
-                                array( 'resize', 'multi_resize', 'crop', 'rotate', 'flip', 'stream' ) );
</del><ins>+                        $required_methods = array();
</ins><span class="cx"> 
</span><span class="cx">                 // Loop over each editor on each request looking for one which will serve this request's needs
</span><span class="cx">                 foreach ( $request_order as $editor ) {
</span><span class="lines">@@ -80,21 +79,114 @@
</span><span class="cx">                 return false;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        abstract protected function load(); // returns bool|WP_Error
</del><ins>+        /**
+         * Loads image from $this-&gt;file into editor.
+         *
+         * @since 3.5.0
+         * @access protected
+         * @abstract
+         *
+         * @return boolean|WP_Error True if loaded; WP_Error on failure.
+         */
+        abstract protected function load();
+
+        /**
+         * Saves current image to file.
+         *
+         * @since 3.5.0
+         * @access public
+         * @abstract
+         *
+         * @param string $destfilename
+         * @param string $mime_type
+         * @return array|WP_Error {'path'=&gt;string, 'file'=&gt;string, 'width'=&gt;int, 'height'=&gt;int, 'mime-type'=&gt;string}
+         */
</ins><span class="cx">         abstract public function save( $destfilename = null, $mime_type = null );
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * Implement all of the below to support natively used functions:
</del><ins>+         * Resizes current image.
</ins><span class="cx">          *
</span><del>-         * public function resize( $max_w, $max_h, $crop = false )
-         * public function multi_resize( $sizes )
-         * public function crop( $src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false )
-         * public function rotate( $angle )
-         * public function flip( $horz, $vert )
-         * public function stream( $mime_type = null )
</del><ins>+         * @since 3.5.0
+         * @access public
+         * @abstract
+         *
+         * @param int $max_w
+         * @param int $max_h
+         * @param boolean $crop
+         * @return boolean|WP_Error
</ins><span class="cx">          */
</span><ins>+        abstract public function resize( $max_w, $max_h, $crop = false );
</ins><span class="cx"> 
</span><span class="cx">         /**
</span><ins>+         * Processes current image and saves to disk
+         * multiple sizes from single source.
+         *
+         * @since 3.5.0
+         * @access public
+         * @abstract
+         *
+         * @param array $sizes
+         * @return array
+         */
+        abstract public function multi_resize( $sizes );
+
+        /**
+         * Crops Image.
+         *
+         * @since 3.5.0
+         * @access public
+         * @abstract
+         *
+         * @param string|int $src The source file or Attachment ID.
+         * @param int $src_x The start x position to crop from.
+         * @param int $src_y The start y position to crop from.
+         * @param int $src_w The width to crop.
+         * @param int $src_h The height to crop.
+         * @param int $dst_w Optional. The destination width.
+         * @param int $dst_h Optional. The destination height.
+         * @param boolean $src_abs Optional. If the source crop points are absolute.
+         * @return boolean|WP_Error
+         */
+        abstract public function crop( $src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false );
+
+        /**
+         * Rotates current image counter-clockwise by $angle.
+         *
+         * @since 3.5.0
+         * @access public
+         * @abstract
+         *
+         * @param float $angle
+         * @return boolean|WP_Error
+         */
+        abstract public function rotate( $angle );
+
+        /**
+         * Flips current image.
+         *
+         * @since 3.5.0
+         * @access public
+         * @abstract
+         *
+         * @param boolean $horz Horizonal Flip
+         * @param boolean $vert Vertical Flip
+         * @return boolean|WP_Error
+         */
+        abstract public function flip( $horz, $vert );
+
+        /**
+         * Streams current image to browser.
+         *
+         * @since 3.5.0
+         * @access public
+         * @abstract
+         *
+         * @param string $mime_type
+         * @return boolean|WP_Error
+         */
+        abstract public function stream( $mime_type = null );
+
+        /**
</ins><span class="cx">          * Checks to see if current environment supports the editor chosen.
</span><span class="cx">          * Must be overridden in a sub-class.
</span><span class="cx">          *
</span><span class="lines">@@ -110,7 +202,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * Checks to see if editor supports mime-type specified
</del><ins>+         * Checks to see if editor supports the mime-type specified.
</ins><span class="cx">          * Must be overridden in a sub-class.
</span><span class="cx">          *
</span><span class="cx">          * @since 3.5.0
</span><span class="lines">@@ -125,7 +217,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * Gets dimensions of image
</del><ins>+         * Gets dimensions of image.
</ins><span class="cx">          *
</span><span class="cx">          * @since 3.5.0
</span><span class="cx">          * @access public
</span><span class="lines">@@ -137,7 +229,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * Sets current image size
</del><ins>+         * Sets current image size.
</ins><span class="cx">          *
</span><span class="cx">          * @since 3.5.0
</span><span class="cx">          * @access protected
</span></span></pre>
</div>
</div>

</body>
</html>