當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WP_Upgrader_Skin::feedback方法代碼示例

本文整理匯總了PHP中WP_Upgrader_Skin::feedback方法的典型用法代碼示例。如果您正苦於以下問題:PHP WP_Upgrader_Skin::feedback方法的具體用法?PHP WP_Upgrader_Skin::feedback怎麽用?PHP WP_Upgrader_Skin::feedback使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WP_Upgrader_Skin的用法示例。


在下文中一共展示了WP_Upgrader_Skin::feedback方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: run

 /**
  * @param $options
  */
 public function run($options)
 {
     $defaults = array('package' => '', 'destination' => '', 'clear_destination' => false, 'abort_if_destination_exists' => true, 'clear_working' => true, 'is_multi' => false, 'hook_extra' => array());
     $options = wp_parse_args($options, $defaults);
     // Connect to the Filesystem first.
     $res = $this->fs_connect(array(WP_CONTENT_DIR, $options['destination']));
     // Mainly for non-connected filesystem.
     if (!$res) {
         /*if ( ! $options['is_multi'] ) {
               $this->skin->footer();
           }*/
         return false;
     }
     //Download the package (Note, This just returns the filename of the file if the package is a local file)
     if (file_exists($options['package'])) {
         $download = $options['package'];
     } else {
         $download = $this->download_package($options['package']);
     }
     if (is_wp_error($download)) {
         $this->skin->error($download);
         //$this->skin->after();
         return $download;
     }
     $delete_package = $download != $options['package'];
     // Do not delete a "local" file
     //Unzips the file into a temporary directory
     $working_dir = $this->unpack_package($download, $delete_package);
     if (is_wp_error($working_dir)) {
         $this->skin->error($working_dir);
         $this->skin->after();
         return $working_dir;
     }
     $options['source'] = $working_dir;
     $options['package_folder'] = basename($working_dir);
     //With the given options, this installs it to the destination directory.
     $result = $this->install_package(array('source' => $working_dir, 'destination' => $options['destination'], 'clear_destination' => $options['clear_destination'], 'abort_if_destination_exists' => $options['abort_if_destination_exists'], 'clear_working' => $options['clear_working'], 'hook_extra' => $options['hook_extra']));
     $this->skin->set_result($result);
     if (is_wp_error($result)) {
         $this->skin->error($result);
         $this->skin->feedback('process_failed');
     } else {
         //Install Succeeded
         $this->skin->feedback('process_success');
         //update packages xml file
         $result = $this->update_packages_wxr($options);
         if (is_wp_error($result)) {
             $this->skin->error($result);
             $this->skin->feedback('process_failed');
         } else {
             $this->skin->feedback('process_success');
         }
     }
     $this->update_packages_wxr($options);
     $this->skin->feedback('go_manage_page');
     $this->skin->after();
     return $result;
 }
開發者ID:hoangsoft90,項目名稱:hw-hoangweb-plugin,代碼行數:61,代碼來源:class-hw-upgrader.php

示例2: maintenance_mode

	/**
	 * Toggle maintenance mode for the site.
	 *
	 * Creates/deletes the maintenance file to enable/disable maintenance mode.
	 *
	 * @since 2.8.0
	 *
	 * @global WP_Filesystem_Base $wp_filesystem Subclass
	 *
	 * @param bool $enable True to enable maintenance mode, false to disable.
	 */
	public function maintenance_mode( $enable = false ) {
		global $wp_filesystem;
		$file = $wp_filesystem->abspath() . '.maintenance';
		if ( $enable ) {
			$this->skin->feedback('maintenance_start');
			// Create maintenance file to signal that we are upgrading
			$maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
			$wp_filesystem->delete($file);
			$wp_filesystem->put_contents($file, $maintenance_string, FS_CHMOD_FILE);
		} elseif ( ! $enable && $wp_filesystem->exists( $file ) ) {
			$this->skin->feedback('maintenance_end');
			$wp_filesystem->delete($file);
		}
	}
開發者ID:ShankarVellal,項目名稱:WordPress,代碼行數:25,代碼來源:class-wp-upgrader.php


注:本文中的WP_Upgrader_Skin::feedback方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。