CC-2166: Packaging Improvements. Moved the Zend app into airtime_mvc. It is now installed to /var/www/airtime. Storage is now set to /srv/airtime/stor. Utils are now installed to /usr/lib/airtime/utils/. Added install/airtime-dircheck.php as a simple test to see if everything is install/uninstalled correctly.

This commit is contained in:
Paul Baranowski 2011-04-14 18:55:04 -04:00
parent 514777e8d2
commit b11cbd8159
4546 changed files with 138 additions and 51 deletions

View file

@ -0,0 +1,71 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Image.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_Yahoo_Image
{
/**
* Image URL
*
* @var string
*/
public $Url;
/**
* Image height in pixels
*
* @var int
*/
public $Height;
/**
* Image width in pixels
*
* @var int
*/
public $Width;
/**
* Initializes the image
*
* @param DOMNode $dom
* @param string $namespace
* @return void
*/
public function __construct(DOMNode $dom, $namespace)
{
$xpath = new DOMXPath($dom->ownerDocument);
$xpath->registerNamespace('yh', $namespace);
$this->Url = Zend_Uri::factory($xpath->query('./yh:Url/text()', $dom)->item(0)->data);
$this->Height = (int) $xpath->query('./yh:Height/text()', $dom)->item(0)->data;
$this->Width = (int) $xpath->query('./yh:Width/text()', $dom)->item(0)->data;
}
}

View file

@ -0,0 +1,111 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: ImageResult.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Service_Yahoo_Result
*/
require_once 'Zend/Service/Yahoo/Result.php';
/**
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_Yahoo_ImageResult extends Zend_Service_Yahoo_Result
{
/**
* Summary info for the image
*
* @var string
*/
public $Summary;
/**
* The URL of the webpage hosting the image
*
* @var string
*/
public $RefererUrl;
/**
* The size of the files in bytes
*
* @var string
*/
public $FileSize;
/**
* The type of file (bmp, gif, jpeg, etc.)
*
* @var string
*/
public $FileFormat;
/**
* The height of the image in pixels
*
* @var string
*/
public $Height;
/**
* The width of the image in pixels
*
* @var string
*/
public $Width;
/**
* The thubmnail image for the article, if it exists
*
* @var Zend_Service_Yahoo_Image
*/
public $Thumbnail;
/**
* Image result namespace
*
* @var string
*/
protected $_namespace = 'urn:yahoo:srchmi';
/**
* Initializes the image result
*
* @param DOMElement $result
* @return void
*/
public function __construct(DOMElement $result)
{
$this->_fields = array('Summary', 'RefererUrl', 'FileSize', 'FileFormat', 'Height', 'Width', 'Thumbnail');
parent::__construct($result);
$this->_setThumbnail();
}
}

View file

@ -0,0 +1,63 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: ImageResultSet.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Service_Yahoo_ResultSet
*/
require_once 'Zend/Service/Yahoo/ResultSet.php';
/**
* @see Zend_Service_Yahoo_ImageResult
*/
require_once 'Zend/Service/Yahoo/ImageResult.php';
/**
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_Yahoo_ImageResultSet extends Zend_Service_Yahoo_ResultSet
{
/**
* Image result set namespace
*
* @var string
*/
protected $_namespace = 'urn:yahoo:srchmi';
/**
* Overrides Zend_Service_Yahoo_ResultSet::current()
*
* @return Zend_Service_Yahoo_ImageResult
*/
public function current()
{
return new Zend_Service_Yahoo_ImageResult($this->_results->item($this->_currentIndex));
}
}

View file

@ -0,0 +1,58 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: InlinkDataResult.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Service_Yahoo_Result
*/
require_once 'Zend/Service/Yahoo/Result.php';
/**
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_Yahoo_InlinkDataResult extends Zend_Service_Yahoo_Result
{
/**
* Web result namespace
*
* @var string
*/
protected $_namespace = 'urn:yahoo:srch';
/**
* Initializes the web result
*
* @param DOMElement $result
* @return void
*/
public function __construct(DOMElement $result)
{
$this->_fields = array();
parent::__construct($result);
}
}

View file

