本文整理汇总了PHP中SEFTools::postRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP SEFTools::postRequest方法的具体用法?PHP SEFTools::postRequest怎么用?PHP SEFTools::postRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SEFTools
的用法示例。
在下文中一共展示了SEFTools::postRequest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findUpdate
function findUpdate($data)
{
$this->_update_site_id = $data["update_site_id"];
$this->base = array();
$this->update_sites = array();
$this->updates = array();
$ext_data = SEFTools::postRequest($data['location']);
$details = $ext_data->content;
$db = JFactory::getDBO();
if (!strlen($details)) {
$query = $db->getQuery(true);
$query->update('#__update_sites')->set('enabled=0')->where('update_site=' . $data["update_site_id"]);
$db->query();
JError::raiseWarning('101', JText::sprintf('JLIB_UPDATER_ERROR_SEFEXT_OPEN_URL', $data["url"]));
return false;
}
if (preg_match("/^[0-9]{2}/", $details, $status)) {
$details = $status[0];
$url = explode("/", $data['location']);
$ext = array_pop($url);
$ext = str_replace('.xml', '', $ext);
if (substr_count($ext, "-")) {
$ext_name_arr = explode("-", $ext);
$ext_name = $ext_name_arr[0];
} else {
$ext_name = $ext;
}
if (substr_count($ext, 'com_joomsef4')) {
$data["name"] = "Artio JoomSEF 4";
} else {
$query = $db->getQuery(true);
$query->select('name')->from('#__extensions')->where('element=' . $db->quote($ext_name))->where('type=' . $db->quote('sef_ext'));
$db->setQuery($query);
$data["name"] = $db->loadResult();
if (is_null($data['name'])) {
// Extension not found
return true;
}
$data['name'] .= ' (JoomSEF extension)';
}
}
switch ($details) {
case '20':
JError::raiseWarning('101', $data["name"] . ': ' . JText::sprintf('COM_SEF_EXPIRED', $data["name"]));
break;
case '30':
JError::raiseWarning('101', $data["name"] . ': ' . JText::sprintf('COM_SEF_NOT_ACTIVATED', $data["name"]));
break;
case '40':
JError::raiseWarning('101', $data["name"] . ': ' . JText::sprintf('COM_SEF_ERR_DOMAIN_NOT_MATCH', $data["name"]));
break;
case '50':
JError::raiseWarning('101', $data["name"] . ': ' . JText::sprintf('COM_SEF_DOWLOAD_ID_INVALID', $data["name"]));
break;
case '90':
// Commercial extension
$location_match = array();
if (preg_match("/(-([A-Za-z0-9]*)).xml/", $data["location"], $location_match)) {
JError::raiseWarning('101', $data["name"] . ': ' . JText::sprintf('COM_SEF_ERROR_DOWNLOAD_ID_NOT_FOUND', $location_match[2]));
// Free extension
} else {
JError::raiseWarning('101', $data["name"] . ': ' . JText::sprintf('COM_SEF_NOT_FOUND', $data["name"]));
}
break;
default:
$xml = simplexml_load_string($details);
if (is_object($xml)) {
foreach ($xml->children() as $update) {
$table = JTable::getInstance('update');
$table->update_site_id = $this->_update_site_id;
$table->version = (string) $update->version;
if ((string) $update->element == 'com_joomsef4') {
$sef_version = SEFTools::getSEFVersion();
$table->name = (string) $update->name;
$table->element = 'com_sef';
$table->client_id = 1;
$table->type = 'component';
} else {
$sefext_version = SEFTools::getExtVersion((string) $update->name);
$table->name = (string) $update->name;
$table->element = (string) $update->element;
$table->client_id = 0;
$table->type = 'sef_ext';
}
$table->detailsurl = $data["location"];
$this->updates[] = $table;
}
}
}
return array('update_sites' => $this->update_sites, 'updates' => $this->updates);
}