当前位置: 首页>>代码示例>>PHP>>正文


PHP wpgrade::coreview方法代码示例

本文整理汇总了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;
}
开发者ID:qhuit,项目名称:Tournesol,代码行数:34,代码来源:ajax.php


注:本文中的wpgrade::coreview方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。