@ -0,0 +1,62 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: InlinkDataResultSet.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Service_Yahoo_ResultSet
*/
require_once 'Zend/Service/Yahoo/ResultSet.php';
/**
* @see Zend_Service_Yahoo_WebResult
*/
require_once 'Zend/Service/Yahoo/InlinkDataResult.php';
/**
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_Yahoo_InlinkDataResultSet extends Zend_Service_Yahoo_ResultSet
{
/**
* Web result set namespace
*
* @var string
*/
protected $_namespace = 'urn:yahoo:srch';
/**
* Overrides Zend_Service_Yahoo_ResultSet::current()
*
* @return Zend_Service_Yahoo_InlinkDataResult
*/
public function current()
{
return new Zend_Service_Yahoo_InlinkDataResult($this->_results->item($this->_currentIndex));
}
}

View file

@ -0,0 +1,124 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: LocalResult.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Service_Yahoo_Result
*/
require_once 'Zend/Service/Yahoo/Result.php';
/**
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_Yahoo_LocalResult extends Zend_Service_Yahoo_Result
{
/**
* Street address of the result
*
* @var string
*/
public $Address;
/**
* City in which the result resides
*
* @var string
*/
public $City;
/**
* State in which the result resides
*
* @var string
*/
public $State;
/**
* Phone number for the result
*
* @var string
*/
public $Phone;
/**
* User-submitted rating for the result
*
* @var string
*/
public $Rating;
/**
* The distance to the result from your specified location
*
* @var string
*/
public $Distance;
/**
* A URL of a map for the result
*
* @var string
*/
public $MapUrl;
/**
* The URL for the business website, if known
*
* @var string
*/
public $BusinessUrl;
/**
* The URL for linking to the business website, if known
*
* @var string
*/
public $BusinessClickUrl;
/**
* Local result namespace
*
* @var string
*/
protected $_namespace = 'urn:yahoo:lcl';
/**
* Initializes the local result
*
* @param DOMElement $result
* @return void
*/
public function __construct(DOMElement $result)
{
$this->_fields = array('Address','City', 'City', 'State', 'Phone', 'Rating', 'Distance', 'MapUrl',
'BusinessUrl', 'BusinessClickUrl');
parent::__construct($result);
}
}

View file

@ -0,0 +1,84 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: LocalResultSet.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Service_Yahoo_ResultSet
*/
require_once 'Zend/Service/Yahoo/ResultSet.php';
/**
* @see Zend_Service_Yahoo_LocalResult
*/
require_once 'Zend/Service/Yahoo/LocalResult.php';
/**
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_Yahoo_LocalResultSet extends Zend_Service_Yahoo_ResultSet
{
/**
* The URL of a webpage containing a map graphic with all returned results plotted on it.
*
* @var string
*/
public $resultSetMapURL;
/**
* Local result set namespace
*
* @var string
*/
protected $_namespace = 'urn:yahoo:lcl';
/**
* Initializes the local result set
*
* @param DOMDocument $dom
* @return void
*/
public function __construct(DOMDocument $dom)
{
parent::__construct($dom);
$this->resultSetMapURL = $this->_xpath->query('//yh:ResultSetMapUrl/text()')->item(0)->data;
}
/**
* Overrides Zend_Service_Yahoo_ResultSet::current()
*
* @return Zend_Service_Yahoo_LocalResult
*/
public function current()
{
return new Zend_Service_Yahoo_LocalResult($this->_results->item($this->_currentIndex));
}
}

View file

@ -0,0 +1,112 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: NewsResult.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Service_Yahoo_Result
*/
require_once 'Zend/Service/Yahoo/Result.php';
/**
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_Yahoo_NewsResult extends Zend_Service_Yahoo_Result
{
/**
* Sumamry text associated with the result article
*
* @var string
*/
public $Summary;
/**
* The company who distributed the article
*
* @var string
*/
public $NewsSource;
/**
* The URL for the company who distributed the article
*
* @var string
*/
public $NewsSourceUrl;
/**
* The language the article is in
*
* @var string
*/
public $Language;
/**
* The date the article was published (in unix timestamp format)
*
* @var string
*/
public $PublishDate;
/**
* The date the article was modified (in unix timestamp format)
*
* @var string
*/
public $ModificationDate;
/**
* The thubmnail image for the article, if it exists
*
* @var Zend_Service_Yahoo_Image
*/
public $Thumbnail;
/**
* News result namespace
*
* @var string
*/
protected $_namespace = 'urn:yahoo:yn';
/**
* Initializes the news result
*
* @param DOMElement $result
* @return void
*/
public function __construct(DOMElement $result)
{
$this->_fields = array('Summary', 'NewsSource', 'NewsSourceUrl', 'Language', 'PublishDate',
'ModificationDate', 'Thumbnail');
parent::__construct($result);
$this->_setThumbnail();
}
}

