本文整理汇总了PHP中wpgrade::coreview方法的典型用法代码示例。如果您正苦于以下问题:PHP wpgrade::coreview方法的具体用法?PHP wpgrade::coreview怎么用?PHP wpgrade::coreview使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wpgrade
的用法示例。
在下文中一共展示了wpgrade::coreview方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wpgrade_ajax_upgradestep_install_package
function wpgrade_ajax_upgradestep_install_package()
{
if (function_exists('set_time_limit')) {
set_time_limit(300);
}
// 5min time limit
// @todo replace hardcoded path with tempfile
$uploads = wp_upload_dir();
$download_file = $uploads['path'] . '/wpgrade-' . wpgrade::shortname() . '-theme.tmp';
// Default Data Structure
// ----------------------
$response = array('status' => 'success', 'data' => array('state' => 'error', 'info' => null, 'html' => wpgrade::coreview('upgrader/unknown-ajax-error' . EXT)));
// Process Install
// ---------------
$theme_data = wp_get_theme();
$theme_name = $theme_data->template;
$upgrader = new WPGradeAjaxUpgrader();
// load error pages into memory; if something goes wrong the files
// might not even exist anymore
$internal_error_view = wpgrade::coreview('upgrader/internal-install-error' . EXT);
$error_while_installing = wpgrade::coreview('upgrader/error-while-installing-theme' . EXT);
try {
if ($upgrader->install($theme_name, $download_file)) {
$response['data'] = array('state' => 'success', 'html' => null);
} else {
// failed to backup file
$response['data'] = array('state' => 'error', 'html' => strtr($error_while_installing, array(':error_list' => '<li>' . implode('</li><li>', $upgrader->errors()) . '</li>')));
}
} catch (Exception $e) {
$response['data'] = array('state' => 'error', 'html' => $internal_error_view);
}
echo json_encode($response);
die;
}