Bulk_Upgrader_Skin{}

WordPress升级的通用批量升级程序皮肤。

描述

另请参见

方法

姓名描述
Bulk_Upgrader_Skin::__construct——
Bulk_Upgrader_Skin::add_strings(Bulk_升级者皮肤::添加字符串)——
Bulk_Upgrader_Skin::之后——
Bulk_Upgrader_Skin::之前——
Bulk_Upgrader_Skin::Bulk_footer——
Bulk_Upgrader_Skin::Bulk_header——
Bulk_Upgrader_Skin::错误——
Bulk_Upgrader_Skin::反馈——
Bulk_Upgrader_Skin::flush_output——
Bulk_Upgrader_Skin::页脚——
Bulk_Upgrader_Skin::页眉——
Bulk_Upgrader_Skin::重置——

来源

类Bulk_Upgrader_Skin扩展了WP_Upgrader_Skin{公共$in_loop=false;/***@var字符串| false*/public$error=false;/***@param数组$args*/公共函数__construct($args=array()){$defaults=数组(“url”=>“”,'nonce'=>'',);$args=wp_parse_args($args,$defaults);父级::__construct($args);}/***/公共函数add_strings(){$this->upgrader->strings['skin_upgrade_start']=__('更新过程正在启动。此过程在某些主机上可能需要一些时间,因此请耐心等待。');/*翻译人员:1:更新的标题,2:错误消息*/$this->upgrader->strings['skin_update_failed_error']=__('更新%1$s时出错:%2$s');/*转换器:%s:更新的标题*/$this->upgrader->strings['skin_update_failed']=__('更新%s失败。');/*转换器:%s:更新的标题*/$this->upgrader->strings['skin_update_successful']=__(“%s更新成功。”);$this->upgrader->strings['skin_upgrade_end']=__('所有更新都已完成。');}/***@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)){回报;}if($this->in_loop){echo“$feedback<br/>\n”;}其他{echo“<p>$反馈</p>\n”;}}/***/公共函数头(){//什么都没有。这将显示在iframe中。}/***/公共函数页脚(){//什么都没有。这将显示在iframe中。}/***@since 5.9.0将PHP 8命名参数支持的“$error”重命名为“$errors”。**@param string | WP_Error$errors错误。*/公共函数错误($errors){if(isstring($errors)&&isset($this->upgrader->strings[$errors]){$this->error=$this->upgrader->string[$errors];}if(iswp_error($errors)){$messages=数组();foreach($errors->get_error_messages()作为$emessage){if($errors->get_error_data()&&is_string($error->get_error data())){$messages[]=$e消息。''。esc_html(strip_tags($errors->get_error_data()));}其他{$messages[]=$emessage;}}$this->error=内爆(',',$messages);}echo'jQuery('.waiting-'.esc_js($this->upgrader->update_current).'\')。隐藏()</脚本>';}/***/公共函数bulk_header(){$this->反馈(“skin_upgrade_start”);}/***/公共函数bulk_footer(){$this->反馈(“skin_upgrade_end”);}/***@param string$title*/之前的公共函数($title=''){$this->in_loop=true;printf(''<h2>'.$this->upgrader->strings['skin_before_update_header'].'<span class=“spinner waiting-'.$his->upgrader->update_current.'”></span></h2>',$title,$this->upgrader->update_courrent,$this->upgrader->update-count);echo'jQuery('.waiting-'.esc_js($this->upgrader->update_current).'\')。css(“显示”、“内联块”)</脚本>';//单击“更多详细信息”时,此进度消息div将通过JavaScript移动。echo'<div class=“update-messages hide-if-js”id=“progress-'.esc_attr($this->upgrader->update_current).'“><p>';$this->flush_output();}/***@param string$title*/($title='')之后的公共函数{echo“</p></div>”;if($this->错误||!$this->result){if($this->错误){$after_error_message=sprintf($this->upgrader->strings[“skin_update_failed_error”],$title,“<strong>”。$this->错误。“</strong>”);}其他{$after_error_message=sprintf($this->upgrader->strings['skin_update_failed'],$title);}wp_admin_notice(管理员通知)($after_error_message后,阵列(“additional_classes”=>数组(“error”),));echo'jQuery('#progress-'.esc_js($this->upgrader->update_current).'\')。show()</脚本>';}if($this->result&&!iswpeerror($this->result)){if(!$this->错误){echo'<div class=“updated js-update-details”data-update-details=“progress-'.esc_attr($this->upgrader->update_current).'“>'。“<p>”。sprintf($this->upgrader->strings['skin_update_success'],$title)。'<button type=“button”class=“hide-if-no-js button-link js-update-details-toggle”aria-expanded=“false”>'__('更多详细信息')。'<span class=“dashicons dashicons-arrowdown”aria-hidden=“true”></span></button>'。“</p></div>”;}echo'jQuery('.waiting-'.esc_js($this->upgrader->update_current).'\')。隐藏()</脚本>';}$this->reset();$this->flush_output();}/***/公共函数reset(){$this->in_loop=假;$this->error=false;}/***/公共函数flush_output(){wp_ob_end_flush_all();flush();}}

变更日志

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

用户贡献的笔记

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