View file

@ -0,0 +1,63 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: NewsResultSet.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Service_Yahoo_ResultSet
*/
require_once 'Zend/Service/Yahoo/ResultSet.php';
/**
* @see Zend_Service_Yahoo_NewsResult
*/
require_once 'Zend/Service/Yahoo/NewsResult.php';
/**
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_Yahoo_NewsResultSet extends Zend_Service_Yahoo_ResultSet
{
/**
* News result set namespace
*
* @var string
*/
protected $_namespace = 'urn:yahoo:yn';
/**
* Overrides Zend_Service_Yahoo_ResultSet::current()
*
* @return Zend_Service_Yahoo_NewsResult
*/
public function current()
{
return new Zend_Service_Yahoo_NewsResult($this->_results->item($this->_currentIndex));
}
}

View file

@ -0,0 +1,58 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: PageDataResult.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Service_Yahoo_Result
*/
require_once 'Zend/Service/Yahoo/Result.php';
/**
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_Yahoo_PageDataResult extends Zend_Service_Yahoo_Result
{
/**
* Web result namespace
*
* @var string
*/
protected $_namespace = 'urn:yahoo:srch';
/**
* Initializes the web result
*
* @param DOMElement $result
* @return void
*/
public function __construct(DOMElement $result)
{
$this->_fields = array();
parent::__construct($result);
}
}

View file

@ -0,0 +1,62 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: PageDataResultSet.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Service_Yahoo_ResultSet
*/
require_once 'Zend/Service/Yahoo/ResultSet.php';
/**
* @see Zend_Service_Yahoo_WebResult
*/
require_once 'Zend/Service/Yahoo/PageDataResult.php';
/**
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_Yahoo_PageDataResultSet extends Zend_Service_Yahoo_ResultSet
{
/**
* Web result set namespace
*
* @var string
*/
protected $_namespace = 'urn:yahoo:srch';
/**
* Overrides Zend_Service_Yahoo_ResultSet::current()
*
* @return Zend_Service_Yahoo_WebResult
*/
public function current()
{
return new Zend_Service_Yahoo_PageDataResult($this->_results->item($this->_currentIndex));
}
}

View file

@ -0,0 +1,126 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Result.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_Yahoo_Result
{
/**
* The title of the search entry
*
* @var string
*/
public $Title;
/**
* The URL of the found object
*
* @var string
*/
public $Url;
/**
* The URL for linking to the found object
*
* @var string
*/
public $ClickUrl;
/**
* Result fields
*
* @var array
*/
protected $_fields;
/**
* REST response fragment for the result
*
* @var DOMElement
*/
protected $_result;
/**
* Object for XPath queries
*
* @var DOMXPath
*/
protected $_xpath;
/**
* Initializes the result
*
* @param DOMElement $result
* @return void
*/
public function __construct(DOMElement $result)
{
// default fields for all search results:
$fields = array('Title', 'Url', 'ClickUrl');
// merge w/ child's fields
$this->_fields = array_merge($this->_fields, $fields);
$this->_xpath = new DOMXPath($result->ownerDocument);
$this->_xpath->registerNamespace('yh', $this->_namespace);
// add search results to appropriate fields
foreach ($this->_fields as $f) {
$query = "./yh:$f/text()";
$node = $this->_xpath->query($query, $result);
if ($node->length == 1) {
$this->{$f} = $node->item(0)->data;
}
}
$this->_result = $result;
}
/**
* Sets the Thumbnail property
*
* @return void
*/
protected function _setThumbnail()
{
$node = $this->_xpath->query('./yh:Thumbnail', $this->_result);
if ($node->length == 1) {
/**
* @see Zend_Service_Yahoo_Image
*/
require_once 'Zend/Service/Yahoo/Image.php';
$this->Thumbnail = new Zend_Service_Yahoo_Image($node->item(0), $this->_namespace);
} else {
$this->Thumbnail = null;
}
}
}

