當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。