Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hosting_reviews
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Ali Arshad
hosting_reviews
Commits
7198f028
Commit
7198f028
authored
Dec 26, 2019
by
Muhammad Usman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dynamic web 80%
parent
10b71909
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
97 additions
and
138 deletions
+97
-138
default-pages.php
.../wp-content/themes/hostingreviews/admin/default-pages.php
+11
-5
custom.css
...TA/wp-content/themes/hostingreviews/assets/css/custom.css
+26
-1
admin.js
WWW_DATA/wp-content/themes/hostingreviews/assets/js/admin.js
+1
-1
index.js
WWW_DATA/wp-content/themes/hostingreviews/assets/js/index.js
+0
-73
functions.php
WWW_DATA/wp-content/themes/hostingreviews/functions.php
+59
-58
summary.php
WWW_DATA/wp-content/themes/hostingreviews/summary.php
+0
-0
No files found.
WWW_DATA/wp-content/themes/hostingreviews/admin/default-pages.php
View file @
7198f028
...
@@ -9,10 +9,11 @@ define('RECENT_REVIEWS_PAGE', 'Recent Reviews');
...
@@ -9,10 +9,11 @@ define('RECENT_REVIEWS_PAGE', 'Recent Reviews');
define
(
'REVIEWS_PAGE'
,
'Reviews'
);
define
(
'REVIEWS_PAGE'
,
'Reviews'
);
define
(
'TOP_BLOG_PAGE'
,
'Top Blog Posts'
);
define
(
'TOP_BLOG_PAGE'
,
'Top Blog Posts'
);
define
(
'NEWSLETTER_PAGE'
,
'Newsletter Page'
);
define
(
'NEWSLETTER_PAGE'
,
'Newsletter Page'
);
define
(
'TOP_HOSTING'
,
'Top Hosting Lists'
);
define
(
'TOP_CACHE_PLUGINS'
,
'Recommended Cache Plugins'
);
define
(
'BLOG_PAGE'
,
'Blog'
);
define
(
'BLOG_PAGE'
,
'Blog'
);
$defaultPagesBanner
=
[
BANNER_PAGE
,
HOSTING_REVIEW_PAGE
,
ABOUT_US_PAGE
,
RECENT_REVIEWS_PAGE
,
TOP_BLOG_PAGE
,
NEWSLETTER_PAGE
,
BLOG_PAGE
];
$defaultPagesBanner
=
[
BANNER_PAGE
,
HOSTING_REVIEW_PAGE
,
ABOUT_US_PAGE
,
RECENT_REVIEWS_PAGE
,
TOP_BLOG_PAGE
,
NEWSLETTER_PAGE
,
BLOG_PAGE
,
TOP_HOSTING
,
TOP_CACHE_PLUGINS
];
for
(
$i
=
0
;
$i
<
count
(
$defaultPagesBanner
);
$i
++
)
{
for
(
$i
=
0
;
$i
<
count
(
$defaultPagesBanner
);
$i
++
)
{
$new_page_title
=
$defaultPagesBanner
[
$i
];
$new_page_title
=
$defaultPagesBanner
[
$i
];
$page_check
=
get_page_by_title
(
$new_page_title
);
$page_check
=
get_page_by_title
(
$new_page_title
);
...
@@ -35,9 +36,14 @@ function vq_set_default_data()
...
@@ -35,9 +36,14 @@ function vq_set_default_data()
$sql
=
"CREATE TABLE
$table_name
("
;
$sql
=
"CREATE TABLE
$table_name
("
;
$sql
.=
"id int(10) unsigned NOT NULL AUTO_INCREMENT,"
;
$sql
.=
"id int(10) unsigned NOT NULL AUTO_INCREMENT,"
;
$sql
.=
"domain_addr varchar(255) NOT NULL,"
;
$sql
.=
"server_location varchar(255) DEFAULT NULL,"
;
$sql
.=
"timestamp varchar(255) NOT NULL,"
;
$sql
.=
"batch_id varchar(255) DEFAULT NULL,"
;
$sql
.=
"video varchar(255) NOT NULL,"
;
$sql
.=
"server_name varchar(255) DEFAULT NULL,"
;
$sql
.=
"hosting_name varchar(255) DEFAULT NULL,"
;
$sql
.=
"domain_addr varchar(255) DEFAULT NULL,"
;
$sql
.=
"domain_ip varchar(255) DEFAULT NULL,"
;
$sql
.=
"timestamp varchar(255) DEFAULT NULL,"
;
$sql
.=
"video varchar(255) DEFAULT NULL,"
;
$sql
.=
"screen_shot varchar(255) DEFAULT NULL,"
;
$sql
.=
"screen_shot varchar(255) DEFAULT NULL,"
;
$sql
.=
"server_response_time varchar(255) DEFAULT NULL,"
;
$sql
.=
"server_response_time varchar(255) DEFAULT NULL,"
;
$sql
.=
"page_load_time varchar(255) DEFAULT NULL,"
;
$sql
.=
"page_load_time varchar(255) DEFAULT NULL,"
;
...
...
WWW_DATA/wp-content/themes/hostingreviews/assets/css/custom.css
View file @
7198f028
...
@@ -1519,7 +1519,7 @@ h5
...
@@ -1519,7 +1519,7 @@ h5
}
}
.cacheHeading
.cacheHeading
p
.cache-para
{
{
font-size
:
15px
!important
;
font-size
:
15px
!important
;
color
:
#6a6a6a
!important
;
color
:
#6a6a6a
!important
;
...
@@ -2953,3 +2953,28 @@ h2 span
...
@@ -2953,3 +2953,28 @@ h2 span
.loader
{
border
:
8px
solid
#f3f3f3
;
border-radius
:
50%
;
border-top
:
8px
solid
#f06e58
;
width
:
120px
;
height
:
120px
;
-webkit-animation
:
spin
1s
linear
infinite
;
/* Safari */
animation
:
spin
1s
linear
infinite
;
display
:
none
;
}
/* Safari */
@-webkit-keyframes
spin
{
0
%
{
-webkit-transform
:
rotate
(
0deg
);
}
100
%
{
-webkit-transform
:
rotate
(
360deg
);
}
}
@keyframes
spin
{
0
%
{
transform
:
rotate
(
0deg
);
}
100
%
{
transform
:
rotate
(
360deg
);
}
}
WWW_DATA/wp-content/themes/hostingreviews/assets/js/admin.js
View file @
7198f028
...
@@ -192,7 +192,7 @@ $(document).ready(function () {
...
@@ -192,7 +192,7 @@ $(document).ready(function () {
serverLocationsBody
.
innerHTML
+=
row
;
serverLocationsBody
.
innerHTML
+=
row
;
});
});
serverLocationsDataHidden
.
value
=
JSON
.
stringify
(
serverLocationsDetails
);
serverLocationsDataHidden
.
value
=
JSON
.
stringify
(
serverLocationsDetails
);
resetChanges
();
reset
ServerLocations
Changes
();
};
};
editServerLocation
=
function
(
index
)
{
editServerLocation
=
function
(
index
)
{
...
...
WWW_DATA/wp-content/themes/hostingreviews/assets/js/index.js
View file @
7198f028
// document.addEventListener("DOMContentLoaded", function() {
// });
jQuery
(
document
).
ready
(
function
(
$
)
{
var
speedBtn
=
document
.
getElementById
(
'homeSpeedButton'
);
if
(
speedBtn
)
{
speedBtn
.
addEventListener
(
'click'
,
getSpeed
);
}
function
getSpeed
()
{
const
domainNameEl
=
document
.
getElementById
(
'domainNameField'
);
if
(
!
domainNameEl
.
value
)
{
return
alert
(
'Please enter a domain'
);
}
var
data
=
{
'action'
:
'get_speed_results'
,
'domain'
:
domainNameEl
.
value
};
$
.
post
(
ajax_url
,
data
,
function
(
response
)
{
console
.
log
(
response
);
},
'json'
);
}
});
// $(document).ready(function () {
//
// (function ($) {
//
//
// {
// var data = {
// 'action': 'get_speed_results',
// 'post_type': 'POST',
// 'name': 'My First AJAX Request'
// };
//
// jQuery.post("", data, function(response) {
// console.log( response );
// }, 'json');
//
// //
// var xhttp = new XMLHttpRequest();
// xhttp.open("POST", ``, true);
// xhttp.send(JSON.stringify(data));
// // xhttp.onreadystatechange = function() {
// // console.log(this.responseText);
// // // if (this.readyState === 4 && this.status === 200) {
// // // document.getElementById("demo").innerHTML =
// // // this.responseText;
// // // }
// // };
// // // http://176.31.196.92:30001/google.com/2019-12-18T142721+0000/pages/google.com/data/screenshots/1.jpg
//
// // xhttp.setRequestHeader('Content-type', 'application/json');
//
// }
// })(jQuery);
WWW_DATA/wp-content/themes/hostingreviews/functions.php
View file @
7198f028
...
@@ -6,7 +6,7 @@ function vq_enqueue_theme_resources() {
...
@@ -6,7 +6,7 @@ function vq_enqueue_theme_resources() {
$assetsFolder
=
"
$templateUri
/assets"
;
$assetsFolder
=
"
$templateUri
/assets"
;
wp_enqueue_style
(
'vq_customStyle'
,
"
$assetsFolder
/css/custom.css"
,
array
(),
'1.0.0'
,
'all'
);
wp_enqueue_style
(
'vq_customStyle'
,
"
$assetsFolder
/css/custom.css"
,
array
(),
'1.0.0'
,
'all'
);
wp_enqueue_script
(
'vq_jquery'
,
"https://code.jquery.com/jquery-3.3.1.min.js"
,
array
(),
'1.0.0'
);
wp_enqueue_script
(
'vq_jquery'
,
"https://code.jquery.com/jquery-3.3.1.min.js"
,
array
(),
'1.0.0'
);
wp_enqueue_script
(
'vq_indexJs'
,
"
$assetsFolder
/js/index.js"
,
array
(
'vq_jquery'
),
'1.0.0'
);
wp_enqueue_script
(
'vq_indexJs'
,
"
$assetsFolder
/js/index.js"
,
array
(
'vq_jquery'
),
'1.0.0'
);
}
}
function
vq_enqueue_custom_admin_style
()
{
function
vq_enqueue_custom_admin_style
()
{
...
@@ -152,67 +152,37 @@ function vq_theme_customize_register( $wp_customize ) {
...
@@ -152,67 +152,37 @@ function vq_theme_customize_register( $wp_customize ) {
}
}
add_action
(
'customize_register'
,
'vq_theme_customize_register'
);
//
//function subscribe_hosting_shortcode() {
// ob_start();
// get_template_part('hosting');
// return ob_get_clean();
//}
//add_shortcode('subscribe-to-hosting', 'subscribe_hosting_shortcode');
//
//add_action('init', 'do_output_buffer');
//function do_output_buffer() {
// ob_start();
//}
//
//
//
//
//$paged = ($_GET['paged'])? $_GET['paged'] : 1;
//$args = array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 14, 'paged' => $paged);
//query_posts($args);
//
//function my_post_queries( $query ) {
// // do not alter the query on wp-admin pages and only alter it if it's the main query
// if (!is_admin() && $query->is_main_query()){
//
// // alter the query for the home and category pages
//
// if(is_home()){
// $query->set('posts_per_page', 14);
// }
//
// if(is_category()){
// $query->set('posts_per_page', 3);
// }
//
// }
//}
//add_action( 'pre_get_posts', 'my_post_queries' );
// Include Admin
// Include Admin
$templateDirectory
=
get_template_directory
();
$templateDirectory
=
get_template_directory
();
require_once
(
"
$templateDirectory
/admin/functions.php"
);
require_once
(
"
$templateDirectory
/admin/functions.php"
);
// Actions
add_action
(
'wp_enqueue_scripts'
,
'vq_enqueue_theme_resources'
);
add_action
(
'init'
,
'vq_register_theme_supports'
);
function
generateRandomString
(
$length
=
10
)
{
add_action
(
'init'
,
'vq_add_theme_default_pages'
);
$characters
=
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
;
add_action
(
'wp_ajax_nopriv_get_speed_results'
,
'vq_get_hosting_speed'
);
$charactersLength
=
strlen
(
$characters
);
add_action
(
'wp_ajax_get_speed_results'
,
'vq_get_hosting_speed'
);
$randomString
=
''
;
add_action
(
'admin_enqueue_scripts'
,
'vq_enqueue_custom_admin_style'
);
for
(
$i
=
0
;
$i
<
$length
;
$i
++
)
{
$randomString
.=
$characters
[
rand
(
0
,
$charactersLength
-
1
)];
}
return
$randomString
;
}
function
vq_get_hosting_speed
()
{
function
vq_get_hosting_speed
()
{
$url
=
"http://176.31.196.92:30001"
;
try
{
$servers
=
json_decode
(
get_option
(
'vq_hosting_server_locations'
));
if
(
!
isset
(
$servers
)
||
count
(
$servers
)
===
0
)
{
print_r
([
'error'
=>
'No servers found.'
]);
}
$requestBatch
=
generateRandomString
(
10
);
$allResults
=
[];
for
(
$i
=
0
;
$i
<
count
(
$servers
);
$i
++
)
{
$domain
=
$_POST
[
'domain'
];
$domain
=
$_POST
[
'domain'
];
$curl
=
curl_init
();
$curl
=
curl_init
();
curl_setopt
(
$curl
,
CURLOPT_URL
,
$url
);
curl_setopt
(
$curl
,
CURLOPT_URL
,
$servers
[
$i
]
->
domain
);
curl_setopt
(
$curl
,
CURLOPT_POST
,
1
);
curl_setopt
(
$curl
,
CURLOPT_POST
,
1
);
curl_setopt
(
$curl
,
CURLOPT_POSTFIELDS
,
json_encode
(
[
'url'
=>
$domain
]
)
);
curl_setopt
(
$curl
,
CURLOPT_POSTFIELDS
,
json_encode
(
[
'url'
=>
$domain
]
)
);
curl_setopt
(
$curl
,
CURLOPT_RETURNTRANSFER
,
true
);
curl_setopt
(
$curl
,
CURLOPT_RETURNTRANSFER
,
true
);
...
@@ -229,7 +199,7 @@ function vq_get_hosting_speed() {
...
@@ -229,7 +199,7 @@ function vq_get_hosting_speed() {
$data
=
$result
[
'data'
][
'data'
];
$data
=
$result
[
'data'
][
'data'
];
$pageTimings
=
$data
[
'browserScripts'
][
0
][
'timings'
][
'pageTimings'
];
$pageTimings
=
$data
[
'browserScripts'
][
0
][
'timings'
][
'pageTimings'
];
$timestamp
=
$data
[
'info'
][
'timestamp
'
];
$timestamp
=
$result
[
'data'
][
'dir
'
];
$videoPath
=
$data
[
'files'
][
'video'
][
0
];
$videoPath
=
$data
[
'files'
][
'video'
][
0
];
$screenshotPath
=
$data
[
'files'
][
'screenshot'
][
0
];
$screenshotPath
=
$data
[
'files'
][
'screenshot'
][
0
];
...
@@ -237,21 +207,52 @@ function vq_get_hosting_speed() {
...
@@ -237,21 +207,52 @@ function vq_get_hosting_speed() {
$pageLoadTime
=
$pageTimings
[
'pageLoadTime'
];
$pageLoadTime
=
$pageTimings
[
'pageLoadTime'
];
$newData
=
[
$newData
=
[
"server_location"
=>
$servers
[
$i
]
->
location
,
"server_name"
=>
$servers
[
$i
]
->
domain
,
"hosting_name"
=>
'-'
,
"domain_addr"
=>
$domain
,
"domain_addr"
=>
$domain
,
"timestamp"
=>
$timestamp
,
"timestamp"
=>
$timestamp
,
"video"
=>
$videoPath
,
"video"
=>
$videoPath
,
"screen_shot"
=>
$screenshotPath
,
"screen_shot"
=>
$screenshotPath
,
"server_response_time"
=>
$serverResponseTime
,
"server_response_time"
=>
$serverResponseTime
,
"page_load_time"
=>
$pageLoadTime
"page_load_time"
=>
$pageLoadTime
,
"batch_id"
=>
$requestBatch
];
];
$newData
[
'domain_ip'
]
=
gethostbyname
(
$domain
);
global
$wpdb
;
global
$wpdb
;
$speed_table_name
=
$wpdb
->
prefix
.
"speed_results"
;
$speed_table_name
=
$wpdb
->
prefix
.
"speed_results"
;
$wpdb
->
insert
(
$speed_table_name
,
$newData
);
$wpdb
->
insert
(
$speed_table_name
,
$newData
);
print_r
(
$wpdb
->
insert_id
);
exit
;
// $cmd = "whois {$newData['ip']}";
// echo shell_exec('whois 64.233.160.0');
$newData
[
'id'
]
=
$wpdb
->
insert_id
;
$newData
[
'imgPath'
]
=
"
{
$servers
[
$i
]
->
domain
}
/
{
$domain
}
/
$timestamp
/
$screenshotPath
"
;
$newData
[
'videoPath'
]
=
"
{
$servers
[
$i
]
->
domain
}
/
{
$domain
}
/
$timestamp
/
$videoPath
"
;
array_push
(
$allResults
,
$newData
);
}
else
{
print_r
([
'error'
=>
'Could not retrieve data from all servers.'
]);
}
}
echo
json_encode
(
$result
);
}
echo
json_encode
(
$allResults
);
exit
;
exit
;
}
catch
(
Exception
$exception
)
{
print_r
([
'error'
=>
'Something went wrong in the server'
]);
}
}
}
// Actions
add_action
(
'customize_register'
,
'vq_theme_customize_register'
);
add_action
(
'wp_enqueue_scripts'
,
'vq_enqueue_theme_resources'
);
add_action
(
'init'
,
'vq_register_theme_supports'
);
add_action
(
'init'
,
'vq_add_theme_default_pages'
);
add_action
(
'wp_ajax_nopriv_get_speed_results'
,
'vq_get_hosting_speed'
);
add_action
(
'wp_ajax_get_speed_results'
,
'vq_get_hosting_speed'
);
add_action
(
'admin_enqueue_scripts'
,
'vq_enqueue_custom_admin_style'
);
WWW_DATA/wp-content/themes/hostingreviews/summary.php
View file @
7198f028
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment