コード例 #1
0
ファイル: seo.php プロジェクト: nishant368/newlifeoffice-new
 /**
  *
  * Return smartWattermark instance or create intitial instance
  *
  * @access public
  * @params $custom_option (optional)
  *
  * @return object
  *
  */
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new smartSeo();
     }
     return self::$instance;
 }
コード例 #2
0
ファイル: api.php プロジェクト: nishant368/newlifeoffice-new
<?php

error_reporting(0);
require_once realpath('classes/seo.php');
$smartSeo = smartSeo::getInstance();
$recives = array('keyword' => $_REQUEST['primary_keyword'], 'meta_title' => $_REQUEST['meta_title'], 'meta_description' => $_REQUEST['meta_description'], 'meta_keywords' => $_REQUEST['meta_keywords'], 'content' => $_REQUEST['content']);
// defautl set all to false
$scoreArray = array('keyword_title_tag' => 0, 'keyword_meta_description' => 0, 'keyword_meta_keywords' => 0, 'keyword_meta_H1' => 0, 'keyword_meta_H2' => 0, 'keyword_meta_H3' => 0, 'keyword_meta_fontsize' => 0, 'keyword_meta_img_alt' => 0);
if (trim($recives['keyword']) == "") {
    // print as json
    echo json_encode($scoreArray);
    die;
}
// Keyword in title tag
$__['keyword_title_tag'] = $smartSeo->rule_keyword_in_string($recives['meta_title'], $recives['keyword']);
if ($__['keyword_title_tag'] > 0) {
    $scoreArray['keyword_title_tag'] = 1;
}
// Keywords in description
$__['keyword_meta_description'] = $smartSeo->rule_keyword_in_string($recives['meta_description'], $recives['keyword']);
if ($__['keyword_meta_description'] > 0) {
    $scoreArray['keyword_meta_description'] = 1;
}
// Keywords in keywords
$__['keyword_meta_keywords'] = $smartSeo->rule_keyword_in_string($recives['meta_keywords'], $recives['keyword']);
if ($__['keyword_meta_keywords'] > 0) {
    $scoreArray['keyword_meta_keywords'] = 1;
}
// Keywords in H1
$__['keyword_meta_H1'] = $smartSeo->rule_keyword_in_tag($recives['content'], $recives['keyword'], 'h1');
if ($__['keyword_meta_H1'] > 0) {