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


PHP MainWP_Utility::ctype_digit方法代码示例

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


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

示例1: render

    public static function render()
    {
        $current_wpid = MainWP_Utility::get_current_wpid();
        if (!MainWP_Utility::ctype_digit($current_wpid)) {
            return;
        }
        $website = MainWP_DB::Instance()->getWebsiteById($current_wpid, true);
        ?>
		<div id="mainwp-notes-area">
			<div id="mainwp-notes-note" style="padding-bottom: 1em;">
				<?php 
        if ($website->note == '') {
            echo 'No Saved Notes';
        } else {
            echo $website->note;
        }
        ?>
			</div>
			<div style="text-align: center; border-top: 1px Solid #f4f4f4; padding-top: 1em;">
				<a href="#" class="mainwp_notes_show_all button button-primary" id="mainwp_notes_<?php 
        echo $website->id;
        ?>
"><?php 
        _e('Edit Notes', 'mainwp');
        ?>
</a>
			</div>
		</div>
		<?php 
    }
开发者ID:senlin,项目名称:mainwp,代码行数:30,代码来源:widget-mainwp-notes.php

示例2: on_admin_menu

 function on_admin_menu()
 {
     if (MainWP_Utility::isAdmin()) {
         global $current_user;
         delete_user_option($current_user->ID, 'screen_layout_toplevel_page_mainwp_tab');
         $this->dashBoard = add_menu_page('MainWP', 'MainWP', 'read', 'mainwp_tab', array($this, 'on_show_page'), plugins_url('images/mainwpicon.png', dirname(__FILE__)), '2.00001');
         if (mainwp_current_user_can('dashboard', 'access_global_dashboard')) {
             add_submenu_page('mainwp_tab', 'MainWP', __('Dashboard', 'mainwp'), 'read', 'mainwp_tab', array($this, 'on_show_page'));
         }
         $val = get_user_option('screen_layout_' . $this->dashBoard);
         if (!MainWP_Utility::ctype_digit($val)) {
             update_user_option($current_user->ID, 'screen_layout_' . $this->dashBoard, 2, true);
         }
         add_action('load-' . $this->dashBoard, array(&$this, 'on_load_page'));
     }
     //        else
     //        {
     //            $this->dashBoard = add_menu_page('MainWP', 'MainWP', 'read', 'mainwp_tab', array($this, 'require_registration'), plugins_url('images/mainwpicon.png', dirname(__FILE__)), '2.0001');
     //        }
 }
开发者ID:senlin,项目名称:mainwp,代码行数:20,代码来源:page-mainwp-main.php

示例3: prepareUpload

 public static function prepareUpload()
 {
     include_once ABSPATH . '/wp-admin/includes/plugin-install.php';
     $output = array();
     $output['sites'] = array();
     if ($_POST['selected_by'] == 'site') {
         //Get sites
         foreach ($_POST['selected_sites'] as $enc_id) {
             $websiteid = $enc_id;
             if (MainWP_Utility::ctype_digit($websiteid)) {
                 $website = MainWP_DB::Instance()->getWebsiteById($websiteid);
                 $output['sites'][$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name'));
             }
         }
     } else {
         //Get sites from group
         foreach ($_POST['selected_groups'] as $enc_id) {
             $groupid = $enc_id;
             if (MainWP_Utility::ctype_digit($groupid)) {
                 $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupId($groupid));
                 while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
                     if ($website->sync_errors != '') {
                         continue;
                     }
                     $output['sites'][$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name'));
                 }
                 @MainWP_DB::free_result($websites);
             }
         }
     }
     $output['urls'] = array();
     foreach ($_POST['files'] as $file) {
         $output['urls'][] = MainWP_Utility::getDownloadUrl('bulk', $file);
     }
     $output['urls'] = implode('||', $output['urls']);
     $output['urls'] = apply_filters('mainwp_installbulk_prepareupload', $output['urls']);
     die(json_encode($output));
 }
开发者ID:reeslo,项目名称:mainwp,代码行数:38,代码来源:page-mainwp-install-bulk.php

