当前位置: 首页>>代码示例>>PHP>>正文


PHP Theme_Upgrader::delete_old_theme方法代码示例

本文整理汇总了PHP中Theme_Upgrader::delete_old_theme方法的典型用法代码示例。如果您正苦于以下问题:PHP Theme_Upgrader::delete_old_theme方法的具体用法?PHP Theme_Upgrader::delete_old_theme怎么用?PHP Theme_Upgrader::delete_old_theme使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Theme_Upgrader的用法示例。


在下文中一共展示了Theme_Upgrader::delete_old_theme方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: explode

 function theme_action()
 {
     //Read form data
     $action = $_POST['action'];
     $theme = $_POST['theme'];
     if ('activate' === $action) {
         include_once ABSPATH . '/wp-admin/includes/theme.php';
         $theTheme = get_theme($theme);
         if (null !== $theTheme && '' !== $theTheme) {
             switch_theme($theTheme['Template'], $theTheme['Stylesheet']);
         }
     } else {
         if ('delete' === $action) {
             include_once ABSPATH . '/wp-admin/includes/theme.php';
             //            if (file_exists(ABSPATH . '/wp-admin/includes/deprecated.php')) include_once(ABSPATH . '/wp-admin/includes/deprecated.php');
             if (file_exists(ABSPATH . '/wp-admin/includes/screen.php')) {
                 include_once ABSPATH . '/wp-admin/includes/screen.php';
             }
             include_once ABSPATH . '/wp-admin/includes/file.php';
             include_once ABSPATH . '/wp-admin/includes/template.php';
             include_once ABSPATH . '/wp-admin/includes/misc.php';
             include_once ABSPATH . '/wp-admin/includes/class-wp-upgrader.php';
             include_once ABSPATH . '/wp-admin/includes/class-wp-filesystem-base.php';
             include_once ABSPATH . '/wp-admin/includes/class-wp-filesystem-direct.php';
             $wp_filesystem = $this->getWPFilesystem();
             if (empty($wp_filesystem)) {
                 $wp_filesystem = new WP_Filesystem_Direct(null);
             }
             $themeUpgrader = new Theme_Upgrader();
             $theme_name = wp_get_theme()->get('Name');
             $themes = explode('||', $theme);
             foreach ($themes as $idx => $themeToDelete) {
                 if ($themeToDelete !== $theme_name) {
                     $theTheme = get_theme($themeToDelete);
                     if (null !== $theTheme && '' !== $theTheme) {
                         $tmp['theme'] = $theTheme['Template'];
                         if (true === $themeUpgrader->delete_old_theme(null, null, null, $tmp)) {
                             $args = array('action' => 'delete', 'Name' => $theTheme['Name']);
                             do_action('mainwp_child_theme_action', $args);
                         }
                     }
                 }
             }
         } else {
             $information['status'] = 'FAIL';
         }
     }
     if (!isset($information['status'])) {
         $information['status'] = 'SUCCESS';
     }
     $information['sync'] = $this->getSiteStats(array(), false);
     MainWP_Helper::write($information);
 }
开发者ID:jexmex,项目名称:mainwp-child,代码行数:53,代码来源:class-mainwp-child.php


注:本文中的Theme_Upgrader::delete_old_theme方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。