Current File : /home/k/a/r/karenpetzb/www/items/category/Query.php.tar |
home/karenpetzb/library/Zend/Gdata/Docs/Query.php 0000604 00000013300 15071310033 0015715 0 ustar 00 <?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_Gdata
* @subpackage Docs
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* Zend_Gdata_Query
*/
require_once('Zend/Gdata/Query.php');
/**
* Assists in constructing queries for Google Document List documents
*
* @link http://code.google.com/apis/gdata/spreadsheets/
*
* @category Zend
* @package Zend_Gdata
* @subpackage Docs
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Docs_Query extends Zend_Gdata_Query
{
/**
* The base URL for retrieving a document list
*
* @var string
*/
const DOCUMENTS_LIST_FEED_URI = 'http://docs.google.com/feeds/documents';
/**
* The generic base URL used by some inherited methods
*
* @var string
*/
protected $_defaultFeedUri = self::DOCUMENTS_LIST_FEED_URI;
/**
* The visibility to be used when querying for the feed. A request for a
* feed with private visbility requires the user to be authenricated.
* Private is the only avilable visibility for the documents list.
*
* @var string
*/
protected $_visibility = 'private';
/**
* The projection determines how much detail should be given in the
* result of the query. Full is the only valid projection for the
* documents list.
*
* @var string
*/
protected $_projection = 'full';
/**
* Constructs a new instance of a Zend_Gdata_Docs_Query object.
*/
public function __construct()
{
parent::__construct();
}
/**
* Sets the projection for this query. Common values for projection
* include 'full'.
*
* @param string $value
* @return Zend_Gdata_Docs_Query Provides a fluent interface
*/
public function setProjection($value)
{
$this->_projection = $value;
return $this;
}
/**
* Sets the visibility for this query. Common values for visibility
* include 'private'.
*
* @return Zend_Gdata_Docs_Query Provides a fluent interface
*/
public function setVisibility($value)
{
$this->_visibility = $value;
return $this;
}
/**
* Gets the projection for this query.
*
* @return string projection
*/
public function getProjection()
{
return $this->_projection;
}
/**
* Gets the visibility for this query.
*
* @return string visibility
*/
public function getVisibility()
{
return $this->_visibility;
}
/**
* Sets the title attribute for this query. The title parameter is used
* to restrict the results to documents whose titles either contain or
* completely match the title.
*
* @param string $value
* @return Zend_Gdata_Docs_Query Provides a fluent interface
*/
public function setTitle($value)
{
if ($value !== null) {
$this->_params['title'] = $value;
} else {
unset($this->_params['title']);
}
return $this;
}
/**
* Gets the title attribute for this query.
*
* @return string title
*/
public function getTitle()
{
if (array_key_exists('title', $this->_params)) {
return $this->_params['title'];
} else {
return null;
}
}
/**
* Sets the title-exact attribute for this query.
* If title-exact is set to true, the title query parameter will be used
* in an exact match. Only documents with a title identical to the
* title parameter will be returned.
*
* @param boolean $value Use either true or false
* @return Zend_Gdata_Docs_Query Provides a fluent interface
*/
public function setTitleExact($value)
{
if ($value) {
$this->_params['title-exact'] = $value;
} else {
unset($this->_params['title-exact']);
}
return $this;
}
/**
* Gets the title-exact attribute for this query.
*
* @return string title-exact
*/
public function getTitleExact()
{
if (array_key_exists('title-exact', $this->_params)) {
return $this->_params['title-exact'];
} else {
return false;
}
}
/**
* Gets the full query URL for this query.
*
* @return string url
*/
public function getQueryUrl()
{
$uri = $this->_defaultFeedUri;
if ($this->_visibility !== null) {
$uri .= '/' . $this->_visibility;
} else {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception(
'A visibility must be provided for cell queries.');
}
if ($this->_projection !== null) {
$uri .= '/' . $this->_projection;
} else {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception(
'A projection must be provided for cell queries.');
}
$uri .= $this->getQueryString();
return $uri;
}
}
home/karenpetzb/library/Zend/Search/Lucene/Search/Query.php 0000604 00000013622 15071410615 0017650 0 ustar 00 <?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_Search_Lucene
* @subpackage Search
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Search_Lucene_Document_Html */
require_once 'Zend/Search/Lucene/Document/Html.php';
/** Zend_Search_Lucene_Index_DocsFilter */
require_once 'Zend/Search/Lucene/Index/DocsFilter.php';
/**
* @category Zend
* @package Zend_Search_Lucene
* @subpackage Search
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Search_Lucene_Search_Query
{
/**
* query boost factor
*
* @var float
*/
private $_boost = 1;
/**
* Query weight
*
* @var Zend_Search_Lucene_Search_Weight
*/
protected $_weight = null;
/**
* Current highlight color
*
* @var integer
*/
private $_currentColorIndex = 0;
/**
* List of colors for text highlighting
*
* @var array
*/
private $_highlightColors = array('#66ffff', '#ff66ff', '#ffff66',
'#ff8888', '#88ff88', '#8888ff',
'#88dddd', '#dd88dd', '#dddd88',
'#aaddff', '#aaffdd', '#ddaaff', '#ddffaa', '#ffaadd', '#ffddaa');
/**
* Gets the boost for this clause. Documents matching
* this clause will (in addition to the normal weightings) have their score
* multiplied by boost. The boost is 1.0 by default.
*
* @return float
*/
public function getBoost()
{
return $this->_boost;
}
/**
* Sets the boost for this query clause to $boost.
*
* @param float $boost
*/
public function setBoost($boost)
{
$this->_boost = $boost;
}
/**
* Score specified document
*
* @param integer $docId
* @param Zend_Search_Lucene_Interface $reader
* @return float
*/
abstract public function score($docId, Zend_Search_Lucene_Interface $reader);
/**
* Get document ids likely matching the query
*
* It's an array with document ids as keys (performance considerations)
*
* @return array
*/
abstract public function matchedDocs();
/**
* Execute query in context of index reader
* It also initializes necessary internal structures
*
* Query specific implementation
*
* @param Zend_Search_Lucene_Interface $reader
* @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter
*/
abstract public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null);
/**
* Constructs an appropriate Weight implementation for this query.
*
* @param Zend_Search_Lucene_Interface $reader
* @return Zend_Search_Lucene_Search_Weight
*/
abstract public function createWeight(Zend_Search_Lucene_Interface $reader);
/**
* Constructs an initializes a Weight for a _top-level_query_.
*
* @param Zend_Search_Lucene_Interface $reader
*/
protected function _initWeight(Zend_Search_Lucene_Interface $reader)
{
// Check, that it's a top-level query and query weight is not initialized yet.
if ($this->_weight !== null) {
return $this->_weight;
}
$this->createWeight($reader);
$sum = $this->_weight->sumOfSquaredWeights();
$queryNorm = $reader->getSimilarity()->queryNorm($sum);
$this->_weight->normalize($queryNorm);
}
/**
* Re-write query into primitive queries in the context of specified index
*
* @param Zend_Search_Lucene_Interface $index
* @return Zend_Search_Lucene_Search_Query
*/
abstract public function rewrite(Zend_Search_Lucene_Interface $index);
/**
* Optimize query in the context of specified index
*
* @param Zend_Search_Lucene_Interface $index
* @return Zend_Search_Lucene_Search_Query
*/
abstract public function optimize(Zend_Search_Lucene_Interface $index);
/**
* Reset query, so it can be reused within other queries or
* with other indeces
*/
public function reset()
{
$this->_weight = null;
}
/**
* Print a query
*
* @return string
*/
abstract public function __toString();
/**
* Return query terms
*
* @return array
*/
abstract public function getQueryTerms();
/**
* Get highlight color and shift to next
*
* @param integer &$colorIndex
* @return string
*/
protected function _getHighlightColor(&$colorIndex)
{
$color = $this->_highlightColors[$colorIndex++];
$colorIndex %= count($this->_highlightColors);
return $color;
}
/**
* Highlight query terms
*
* @param integer &$colorIndex
* @param Zend_Search_Lucene_Document_Html $doc
*/
abstract public function highlightMatchesDOM(Zend_Search_Lucene_Document_Html $doc, &$colorIndex);
/**
* Highlight matches in $inputHTML
*
* @param string $inputHTML
* @return string
*/
public function highlightMatches($inputHTML)
{
$doc = Zend_Search_Lucene_Document_Html::loadHTML($inputHTML);
$colorIndex = 0;
$this->highlightMatchesDOM($doc, $colorIndex);
return $doc->getHTML();
}
}
home/karenpetzb/library/Zend/Gdata/Gapps/Query.php 0000604 00000007273 15071455227 0016132 0 ustar 00 <?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_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* Zend_Gdata_Query
*/
require_once('Zend/Gdata/Query.php');
/**
* Zend_Gdata_Gapps
*/
require_once('Zend/Gdata/Gapps.php');
/**
* Assists in constructing queries for Google Apps entries. This class
* provides common methods used by all other Google Apps query classes.
*
* This class should never be instantiated directly. Instead, instantiate a
* class which inherits from this class.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Gdata_Gapps_Query extends Zend_Gdata_Query
{
/**
* The domain which is being administered via the Provisioning API.
*
* @var string
*/
protected $_domain = null;
/**
* Create a new instance.
*
* @param string $domain (optional) The Google Apps-hosted domain to use
* when constructing query URIs.
*/
public function __construct($domain = null)
{
parent::__construct();
$this->_domain = $domain;
}
/**
* Set domain for this service instance. This should be a fully qualified
* domain, such as 'foo.example.com'.
*
* This value is used when calculating URLs for retrieving and posting
* entries. If no value is specified, a URL will have to be manually
* constructed prior to using any methods which interact with the Google
* Apps provisioning service.
*
* @param string $value The domain to be used for this session.
*/
public function setDomain($value)
{
$this->_domain = $value;
}
/**
* Get domain for this service instance. This should be a fully qualified
* domain, such as 'foo.example.com'. If no domain is set, null will be
* returned.
*
* @see setDomain
* @return string The domain to be used for this session, or null if not
* set.
*/
public function getDomain()
{
return $this->_domain;
}
/**
* Returns the base URL used to access the Google Apps service, based
* on the current domain. The current domain can be temporarily
* overridden by providing a fully qualified domain as $domain.
*
* @see setDomain
* @param string $domain (optional) A fully-qualified domain to use
* instead of the default domain for this service instance.
*/
public function getBaseUrl($domain = null)
{
if ($domain !== null) {
return Zend_Gdata_Gapps::APPS_BASE_FEED_URI . '/' . $domain;
}
else if ($this->_domain !== null) {
return Zend_Gdata_Gapps::APPS_BASE_FEED_URI . '/' . $this->_domain;
}
else {
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
throw new Zend_Gdata_App_InvalidArgumentException(
'Domain must be specified.');
}
}
}
home/karenpetzb/library/Zend/Db/Profiler/Query.php 0000604 00000011117 15071473471 0016140 0 ustar 00 <?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_Db
* @subpackage Profiler
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Query.php 9101 2008-03-30 19:54:38Z thomas $
*/
/**
* @category Zend
* @package Zend_Db
* @subpackage Profiler
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Db_Profiler_Query
{
/**
* SQL query string or user comment, set by $query argument in constructor.
*
* @var string
*/
protected $_query = '';
/**
* One of the Zend_Db_Profiler constants for query type, set by $queryType argument in constructor.
*
* @var integer
*/
protected $_queryType = 0;
/**
* Unix timestamp with microseconds when instantiated.
*
* @var float
*/
protected $_startedMicrotime = null;
/**
* Unix timestamp with microseconds when self::queryEnd() was called.
*
* @var integer
*/
protected $_endedMicrotime = null;
/**
* @var array
*/
protected $_boundParams = array();
/**
* @var array
*/
/**
* Class constructor. A query is about to be started, save the query text ($query) and its
* type (one of the Zend_Db_Profiler::* constants).
*
* @param string $query
* @param integer $queryType
* @return void
*/
public function __construct($query, $queryType)
{
$this->_query = $query;
$this->_queryType = $queryType;
// by default, and for backward-compatibility, start the click ticking
$this->start();
}
/**
* Clone handler for the query object.
* @return void
*/
public function __clone()
{
$this->_boundParams = array();
$this->_endedMicrotime = null;
$this->start();
}
/**
* Starts the elapsed time click ticking.
* This can be called subsequent to object creation,
* to restart the clock. For instance, this is useful
* right before executing a prepared query.
*
* @return void
*/
public function start()
{
$this->_startedMicrotime = microtime(true);
}
/**
* Ends the query and records the time so that the elapsed time can be determined later.
*
* @return void
*/
public function end()
{
$this->_endedMicrotime = microtime(true);
}
/**
* Returns true if and only if the query has ended.
*
* @return boolean
*/
public function hasEnded()
{
return $this->_endedMicrotime !== null;
}
/**
* Get the original SQL text of the query.
*
* @return string
*/
public function getQuery()
{
return $this->_query;
}
/**
* Get the type of this query (one of the Zend_Db_Profiler::* constants)
*
* @return integer
*/
public function getQueryType()
{
return $this->_queryType;
}
/**
* @param string $param
* @param mixed $variable
* @return void
*/
public function bindParam($param, $variable)
{
$this->_boundParams[$param] = $variable;
}
/**
* @param array $param
* @return void
*/
public function bindParams(array $params)
{
if (array_key_exists(0, $params)) {
array_unshift($params, null);
unset($params[0]);
}
foreach ($params as $param => $value) {
$this->bindParam($param, $value);
}
}
/**
* @return array
*/
public function getQueryParams()
{
return $this->_boundParams;
}
/**
* Get the elapsed time (in seconds) that the query ran.
* If the query has not yet ended, false is returned.
*
* @return float|false
*/
public function getElapsedSecs()
{
if (null === $this->_endedMicrotime) {
return false;
}
return $this->_endedMicrotime - $this->_startedMicrotime;
}
}
home/karenpetzb/library/Zend/Gdata/Query.php 0000604 00000022740 15071477673 0015065 0 ustar 00 <?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_Gdata
* @subpackage Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* Zend_Gdata_App_Util
*/
require_once 'Zend/Gdata/App/Util.php';
/**
* Provides a mechanism to build a query URL for Gdata services.
* Queries are not defined for APP, but are provided by Gdata services
* as an extension.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gdata
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Query
{
/**
* Query parameters.
*
* @var array
*/
protected $_params = array();
/**
* Default URL
*
* @var string
*/
protected $_defaultFeedUri = null;
/**
* Base URL
* TODO: Add setters and getters
*
* @var string
*/
protected $_url = null;
/**
* Category for the query
*
* @var string
*/
protected $_category = null;
/**
* Create Gdata_Query object
*/
public function __construct($url = null)
{
$this->_url = $url;
}
/**
* @return string querystring
*/
public function getQueryString()
{
$queryArray = array();
foreach ($this->_params as $name => $value) {
if (substr($name, 0, 1) == '_') {
continue;
}
$queryArray[] = urlencode($name) . '=' . urlencode($value);
}
if (count($queryArray) > 0) {
return '?' . implode('&', $queryArray);
} else {
return '';
}
}
/**
*
*/
public function resetParameters()
{
$this->_params = array();
}
/**
* @return string url
*/
public function getQueryUrl()
{
if ($this->_url == null) {
$url = $this->_defaultFeedUri;
} else {
$url = $this->_url;
}
if ($this->getCategory() !== null) {
$url .= '/-/' . $this->getCategory();
}
$url .= $this->getQueryString();
return $url;
}
/**
* @param string $name
* @param string $value
* @return Zend_Gdata_Query Provides a fluent interface
*/
public function setParam($name, $value)
{
$this->_params[$name] = $value;
return $this;
}
/**
* @param string $name
*/
public function getParam($name)
{
return $this->_params[$name];
}
/**
* @param string $value
* @return Zend_Gdata_Query Provides a fluent interface
*/
public function setAlt($value)
{
if ($value != null) {
$this->_params['alt'] = $value;
} else {
unset($this->_params['alt']);
}
return $this;
}
/**
* @param int $value
* @return Zend_Gdata_Query Provides a fluent interface
*/
public function setMaxResults($value)
{
if ($value != null) {
$this->_params['max-results'] = $value;
} else {
unset($this->_params['max-results']);
}
return $this;
}
/**
* @param string $value
* @return Zend_Gdata_Query Provides a fluent interface
*/
public function setQuery($value)
{
if ($value != null) {
$this->_params['q'] = $value;
} else {
unset($this->_params['q']);
}
return $this;
}
/**
* @param int $value
* @return Zend_Gdata_Query Provides a fluent interface
*/
public function setStartIndex($value)
{
if ($value != null) {
$this->_params['start-index'] = $value;
} else {
unset($this->_params['start-index']);
}
return $this;
}
/**
* @param string $value
* @return Zend_Gdata_Query Provides a fluent interface
*/
public function setUpdatedMax($value)
{
if ($value != null) {
$this->_params['updated-max'] = Zend_Gdata_App_Util::formatTimestamp($value);
} else {
unset($this->_params['updated-max']);
}
return $this;
}
/**
* @param string $value
* @return Zend_Gdata_Query Provides a fluent interface
*/
public function setUpdatedMin($value)
{
if ($value != null) {
$this->_params['updated-min'] = Zend_Gdata_App_Util::formatTimestamp($value);
} else {
unset($this->_params['updated-min']);
}
return $this;
}
/**
* @param string $value
* @return Zend_Gdata_Query Provides a fluent interface
*/
public function setPublishedMax($value)
{
if ($value !== null) {
$this->_params['published-max'] = Zend_Gdata_App_Util::formatTimestamp($value);
} else {
unset($this->_params['published-max']);
}
return $this;
}
/**
* @param string $value
* @return Zend_Gdata_Query Provides a fluent interface
*/
public function setPublishedMin($value)
{
if ($value != null) {
$this->_params['published-min'] = Zend_Gdata_App_Util::formatTimestamp($value);
} else {
unset($this->_params['published-min']);
}
return $this;
}
/**
* @param string $value
* @return Zend_Gdata_Query Provides a fluent interface
*/
public function setAuthor($value)
{
if ($value != null) {
$this->_params['author'] = $value;
} else {
unset($this->_params['author']);
}
return $this;
}
/**
* @return string rss or atom
*/
public function getAlt()
{
if (array_key_exists('alt', $this->_params)) {
return $this->_params['alt'];
} else {
return null;
}
}
/**
* @return int maxResults
*/
public function getMaxResults()
{
if (array_key_exists('max-results', $this->_params)) {
return intval($this->_params['max-results']);
} else {
return null;
}
}
/**
* @return string query
*/
public function getQuery()
{
if (array_key_exists('q', $this->_params)) {
return $this->_params['q'];
} else {
return null;
}
}
/**
* @return int startIndex
*/
public function getStartIndex()
{
if (array_key_exists('start-index', $this->_params)) {
return intval($this->_params['start-index']);
} else {
return null;
}
}
/**
* @return string updatedMax
*/
public function getUpdatedMax()
{
if (array_key_exists('updated-max', $this->_params)) {
return $this->_params['updated-max'];
} else {
return null;
}
}
/**
* @return string updatedMin
*/
public function getUpdatedMin()
{
if (array_key_exists('updated-min', $this->_params)) {
return $this->_params['updated-min'];
} else {
return null;
}
}
/**
* @return string publishedMax
*/
public function getPublishedMax()
{
if (array_key_exists('published-max', $this->_params)) {
return $this->_params['published-max'];
} else {
return null;
}
}
/**
* @return string publishedMin
*/
public function getPublishedMin()
{
if (array_key_exists('published-min', $this->_params)) {
return $this->_params['published-min'];
} else {
return null;
}
}
/**
* @return string author
*/
public function getAuthor()
{
if (array_key_exists('author', $this->_params)) {
return $this->_params['author'];
} else {
return null;
}
}
/**
* @param string $value
* @return Zend_Gdata_Query Provides a fluent interface
*/
public function setCategory($value)
{
$this->_category = $value;
return $this;
}
/*
* @return string id
*/
public function getCategory()
{
return $this->_category;
}
public function __get($name)
{
$method = 'get'.ucfirst($name);
if (method_exists($this, $method)) {
return call_user_func(array(&$this, $method));
} else {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception('Property ' . $name . ' does not exist');
}
}
public function __set($name, $val)
{
$method = 'set'.ucfirst($name);
if (method_exists($this, $method)) {
return call_user_func(array(&$this, $method), $val);
} else {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception('Property ' . $name . ' does not exist');
}
}
}
home/karenpetzb/library/Zend/Dom/Query.php 0000604 00000013065 15071531065 0014546 0 ustar 00 <?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_Dom
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Dom_Query_Css2Xpath
*/
require_once 'Zend/Dom/Query/Css2Xpath.php';
/**
* @see Zend_Dom_Query_Result
*/
require_once 'Zend/Dom/Query/Result.php';
/**
* Query DOM structures based on CSS selectors and/or XPath
*
* @package Zend_Dom
* @subpackage Query
* @copyright Copyright (C) 2008 - Present, Zend Technologies, Inc.
* @license New BSD {@link http://framework.zend.com/license/new-bsd}
*/
class Zend_Dom_Query
{
/**#@+
* @const string Document types
*/
const DOC_XML = 'docXml';
const DOC_HTML = 'docHtml';
const DOC_XHTML = 'docXhtml';
/**#@-*/
/**
* @var string
*/
protected $_document;
/**
* Document type
* @var string
*/
protected $_docType;
/**
* Constructor
*
* @param null|string $document
* @return void
*/
public function __construct($document = null)
{
if (null !== $document) {
$this->setDocument($document);
}
}
/**
* Set document to query
*
* @param string $document
* @return Zend_Dom_Query
*/
public function setDocument($document)
{
if ('<?xml' == substr(trim($document), 0, 5)) {
return $this->setDocumentXml($document);
}
if (strstr($document, 'DTD XHTML')) {
return $this->setDocumentXhtml($document);
}
return $this->setDocumentHtml($document);
}
/**
* Register HTML document
*
* @param string $document
* @return Zend_Dom_Query
*/
public function setDocumentHtml($document)
{
$this->_document = (string) $document;
$this->_docType = self::DOC_HTML;
return $this;
}
/**
* Register XHTML document
*
* @param string $document
* @return Zend_Dom_Query
*/
public function setDocumentXhtml($document)
{
$this->_document = (string) $document;
$this->_docType = self::DOC_XHTML;
return $this;
}
/**
* Register XML document
*
* @param string $document
* @return Zend_Dom_Query
*/
public function setDocumentXml($document)
{
$this->_document = (string) $document;
$this->_docType = self::DOC_XML;
return $this;
}
/**
* Retrieve current document
*
* @return string
*/
public function getDocument()
{
return $this->_document;
}
/**
* Get document type
*
* @return string
*/
public function getDocumentType()
{
return $this->_docType;
}
/**
* Perform a CSS selector query
*
* @param string $query
* @return Zend_Dom_Query_Result
*/
public function query($query)
{
$xpathQuery = Zend_Dom_Query_Css2Xpath::transform($query);
return $this->queryXpath($xpathQuery, $query);
}
/**
* Perform an XPath query
*
* @param string $xpathQuery
* @param string $query CSS selector query
* @return Zend_Dom_Query_Result
*/
public function queryXpath($xpathQuery, $query = null)
{
if (null === ($document = $this->getDocument())) {
require_once 'Zend/Dom/Exception.php';
throw new Zend_Dom_Exception('Cannot query; no document registered');
}
$domDoc = new DOMDocument;
$type = $this->getDocumentType();
switch ($type) {
case self::DOC_XML:
$success = @$domDoc->loadXML($document);
break;
case self::DOC_HTML:
case self::DOC_XHTML:
default:
$success = @$domDoc->loadHTML($document);
break;
}
if (!$success) {
require_once 'Zend/Dom/Exception.php';
throw new Zend_Dom_Exception(sprintf('Error parsing document (type == %s)', $type));
}
$nodeList = $this->_getNodeList($domDoc, $xpathQuery);
return new Zend_Dom_Query_Result($query, $xpathQuery, $domDoc, $nodeList);
}
/**
* Prepare node list
*
* @param DOMDocument $document
* @param string|array $xpathQuery
* @return array
*/
protected function _getNodeList($document, $xpathQuery)
{
$xpath = new DOMXPath($document);
$xpathQuery = (string) $xpathQuery;
if (preg_match_all('|\[contains\((@[a-z0-9_-]+),\s?\' |i', $xpathQuery, $matches)) {
foreach ($matches[1] as $attribute) {
$queryString = '//*[' . $attribute . ']';
$attributeName = substr($attribute, 1);
$nodes = $xpath->query($queryString);
foreach ($nodes as $node) {
$attr = $node->attributes->getNamedItem($attributeName);
$attr->value = ' ' . $attr->value . ' ';
}
}
}
return $xpath->query($xpathQuery);
}
}
home/karenpetzb/library/Zend/Gdata/Health/Query.php 0000604 00000020565 15071646010 0016254 0 ustar 00 <?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_Gdata
* @subpackage Health
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Query
*/
require_once('Zend/Gdata/Query.php');
/**
* Assists in constructing queries for Google Health
*
* @link http://code.google.com/apis/health
*
* @category Zend
* @package Zend_Gdata
* @subpackage Health
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Health_Query extends Zend_Gdata_Query
{
/**
* URI of a user's profile feed.
*/
const HEALTH_PROFILE_FEED_URI =
'https://www.google.com/health/feeds/profile/default';
/**
* URI of register (notices) feed.
*/
const HEALTH_REGISTER_FEED_URI =
'https://www.google.com/health/feeds/register/default';
/**
* Namespace for an item category
*/
const ITEM_CATEGORY_NS = 'http://schemas.google.com/health/item';
/**
* The default URI for POST methods
*
* @var string
*/
protected $_defaultFeedUri = self::HEALTH_PROFILE_FEED_URI;
/**
* Sets the digest parameter's value.
*
* @param string $value
* @return Zend_Gdata_Health_Query Provides a fluent interface
*/
public function setDigest($value)
{
if ($value !== null) {
$this->_params['digest'] = $value;
}
return $this;
}
/**
* Returns the digest parameter's value.
*
* @return string The value set for the digest parameter.
*/
public function getDigest()
{
if (array_key_exists('digest', $this->_params)) {
return $this->_params['digest'];
} else {
return null;
}
}
/**
* Setter for category queries.
*
* @param string $item A category to query.
* @param string $name (optional) A specific item to search a category for.
* An example would be 'Lipitor' if $item is set to 'medication'.
* @return Zend_Gdata_Health_Query Provides a fluent interface
*/
public function setCategory($item, $name = null)
{
$this->_category = $item .
($name ? '/' . urlencode('{' . self::ITEM_CATEGORY_NS . '}' . $name) : null);
return $this;
}
/**
* Returns the query object's category.
*
* @return string id
*/
public function getCategory()
{
return $this->_category;
}
/**
* Setter for the grouped parameter.
*
* @param string $value setting a count of results per group.
* @return Zend_Gdata_Health_Query Provides a fluent interface
*/
public function setGrouped($value)
{
if ($value !== null) {
$this->_params['grouped'] = $value;
}
return $this;
}
/**
* Returns the value set for the grouped parameter.
*
* @return string grouped parameter.
*/
public function getGrouped()
{
if (array_key_exists('grouped', $this->_params)) {
return $this->_params['grouped'];
} else {
return null;
}
}
/**
* Setter for the max-results-group parameter.
*
* @param int $value Specifies the maximum number of groups to be
* retrieved. Must be an integer value greater than zero. This parameter
* is only valid if grouped=true.
* @return Zend_Gdata_Health_Query Provides a fluent interface
*/
public function setMaxResultsGroup($value)
{
if ($value !== null) {
if ($value <= 0 || $this->getGrouped() !== 'true') {
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
throw new Zend_Gdata_App_InvalidArgumentException(
'The max-results-group parameter must be set to a value
greater than 0 and can only be used if grouped=true');
} else {
$this->_params['max-results-group'] = $value;
}
}
return $this;
}
/**
* Returns the value set for max-results-group.
*
* @return int Returns max-results-group parameter.
*/
public function getMaxResultsGroup()
{
if (array_key_exists('max-results-group', $this->_params)) {
return $this->_params['max-results-group'];
} else {
return null;
}
}
/**
* Setter for the max-results-group parameter.
*
* @param int $value Specifies the maximum number of records to be
* retrieved from each group. The limits that you specify with this
* parameter apply to all groups. Must be an integer value greater than
* zero. This parameter is only valid if grouped=true.
* @return Zend_Gdata_Health_Query Provides a fluent interface
*/
public function setMaxResultsInGroup($value)
{
if ($value !== null) {
if ($value <= 0 || $this->getGrouped() !== 'true') {
throw new Zend_Gdata_App_InvalidArgumentException(
'The max-results-in-group parameter must be set to a value
greater than 0 and can only be used if grouped=true');
} else {
$this->_params['max-results-in-group'] = $value;
}
}
return $this;
}
/**
* Returns the value set for max-results-in-group.
*
* @return int Returns max-results-in-group parameter.
*/
public function getMaxResultsInGroup()
{
if (array_key_exists('max-results-in-group', $this->_params)) {
return $this->_params['max-results-in-group'];
} else {
return null;
}
}
/**
* Setter for the start-index-group parameter.
*
* @param int $value Retrieves only items whose group ranking is at
* least start-index-group. This should be set to a 1-based index of the
* first group to be retrieved. The range is applied per category.
* This parameter is only valid if grouped=true.
* @return Zend_Gdata_Health_Query Provides a fluent interface
*/
public function setStartIndexGroup($value)
{
if ($value !== null && $this->getGrouped() !== 'true') {
throw new Zend_Gdata_App_InvalidArgumentException(
'The start-index-group can only be used if grouped=true');
} else {
$this->_params['start-index-group'] = $value;
}
return $this;
}
/**
* Returns the value set for start-index-group.
*
* @return int Returns start-index-group parameter.
*/
public function getStartIndexGroup()
{
if (array_key_exists('start-index-group', $this->_params)) {
return $this->_params['start-index-group'];
} else {
return null;
}
}
/**
* Setter for the start-index-in-group parameter.
*
* @param int $value A 1-based index of the records to be retrieved from
* each group. This parameter is only valid if grouped=true.
* @return Zend_Gdata_Health_Query Provides a fluent interface
*/
public function setStartIndexInGroup($value)
{
if ($value !== null && $this->getGrouped() !== 'true') {
throw new Zend_Gdata_App_InvalidArgumentException('start-index-in-group');
} else {
$this->_params['start-index-in-group'] = $value;
}
return $this;
}
/**
* Returns the value set for start-index-in-group.
*
* @return int Returns start-index-in-group parameter.
*/
public function getStartIndexInGroup()
{
if (array_key_exists('start-index-in-group', $this->_params)) {
return $this->_params['start-index-in-group'];
} else {
return null;
}
}
}
home/karenpetzb/library/Zend/Gdata/Gbase/Query.php 0000604 00000014207 15071671316 0016073 0 ustar 00 <?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_Gdata
* @subpackage Gbase
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Query
*/
require_once('Zend/Gdata/Query.php');
/**
* Assists in constructing queries for Google Base
*
* @link http://code.google.com/apis/base
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gbase
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Gbase_Query extends Zend_Gdata_Query
{
/**
* Path to the customer items feeds on the Google Base server.
*/
const GBASE_ITEM_FEED_URI = 'http://www.google.com/base/feeds/items';
/**
* Path to the snippets feeds on the Google Base server.
*/
const GBASE_SNIPPET_FEED_URI = 'http://www.google.com/base/feeds/snippets';
/**
* The default URI for POST methods
*
* @var string
*/
protected $_defaultFeedUri = self::GBASE_ITEM_FEED_URI;
/**
* @param string $value
* @return Zend_Gdata_Gbase_Query Provides a fluent interface
*/
public function setKey($value)
{
if ($value !== null) {
$this->_params['key'] = $value;
} else {
unset($this->_params['key']);
}
return $this;
}
/**
* @param string $value
* @return Zend_Gdata_Gbase_ItemQuery Provides a fluent interface
*/
public function setBq($value)
{
if ($value !== null) {
$this->_params['bq'] = $value;
} else {
unset($this->_params['bq']);
}
return $this;
}
/**
* @param string $value
* @return Zend_Gdata_Gbase_ItemQuery Provides a fluent interface
*/
public function setRefine($value)
{
if ($value !== null) {
$this->_params['refine'] = $value;
} else {
unset($this->_params['refine']);
}
return $this;
}
/**
* @param string $value
* @return Zend_Gdata_Gbase_ItemQuery Provides a fluent interface
*/
public function setContent($value)
{
if ($value !== null) {
$this->_params['content'] = $value;
} else {
unset($this->_params['content']);
}
return $this;
}
/**
* @param string $value
* @return Zend_Gdata_Gbase_ItemQuery Provides a fluent interface
*/
public function setOrderBy($value)
{
if ($value !== null) {
$this->_params['orderby'] = $value;
} else {
unset($this->_params['orderby']);
}
return $this;
}
/**
* @param string $value
* @return Zend_Gdata_Gbase_ItemQuery Provides a fluent interface
*/
public function setSortOrder($value)
{
if ($value !== null) {
$this->_params['sortorder'] = $value;
} else {
unset($this->_params['sortorder']);
}
return $this;
}
/**
* @param string $value
* @return Zend_Gdata_Gbase_ItemQuery Provides a fluent interface
*/
public function setCrowdBy($value)
{
if ($value !== null) {
$this->_params['crowdby'] = $value;
} else {
unset($this->_params['crowdby']);
}
return $this;
}
/**
* @param string $value
* @return Zend_Gdata_Gbase_ItemQuery Provides a fluent interface
*/
public function setAdjust($value)
{
if ($value !== null) {
$this->_params['adjust'] = $value;
} else {
unset($this->_params['adjust']);
}
return $this;
}
/**
* @return string key
*/
public function getKey()
{
if (array_key_exists('key', $this->_params)) {
return $this->_params['key'];
} else {
return null;
}
}
/**
* @return string bq
*/
public function getBq()
{
if (array_key_exists('bq', $this->_params)) {
return $this->_params['bq'];
} else {
return null;
}
}
/**
* @return string refine
*/
public function getRefine()
{
if (array_key_exists('refine', $this->_params)) {
return $this->_params['refine'];
} else {
return null;
}
}
/**
* @return string content
*/
public function getContent()
{
if (array_key_exists('content', $this->_params)) {
return $this->_params['content'];
} else {
return null;
}
}
/**
* @return string orderby
*/
public function getOrderBy()
{
if (array_key_exists('orderby', $this->_params)) {
return $this->_params['orderby'];
} else {
return null;
}
}
/**
* @return string sortorder
*/
public function getSortOrder()
{
if (array_key_exists('sortorder', $this->_params)) {
return $this->_params['sortorder'];
} else {
return null;
}
}
/**
* @return string crowdby
*/
public function getCrowdBy()
{
if (array_key_exists('crowdby', $this->_params)) {
return $this->_params['crowdby'];
} else {
return null;
}
}
/**
* @return string adjust
*/
public function getAdjust()
{
if (array_key_exists('adjust', $this->_params)) {
return $this->_params['adjust'];
} else {
return null;
}
}
}