本文整理汇总了PHP中History::getFewInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP History::getFewInfo方法的具体用法?PHP History::getFewInfo怎么用?PHP History::getFewInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类History
的用法示例。
在下文中一共展示了History::getFewInfo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ajax_updatenext
public function ajax_updatenext()
{
$time_start = microtime(true);
$response["error"] = "none";
$response["file"] = "none";
$response["nextId"] = null;
if (!empty($_POST["id"])) {
$id = intval($_POST["id"]);
if ($id < 1) {
$i = 1;
}
$history = new History();
$themeInfo = $history->getFewInfo($id);
if (!empty($themeInfo)) {
$unzippath = TC_VAULTDIR . '/unzip/' . $themeInfo["hash"] . "/";
if (file_exists($unzippath)) {
$nextId = $history->getNextId($themeInfo["id"]);
$response["nextId"] = $nextId;
$themeInfo = $history->loadThemeFromHash($themeInfo["hash"]);
// need an objet and not an array
$r = $themeInfo->initFromUnzippedArchive($unzippath, $themeInfo->zipfilename, $themeInfo->zipmimetype, $themeInfo->zipfilesize);
// merchant...
$this->fileValidator = new FileValidator($themeInfo);
$this->fileValidator->validate();
if (UserMessage::getCount(ERRORLEVEL_FATAL) > 0) {
$response["error"] = "fatal error:\n";
foreach (UserMessage::getMessages(ERRORLEVEL_FATAL) as $m) {
$response["error"] .= "\n" . $m;
}
} else {
if ($this->fileValidator->serialize(true)) {
if (UserMessage::getCount(ERRORLEVEL_FATAL) > 0) {
// at least one error occured while serializing (no thumbnail...)
$response["error"] = "fatal error, could not serialize validation results:\n";
foreach (UserMessage::getMessages(ERRORLEVEL_FATAL) as $m) {
$response["error"] .= "\n" . $m;
}
foreach (UserMessage::getMessages(ERRORLEVEL_CRITICAL) as $m) {
$response["error"] .= "\n" . $m;
}
} else {
$this->validationResults = $this->fileValidator->getValidationResults(I18N::getCurLang());
$themeInfo = $this->fileValidator->themeInfo;
$response["name"] = $themeInfo->name;
}
} else {
// at least one error occured while serializing (no thumbnail...)
if (UserMessage::getCount(ERRORLEVEL_CRITICAL) > 0) {
$response["error"] = "could not serialize validation results";
}
foreach (UserMessage::getMessages(ERRORLEVEL_CRITICAL) as $m) {
$response["error"] .= "\n" . $m;
}
}
}
} else {
$response["error"] .= "No zip file " . $unzippath;
}
} else {
if (UserMessage::getCount(ERRORLEVEL_FATAL) > 0) {
// at least one error occured while serializing (no thumbnail...)
$response["error"] = "could not execute validation:\n";
foreach (UserMessage::getMessages(ERRORLEVEL_FATAL) as $m) {
$response["error"] .= "\n" . $m;
}
foreach (UserMessage::getMessages(ERRORLEVEL_CRITICAL) as $m) {
$response["error"] .= "\n" . $m;
}
} else {
$response["error"] = "could not execute validation (unknown error).";
}
}
}
$time_end = microtime(true);
$time = $time_end - $time_start;
$response["duration"] = $time;
//ob_clean();
header('Content-Type: application/json');
echo json_encode($response);
}
示例2: ajax_sample
public function ajax_sample()
{
$time_start = microtime(true);
$response["error"] = "none";
$response["html"] = "";
$themeid = 1;
if (isset($_POST["themeid"])) {
$themeid = intval($_POST["themeid"]);
}
if ($themeid < 1) {
$themeid = 1;
}
$checkid = $_POST["checkid"];
if (USE_DB) {
$history = new History();
$themInfo = $history->getFewInfo($themeid);
$hash = $themInfo["hash"];
$fileValidator = FileValidator::unserialize($hash);
$fileValidator->validate($checkid);
//if (UserMessage::getCount(ERRORLEVEL_FATAL) == 0) // serialize only if no fatal errors
$validationResults = $fileValidator->getValidationResults(I18N::getCurLang());
if (count($validationResults->check_critical) > 0 || count($validationResults->check_warnings) > 0 || count($validationResults->check_info) > 0) {
$url = TC_HTTPDOMAIN . '/' . Route::getInstance()->assemble(array("lang" => "en", "phpfile" => "results", "hash" => $hash));
$html = '<h2 style="color:#D00;">' . $themInfo["name"] . '<a href="' . $url . '" target="_blank" style="font-size:14px;margin-left:6px"><span class="glyphicon glyphicon-new-window"></span></a>' . '</h2>';
}
if (count($validationResults->check_critical) > 0) {
//$html .= '<h2 style="line-height:100px;color:#D00;">'.__("Critical alerts").'</h2>';
$html .= '<ol>';
foreach ($validationResults->check_critical as $check) {
$html .= '<h4 style="color:#666;margin-top:40px;"><li>' . $check->title . ' : ' . $check->hint . '</li></h4>';
if (!empty($check->messages)) {
$html .= '<p style="color:#c94b4b;">' . implode('<br/>', $check->messages) . '</p>';
}
}
$html .= '</ol>';
}
if (count($validationResults->check_warnings) > 0) {
//$html .= '<h2 style="line-height:100px;color:#eea43a;">'.__("Warnings").'</h2>';
$html .= '<ol>';
foreach ($validationResults->check_warnings as $check) {
$html .= '<h4 style="color:#666;margin-top:40px;"><li>' . $check->title . ' : ' . $check->hint . '</li></h4>';
if (!empty($check->messages)) {
$html .= '<p style="color:#eea43a;">' . implode('<br/>', $check->messages) . '</p>';
}
}
$html .= '</ol>';
}
if (count($validationResults->check_info) > 0) {
//$html .= '<h2 style="line-height:100px;color:#eea43a;">'.__("Warnings").'</h2>';
$html .= '<ol>';
foreach ($validationResults->check_info as $check) {
$html .= '<h4 style="color:#666;margin-top:40px;"><li>' . $check->title . ' : ' . $check->hint . '</li></h4>';
if (!empty($check->messages)) {
$html .= '<p style="color:#00b6e3;">' . implode('<br/>', $check->messages) . '</p>';
}
}
$html .= '</ol>';
}
$response["html"] = $html;
$prevId = $history->getPrevId($themeid);
if (!empty($prevId)) {
$themInfoNext = $history->getFewInfo($prevId);
$response["next_id"] = $prevId;
$response["next_name"] = $themInfoNext["name"];
} else {
$response["next_id"] = null;
$response["next_name"] = null;
}
}
$time_end = microtime(true);
$time = $time_end - $time_start;
$response["duration"] = $time;
//ob_clean();
header('Content-Type: application/json');
echo json_encode($response);
}
示例3: unserialize
/**
* Restore check results from a JSON file.
**/
public static function unserialize($hash)
{
if (!USE_DB) {
return null;
}
$directory = ThemeInfo::getReportDirectory($hash);
if (!file_exists($directory)) {
return null;
}
$history = new History();
$themeInfo = $history->loadThemeFromHash($hash);
if (empty($themeInfo)) {
return null;
}
$fileValidator = new FileValidator($themeInfo);
global $ExistingLangs;
foreach ($ExistingLangs as $l) {
$_validationResults = ValidationResults::unserialize($hash, $l);
if (empty($_validationResults)) {
continue;
}
$fileValidator->validationResults[$l] = $_validationResults;
}
if (!empty($themeInfo->parentId)) {
$fewInfo = $history->getFewInfo($themeInfo->parentId);
if (!empty($fewInfo["id"])) {
$themeInfo->parentNameSanitized = $fewInfo["namesanitized"];
}
$themeInfo->parentThemeType = $fewInfo["themetype"];
}
if ($themeInfo->isThemeForest) {
$fileValidator->generateThemeForestReport();
}
return $fileValidator;
}
示例4: render
//.........这里部分代码省略.........
?>
</div>
<div class="container">
<div id="disqus_thread" style="margin-top:60px"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'themecheck'; // required: replace example with your forum shortname
var disqus_url = '<?php
echo $this->samepage_i18n[I18N::getCurLang()];
?>
';
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink" rel="nofollow">comments powered by <span class="logo-disqus">Disqus</span></a>
<?php
if (USE_DB) {
echo '<hr>';
echo '<h2 style="line-height:100px;color:#888">' . __("Other files checked around the same date") . '</h2>';
$history = new History();
$id = intval($history->getIdFromHash($themeInfo->hash));
for ($i = 1; $i > -4; $i--) {
if ($i == 0) {
$i--;
}
// not the current one
$r = $history->getFewInfo($id + $i);
if ($r !== false) {
$html = '';
$namesanitized = $r['namesanitized'];
$themetype = $r['themetype'];
$score = $r['score'];
$themetype_text = sprintf(__("Wordpress %s theme"), $r['cmsVersion']);
if ($themetype == TT_JOOMLA) {
$themetype_text = sprintf(__("Joomla %s template"), $r['cmsVersion']);
}
$url = TC_HTTPDOMAIN . '/' . Route::getInstance()->assemble(array("lang" => I18N::getCurLang(), "phpfile" => "results", "namesanitized" => $namesanitized, "themetype" => $themetype));
$html .= '<div style="width:220px;height:220px;display:inline-block;text-align:center;margin:10px 32px">';
$html .= '<a href="' . $url . '" ><img style="box-shadow: 0 0 20px #DDD;" src="' . TC_HTTPDOMAIN . '/' . $r['hash'] . '/thumbnail.png"></a>';
$html .= '<div style="width:220px;height:40px;margin:3px 0 0 0;text-align:left;line-height:18px;padding:0 7px;overflow:hidden;white-space:nowrap;font-size : 12px;">';
$html .= '<div style="width:33px;height:40px;float:right;">';
$html .= getShield($r, I18N::getCurLang(), 40, $url, TC_HTTPDOMAIN . '/');
$html .= '</div>';
$html .= htmlspecialchars($r['name']) . '<br/><span style="font-size : 12px; color:#AAA;">' . $themetype_text . '</span>';
$html .= '</div>';
$html .= '</div>';
echo $html;
}
}
// $themetype = $r['themetype'];
// $score = $r['score'];
}
} else {
if (UserMessage::getCount(ERRORLEVEL_FATAL) > 0) {
?>
<div class="container">
<br/>
<div class="row text-center">
<h1><?php