コード例 #1
0
 /**
  * Sending request to mark issue as fixed
  *
  * @param string $url      Issue URL.
  * @param string $platform Platform (desktop, mobile, feature phone).
  * @param string $category Issue type.
  *
  * @return bool
  */
 public function mark_as_fixed($url, $platform, $category)
 {
     $response = $this->client->do_request('sites/' . urlencode($this->profile) . '/urlCrawlErrorsSamples/' . urlencode(ltrim($url, '/')) . '?category=' . WPSEO_GSC_Mapper::category_to_api($category) . '&platform=' . WPSEO_GSC_Mapper::platform_to_api($platform) . '', false, 'DELETE');
     return $response->getResponseHttpCode() === 204;
 }
コード例 #2
0
ファイル: class-gsc.php プロジェクト: Nisha318/p3edtech
 /**
  * Setting dependencies which will be used one this page
  */
 private function set_dependencies()
 {
     // Setting the service object.
     $this->service = new WPSEO_GSC_Service(WPSEO_GSC_Settings::get_profile());
     // Setting the platform.
     $this->platform = WPSEO_GSC_Mapper::get_current_platform('tab');
     // Loading the issue counter.
     $issue_count = new WPSEO_GSC_Count($this->service);
     // Loading the category filters.
     $this->category_filter = new WPSEO_GSC_Category_Filters($issue_count->get_platform_counts($this->platform));
     // Setting the current category.
     $this->category = $this->category_filter->get_category();
     // Listing the issues.
     $issue_count->list_issues($this->platform, $this->category);
     // Fetching the issues.
     $this->issue_fetch = new WPSEO_GSC_Issues($this->platform, $this->category, $issue_count->get_issues());
 }
コード例 #3
0
 /**
  * Listing the issues for current category.
  *
  * @param array  $counts
  * @param string $platform
  * @param string $category
  *
  * @return array
  */
 private function list_category_issues(array $counts, $platform, $category)
 {
     // When the issues have to be fetched.
     if (array_key_exists($category, $counts) && $counts[$category]['count'] > 0 && $counts[$category]['last_fetch'] <= strtotime('-12 hours')) {
         if ($issues = $this->service->fetch_category_issues(WPSEO_GSC_Mapper::platform_to_api($platform), WPSEO_GSC_Mapper::category_to_api($category))) {
             $this->issues = $issues;
         }
         // Be sure the total count is correct.
         $counts[$category]['count'] = count($this->issues);
         // Set last fetch.
         $counts[$category]['last_fetch'] = time();
     }
     return $counts;
 }