示例4: updateTipSettings

 public static function updateTipSettings()
 {
     if (MainWP_Utility::ctype_digit($_POST['status'])) {
         $userExtension = MainWP_DB::Instance()->getUserExtension();
         $userExtension->tips = $_POST['status'];
         MainWP_DB::Instance()->updateUserExtension($userExtension);
     }
 }
开发者ID:senlin,项目名称:mainwp,代码行数:8,代码来源:page-mainwp-manage-tips.php

示例5: render

    public static function render()
    {
        $current_wpid = MainWP_Utility::get_current_wpid();
        if (!MainWP_Utility::ctype_digit($current_wpid)) {
            return;
        }
        $website = MainWP_DB::Instance()->getWebsiteById($current_wpid, true);
        ?>
		<div class="mainwp-row-top">
			<div style="display: inline-block; width: 100px;"><?php 
        _e('Groups:', 'mainwp');
        ?>
</div>
			<?php 
        echo $website->groups == '' ? 'None' : $website->groups;
        ?>
		</div>
		<div class="mainwp-row">
			<div style="display: inline-block; width: 100px;"><?php 
        _e('Notes:', 'mainwp');
        ?>
</div>
			<a href="#" class="mainwp_notes_show_all" id="mainwp_notes_<?php 
        echo $website->id;
        ?>
"><i class="fa fa-pencil"></i> <?php 
        _e('Open Notes', 'mainwp');
        ?>
			</a><img src="<?php 
        echo plugins_url('images/notes.png', dirname(__FILE__));
        ?>
" class="mainwp_notes_img" id="mainwp_notes_img_<?php 
        echo $website->id;
        ?>
" <?php 
        if ($website->note == '') {
            echo 'style="display: none;"';
        }
        ?>
 />
		</div>
		<span style="display: none"
			id="mainwp_notes_<?php 
        echo $website->id;
        ?>
_note"><?php 
        echo $website->note;
        ?>
</span>
		<div class="mainwp-row">
			<div style="display: inline-block; width: 100px;"><?php 
        _e('Go to:', 'mainwp');
        ?>
</div>
			<a href="admin.php?page=SiteOpen&newWindow=yes&websiteid=<?php 
        echo $website->id;
        ?>
" target="_blank"><i class="fa fa-external-link"></i> <?php 
        _e('WP Admin', 'mainwp');
        ?>
			</a> |
			<a target="_blank" href="<?php 
        echo $website->url;
        ?>
"><i class="fa fa-external-link"></i> <?php 
        _e('Front Page', 'mainwp');
        ?>
			</a>
		</div>
		<div class="mainwp-row">
			<div style="display: inline-block; width: 100px;"><?php 
        _e('Child Site:', 'mainwp');
        ?>
</div>
			<a href="admin.php?page=managesites&id=<?php 
        echo $website->id;
        ?>
"><i class="fa fa-pencil-square-o"></i> <?php 
        _e('Edit', 'mainwp');
        ?>
			</a> |
			<a target="_blank" href="admin.php?page=managesites&scanid=<?php 
        echo $website->id;
        ?>
"><i class="fa fa-shield"></i> <?php 
        _e('Security Scan', 'mainwp');
        ?>
			</a>
		</div>

		<?php 
        do_action('mainwp_shortcuts_widget', $website);
        ?>
		<div id="mainwp_notes_overlay" class="mainwp_overlay"></div>
		<div id="mainwp_notes" class="mainwp_popup">
			<a id="mainwp_notes_closeX" class="mainwp_closeX" style="display: inline; "></a>

			<div id="mainwp_notes_title" class="mainwp_popup_title">
				<a href="<?php 
        echo admin_url('admin.php?page=managesites&dashboard=' . $website->id);
//.........这里部分代码省略.........
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:101,代码来源:widget-mainwp-shortcuts.php

示例6: mainwp_backuptask_run_site

 function mainwp_backuptask_run_site()
 {
     try {
         $this->secure_request('mainwp_backuptask_run_site');
         if (!isset($_POST['site_id']) || !MainWP_Utility::ctype_digit($_POST['site_id']) || !isset($_POST['task_id']) || !MainWP_Utility::ctype_digit($_POST['task_id'])) {
             throw new MainWP_Exception('Invalid request');
         }
         die(json_encode(array('result' => MainWP_Manage_Backups::backup($_POST['task_id'], $_POST['site_id'], $_POST['fileNameUID']))));
     } catch (MainWP_Exception $e) {
         die(json_encode(array('error' => array('message' => $e->getMessage(), 'extra' => $e->getMessageExtra()))));
     }
 }
开发者ID:jexmex,项目名称:mainwp,代码行数:12,代码来源:class-mainwp-post-handler.php

示例7: upgradePluginTheme

 public static function upgradePluginTheme($id, $type, $list)
 {
     if (isset($id) && MainWP_Utility::ctype_digit($id)) {
         $website = MainWP_DB::Instance()->getWebsiteById($id);
         if (MainWP_Utility::can_edit_website($website)) {
             $information = MainWP_Utility::fetchUrlAuthed($website, 'upgradeplugintheme', array('type' => $type, 'list' => urldecode($list)));
             if (isset($information['upgrades'])) {
                 $tmp = array();
                 //todo: 20130718: the syncing in else branch may be removed in the future, it now works with the sync below (just here for older childs..)
                 if (isset($information['sync'])) {
                     foreach ($information['upgrades'] as $k => $v) {
                         $tmp[urlencode($k)] = $v;
                     }
                 } else {
                     $decodedPluginUpgrades = json_decode($website->plugin_upgrades, true);
                     $decodedThemeUpgrades = json_decode($website->theme_upgrades, true);
                     $decodedPremiumUpgrades = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'premium_upgrades'), true);
                     if (is_array($decodedPremiumUpgrades)) {
                         foreach ($decodedPremiumUpgrades as $crrSlug => $premiumUpgrade) {
                             if ($premiumUpgrade['type'] == 'plugin') {
                                 if (!is_array($decodedPluginUpgrades)) {
                                     $decodedPluginUpgrades = array();
                                 }
                                 $decodedPluginUpgrades[$crrSlug] = $premiumUpgrade;
                             } else {
                                 if ($premiumUpgrade['type'] == 'theme') {
                                     if (!is_array($decodedThemeUpgrades)) {
                                         $decodedThemeUpgrades = array();
                                     }
                                     $decodedThemeUpgrades[$crrSlug] = $premiumUpgrade;
                                 }
                             }
                         }
                     }
                     foreach ($information['upgrades'] as $k => $v) {
                         $tmp[urlencode($k)] = $v;
                         if ($v == 1) {
                             if ($type == 'plugin') {
                                 if (isset($decodedPluginUpgrades[$k])) {
                                     unset($decodedPluginUpgrades[$k]);
                                 }
                             }
                             if ($type == 'theme') {
                                 if (isset($decodedThemeUpgrades[$k])) {
                                     unset($decodedThemeUpgrades[$k]);
                                 }
                             }
                         }
                     }
                     if ($type == 'plugin') {
                         MainWP_DB::Instance()->updateWebsiteValues($website->id, array('plugin_upgrades' => json_encode($decodedPluginUpgrades)));
                     }
                     if ($type == 'theme') {
                         MainWP_DB::Instance()->updateWebsiteValues($website->id, array('theme_upgrades' => json_encode($decodedThemeUpgrades)));
                     }
                 }
                 return $tmp;
             } else {
                 if (isset($information['error'])) {
                     throw new MainWP_Exception('WPERROR', $information['error']);
                 } else {
                     throw new MainWP_Exception('ERROR', 'Invalid response from site');
                 }
             }
         }
     }
     throw new MainWP_Exception('ERROR', __('Invalid request', 'mainwp'));
 }
