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


PHP wpgrade::state方法代码示例

本文整理汇总了PHP中wpgrade::state方法的典型用法代码示例。如果您正苦于以下问题:PHP wpgrade::state方法的具体用法?PHP wpgrade::state怎么用?PHP wpgrade::state使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wpgrade的用法示例。


在下文中一共展示了wpgrade::state方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: state

 /**
  * The state consists of variables set by the system, and used to pass data
  * between different routines. eg. the update notifier
  * @return WPGradeMeta current system state
  */
 static function state()
 {
     if (self::$state === null) {
         self::$state = WPGradeMeta::instance(array());
     }
     return self::$state;
 }
开发者ID:pwzCypher,项目名称:wp-push,代码行数:12,代码来源:wpgrade.php

示例2: wpgrade_callback_update_notifier_update_notice

/**
 * Let the user know what is happening and if everything went well
 */
function wpgrade_callback_update_notifier_update_notice()
{
    if (wpgrade::option('themeforest_upgrade')) {
        $message_type = "updated";
        if (wpgrade::state()->has('theme_updated') && isset($_GET['wpgrade_update']) && $_GET['wpgrade_update'] == 'true') {
            if (wpgrade::state()->get('theme_updated')) {
                $message = 'The theme has been updated successfully';
                //in case we have backups activated
                //add a link to download the backup archive
                $backup_uri = wpgrade::state()->get('backup_uri', null);
                if (!empty($backup_uri)) {
                    $message .= '<br/><br/><i>' . __('If you want, you can download the automatic theme backup.', 'rosa_txtd') . ' <a href="' . $backup_uri . '" title="' . esc_attr(__('Download Backup', 'rosa_txtd')) . '">' . esc_attr(__('Download Backup', 'rosa_txtd')) . '</a></i>';
                }
            } else {
                // error while updating theme
                $message = '<b>' . __('Upgrade Process Failed', 'rosa_txtd') . '</b><br>' . __('The process has encountered the following errors:', wpgrade::textdoamin());
                $upgrader = wpgrade::state()->get('theme_upgrader', null);
                $message .= '<ul style="list-style-type: square; margin: 0; padding: 0 25px;">';
                if ($upgrader !== null) {
                    foreach ($upgrader->upgrade_errors() as $error) {
                        $message .= "<li>{$error}</li>";
                    }
                } else {
                    // failed to retrieve upgrade handler
                    $message .= '<li>' . __('Upgrade handler failed to initialize self-diagnostics. (please contact support)', 'rosa_txtd') . '</li>';
                }
                $message .= '</ul>';
                /*
                $message = 'An error occurred, the theme has not been updated. Please try again later or install the update manually.';
                $theme_update_error = wpgrade::state()->get('theme_update_error', array());
                
                if (isset($theme_update_error[1])) {
                	$message .= '<br/>(Error message: '.$theme_update_error[1].')';
                }
                */
                $message_type = "error";
            }
        } elseif (wpgrade::state()->get('curl_disabled', false)) {
            $message = 'Error: The theme was not updated, because the cURL extension is not enabled on your server. In order to update the theme automatically, the Envato Toolkit Library requires cURL to be enabled on your server. You can contact your hosting provider to enable this extension for you.';
            $message_type = "error";
        } elseif (wpgrade::state()->has('backup_failed') && wpgrade::state()->get('backup_failed') === true) {
            $message = '<b>' . __('Upgrade Backup Process Failed', 'rosa_txtd') . '</b><br>' . __('The backup process has encountered the following errors:', 'rosa_txtd');
            $upgrader = wpgrade::state()->get('theme_upgrader', null);
            $message .= '<ul style="list-style-type: square; margin: 0; padding: 0 25px;">';
            if ($upgrader !== null) {
                foreach ($upgrader->backup_errors() as $error) {
                    $message .= "<li>{$error}</li>";
                }
            } else {
                // failed to retrieve upgrade handler
                $message .= '<li>' . __('Upgrade handler failed to initialize self-diagnostics. (please contact support)', 'rosa_txtd') . '</li>';
            }
            $message .= '</ul>';
            // @todo in translation refactor :theme_options_url to use absolute url instead of relative
            // @todo update based on basecamp discussion
            $message .= '<i>' . strtr(__('You may bypass the backup system by turning off automatic backups in your <a href=":theme_options_url">utilities section of theme options</a>.', 'rosa_txtd'), array(':theme_options_url' => admin_url('admin.php?page=bucket_options&amp;tab=6'))) . '<br>' . __('Should you choose to disable automatic backups you are <b>strongly encouraged to perform a manual backup</b>.', 'rosa_txtd') . '<br>' . __('Skipping the backup process entirely will result, upon a failed upgrade attempt, in the loss of any modifications you have made to the theme.', 'rosa_txtd') . '</i>' . '<br><br><b>' . __('Tip', 'rosa_txtd') . '</b>: ' . __('Modifying a theme via a child theme is the best way to easily deal with theme upgrade issues.', 'rosa_txtd');
            $message_type = "error";
        }
        if (isset($message)) {
            echo '<div class="' . $message_type . '"><p>' . $message . '</p></div>';
        }
    }
}
开发者ID:pwzCypher,项目名称:wp-push,代码行数:66,代码来源:callbacks.php


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