Ejemplo n.º 1
0
<?php

//CHANGE THIS SETTINGS - http://www.eranker.com/settings
$eranker_apiemail = "*****@*****.**";
$eranker_apikey = "ee9978e1e5280ace6c0a3e99a77ea48c";
//Required Files
require_once 'libs/eRankerAPI.class.php';
require_once 'libs/eRankerCommons.php';
eRankerCommons::$factorCreateImageFolder = "libs/";
eRankerCommons::$imgfolder = "img/";
//Some default variables (can be overwritten by pages init)
$page_title = "Home";
$page_desc = "This is a DEMO project that uses eRanker API. It contains some basic features like: Create Report; View and print Report; Generate PDF; Latest Reports";
$project_name = "eRanker Factor Checker";
//Init the eranker object and fill the user and factors data
global $erapi;
$erapi = new eRankerAPI($eranker_apiemail, $eranker_apikey, true);
$erapi_accountinfo = $erapi->account();
$erapi_allfactors = $erapi->factors('en');
$seocheck_error = false;
Ejemplo n.º 2
0
    header('Location: /404');
    exit;
}
$report = $erapi->report($report_id);
if (empty($report)) {
    header('Location: /404');
    exit;
}
if (isset($seocheck_reportobj->msg)) {
    $seocheck_error = TRUE;
    $seocheck_error_msg = $report->msg . '<br/>' . $report->solution;
}
if (isset($seocheck_reportobj->url)) {
    $page_desc .= " - " . $seocheck_reportobj->url;
}
$report_scores = $erapi->reportscores($report_id, 'en');
if (empty($report_scores)) {
    header('Location: /404');
    exit;
}
if (isset($report_scores->msg)) {
    $seocheck_error = TRUE;
    $seocheck_error_msg = $report_scores->msg . '<br/>' . $report_scores->solution;
}
//AJAX requests
if (isset($_GET['ajax']) && !empty($_GET['ajax']) && isset($_GET['factors']) && !empty($_GET['factors'])) {
    $ajaxObj = eRankerCommons::ajaxReport($report, $erapi_allfactors, $report_scores, $_GET['factors'], true);
    header('Content-Type: application/json');
    echo json_encode($ajaxObj, JSON_PRETTY_PRINT);
    exit;
}
 public static function guiImgemptyalt($endModel, $data, $report, $factor)
 {
     $out = '';
     if (!empty($data)) {
         if (!empty($data['total'])) {
             $out .= '<div>' . str_replace('%total', $data['total'], eRankerCommons::translate("model_orange", $factor)) . '</div>';
             $url_href = '';
             foreach ($data['image'] as $value) {
                 if (strpos($value, "://")) {
                     $domain = explode('/', $value);
                     $url_href .= $domain[2];
                     break;
                 }
             }
             if ($url_href === '') {
                 $url_href = $report->url;
             }
             $out .= '<div class="trickydiv"><ul style="text-overflow: ellipsis;white-space: nowrap; max-width: 90%;" class="imgalttoggle imgalttoggledown">';
             if (!empty($data['image'])) {
                 $count = 0;
                 foreach ($data['image'] as $value) {
                     $count++;
                     if ($count == 5) {
                         $out .= '<li class="lastnotoggle">';
                     } else {
                         $out .= '<li>';
                     }
                     if (strpos($value, "://") === false) {
                         $url_href = rtrim($url_href, '/');
                         $value = ltrim($value, '/');
                         $url = $url_href . '/' . $value;
                     } else {
                         $url = $value;
                     }
                     $out .= '<a href="' . (eRankerCommons::fixURL($url) !== false ? eRankerCommons::fixURL($url) : $url) . '" target="_blank">' . $value . '</a>';
                     $out .= '</li>';
                 }
             }
             $out .= '</ul></div>';
             if ($count > 5) {
                 $out .= '<a class="showmoreimgalt" href="javascript:void(0);" onclick="if(jQuery(\'.imgalttoggle\').hasClass(\'imgalttoggledown\')){imgAltToggle(\' Show less\');}else if(jQuery(\'.imgalttoggle\').hasClass(\'imgalttoggleup\')){imgAltToggle(\' Show more\')}">' . 'Show more</a>';
             }
         } else {
             $out .= $endModel;
         }
     }
     return !empty($out) && !isset($_COOKIE['detectedLanguage']) || isset($_COOKIE['detectedLanguage']) && $_COOKIE['detectedLanguage'] === "en" ? $out : $endModel;
 }
<?php

if ($seocheck_error) {
    include '404-content.php';
    return;
}
$show_header = TRUE;
$show_title = TRUE;
$show_category = TRUE;
echo "<div class='container'>";
echo eRankerCommons::getReportHTML($report, $report_scores, $erapi_allfactors, true, false, true, $show_header, $show_title, $show_category);
echo "</div'>";