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


PHP Misc::getURL方法代码示例

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


在下文中一共展示了Misc::getURL方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateSchedule

 public function updateSchedule()
 {
     $countries = $this->pdo->query("SELECT DISTINCT(country) AS country FROM tvrage_titles WHERE country != ''");
     $showsindb = $this->pdo->query("SELECT DISTINCT(rageid) AS rageid FROM tvrage_titles");
     $showarray = [];
     foreach ($showsindb as $show) {
         $showarray[] = $show['rageid'];
     }
     foreach ($countries as $country) {
         if ($this->echooutput) {
             echo $this->pdo->log->headerOver('Updating schedule for: ') . $this->pdo->log->primary($country['country']);
         }
         $sched = Misc::getURL(['url' => $this->xmlFullScheduleUrl . $country['country']]);
         if ($sched !== false && ($xml = @simplexml_load_string($sched))) {
             $tzOffset = 60 * 60 * 6;
             $yesterday = strtotime("-1 day") - $tzOffset;
             $xmlSchedule = [];
             foreach ($xml->DAY as $sDay) {
                 $currDay = strtotime($sDay['attr']);
                 foreach ($sDay as $sTime) {
                     $currTime = (string) $sTime['attr'];
                     foreach ($sTime as $sShow) {
                         $currShowName = (string) $sShow['name'];
                         $currShowId = (string) $sShow->sid;
                         $day_time = strtotime($sDay['attr'] . ' ' . $currTime);
                         $tag = $currDay < $yesterday ? 'prev' : 'next';
                         if ($tag == 'prev' || $tag == 'next' && !isset($xmlSchedule[$currShowId]['next'])) {
                             $xmlSchedule[$currShowId][$tag] = ['name' => $currShowName, 'day' => $currDay, 'time' => $currTime, 'day_time' => $day_time, 'day_date' => date("Y-m-d H:i:s", $day_time), 'title' => html_entity_decode((string) $sShow->title, ENT_QUOTES, 'UTF-8'), 'episode' => html_entity_decode((string) $sShow->ep, ENT_QUOTES, 'UTF-8')];
                             $xmlSchedule[$currShowId]['showname'] = $currShowName;
                         }
                         // Only add it here, no point adding it to tvrage aswell that will automatically happen when an ep gets posted.
                         if ($sShow->ep == "01x01") {
                             $showarray[] = $sShow->sid;
                         }
                         // Only stick current shows and new shows in there.
                         if (in_array($currShowId, $showarray)) {
                             $this->pdo->queryExec(sprintf("INSERT INTO tvrage_episodes (rageid, showtitle, fullep, airdate, link, eptitle) VALUES (%d, %s, %s, %s, %s, %s) ON DUPLICATE KEY UPDATE airdate = %s, link = %s ,eptitle = %s, showtitle = %s", $sShow->sid, $this->pdo->escapeString($currShowName), $this->pdo->escapeString($sShow->ep), $this->pdo->escapeString(date("Y-m-d H:i:s", $day_time)), $this->pdo->escapeString($sShow->link), $this->pdo->escapeString($sShow->title), $this->pdo->escapeString(date("Y-m-d H:i:s", $day_time)), $this->pdo->escapeString($sShow->link), $this->pdo->escapeString($sShow->title), $this->pdo->escapeString($currShowName)));
                         }
                     }
                 }
             }
             // Update series info.
             foreach ($xmlSchedule as $showId => $epInfo) {
                 $res = $this->pdo->query(sprintf("SELECT * FROM tvrage_titles WHERE rageid = %d", $showId));
                 if (sizeof($res) > 0) {
                     foreach ($res as $arr) {
                         $prev_ep = $next_ep = "";
                         $query = [];
                         // Previous episode.
                         if (isset($epInfo['prev']) && $epInfo['prev']['episode'] != '') {
                             $prev_ep = $epInfo['prev']['episode'] . ', "' . $epInfo['prev']['title'] . '"';
                             $query[] = sprintf("prevdate = %s, previnfo = %s", $this->pdo->from_unixtime($epInfo['prev']['day_time']), $this->pdo->escapeString($prev_ep));
                         }
                         // Next episode.
                         if (isset($epInfo['next']) && $epInfo['next']['episode'] != '') {
                             if ($prev_ep == "" && $arr['nextinfo'] != '' && $epInfo['next']['day_time'] > strtotime($arr["nextdate"]) && strtotime(date('Y-m-d', strtotime($arr["nextdate"]))) < $yesterday) {
                                 $this->pdo->queryExec(sprintf("UPDATE tvrage_titles SET prevdate = nextdate, previnfo = nextinfo WHERE id = %d", $arr['id']));
                                 $prev_ep = "SWAPPED with: " . $arr['nextinfo'] . " - " . date("r", strtotime($arr["nextdate"]));
                             }
                             $next_ep = $epInfo['next']['episode'] . ', "' . $epInfo['next']['title'] . '"';
                             $query[] = sprintf("nextdate = %s, nextinfo = %s", $this->pdo->from_unixtime($epInfo['next']['day_time']), $this->pdo->escapeString($next_ep));
                         } else {
                             $query[] = "nextdate = NULL, nextinfo = NULL";
                         }
                         // Output.
                         if ($this->echooutput) {
                             echo $this->pdo->log->primary($epInfo['showname'] . " (" . $showId . "):");
                             if (isset($epInfo['prev']['day_time'])) {
                                 echo $this->pdo->log->headerOver("Prev EP: ") . $this->pdo->log->primary("{$prev_ep} - " . date("m/d/Y H:i T", $epInfo['prev']['day_time']));
                             }
                             if (isset($epInfo['next']['day_time'])) {
                                 echo $this->pdo->log->headerOver("Next EP: ") . $this->pdo->log->primary("{$next_ep} - " . date("m/d/Y H:i T", $epInfo['next']['day_time']));
                             }
                             echo "\n";
                         }
                         // Update info.
                         if (count($query) > 0) {
                             $sql = join(", ", $query);
                             $sql = sprintf("UPDATE tvrage_titles SET {$sql} WHERE id = %d", $arr['id']);
                             $this->pdo->queryExec($sql);
                         }
                     }
                 }
             }
         } else {
             // No response from tvrage.
             if ($this->echooutput) {
                 echo $this->pdo->log->info("Schedule not found.");
             }
         }
     }
     if ($this->echooutput) {
         echo $this->pdo->log->primary("Updated the TVRage schedule succesfully.");
     }
 }
开发者ID:advhamstrong,项目名称:nZEDb,代码行数:95,代码来源:TvRage.php


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