menu_title = __('Clearfy Settings', 'clearfy');
$this->page_menu_short_description = __('Useful tweaks', 'clearfy');
parent::__construct($plugin);
$this->plugin = $plugin;
}
/**
* Permalinks options.
*
* @return mixed[]
* @since 1.0.0
*/
public function getPageOptions()
{
$options = [];
$options[] = [
'type' => 'html',
'html' => '
'
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'disable_clearfy_extra_menu',
'title' => __('Disable menu in adminbar', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'red'],
'hint' => __('This setting allows you to disable the additional menu of the Clearfy plugin, in the admin bar. This menu is required to work with the Minify and Combine and Assets Manager components.', 'clearfy'),
'default' => false
];
$options[] = [
'type' => 'checkbox',
'way' => 'buttons',
'name' => 'complete_uninstall',
'title' => __('Complete Uninstall', 'clearfy'),
'layout' => ['hint-type' => 'icon', 'hint-icon-color' => 'grey'],
'hint' => __("When the plugin is deleted from the Plugins menu, also delete all plugin settings.", 'clearfy'),
'default' => false
];
$options[] = [
'type' => 'html',
'html' => ''
];
$options[] = [
'type' => 'html',
'html' => [$this, 'export']
];
$options[] = [
'type' => 'html',
'html' => ''
];
$options[] = [
'type' => 'html',
'html' => [$this, 'supports']
];
$formOptions = [];
$formOptions[] = [
'type' => 'form-group',
'items' => $options,
//'cssClass' => 'postbox'
];
return apply_filters('wbcr/clearfy/settings_form_options', $formOptions, $this);
}
public function export()
{
?>
-
-
support forum, include the debug report into the message body.', 'clearfy'), "https://forum.webcraftic.com"); ?>
"
. "" . "
" . " Config: " . "
" . " | php " . phpversion() . " " . php_sapi_name() . " / zend engine " . zend_version() . "
" . " | Server Timezone: " . date_default_timezone_get() . "
" . " Load: " . "
" . " | Memory: {$memory_avail} (avail) / {$memory_used}M (used) / {$memory_peak}M (peak)" . "
" . " | Time: {$run_time}s | {$pps} req/sec" . "
" . "Url: " . "
" . " |" . "
" . " | Agent: " . (@$_SERVER["HTTP_USER_AGENT"]) . "
" . "Version Control: " . "
" . " " . "
";
}
$debug .= "Plugins
";
$debug .= "=====================
";
$plugins = get_plugins();
require_once ABSPATH . '/wp-admin/includes/plugin.php';
foreach($plugins as $path => $plugin) {
if( is_plugin_active($path) ) {
$debug .= $plugin['Name'] . '
';
}
}
return $debug;
}
/**
* Generates a report about the system and plug-in error
*
* @return string
*/
public function gererateReportAction()
{
if( !(isset( $_GET[ '_wpnonce' ] ) && wp_verify_nonce( $_GET[ '_wpnonce' ], 'gererate_report' ))
|| !WCL_Plugin::app()->currentUserCan() ) {
wp_die(__('You do not have sufficient permissions to perform this action!', 'clearfy'));
}
require_once(WCL_PLUGIN_DIR . '/includes/classes/class.zip-archive.php');
$reposts_dir = WCL_PLUGIN_DIR . '/reports';
$reports_temp = $reposts_dir . '/temp';
if( !file_exists($reposts_dir) ) {
mkdir($reposts_dir, 0777, true);
}
if( !file_exists($reports_temp) ) {
mkdir($reports_temp, 0777, true);
}
$file = fopen($reports_temp . '/site-info.html', 'w+');
fputs($file, $this->getDebugReport());
fclose($file);
$download_file_name = 'webcraftic-clearfy-report-' . date('Y.m.d-H.i.s') . '.zip';
$download_file_path = WCL_PLUGIN_DIR . '/reports/' . $download_file_name;
Wbcr_ExtendedZip::zipTree(WCL_PLUGIN_DIR . '/reports/temp', $download_file_path, ZipArchive::CREATE);
array_map('unlink', glob(WCL_PLUGIN_DIR . "/reports/temp/*"));
wp_redirect(WCL_PLUGIN_URL . '/reports/' . $download_file_name);
exit;
}
}