当前位置: 首页>>代码示例>>PHP>>正文


PHP History::loadThemeFromHash方法代码示例

本文整理汇总了PHP中History::loadThemeFromHash方法的典型用法代码示例。如果您正苦于以下问题:PHP History::loadThemeFromHash方法的具体用法?PHP History::loadThemeFromHash怎么用?PHP History::loadThemeFromHash使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在History的用法示例。


在下文中一共展示了History::loadThemeFromHash方法的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);
 }
开发者ID:Vultur,项目名称:themecheck,代码行数:80,代码来源:controller_massimport.php

示例2: assemble

 public function assemble($route = array())
 {
     $i18n = I18N::getInstance();
     $lang = "";
     if (isset($route["lang"])) {
         if ($route["lang"] == TC_DEFAULT_LANG) {
             $lang = "";
         } else {
             $lang = $route["lang"];
         }
     }
     $url = "";
     if (!empty($lang)) {
         $url = $lang . '/';
     }
     if (!isset($route["phpfile"])) {
         return "Error : phpfile not defined";
     }
     if ($route["phpfile"] == "home") {
         $url = trim($url, '/ ');
     } else {
         if ($route["phpfile"] == "results") {
             $data = array();
             if (isset($route["hash"])) {
                 $url = trim($url . $i18n->url($route["lang"], 'score'), '/ ');
                 if (!USE_DB) {
                     echo 'error in route. cannot assemble route without DB';
                     die;
                 }
                 $history = new History();
                 $themeInfo = $history->loadThemeFromHash($route["hash"]);
                 if (empty($themeInfo)) {
                     return null;
                 }
                 $data["name"] = $themeInfo->namesanitized;
                 if ($themeInfo->themetype == TT_WORDPRESS) {
                     $data["themetype"] = 'wordpress_theme';
                 }
                 if ($themeInfo->themetype == TT_JOOMLA) {
                     $data["themetype"] = 'joomla_template';
                 }
                 if ($themeInfo->themetype == TT_WORDPRESS_CHILD) {
                     $data["themetype"] = 'wordpress_theme';
                 }
                 $url .= '/' . trim($i18n->url($route["lang"], $data["themetype"])) . '_' . trim($data["name"]) . '.html';
             } else {
                 if (isset($route["namesanitized"]) && isset($route["themetype"])) {
                     $url = trim($url . $i18n->url($route["lang"], 'score'), '/ ');
                     if ($route["themetype"] == TT_WORDPRESS) {
                         $data["themetype"] = 'wordpress_theme';
                     }
                     if ($route["themetype"] == TT_JOOMLA) {
                         $data["themetype"] = 'joomla_template';
                     }
                     if ($route["themetype"] == TT_WORDPRESS_CHILD) {
                         $data["themetype"] = 'wordpress_theme';
                     }
                     $url .= '/' . trim($i18n->url($route["lang"], $data["themetype"])) . '_' . trim($route["namesanitized"]) . '.html';
                 } else {
                     if (isset($route["ut"])) {
                         $url = trim($url . $i18n->url($route["lang"], 'score'), '/ ') . '?ut=' . urlencode($route["ut"]);
                     } else {
                         $url = trim($url . $i18n->url($route["lang"], 'score'), '/ ');
                     }
                 }
             }
         } else {
             if ($route["phpfile"] == "unittests") {
                 $url = trim($url . $i18n->url($route["lang"], 'unittests'), '/ ');
             } else {
                 if ($route["phpfile"] == "massimport") {
                     $url = "massimport";
                 } else {
                     if ($route["phpfile"] == "contact") {
                         $url = trim($url . $i18n->url($route["lang"], 'contact'), '/ ');
                     } else {
                         if ($route["phpfile"] == "error404.php") {
                             $url = trim($url . $i18n->url($route["lang"], $route["phpfile"]), '/ ');
                         }
                     }
                 }
             }
         }
     }
     return strtolower($url);
 }
开发者ID:Vultur,项目名称:themecheck,代码行数:86,代码来源:Route.php

示例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;
 }
开发者ID:Vultur,项目名称:themecheck,代码行数:38,代码来源:FileValidator.php

示例4: strtolower

include_once 'include/shield.php';
$lang = 'en';
if (isset($_GET['lang']) && in_array(strtolower($_GET['lang']), $ExistingLangs)) {
    $lang = strtolower($_GET['lang']);
}
$size = '80';
if (isset($_GET['size']) && $_GET['size'] == "big") {
    $size = '240';
}
if (isset($_GET['size']) && $_GET['size'] == "small") {
    $size = '40';
}
$hash = $_GET['id'];
if (preg_match("/^[a-zA-Z0-9]{25}\$/", $hash)) {
    $history = new History();
    $themeInfo = $history->loadThemeFromHash($hash);
    if (!empty($themeInfo)) {
        ?>
		<script>
		var loc = window.location.protocol + "//" + window.location.hostname + window.location.pathname + window.location.search;
		ga('send', 'pageview', loc, '<?php 
        if ($themeInfo->themetype == 1) {
            echo '[WP] ';
        }
        if ($themeInfo->themetype == 2) {
            echo '[Joomla] ';
        }
        if ($themeInfo->themetype == 4) {
            echo '[WP child] ';
        }
        echo $themeInfo->namesanitized;
开发者ID:Vultur,项目名称:themecheck,代码行数:31,代码来源:score.php


注:本文中的History::loadThemeFromHash方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。