WP_升级皮肤{}

WordPress升级程序类的通用外观。这种皮肤是为特定目的而设计的。

方法

姓名描述
WP_Upgrader_Skin::__construct建造师。
WP_Upgrader_Skin::添加字符串
WP_Upgrader_Skin::之后执行更新后的操作。
WP_Upgrader_Skin::之前在更新之前执行操作。
WP_Upgrader_Skin::bulk_footer
WP_Upgrader_Skin::bulk_header
WP_Upgrader_Skin::decrement_update_count输出调用函数以减少更新计数的JavaScript。
WP_Upgrader_Skin::错误
WP_Upgrader_Skin::反馈
WP_Upgrader_Skin::页脚
WP_Upgrader_Skin::页眉
WP_Upgrader_Skin::隐藏进程失败通过上载zip文件进行更新时隐藏“process_failed”错误消息。
WP_Upgrader_Skin::请求文件系统凭据向用户显示一个表单,以请求他们的FTP/SSH详细信息,以便连接到文件系统。
WP_Upgrader_Skin::集合结果设置升级结果。
WP_Upgrader_Skin::set_Upgrader

来源

类WP_Upgrader_Skin{/***保存升级程序数据。**@自2.8.0起**@var WP_升级*/公共$升级程序;/***标题是否完成。**@自2.8.0起**@var布尔*/public$done_header=false;/***页脚是否完成。**@自2.8.0起**@var布尔*/public$done_footer=false;/***保存升级结果。**@自2.8.0起**@var字符串|bool|WP_Error*/public$result=false;/***保留升级选项。**@自2.8.0起**@var数组*/public$options=array();/***建造师。**为WordPress Upgrader类设置通用外观。**@自2.8.0起**@param array$args可选。WordPress升级程序皮肤参数*覆盖默认选项。默认空数组。*/公共函数__construct($args=array()){$defaults=数组(“url”=>“”,“nonce”=>“”,“标题”=>“”,“context”=>false,);$this->options=wp_parse_args($args,$defaults);}/***@自2.8.0起**@param WP_Upgrader$升级程序*/公共函数set_upgrader(&$upgrader){if(is_object($upgrader)){$this->upgrader=&$upgrader;}$this->add_strings();}/***@自3.0.0起*/公共函数add_strings(){}/***设置升级结果。**@自2.8.0起**@param string|bool|WP_Error$result升级的结果。*/公共函数set_result($result){$this->result=$result;}/***向用户显示一个表单,以便按顺序请求其FTP/SSH详细信息*连接到文件系统。**@自2.8.0起*@自4.6.0起`$context`参数默认值从`false`更改为空字符串。**@请参阅request_filesystem_credentials()**@param bool|WP_Error$Error可选。当前请求是否连接失败,*或错误对象。默认为false。*@param string$context可选。测试目录的完整路径*因为它是可写的。默认为空。*@param bool$allow_relaxed_file_ownership可选。是否允许组/世界可写。默认为false。*@return bool成功为True,失败为false。*/公共函数request_filesystem_credentials($error=false,$context='',$allow_relaxed_file_ownership=false){$url=$this->选项[“url”];if(!$context){$context=$this->options['context'];}if(!空($this->options['nonce']){$url=wp_nonce_url($url,$this->options['nonce']);}$extra_fields=数组();返回request_filesystem_credentials($url,“”,$error,$context,$extra_fields,$allow_relaxed_file_ownership);}/***@自2.8.0起*/公共函数头(){if($this->done_header){回报;}$this->done_header=true;echo'<div class=“wrap”>';echo“<h1>”$此->选项[“标题”]。'</h1>';}/***@自2.8.0起*/公共函数页脚(){if($this->done_footer){回报;}$this->done_footer=true;echo“</div>”;}/***@自2.8.0起**@param string | WP_Error$errors错误。*/公共函数错误($errors){if(!$this->done_header){$this->header();}if(is_string($errors)){$this->反馈($errors);}elseif(is_wp_error($errors)&&$errors->has_errors()){foreach($errors->get_error_messages()作为$message){if($errors->get_error_data()&&is_string($error->get_error data())){$this->反馈($message.''.esc_html(strip_tags($errors->get_error_data()));}其他{$this->反馈($message);}}}}/***@自2.8.0起*@since 5.9.0将PHP 8命名参数支持的`$string`(PHP保留关键字)重命名为`$feedback`。**@param string$反馈消息数据。*@param混合$args可选文本替换。*/公共功能反馈($feedback,…$args){if(isset($this->upgrader->strings[$feedback]){$feedback=$this->upgrader->strings[$feeduck];}if(str_contains($feedback,“%”){if($args){$args=array_map('strip_tags',$args);$args=数组映射(“esc_html”,$args);$feedback=vsprintf($feeduck,$args);}}if(空($feedback)){回报;}显示消息($反馈);}/***在更新之前执行操作。**@自2.8.0起*/公共函数before(){}/***执行更新后的操作。**@自2.8.0起*/公共函数after(){}/***输出调用函数以减少更新计数的JavaScript。**@自3.9.0起**@param string$type要递减的更新计数类型。可能的值包括“plugin”,*“主题”、“翻译”等。*/受保护函数decrement_update_count($type){if(!$this->result|iswpeerror($this->result){回报;}if(已定义(“IFRAME_REQUEST”){echo'<script type=“text/javascript”>if(window.postMessage&&JSON){window.parent.post消息(JSON.stringify({操作:“decrementUpdateCount”,upgradeType:“'.$type.'”} ),window.location.protocol+“//”+windows.location.hostname+(“”!==window.location.port?“:”+window.llocation.port:“”));}</script>';}其他{echo'<script type=“text/javascript”>(函数(wp){if(wp&&wp.updates&&wp.updates.decrementCount){wp.updates.decrementCount(“'.$type.'”);}})(window.wp);</script>';}}/***@自3.0.0起*/公共函数bulk_header(){}/***@自3.0.0起*/公共函数bulk_footer(){}/***通过上载zip文件进行更新时隐藏“process_failed”错误消息。**@自5.5.0起**@param WP_Error$WP_Error WP_Error对象。*@return bool如果应该隐藏错误,则返回True,否则返回false。*/公共函数hide_process_failed($wp_error){返回false;}}

变更日志

版本描述
4.6.0已从wp-admin/includes/class-wp-upgrader-skins.php移至其自己的文件。
2.8.0介绍。

用户贡献的笔记

你必须登录在能够发表注释或反馈之前。