>
ID, 'description', true); ?>
validateOnParse = true;
@$dom->loadHTML($response['body']);
$results = $dom->saveHTML($dom->getElementById($id));
if(!$results){
_e( "We could not fetch results at the moment. Please try again.", "als");
return;
}
echo $results ;
}
else {
_e( "We could not fetch results at the moment. Please try again.", "als");
}
}
/**
* Fills the searches log table with dummy data
*
* @since 1.0.0
*
* @return null
*/
function als_dummy_data(){
global $wpdb;
$data = file_get_contents('D:\Flash\voc.txt');
$table = $wpdb->prefix . 'als_log';
$queries = array('Brian','Pappito','Adele','Creative','Create','write','google','bot','crawl','java','javascript','themeforest','codecanyon','namecheap','hostgator','account','password','email','join','president','music','videos','images','photos','view','delete','random','number','generator','online');
$db_words = array();
for ($i = 0; $i<200; $i++) {
$first = mt_rand(0, count($queries)-1);
$second = mt_rand(0, count($queries)-1);
$word = $queries[$first] . ' ' . $queries[$second];
$word2 = $queries[$second] . ' ' . $queries[$first];
if(!in_array($word, $db_words))
$db_words[] = $word;
if(!in_array($word2, $db_words))
$db_words[] = $word2;
}
$tri_words = array();
for ($i = 0; $i<100; $i++) {
$first = mt_rand(0, count($queries)-1);
$second = mt_rand(0, count($queries)-1);
$third = mt_rand(0, count($queries)-1);
$word = array();
$word[] = $queries[$first] . ' ' . $queries[$second] . ' ' . $queries[$third];
$word[] = $queries[$second] . ' ' . $queries[$third] . ' ' . $queries[$first];
$word[] = $queries[$third] . ' ' . $queries[$first] . ' ' . $queries[$second];
$word[] = $queries[$first] . ' ' . $queries[$third] . ' ' . $queries[$second];
$word[] = $queries[$second] . ' ' . $queries[$first] . ' ' . $queries[$third];
$word[] = $queries[$third] . ' ' . $queries[$second] . ' ' . $queries[$first];
foreach($word as $w){
if(!in_array($w, $tri_words))
$tri_words[] = $w;
}
}
$words = array_merge($queries, $db_words, $tri_words);
$insert_data = array();
$dateinitial = strtotime('5 months ago');
$date_now = time();
foreach($words as $word){
$searches = mt_rand(1, 100);
$results = mt_rand(0, 100);
$time = mt_rand($dateinitial, $date_now);
$date = date('Y-m-d H:i:s', $time);
$value = $wpdb->prepare("(%s,%s, %d, %d, %s)",
$word, $word, $results, $searches, $date);
array_push($insert_data, $value);
}
if (function_exists('wp_suspend_cache_addition'))
wp_suspend_cache_addition(true);
if (!empty($insert_data)) {
$insert_data = implode(', ',$insert_data);
$query = "INSERT IGNORE INTO $table (query, modified, hits, searches, time)
VALUES $insert_data";
$wpdb->query($query);
}
if (function_exists('wp_suspend_cache_addition')) {
wp_suspend_cache_addition(false);
}
}