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


PHP MainWP_Utility::startsWith方法代码示例

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


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

示例1: admin_init

 function admin_init()
 {
     if (!MainWP_Utility::isAdmin()) {
         return;
     }
     if (get_option('mainwp_activated') == 'yes') {
         delete_option('mainwp_activated');
         wp_redirect(admin_url('admin.php?page=managesites&do=new'));
         return;
     }
     global $mainwpUseExternalPrimaryBackupsMethod;
     if ($mainwpUseExternalPrimaryBackupsMethod === null) {
         $mainwpUseExternalPrimaryBackupsMethod = apply_filters('mainwp-getprimarybackup-activated', '');
     }
     add_action('admin_notices', array($this, 'mainwp_warning_notice'));
     $this->posthandler->init();
     wp_enqueue_script('jquery-ui-tooltip');
     wp_enqueue_script('jquery-ui-autocomplete');
     wp_enqueue_script('jquery-ui-progressbar');
     wp_enqueue_script('jquery-ui-datepicker');
     wp_enqueue_script('jquery-ui-dialog');
     global $wp_scripts;
     $ui = $wp_scripts->query('jquery-ui-core');
     $version = $ui->ver;
     if (MainWP_Utility::startsWith($version, '1.10')) {
         wp_enqueue_style('jquery-ui-style', MAINWP_PLUGIN_URL . 'css/1.10.4/jquery-ui.min.css', array(), '1.10.4');
     } else {
         wp_enqueue_style('jquery-ui-style', MAINWP_PLUGIN_URL . 'css/1.11.1/jquery-ui.min.css', array(), '1.11.1');
     }
     wp_enqueue_script('mainwp', MAINWP_PLUGIN_URL . 'js/mainwp.js', array('jquery-ui-tooltip', 'jquery-ui-autocomplete', 'jquery-ui-progressbar', 'jquery-ui-dialog', 'jquery-ui-datepicker'), $this->current_version);
     $mainwpParams = array('image_url' => MAINWP_PLUGIN_URL . 'images/', 'backup_before_upgrade' => get_option('mainwp_backup_before_upgrade') == 1, 'admin_url' => admin_url(), 'date_format' => get_option('date_format'), 'time_format' => get_option('time_format'), 'enabledTwit' => MainWP_Twitter::enabledTwitterMessages(), 'maxSecondsTwit' => MAINWP_TWITTER_MAX_SECONDS);
     wp_localize_script('mainwp', 'mainwpParams', $mainwpParams);
     wp_enqueue_script('mainwp-tristate', MAINWP_PLUGIN_URL . 'js/tristate.min.js', array('mainwp'), $this->current_version);
     $mainwpTranslations = MainWP_System_View::getMainWPTranslations();
     wp_localize_script('mainwp', 'mainwpTranslations', $mainwpTranslations);
     $security_nonces = $this->posthandler->getSecurityNonces();
     wp_localize_script('mainwp', 'security_nonces', $security_nonces);
     MainWP_Meta_Boxes::initMetaBoxes();
     wp_enqueue_script('thickbox');
     wp_enqueue_script('user-profile');
     wp_enqueue_style('thickbox');
     if (isset($_GET['page']) && ($_GET['page'] == 'PluginsManage' || $_GET['page'] == 'ThemesManage')) {
         wp_enqueue_script('mainwp-fixedtable', MAINWP_PLUGIN_URL . 'js/tableHeadFixer.js', array('jquery', 'jquery-ui-core'), $this->current_version);
     }
     if (!current_user_can('update_core')) {
         remove_action('admin_notices', 'update_nag', 3);
     }
 }
开发者ID:reeslo,项目名称:mainwp,代码行数:48,代码来源:class-mainwp-system.php