View file

@ -0,0 +1,195 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: ResultSet.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_Yahoo_ResultSet implements SeekableIterator
{
/**
* Total number of results available
*
* @var int
*/
public $totalResultsAvailable;
/**
* The number of results in this result set
*
* @var int
*/
public $totalResultsReturned;
/**
* The offset in the total result set of this search set
*
* @var int
*/
public $firstResultPosition;
/**
* A DOMNodeList of results
*
* @var DOMNodeList
*/
protected $_results;
/**
* Yahoo Web Service Return Document
*
* @var DOMDocument
*/
protected $_dom;
/**
* Xpath Object for $this->_dom
*
* @var DOMXPath
*/
protected $_xpath;
/**
* Current Index for SeekableIterator
*
* @var int
*/
protected $_currentIndex = 0;
/**
* Parse the search response and retrieve the results for iteration
*
* @param DOMDocument $dom the REST fragment for this object
* @return void
*/
public function __construct(DOMDocument $dom)
{
$this->totalResultsAvailable = (int) $dom->documentElement->getAttribute('totalResultsAvailable');
$this->totalResultsReturned = (int) $dom->documentElement->getAttribute('totalResultsReturned');
$this->firstResultPosition = (int) $dom->documentElement->getAttribute('firstResultPosition');
$this->_dom = $dom;
$this->_xpath = new DOMXPath($dom);
$this->_xpath->registerNamespace('yh', $this->_namespace);
$this->_results = $this->_xpath->query('//yh:Result');
}
/**
* Total Number of results returned
*
* @return int Total number of results returned
*/
public function totalResults()
{
return $this->totalResultsReturned;
}
/**
* Implement SeekableIterator::current()
*
* Must be implemented by child classes
*
* @throws Zend_Service_Exception
* @return Zend_Service_Yahoo_Result
*/
public function current()
{
/**
* @see Zend_Service_Exception
*/
require_once 'Zend/Service/Exception.php';
throw new Zend_Service_Exception('Zend_Service_Yahoo_ResultSet::current() must be implemented by child '
. 'classes');
}
/**
* Implement SeekableIterator::key()
*
* @return int
*/
public function key()
{
return $this->_currentIndex;
}
/**
* Implement SeekableIterator::next()
*
* @return void
*/
public function next()
{
$this->_currentIndex += 1;
}
/**
* Implement SeekableIterator::rewind()
*
* @return void
*/
public function rewind()
{
$this->_currentIndex = 0;
}
/**
* Implement SeekableIterator::seek()
*
* @param int $index
* @return void
* @throws OutOfBoundsException
*/
public function seek($index)
{
$indexInt = (int) $index;
if ($indexInt >= 0 && $indexInt < $this->_results->length) {
$this->_currentIndex = $indexInt;
} else {
throw new OutOfBoundsException("Illegal index '$index'");
}
}
/**
* Implement SeekableIterator::valid()
*
* @return boolean
*/
public function valid()
{
return $this->_currentIndex < $this->_results->length;
}
}

View file

