Website Review | PHP Script - Documentation


Thank you for purchasing website review PHP script. If you have any questions that are beyond the scope of this help file, please feel free to email roman.codecanyon@gmail.com. Thanks so much!



Note. You can view framework's requirements by accessing the requirement checker script via the following URL in a Web browser: http://your-domain.com/requirements
Note. If you installed script not in web-root directory then you need to add RewriteBase /subdir/ into .htaccess file after RewriteEngine on



Database Settings

This application is build on Yii framework.
So, The main Web application configuration file located in ~/root/website_review/config/main.php
Open this file and let's begin with configure database settings. Find following lines and set your own mysql settings
 
'db'=>array(
	// Mysql with host: localhost and databse name website_review
	'connectionString' => 'mysql:host=localhost;dbname=website_review',

	// whether to turn on prepare emulation
	'emulatePrepare' => true,

	// db username
	'username' => 'root',

	// db password
	'password' => '',

	// default cahrset
	'charset' => 'utf8',

	// table prefix
	'tablePrefix' => 'ca_',

	// cache time to reduce SHOW CREATE TABLE * queries
	'schemaCachingDuration' => 60 * 60 * 24 * 30,
),

SMTP Mail server

If you have SMTP Mail server, then you can receive messages from users via contact form. See below how to setup settings. The same config file:
 
// your email which will receive messages from contact form
'adminEmail'=>'admin@my-mail.com',
...
// Mailer extension
'mailer' => array(
	'SMTPAuth' => true,

	// smtp server's port
	'Port' => 25,

	// server's host
	'Host' => 'mail.your-host.com',

	// username
	'Username' => 'username',

	// password
	'Password' => 'password',

	// letter's charset
	'CharSet' => 'UTF-8',
),
If you do not have possibility to send emails via contact form, then I offer you to remove "Contact us" Link from menu.
Open: ~/root/website_review/views/layouts/main.php file
Remove this line:
 
<li <?php echo $this -> action -> id == "contact" ? 'class="active"' : ''; ?>><a href="<?php echo $this->createAbsoluteUrl("site/contact") ?>"><?php echo Yii::t("app", "Contact Us") ?></a></li>

Or replace with this one

 

<li><a href="mailto:your-email@ex.com"><?php echo Yii::t("app", "Contact Us") ?></a></li>


Google API

