| ');
$s = preg_replace('/ | ]*>([^<]+)<\/th>/', '\1', $s);
$s = preg_replace('/ | ]*>([^<]+)<\/td>/', '\1', $s);
$t = preg_split('/(]*>[^<]+<\/h2>)/', $s, -1, PREG_SPLIT_DELIM_CAPTURE);
$r = array(); $count = count($t);
$p1 = '([^<]+)<\/info>';
$p2 = '/'.$p1.'\s*'.$p1.'\s*'.$p1.'/';
$p3 = '/'.$p1.'\s*'.$p1.'/';
for ($i = 1; $i < $count; $i++) {
if (preg_match('/]*>([^<]+)<\/h2>/', $t[$i], $matchs)) {
$name = trim($matchs[1]);
$vals = explode("\n", $t[$i + 1]);
foreach ($vals AS $val) {
if (preg_match($p2, $val, $matchs)) { // 3cols
$r[$name][trim($matchs[1])] = array(trim($matchs[2]), trim($matchs[3]));
} elseif (preg_match($p3, $val, $matchs)) { // 2cols
$r[$name][trim($matchs[1])] = trim($matchs[2]);
}
}
}
}
return $r;
}
public function isMinimumVersion($version)
{
return version_compare(get_bloginfo('version'), $version) >= 0;
}
private function getThemeData()
{
$themeData =null;
if ($this->isMinimumVersion('3.4')) {
$themeData = wp_get_theme();
} else {
$themeData = get_theme_data(get_stylesheet());
}
return $themeData;
}
private function getPlugins() {
$array = get_plugins();
return $array;
}
private function get_wpinfo() {
$context = array(
'plugin_name' => __('Affiliate Toolkit', ATKP_PLUGIN_PREFIX),
'plugin_version' => ATKPSettings::plugin_get_version(),
'OS' => PHP_OS,
'uname' => php_uname(),
'wp_version' => get_bloginfo('version'),
'wp_charset' => get_bloginfo('charset'),
'wp_count_users' => count_users()['total_users'],
'wp_debug' => WP_DEBUG == true ? 'true' : 'false',
'wp_debug_log' => WP_DEBUG_LOG == true ? 'true' : 'false',
'wp_debug_display' => WP_DEBUG_DISPLAY == true ? 'true' : 'false',
'plugins' => $this->getPlugins(),
'theme' => $this->getThemeData(),
'php_version' => phpversion(),
'php_memory_limit' => ini_get('memory_limit'),
'php_include_path' => get_include_path(),
'php_open_basedir' => ini_get('open_basedir'),
'php_ipv6' => defined('AF_INET6') ? "PHP was compiled without --disable-ipv6 option" : "PHP was compiled with --disable-ipv6 option",
'mysql_version' => !empty($mysql_server_info) ? $mysql_server_info : '',
'mysql_client' => !empty($mysql_client_info) ? $mysql_client_info : '',
'server_software' => $_SERVER['SERVER_SOFTWARE'],
);
if (function_exists('mysql_get_server_info')) {
$mysql_server_info = @mysql_get_server_info();
} else {
$mysql_server_info = '';
}
if (function_exists('mysql_get_client_info')) {
$mysql_client_info = @mysql_get_client_info();
} else {
$mysql_client_info = '';
}
$context['mysql_version'] = !empty($mysql_server_info) ? $mysql_server_info : '';
$context['mysql_client'] = !empty($mysql_client_info) ? $mysql_client_info : '';
$context['server_software'] = $_SERVER['SERVER_SOFTWARE'];
if (function_exists('apache_get_version')) {
$context['apache_version'] = apache_get_version();
}
if (function_exists('apache_get_modules')) {
$context['apache_modules'] = apache_get_modules();
}
return print_r($context, true);
}
private function get_logfile() {
if(file_exists(ATKP_PLUGIN_DIR.'/log/log.txt'))
return file_get_contents(ATKP_PLUGIN_DIR.'/log/log.txt');
else
return 'file not found';
}
}
?> |