本文整理汇总了PHP中SFUtils::getValuesFromExternalURL方法的典型用法代码示例。如果您正苦于以下问题:PHP SFUtils::getValuesFromExternalURL方法的具体用法?PHP SFUtils::getValuesFromExternalURL怎么用?PHP SFUtils::getValuesFromExternalURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SFUtils
的用法示例。
在下文中一共展示了SFUtils::getValuesFromExternalURL方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$params = $this->extractRequestParams();
$substr = $params['substr'];
$namespace = $params['namespace'];
$property = $params['property'];
$category = $params['category'];
$concept = $params['concept'];
$external_url = $params['external_url'];
$baseprop = $params['baseprop'];
$basevalue = $params['basevalue'];
//$limit = $params['limit'];
if (is_null($baseprop) && strlen($substr) == 0) {
$this->dieUsage('The substring must be specified', 'param_substr');
}
if (!is_null($baseprop)) {
if (!is_null($property)) {
$data = self::getAllValuesForProperty($property, null, $baseprop, $basevalue);
}
} elseif (!is_null($property)) {
$data = self::getAllValuesForProperty($property, $substr);
} elseif (!is_null($category)) {
$data = SFUtils::getAllPagesForCategory($category, 3, $substr);
} elseif (!is_null($concept)) {
$data = SFUtils::getAllPagesForConcept($concept, $substr);
} elseif (!is_null($namespace)) {
$data = SFUtils::getAllPagesForNamespace($namespace, $substr);
} elseif (!is_null($external_url)) {
$data = SFUtils::getValuesFromExternalURL($external_url, $substr);
} else {
$data = array();
}
// If we got back an error message, exit with that message.
if (!is_array($data)) {
$this->dieUsage($data);
}
// to prevent JS parsing problems, display should be the same
// even if there are no results
/*
if ( count( $data ) <= 0 ) {
return;
}
*/
// Format data as the API requires it - this is not needed
// for "values from url", where the data is already formatted
// correctly.
if (is_null($external_url)) {
$formattedData = array();
foreach ($data as $value) {
$formattedData[] = array('title' => $value);
}
} else {
$formattedData = $data;
}
// Set top-level elements.
$result = $this->getResult();
$result->setIndexedTagName($formattedData, 'p');
$result->addValue(null, $this->getModuleName(), $formattedData);
}