The script takes advantage of PageSpeed Insights. PageSpeed Insights analyzes the content of a web page, then generates suggestions to make that page faster. To make it work you need to configure this API.
Firstly, go to Google Console -> Credentials. Create new key for server (Credentials -> Add credentials -> API key -> Server key) application (if you haven't created yet). Copy API key and paste it into config file:

...
'googleApiKey'=>'',
...
Next go to Google Console -> APIs -> PageSpeed Insights API Click on "Enable API".



How to block domain?

There is possibility to block any domain using regular expression. The config of rules is under ~root/website_review/config/domain_restriction.php. The file contains a lot of examples.



Localization

To see the list of available languages find this line:

 

...
'languages'=>array('ru'=>'Русский', 'en'=>'English'),
...

Set default app language.

 

...
'language'=>'en',
...
You can setup as many languages as you want. For example, let's translate application to German.
First of all, create directory with chosen language. In our case language's ID will be de.
~/root/website_review/messages/de/
 
Copy files
app.php, meta.php, advice.php
from
~/root/website_review/messages/en/
to
~/root/website_review/messages/de/
 
Open them and translate.
 
Then add new key=>value pair into config file
 
...
'languages'=>array('ru'=>'Русский', 'en'=>'English', 'de'=>'Deutsch'),
...
That is all.

Rate system

You can modify already defined rates with your own. To do this, open ~/root/website_review/vendors/Webmaster/Rates/rates.php file
and set your stats.
 

Improve website parser

 
To improve website parser you need to specify common words for specific language. For example: to improve german websites parsing, create ~/root/website_review/vendors/Webmaster/TagCloud/CommonWords/de.php
and set the array of common words. See example how, in en.php file.



Webiste filter

Each webmaster wants to monetize website by adding ads. Of course Google is the best provider. But what will if user will add bad website (ex. I'm speaking about adult content), in this way Google can block displaying advertisment or even remove account. Of course you can monitor each review, but what if they will be thousands? There is a solution to prevent such thing. By default this feature is enabled

Open main config file (~/root/website_review/protected/main.php)
Find following line:

'checkForBadwords' => true,

and set it true to enable automatic site filter or false to disable.

You can manage which words should contains website to be banned. You can find them in ~/root/website_review/config/badwords folder.


Get review via url

By default user can get website's review only by submitting a form, but sometimes really need to get it via requesting url. Read below how to do this.

First of all, you need to allow user send requests to parse controller. To do this open:

~/root/website-review/config/main.php

and set instantRedir to true


...
// Allow instant redirect
'instantRedir'=>true,
...

Next, do a request via browser:
http://your-domain.com/parse?Website[domain]=php5developer.com&redirect=1
Where:
php5developer.com : the website which you need to analyse
redirect=1 : tell script that we need instant redirect




Social sharing

To include social sharing plugin into review page, you need to register at addthis.com.
Next go to "Dashboard" and choose your suitable plugin. Click on Get this code and copy js source into our local config file in ~root/website_review/config/main.php

'addthis'=>'your-js-code',



reCAPTCHA and PDF

This section is for users who has monthly bandwidth limit or hosted on shared hostings. The fact is that in addition to visitors, your website scanning a lot of bots. They generates a lot of traffic, by clicking on links. The one is "pdf generation" link which is generates PDF review. PDF generation is greedy operation and requires more process time, than HTML page generation. Also it's generates more traffic because PDF takes up more space. So, to reduce CPU usage and decrease traffic you need apply reCAPTCHA credentials. To do this go to official reCAPTCHA page and generate for your domain Site key and Secret key keys. Next open ~root/website_review/config/recaptcha.php file and fill out the config:

'public-key'=>'', // Insert your Site key here
'private-key'=>'', // Insert your Secret key here

That's all. Now user must enter valid CAPTCHA to download review in PDF format.

NOTE! If you think that it's bad practice, leave 'public-key' and 'private-key' empty in config file. In this case, anyone can instantly get review in PDF format without entering captcha.

By default the PageSpeed Insights results stored in a separate PDF file. This implemented in this way, because usually basic review + PageSpeed Insights takes about 50 pages. This is not a small amount of data and to generate PDF file containing all the reviews needs about 50-60 seconds (tested on my local PC with SSD). However if you are using this app for personal usage, you could include all reviews in one PDF file. To do this open main config file and set partialPdf to false:

'partialPdf'=>false,

Also I would like to recommend to set

memory_limit = 128M
in php.ini

Application options

Some common options you can change.

 

...
// Brand name. Your app name (Will not be translated)
'name'=>'Website Review',

// Websites count in "Rating" section
'webPerPage'=>6,
...

Cron jobs

This app has already built-in possibility to generate sitemap. Here is instruction how to do this.
To begin with, Command Line do not know the website's host information and etc. For this needs we have console config file.
Open: ~/root/website_review/config/console.php file and configure it.
 
...
// your website name: for example: http://your-domain.com
'hostInfo' => 'http://your-domain.com',

// if you installed script not in root directory, then you need to set baseUrl. For example : /website_review
'baseUrl' => '',
...
 
And set command (in my case it's):

0 0 * * * /usr/bin/php /path/to/web/root/website_review/yiic.php sitemap >/dev/null 2>&1
By default sitemap contains links in all languages. For example, if system has 3 languages (en, ru, de) and one reviewed domain (php5developer.com), then in sitemap will appear 3 links:
  • en/php5developer.com
  • ru/php5developer.com
  • de/php5developer.com
This will increase amount of indexed pages in search engines.

If you want links to be added to the sitemap only in the language set by default, then set up following command:
0 0 * * * /usr/bin/php /path/to/web/root/website_review/yiic.php sitemap old >/dev/null 2>&1

NOTE! Script already support multiple sitemap generation. Each sitemap has maximum of 50 000 URLs. If you want to change this number go to: ~/root/website_review/commands/SitemapCommand.php and set any number of $urlCount property.