当前位置: 首页>>代码示例>>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;未经允许,请勿转载。