开发者ID:senlin,项目名称:mainwp,代码行数:68,代码来源:widget-mainwp-right-now.php

示例8: action

 public static function action($pAction)
 {
     $plugin = $_POST['plugin'];
     $websiteIdEnc = $_POST['websiteId'];
     if (empty($plugin)) {
         die(json_encode(array('error' => 'Invalid Request.')));
     }
     $websiteId = $websiteIdEnc;
     if (!MainWP_Utility::ctype_digit($websiteId)) {
         die(json_encode(array('error' => 'Invalid Request.')));
     }
     $website = MainWP_DB::Instance()->getWebsiteById($websiteId);
     if (!MainWP_Utility::can_edit_website($website)) {
         die(json_encode(array('error' => 'You can not edit this website.')));
     }
     try {
         $information = MainWP_Utility::fetchUrlAuthed($website, 'plugin_action', array('action' => $pAction, 'plugin' => $plugin));
     } catch (MainWP_Exception $e) {
         die(json_encode(array('error' => $e->getMessage())));
     }
     if (!isset($information['status']) || $information['status'] != 'SUCCESS') {
         die(json_encode(array('error' => 'Unexpected error.')));
     }
 }
开发者ID:senlin,项目名称:mainwp,代码行数:24,代码来源:widget-mainwp-widget-plugins.php