@ -0,0 +1,132 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: VideoResult.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Service_Yahoo_Result
*/
require_once 'Zend/Service/Yahoo/Result.php';
/**
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_Yahoo_VideoResult extends Zend_Service_Yahoo_Result
{
/**
* Summary info for the video
*
* @var string
*/
public $Summary;
/**
* The URL of the webpage hosting the video
*
* @var string
*/
public $RefererUrl;
/**
* The size of the files in bytes
*
* @var string
*/
public $FileSize;
/**
* The type of file (bmp, gif, jpeg, etc.)
*
* @var string
*/
public $FileFormat;
/**
* The height of the video in pixels
*
* @var string
*/
public $Height;
/**
* The width of the video in pixels
*
* @var string
*/
public $Width;
/**
* The duration of the video in seconds
*
* @var string
*/
public $Duration;
/**
* The number of audio channels in the video
*
* @var string
*/
public $Channels;
/**
* Whether the video is streamed or not
*
* @var boolean
*/
public $Streaming;
/**
* The thubmnail video for the article, if it exists
*
* @var Zend_Service_Yahoo_Video
*/
public $Thumbnail;
/**
* Video result namespace
*
* @var string
*/
protected $_namespace = 'urn:yahoo:srchmv';
/**
* Initializes the video result
*
* @param DOMElement $result
* @return void
*/
public function __construct(DOMElement $result)
{
$this->_fields = array('Summary', 'RefererUrl', 'FileSize', 'FileFormat', 'Height', 'Width', 'Duration', 'Channels', 'Streaming', 'Thumbnail');
parent::__construct($result);
$this->_setThumbnail();
}
}

View file

@ -0,0 +1,63 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: VideoResultSet.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Service_Yahoo_ResultSet
*/
require_once 'Zend/Service/Yahoo/ResultSet.php';
/**
* @see Zend_Service_Yahoo_VideoResult
*/
require_once 'Zend/Service/Yahoo/VideoResult.php';
/**
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_Yahoo_VideoResultSet extends Zend_Service_Yahoo_ResultSet
{
/**
* Video result set namespace
*
* @var string
*/
protected $_namespace = 'urn:yahoo:srchmv';
/**
* Overrides Zend_Service_Yahoo_ResultSet::current()
*
* @return Zend_Service_Yahoo_VideoResult
*/
public function current()
{
return new Zend_Service_Yahoo_VideoResult($this->_results->item($this->_currentIndex));
}
}

View file

@ -0,0 +1,109 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: WebResult.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Service_Yahoo_Result
*/
require_once 'Zend/Service/Yahoo/Result.php';
/**
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_Yahoo_WebResult extends Zend_Service_Yahoo_Result
{
/**
* A summary of the result
*
* @var string
*/
public $Summary;
/**
* The file type of the result (text, html, pdf, etc.)
*
* @var string
*/
public $MimeType;
/**
* The modification time of the result (as a unix timestamp)
*
* @var string
*/
public $ModificationDate;
/**
* The URL for the Yahoo cache of this page, if it exists
*
* @var string
*/
public $CacheUrl;
/**
* The size of the cache entry
*
* @var int
*/
public $CacheSize;
/**
* Web result namespace
*
* @var string
*/
protected $_namespace = 'urn:yahoo:srch';
/**
* Initializes the web result
*
* @param DOMElement $result
* @return void
*/
public function __construct(DOMElement $result)
{
$this->_fields = array('Summary', 'MimeType', 'ModificationDate');
parent::__construct($result);
$this->_xpath = new DOMXPath($result->ownerDocument);
$this->_xpath->registerNamespace('yh', $this->_namespace);
// check if the cache section exists
$cacheUrl = $this->_xpath->query('./yh:Cache/yh:Url/text()', $result)->item(0);
if ($cacheUrl instanceof DOMNode)
{
$this->CacheUrl = $cacheUrl->data;
}
$cacheSize = $this->_xpath->query('./yh:Cache/yh:Size/text()', $result)->item(0);
if ($cacheSize instanceof DOMNode)
{
$this->CacheSize = (int) $cacheSize->data;
}
}
}

View file

@ -0,0 +1,63 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: WebResultSet.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Service_Yahoo_ResultSet
*/
require_once 'Zend/Service/Yahoo/ResultSet.php';
/**
* @see Zend_Service_Yahoo_WebResult
*/
require_once 'Zend/Service/Yahoo/WebResult.php';
/**
* @category Zend
* @package Zend_Service
* @subpackage Yahoo
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_Yahoo_WebResultSet extends Zend_Service_Yahoo_ResultSet
{
/**
* Web result set namespace
*
* @var string
*/
protected $_namespace = 'urn:yahoo:srch';
/**
* Overrides Zend_Service_Yahoo_ResultSet::current()
*
* @return Zend_Service_Yahoo_WebResult
*/
public function current()
{
return new Zend_Service_Yahoo_WebResult($this->_results->item($this->_currentIndex));
}
}