示例2: addExcludedBackups

 private static function addExcludedBackups(&$files, &$arr)
 {
     $newExcludes = array();
     //Backup buddy
     $newExcludes[] = 'wp-content/uploads/backupbuddy_backups';
     $newExcludes[] = 'wp-content/uploads/backupbuddy_temp';
     $newExcludes[] = 'wp-content/uploads/pb_backupbuddy';
     //ManageWP
     $newExcludes[] = 'wp-content/managewp';
     //InfiniteWP
     $newExcludes[] = 'wp-content/infinitewp';
     //WordPress Backup to Dropbox
     $newExcludes[] = 'wp-content/backups';
     //BackWPUp
     $newExcludes[] = 'wp-content/uploads/backwpup*';
     //WP Complete Backup
     $newExcludes[] = 'wp-content/plugins/wp-complete-backup/storage';
     //Online Backup for WordPress
     $newExcludes[] = 'wp-content/backups';
     //XCloner
     $newExcludes[] = 'administrator/backups';
     foreach ($newExcludes as $newExclude) {
         $path = explode('/', $newExclude);
         $found = true;
         $newExcludeSuffix = null;
         $currentArr = null;
         foreach ($path as $pathPart) {
             if ($currentArr == null) {
                 if (isset($files[$pathPart])) {
                     $currentArr = $files[$pathPart];
                 }
             } else {
                 if (isset($currentArr[$pathPart])) {
                     $currentArr = $currentArr[$pathPart];
                 } else {
                     if (MainWP_Utility::endsWith($pathPart, '*')) {
                         foreach ($currentArr as $key => $val) {
                             if (MainWP_Utility::startsWith($key, substr($pathPart, 0, strlen($pathPart) - 1))) {
                                 if ($newExcludeSuffix == null) {
                                     $newExcludeSuffix = array();
                                 }
                                 $newExcludeSuffix[] = $key;
                             }
                         }
                         if ($newExcludeSuffix != null && count($newExcludeSuffix) > 0) {
                             break;
                         }
                     }
                     $currentArr = null;
                 }
             }
             if (!is_array($currentArr)) {
                 $found = false;
                 break;
             }
         }
         if ($found) {
             if ($newExcludeSuffix != null) {
                 $newExclude = substr($newExclude, 0, strrpos($newExclude, '/') + 1);
                 foreach ($newExcludeSuffix as $newExcludeSuff) {
                     $arr[] = $newExclude . $newExcludeSuff;
                 }
             } else {
                 $arr[] = $newExclude;
             }
         }
     }
 }
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:68,代码来源:page-mainwp-manage-backups.php