示例9: syncInformationArray

 public static function syncInformationArray(&$pWebsite, &$information, $sync_errors = '', $offline_check_result = 1, $error = false, $pAllowDisconnect = true)
 {
     $emptyArray = json_encode(array());
     $websiteValues = array('directories' => $emptyArray, 'plugin_upgrades' => $emptyArray, 'theme_upgrades' => $emptyArray, 'translation_upgrades' => $emptyArray, 'securityIssues' => $emptyArray, 'themes' => $emptyArray, 'plugins' => $emptyArray, 'users' => $emptyArray, 'categories' => $emptyArray, 'pluginConflicts' => $emptyArray, 'themeConflicts' => $emptyArray, 'offline_check_result' => $offline_check_result);
     $websiteSyncValues = array('uptodate' => 0, 'sync_errors' => $sync_errors, 'version' => 0);
     $done = false;
     if (isset($information['siteurl'])) {
         $websiteValues['siteurl'] = $information['siteurl'];
         $done = true;
     }
     if (isset($information['version'])) {
         $websiteSyncValues['version'] = $information['version'];
         $done = true;
     }
     if (isset($information['directories']) && is_array($information['directories'])) {
         $websiteValues['directories'] = @json_encode($information['directories']);
         $done = true;
     } else {
         if (isset($information['directories'])) {
             $websiteValues['directories'] = $information['directories'];
             $done = true;
         }
     }
     if (isset($information['wp_updates']) && $information['wp_updates'] != null) {
         MainWP_DB::Instance()->updateWebsiteOption($pWebsite, 'wp_upgrades', @json_encode(array('current' => $information['wpversion'], 'new' => $information['wp_updates'])));
         $done = true;
     } else {
         MainWP_DB::Instance()->updateWebsiteOption($pWebsite, 'wp_upgrades', $emptyArray);
     }
     if (isset($information['plugin_updates'])) {
         $websiteValues['plugin_upgrades'] = @json_encode($information['plugin_updates']);
         $done = true;
     }
     if (isset($information['theme_updates'])) {
         $websiteValues['theme_upgrades'] = @json_encode($information['theme_updates']);
         $done = true;
     }
     if (isset($information['translation_updates'])) {
         $websiteValues['translation_upgrades'] = @json_encode($information['translation_updates']);
         $done = true;
     }
     if (isset($information['premium_updates'])) {
         MainWP_DB::Instance()->updateWebsiteOption($pWebsite, 'premium_upgrades', @json_encode($information['premium_updates']));
         $done = true;
     } else {
         MainWP_DB::Instance()->updateWebsiteOption($pWebsite, 'premium_upgrades', $emptyArray);
     }
     if (isset($information['securityIssues']) && MainWP_Utility::ctype_digit($information['securityIssues']) && $information['securityIssues'] >= 0) {
         $websiteValues['securityIssues'] = $information['securityIssues'];
         $done = true;
     }
     if (isset($information['recent_comments'])) {
         MainWP_DB::Instance()->updateWebsiteOption($pWebsite, 'recent_comments', @json_encode($information['recent_comments']));
         $done = true;
     } else {
         MainWP_DB::Instance()->updateWebsiteOption($pWebsite, 'recent_comments', $emptyArray);
     }
     if (isset($information['recent_posts'])) {
         MainWP_DB::Instance()->updateWebsiteOption($pWebsite, 'recent_posts', @json_encode($information['recent_posts']));
         $done = true;
     } else {
         MainWP_DB::Instance()->updateWebsiteOption($pWebsite, 'recent_posts', $emptyArray);
     }
     if (isset($information['recent_pages'])) {
         MainWP_DB::Instance()->updateWebsiteOption($pWebsite, 'recent_pages', @json_encode($information['recent_pages']));
         $done = true;
     } else {
         MainWP_DB::Instance()->updateWebsiteOption($pWebsite, 'recent_pages', $emptyArray);
     }
     if (isset($information['themes'])) {
         $websiteValues['themes'] = @json_encode($information['themes']);
         $done = true;
     }
     $to_fix = false;
     if (isset($information['plugins'])) {
         foreach ($information['plugins'] as $info) {
             if (isset($info['slug']) && in_array($info['slug'], array('ithemes-security-pro/ithemes-security-pro.php', 'monarch/monarch.php'))) {
                 $to_fix = true;
             }
         }
         $websiteValues['plugins'] = @json_encode($information['plugins']);
         $done = true;
     }
     if ($to_fix) {
         $request = get_option('mainwp_request_plugins_page_site_' . $pWebsite->id);
         if (empty($request)) {
             update_option('mainwp_request_plugins_page_site_' . $pWebsite->id, 'yes');
         }
     } else {
         if ('yes' == get_option('mainwp_request_plugins_page_site_' . $pWebsite->id)) {
             delete_option('mainwp_request_plugins_page_site_' . $pWebsite->id);
         }
     }
     if (isset($information['users'])) {
         $websiteValues['users'] = @json_encode($information['users']);
         $done = true;
     }
     if (isset($information['categories'])) {
         $websiteValues['categories'] = @json_encode($information['categories']);
         $done = true;
//.........这里部分代码省略.........
开发者ID:reeslo,项目名称:mainwp,代码行数:101,代码来源:class-mainwp-sync.php

示例10: getPostMeta

 public static function getPostMeta($postId, $keys, $value, $websiteId)
 {
     if (!MainWP_Utility::ctype_digit($postId)) {
         return;
     }
     if (!MainWP_Utility::ctype_digit($websiteId)) {
         return;
     }
     $website = MainWP_DB::Instance()->getWebsiteById($websiteId);
     if (!MainWP_Utility::can_edit_website($website)) {
         return;
     }
     try {
         $results = MainWP_Utility::fetchUrlAuthed($website, 'get_post_meta', array('id' => base64_encode($postId), 'keys' => base64_encode($keys), 'value' => base64_encode($value)));
     } catch (MainWP_Exception $e) {
         return;
     }
     return $results;
 }
开发者ID:senlin,项目名称:mainwp,代码行数:19,代码来源:page-mainwp-post.php

示例11: ignoreUpdates

 public static function ignoreUpdates()
 {
     $websiteIdEnc = $_POST['websiteId'];
     $websiteId = $websiteIdEnc;
     if (!MainWP_Utility::ctype_digit($websiteId)) {
         die('FAIL');
     }
     $website = MainWP_DB::Instance()->getWebsiteById($websiteId);
     if (!MainWP_Utility::can_edit_website($website)) {
         die('FAIL');
     }
     $themes = $_POST['themes'];
     $names = $_POST['names'];
     $decodedIgnoredThemes = json_decode($website->ignored_themes, true);
     if (!is_array($decodedIgnoredThemes)) {
         $decodedIgnoredThemes = array();
     }
     if (is_array($themes)) {
         for ($i = 0; $i < count($themes); $i++) {
             $slug = $themes[$i];
             $name = $names[$i];
             if (!isset($decodedIgnoredThemes[$slug])) {
                 $decodedIgnoredThemes[$slug] = urldecode($name);
             }
         }
         MainWP_DB::Instance()->updateWebsiteValues($website->id, array('ignored_themes' => json_encode($decodedIgnoredThemes)));
     }
     die(json_encode(array('result' => true)));
 }
开发者ID:jexmex,项目名称:mainwp,代码行数:29,代码来源:page-mainwp-themes.php

示例12: action_update

 public static function action_update($pAction)
 {
     $postId = $_POST['postId'];
     $websiteIdEnc = $_POST['websiteId'];
     $post_data = $_POST['post_data'];
     if (!MainWP_Utility::ctype_digit($postId)) {
         die('FAIL');
     }
     $websiteId = $websiteIdEnc;
     if (!MainWP_Utility::ctype_digit($websiteId)) {
         die('FAIL');
     }
     $website = MainWP_DB::Instance()->getWebsiteById($websiteId);
     if (!MainWP_Utility::can_edit_website($website)) {
         die('FAIL');
     }
     try {
         $information = MainWP_Utility::fetchUrlAuthed($website, 'post_action', array('action' => $pAction, 'id' => $postId, 'post_data' => $post_data));
     } catch (MainWP_Exception $e) {
         die('FAIL');
     }
     if (!isset($information['status']) || $information['status'] != 'SUCCESS') {
         die('FAIL');
     }
 }
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:25,代码来源:widget-mainwp-recent-posts.php

示例13: pauseBackup

 public static function pauseBackup()
 {
     if (isset($_POST['id']) && MainWP_Utility::ctype_digit($_POST['id'])) {
         $task = MainWP_DB::Instance()->getBackupTaskById($_POST['id']);
         if (MainWP_Utility::can_edit_backuptask($task)) {
             MainWP_DB::Instance()->updateBackupTaskWithValues($task->id, array('paused' => 1));
             die(json_encode(array('result' => 'SUCCESS')));
         }
     }
     die(json_encode(array('notask' => true)));
 }
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:11,代码来源:page-mainwp-manage-backups.php

示例14: updateGroup

 public static function updateGroup()
 {
     if (isset($_POST['groupId']) && MainWP_Utility::ctype_digit($_POST['groupId'])) {
         $group = MainWP_DB::Instance()->getGroupById($_POST['groupId']);
         if (MainWP_Utility::can_edit_group($group)) {
             MainWP_DB::Instance()->clearGroup($group->id);
             if (isset($_POST['websiteIds'])) {
                 foreach ($_POST['websiteIds'] as $websiteId) {
                     $website = MainWP_DB::Instance()->getWebsiteById($websiteId);
                     if (MainWP_Utility::can_edit_website($website)) {
                         MainWP_DB::Instance()->updateGroupSite($group->id, $website->id);
                     }
                 }
             }
             die(json_encode(array('result' => true)));
         }
     }
     die(json_encode(array('result' => false)));
 }
开发者ID:senlin,项目名称:mainwp,代码行数:19,代码来源:page-mainwp-manage-groups.php

示例15: posting

    public static function posting()
    {
        ?>
	<div class="wrap">
		<?php 
        //  Use this to add a new page. To bulk change pages click on the "Manage" tab.
        do_action('mainwp_bulkpage_before_post', $_GET['id']);
        $skip_post = false;
        if (isset($_GET['id'])) {
            if ('yes' == get_post_meta($_GET['id'], '_mainwp_skip_posting', true)) {
                $skip_post = true;
                wp_delete_post($_GET['id'], true);
            }
        }
        if (!$skip_post) {
            //Posts the saved sites
            if (isset($_GET['id'])) {
                $id = $_GET['id'];
                $post = get_post($id);
                if ($post) {
                    $selected_by = get_post_meta($id, '_selected_by', true);
                    $selected_sites = unserialize(base64_decode(get_post_meta($id, '_selected_sites', true)));
                    $selected_groups = unserialize(base64_decode(get_post_meta($id, '_selected_groups', true)));
                    $post_slug = base64_decode(get_post_meta($id, '_slug', true));
                    $post_custom = get_post_custom($id);
                    include_once ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'post-thumbnail-template.php';
                    $post_featured_image = get_post_thumbnail_id($id);
                    $mainwp_upload_dir = wp_upload_dir();
                    $new_post = array('post_title' => $post->post_title, 'post_content' => $post->post_content, 'post_status' => $post->post_status, 'post_date' => $post->post_date, 'post_date_gmt' => $post->post_date_gmt, 'post_type' => 'page', 'post_name' => $post_slug, 'post_excerpt' => $post->post_excerpt, 'comment_status' => $post->comment_status, 'ping_status' => $post->ping_status, 'id_spin' => $post->ID);
                    if ($post_featured_image != null) {
                        //Featured image is set, retrieve URL
                        $img = wp_get_attachment_image_src($post_featured_image, 'full');
                        $post_featured_image = $img[0];
                    }
                    $dbwebsites = array();
                    if ($selected_by == 'site') {
                        //Get all selected websites
                        foreach ($selected_sites as $k) {
                            if (MainWP_Utility::ctype_digit($k)) {
                                $website = MainWP_DB::Instance()->getWebsiteById($k);
                                $dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
                            }
                        }
                    } else {
                        //Get all websites from the selected groups
                        foreach ($selected_groups as $k) {
                            if (MainWP_Utility::ctype_digit($k)) {
                                $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupId($k));
                                while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
                                    if ($website->sync_errors != '') {
                                        continue;
                                    }
                                    $dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
                                }
                                @MainWP_DB::free_result($websites);
                            }
                        }
                    }
                    $output = new stdClass();
                    $output->ok = array();
                    $output->errors = array();
                    $startTime = time();
                    if (count($dbwebsites) > 0) {
                        $post_data = array('new_post' => base64_encode(serialize($new_post)), 'post_custom' => base64_encode(serialize($post_custom)), 'post_featured_image' => base64_encode($post_featured_image), 'mainwp_upload_dir' => base64_encode(serialize($mainwp_upload_dir)));
                        $post_data = apply_filters('mainwp_bulkpage_posting', $post_data, $id);
                        MainWP_Utility::fetchUrlsAuthed($dbwebsites, 'newpost', $post_data, array(MainWP_Bulk_Add::getClassName(), 'PostingBulk_handler'), $output);
                    }
                    $failed_posts = array();
                    foreach ($dbwebsites as $website) {
                        if ($output->ok[$website->id] == 1 && isset($output->added_id[$website->id])) {
                            do_action('mainwp-post-posting-page', $website, $output->added_id[$website->id], isset($output->link[$website->id]) ? $output->link[$website->id] : null);
                            do_action('mainwp-bulkposting-done', $post, $website, $output);
                        } else {
                            $failed_posts[] = $website->id;
                        }
                    }
                    $del_post = true;
                    $saved_draft = get_post_meta($id, '_saved_as_draft', true);
                    if ($saved_draft == 'yes') {
                        if (count($failed_posts) > 0) {
                            $del_post = false;
                            update_post_meta($post->ID, '_selected_sites', base64_encode(serialize($failed_posts)));
                            update_post_meta($post->ID, '_selected_groups', '');
                            wp_update_post(array('ID' => $id, 'post_status' => 'draft'));
                        }
                    }
                    if ($del_post) {
                        wp_delete_post($id, true);
                    }
                    $countSites = 0;
                    $countRealItems = 0;
                    foreach ($dbwebsites as $website) {
                        if (isset($output->ok[$website->id]) && $output->ok[$website->id] == 1) {
                            $countSites++;
                            $countRealItems++;
                        }
                    }
                    if (!empty($countSites)) {
                        $seconds = time() - $startTime;
                        MainWP_Twitter::updateTwitterInfo('new_page', $countSites, $seconds, $countRealItems, $startTime, 1);
//.........这里部分代码省略.........
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:101,代码来源:page-mainwp-page.php


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