本文整理汇总了PHP中UTIL_HtmlTag::escapeJs方法的典型用法代码示例。如果您正苦于以下问题:PHP UTIL_HtmlTag::escapeJs方法的具体用法?PHP UTIL_HtmlTag::escapeJs怎么用?PHP UTIL_HtmlTag::escapeJs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UTIL_HtmlTag
的用法示例。
在下文中一共展示了UTIL_HtmlTag::escapeJs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkItemLicense
/**
* Generic action to get the license key for items.
*/
public function checkItemLicense()
{
$params = $_GET;
$language = OW::getLanguage();
$params[BOL_StorageService::URI_VAR_LICENSE_CHECK_COMPLETE] = 0;
$params[BOL_StorageService::URI_VAR_LICENSE_CHECK_RESULT] = 0;
if (empty($params[BOL_StorageService::URI_VAR_KEY]) || empty($params[BOL_StorageService::URI_VAR_ITEM_TYPE]) || empty($params[BOL_StorageService::URI_VAR_DEV_KEY])) {
$errMsg = $language->text("admin", "check_license_invalid_params_err_msg");
OW::getFeedback()->error($errMsg);
$this->redirectToBackUri($params);
$this->assign("message", $errMsg);
return;
}
$key = trim($params[BOL_StorageService::URI_VAR_KEY]);
$devKey = trim($params[BOL_StorageService::URI_VAR_DEV_KEY]);
$type = trim($params[BOL_StorageService::URI_VAR_ITEM_TYPE]);
$data = $this->storageService->getItemInfoForUpdate($key, $devKey);
if (!$data) {
$this->assign("backButton", true);
$errMsg = $language->text("admin", "check_license_invalid_server_responce_err_msg");
OW::getFeedback()->error($errMsg);
$this->redirectToBackUri($params);
$this->assign("message", $errMsg);
return;
}
// if item is freeware reset check ts and redirect to back uri
if ((bool) $data[BOL_StorageService::URI_VAR_FREEWARE]) {
$params[BOL_StorageService::URI_VAR_LICENSE_CHECK_COMPLETE] = 1;
$params[BOL_StorageService::URI_VAR_LICENSE_CHECK_RESULT] = 1;
$params[BOL_StorageService::URI_VAR_FREEWARE] = 1;
$this->assign("message", $language->text("admin", "check_license_item_is_free_msg"));
$dto = $this->storageService->findStoreItem($key, $devKey, $params[BOL_StorageService::URI_VAR_ITEM_TYPE]);
if ($dto != null) {
$dto->setLicenseCheckTimestamp(null);
$this->storageService->saveStoreItem($dto);
}
$this->redirectToBackUri($params);
return;
}
$this->assign("text", $language->text("admin", "license_request_text", array("type" => $type, "title" => $data["title"])));
$form = new Form("license-key");
$licenseKey = new TextField("key");
$licenseKey->setRequired();
$licenseKey->setLabel($language->text("admin", "com_plugin_request_key_label"));
$form->addElement($licenseKey);
$submit = new Submit("submit");
$submit->setValue($language->text("admin", "license_form_button_label"));
$form->addElement($submit);
if (isset($params["back-button-uri"])) {
$button = new Button("button");
$button->setValue($language->text("admin", "license_form_back_label"));
$redirectUrl = UTIL_HtmlTag::escapeJs(OW_URL_HOME . urldecode($params["back-button-uri"]));
$button->addAttribute("onclick", "window.location='{$redirectUrl}'");
$form->addElement($button);
$this->assign("backButton", true);
}
$this->addForm($form);
if (OW::getRequest()->isPost()) {
if ($form->isValid($_POST)) {
$data = $form->getValues();
$licenseKey = $data["key"];
$result = $this->storageService->checkLicenseKey($key, $devKey, $licenseKey);
$params[BOL_StorageService::URI_VAR_LICENSE_CHECK_COMPLETE] = 1;
if ($result) {
$params[BOL_StorageService::URI_VAR_LICENSE_CHECK_RESULT] = 1;
$params[BOL_StorageService::URI_VAR_LICENSE_KEY] = urlencode($licenseKey);
$dto = $this->storageService->findStoreItem($key, $devKey, $params[BOL_StorageService::URI_VAR_ITEM_TYPE]);
if ($dto != null) {
$dto->setLicenseKey($licenseKey);
$dto->setLicenseCheckTimestamp(null);
$this->storageService->saveStoreItem($dto);
}
OW::getFeedback()->info($language->text("admin", "plugins_manage_license_key_check_success"));
$this->redirectToBackUri($params);
$this->redirect();
} else {
OW::getFeedback()->error($language->text('admin', 'plugins_manage_invalid_license_key_error_message'));
$this->redirect();
}
}
}
}