/** * Extracts all <img>-Tage contained in a page determined by the $galleryId * Useful for paging are the parameters $start and $end. Both are optional and * if not supplied will return all Images. * * @param int id of the page to be returned as a Gallery * @param bool true if images of sub galleries should also be returned * @param int index of the first image to return * @param int index of the the last image to return * @return wpws_Image[] */ function getImages($galleryId, $includeSubGalleries, $start = 1, $end = null) { $galleryId = is_numeric($galleryId) ? intval($galleryId) : 0; $includeSubGalleries = $includeSubGalleries ? true : false; $start = is_numeric($start) ? intval($start) : null; $end = is_numeric($end) ? intval($end) : null; $wpws_page = wp_WebService::getPage($galleryId); $html = $wpws_page->content; $xml = new SimpleXMLElement('<xml>' . utf8_encode(html_entity_decode($html)) . '</xml>'); // Construct XPath query $q = "/descendant-or-self::img"; $predicate = array(); if ($start != null) { $predicate[] = "position() >= {$start}"; } if ($end != null) { $predicate[] = "position() <= {$end}"; } if (count($predicate) > 0) { $q .= "[" . implode(" and ", $predicate) . "]"; } $xml_images = $xml->xpath($q); $wpws_images = array(); foreach ($xml_images as $xml_image) { // Build original / full size image url // and pass the url to the resize script list(, $uri) = explode(WP_UPLOAD_DIR, strval($xml_image["src"])); // http://abc.de/blog/, 2010/xyz/img-120x120.jpg $originalUri = preg_replace("~-\\d+x\\d+~", "", $uri, 1); // 2010/xyz/img.jpg $resizeableUrl = wpws_getPluginUrl() . "/resize_image.php?src=" . $originalUri . "&width=%{WIDTH}&height=%{HEIGHT}&quality=%{QUALITY}"; $file = wpws_getBasedir() . WP_UPLOAD_DIR . $uri; list($width, $height) = getimagesize($file); $originalFile = wpws_getBasedir() . WP_UPLOAD_DIR . $originalUri; list($maxResizeableWidth, $maxResizeableHeight) = getimagesize($originalFile); $wpws_images[] = new wpws_Image($galleryId, strval($xml_image["src"]), $width, $height, $resizeableUrl, $maxResizeableWidth, $maxResizeableHeight, strval($xml_image["title"]), strval($xml_image["alt"])); } if ($includeSubGalleries) { $wpws_subPages = wp_WebService::getPages("child_of=" . $galleryId); foreach ($wpws_subPages as $wpws_subPage) { $wpws_subImages = wp_WebService::getImages($wpws_subPage->id); $wpws_images = array_merge($wpws_images, $wpws_subImages); } } return $wpws_images; }
$formattedSoapClientUrl .= substr($soapClientUrl, $i, $numCharPerBreak) . " "; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>WordPress Web Service</title> <link rel="stylesheet" type="text/css" href="<?php echo wpws_getPluginUrl(); ?> /assets/wpws.css"/> </head> <body> <h1><a href="https://code.google.com/p/wordpress-web-service" target="_blank"><img src="<?php echo wpws_getPluginUrl(); ?> /assets/wpws.png" alt="WordPress Web Service" width="265" height="73" border="0" /></a> Version <?php echo wpws_getVersion(); ?> </h1> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><p>Welcome to your WordPress Web Service (WPWS) plugin!</p> <?php if (wpws_WSDLcustomized()) { ?> <p><strong>You have successfully installed WPWS and you're ready to connect <br /> your WSDL enabled application to your WordPress installation.</strong></p> <p>Your WSDL url is:<br /> <a href="<?php