コード例 #1
0
ファイル: WebpageTextChecker.php プロジェクト: Kurets/origin
 public function webpageTextChecker()
 {
     $this->deleteOldFiles();
     $site = Files::fileToArray('sites.txt')[0];
     Curl::cookieCreation($site);
     $pageNumber = -1;
     $pages = self::clearPages();
     $pagesUnique = array_unique($pages);
     foreach ($pagesUnique as $page) {
         self::setTextForSearch($page);
         /* check if page does not start with
            slash then add it */
         if ($page[0] !== "/") {
             if (in_array("/{$page}", $pages)) {
                 continue;
             }
             $page = "/{$page}";
         }
         $textForSearch = self::getTextForSearch();
         $pageNumber++;
         $sitePage = $site . $page;
         echo count($pagesUnique) - $pageNumber . ".", $sitePage . "\n";
         $this->pageTextChecker($page, $pages, $site, $sitePage, $textForSearch);
     }
     $logFileName = 'ptc_log_';
     $log = $this->getLog();
     LogCreation::logFileCreator($log, $logFileName);
 }
コード例 #2
0
ファイル: timecount.php プロジェクト: Kurets/origin
}
//create log table with column names, header and fill it with 0s
array_splice($people, 0, 0, 'Name');
foreach ($people as $personKey => $person) {
    if ($personKey == 0) {
        $log[$personKey] = array_merge(array($person, 'Else'), $heroLabels);
    } else {
        foreach ($log[0] as $logKey => $logRow) {
            if ($logKey == 0) {
                $log[$personKey][$logKey] = $person;
            } else {
                $log[$personKey][$logKey] = '';
            }
        }
    }
}
//fil out log table with percents
foreach ($log as $logKey => $logRow) {
    foreach ($dbLogPercent as $dbLogPercRow) {
        if ($logRow[0] == $dbLogPercRow[1]) {
            foreach ($log[0] as $logRowKey => $logRowItem) {
                if ($logRowKey != 0 && $logRowItem == $dbLogPercRow[0]) {
                    $log[$logKey][$logRowKey] = $dbLogPercRow['%'];
                }
            }
        }
    }
}
$logFileName = 'timecount_';
LogCreation::logFileCreator($log, $logFileName);
コード例 #3
0
ファイル: WebsiteTextChecker.php プロジェクト: Kurets/origin
 public function websiteTextChecker()
 {
     self::deleteOldFiles();
     $sites = Files::fileToArray('sites.txt');
     $pagesFromFile = Files::fileToArray('pages.txt');
     $siteNumber = -1;
     $textForSearch = Files::fileToArray('text_for_search.txt');
     foreach ($sites as $site) {
         $site = InputInfoValidator::siteNameValidator($site);
         if (!is_null(GetAllHrefs::getOptsForPages())) {
             options:
             GetAllHrefs::setOptsForPages();
         }
         if (in_array(GetAllHrefs::getOptsForPages(), array(1, 3))) {
             if (!isset($checkBlog)) {
                 $checkBlog = GetAllHrefs::setCheckBlog();
             }
             Curl::cookieCreation($site);
             $sitePage = $site;
             $curlForLinks = Curl::getCurlResult($sitePage)[0];
             $pages = GetAllHrefs::getHrefs($site, $curlForLinks);
             if (GetAllHrefs::getOptsForPages() == 3) {
                 $pagesCurl = $pages;
                 $pages = array_merge($pagesCurl, $pagesFromFile);
             }
         } elseif (GetAllHrefs::getOptsForPages() == 2) {
             Curl::cookieCreation($site);
             $pages = $pagesFromFile;
         } else {
             goto options;
         }
         $pageNumber = -1;
         $siteNumber++;
         foreach ($pages as $key => &$page) {
             $pageNumber++;
             if (strpos($page, $site) == TRUE) {
                 $sitePage = $page;
             } else {
                 /* check if page does not start with
                    slash then add it */
                 if ($page[0] !== "/") {
                     if (in_array("/{$page}", $pages)) {
                         continue;
                     }
                     $page = "/{$page}";
                 }
                 $sitePage = "{$site}{$page}";
             }
             #counter for pages, which are being checker
             echo count($sites) - $siteNumber . ".", count($pages) - $pageNumber . ".", $sitePage . "\n";
             self::pageTextChecker($page, $pages, $site, $sitePage, $textForSearch);
         }
     }
     $logFileName = 'wtc_log_';
     $log = $this->log;
     LogCreation::logFileCreator($log, $logFileName);
 }