示例3: renderAllSites

    public static function renderAllSites(&$website, $updated, $groups, $statusses, $pluginDir)
    {
        if (!mainwp_current_user_can('dashboard', 'edit_sites')) {
            mainwp_do_not_have_permissions(__('edit sites', 'mainwp'));
            return;
        }
        $remote_destinations = apply_filters('mainwp_backups_remote_get_destinations', null, array('website' => $website->id));
        $hasRemoteDestinations = $remote_destinations == null ? $remote_destinations : count($remote_destinations);
        ?>
        <div class="error below-h2" style="display: none;" id="ajax-error-zone"></div>
        <div id="ajax-information-zone" class="updated" style="display: none;"></div>
        <?php 
        if ($updated) {
            ?>
            <div id="mainwp_managesites_edit_message" class="updated"><p><?php 
            _e('Website updated.', 'mainwp');
            ?>
</p></div>
            <?php 
        }
        ?>
        <form method="POST" action="" id="mainwp-edit-single-site-form" enctype="multipart/form-data">
            <div class="postbox">
            <h3 class="mainwp_box_title"><i class="fa fa-cog"></i> <?php 
        _e('General Options', 'mainwp');
        ?>
</h3>
            <div class="inside">
            <table class="form-table">
                <tbody>
                <tr>
                    <th scope="row"><?php 
        _e('Site Name', 'mainwp');
        ?>
</th>
                    <td><input type="text" name="mainwp_managesites_edit_sitename"
                               value="<?php 
        echo stripslashes($website->name);
        ?>
" class="regular-text"/></td>
                </tr>
                <tr>
                    <th scope="row"><?php 
        _e('Site URL', 'mainwp');
        ?>
</th>
                    <td><select id="mainwp_managesites_edit_siteurl_protocol" name="mainwp_managesites_edit_siteurl_protocol"><option <?php 
        echo MainWP_Utility::startsWith($website->url, 'http:') ? 'selected' : '';
        ?>
 value="http">http://</option><option <?php 
        echo MainWP_Utility::startsWith($website->url, 'https:') ? 'selected' : '';
        ?>
 value="https">https://</option></select> <input type="text" id="mainwp_managesites_edit_siteurl" disabled="disabled"
                               value="<?php 
        echo MainWP_Utility::removeHttpPrefix($website->url, true);
        ?>
" class="regular-text" /> <span
                            class="mainwp-form_hint-display"><?php 
        _e('Site URL cannot be changed.', 'mainwp');
        ?>
</span></td>
                </tr>
                <tr>
                    <th scope="row"><?php 
        _e('Administrator Username', 'mainwp');
        ?>
</th>
                    <td><input type="text" name="mainwp_managesites_edit_siteadmin"
                               id="mainwp_managesites_edit_siteadmin"
                               value="<?php 
        echo $website->adminname;
        ?>
"
                               class="regular-text"/></td>
                </tr>
                <tr>
                    <th scope="row"><?php 
        _e('Groups', 'mainwp');
        ?>
</th>
                    <td>
                        <input type="text" name="mainwp_managesites_edit_addgroups"
                               id="mainwp_managesites_edit_addgroups" value=""
                               class="regular-text"/> <span
                            class="mainwp-form_hint"><?php 
        _e('Separate groups by commas (e.g. Group 1, Group 2).', 'mainwp');
        ?>
</span>

                        <div id="selected_groups" style="display: block; width: 25em">
                            <?php 
        if (count($groups) == 0) {
            echo 'No groups added yet.';
        }
        $groupsSite = MainWP_DB::Instance()->getGroupsByWebsiteId($website->id);
        foreach ($groups as $group) {
            echo '<div class="mainwp_selected_groups_item"><input type="checkbox" name="selected_groups[]" value="' . $group->id . '" ' . (isset($groupsSite[$group->id]) && $groupsSite[$group->id] ? 'checked' : '') . ' />&nbsp' . stripslashes($group->name) . '</div>';
        }
        ?>
                        </div>
//.........这里部分代码省略.........
开发者ID:senlin,项目名称:mainwp,代码行数:101,代码来源:view-mainwp-manage-sites-view.php

示例4: renderBulkUpload

    public static function renderBulkUpload()
    {
        ?>
            <div id="MainWPBulkUploadSitesLoading" class="updated" style="display: none;">
                <div><i class="fa fa-spinner fa-pulse"></i> <?php 
        _e('Importing sites', 'mainwp');
        ?>
</div>
            </div>
            <?php 
        $errors = array();
        if ($_FILES['mainwp_managesites_file_bulkupload']['error'] == UPLOAD_ERR_OK) {
            if (is_uploaded_file($_FILES['mainwp_managesites_file_bulkupload']['tmp_name'])) {
                $content = file_get_contents($_FILES['mainwp_managesites_file_bulkupload']['tmp_name']);
                $lines = explode("\r", $content);
                $allowedHeaders = array('site name', 'url', 'admin name', 'group', 'security id', 'http username', 'http password', 'verify certificate', 'ssl version');
                $default = array('', '', '', '', '', '', '', '1', 'auto');
                if (is_array($lines) && count($lines) > 0) {
                    $i = 0;
                    $header_line = null;
                    $header_line_split = null;
                    foreach ($lines as $originalLine) {
                        $line = trim($originalLine);
                        if (MainWP_Utility::startsWith($line, '#')) {
                            continue;
                        }
                        if ($header_line == null && $_POST['mainwp_managesites_chk_header_first']) {
                            $header_line = $line . "\n";
                            $header_line_split_tmp = explode(',', $header_line);
                            $header_line_split = array();
                            for ($x = 0; $x < count($header_line_split_tmp); $x++) {
                                $header_line_split[$x] = strtolower(trim(trim($header_line_split_tmp[$x]), '"'));
                            }
                            continue;
                        }
                        $items = explode(',', $line);
                        $line = '';
                        for ($x = 0; $x < count($allowedHeaders); $x++) {
                            if ($line != '') {
                                $line .= ',';
                            }
                            $idx = $x;
                            if (!empty($header_line_split)) {
                                $idx = array_search($allowedHeaders[$x], $header_line_split);
                            }
                            $val = null;
                            if ($idx > -1) {
                                $val = trim(trim($items[$idx]), '"');
                                if ($allowedHeaders[$x] == 'verify certificate') {
                                    if ($val == 'T') {
                                        $val = '1';
                                    } else {
                                        $val = '0';
                                    }
                                }
                            }
                            if (empty($val)) {
                                $val = $default[$x];
                            }
                            $line .= $val;
                        }
                        ?>
                            <input type="hidden"
                                   id="mainwp_managesites_import_csv_line_<?php 
                        echo $i + 1;
                        ?>
"
                                   value="<?php 
                        echo esc_attr($line);
                        ?>
"
                                   original="<?php 
                        echo esc_attr($originalLine);
                        ?>
" />
                            <?php 
                        $i++;
                    }
                    ?>
                        <div class="postbox">
                        <h3 class="mainwp_box_title"><i class="fa fa-globe"></i> <?php 
                    _e('Importing New Child Sites', 'mainwp');
                    ?>
</h3>
                        <div class="inside">
                        <input type="hidden" id="mainwp_managesites_do_import" value="1"/>
                        <input type="hidden" id="mainwp_managesites_total_import" value="<?php 
                    echo $i;
                    ?>
"/>

                        <p>
                        <div class="mainwp_managesites_import_listing" id="mainwp_managesites_import_logging">
                            <pre class="log"><?php 
                    echo esc_attr($header_line);
                    ?>
</pre>
                        </div></p>

                        <p class="submit"><input type="button" name="mainwp_managesites_btn_import"
//.........这里部分代码省略.........
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:101,代码来源:view-mainwp-manage-sites-view.php


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