本文整理汇总了PHP中ms_is_switched函数的典型用法代码示例。如果您正苦于以下问题:PHP ms_is_switched函数的具体用法?PHP ms_is_switched怎么用?PHP ms_is_switched使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ms_is_switched函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_primary_terms
/**
* Saves all selected primary terms
*
* @param int $post_ID Post ID to save primary terms for.
*/
public function save_primary_terms($post_ID)
{
// Bail if this is a multisite installation and the site has been switched.
if (is_multisite() && ms_is_switched()) {
return;
}
$taxonomies = $this->get_primary_term_taxonomies($post_ID);
foreach ($taxonomies as $taxonomy) {
$this->save_primary_term($post_ID, $taxonomy);
}
}
示例2: tearDown
function tearDown() {
global $wpdb, $wp_query, $post;
$wpdb->query( 'ROLLBACK' );
if ( is_multisite() ) {
while ( ms_is_switched() ) {
restore_current_blog();
}
}
$wp_query = new WP_Query();
$post = null;
remove_theme_support( 'html5' );
remove_filter( 'query', array( $this, '_create_temporary_tables' ) );
remove_filter( 'query', array( $this, '_drop_temporary_tables' ) );
remove_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) );
$this->_restore_hooks();
wp_set_current_user( 0 );
}
示例3: test_switch_restore_blog
function test_switch_restore_blog() {
global $_wp_switched_stack, $wpdb;
$this->assertEquals( array(), $_wp_switched_stack );
$this->assertFalse( ms_is_switched() );
$current_blog_id = get_current_blog_id();
$this->assertInternalType( 'integer', $current_blog_id );
wp_cache_set( 'switch-test', $current_blog_id, 'switch-test' );
$this->assertEquals( $current_blog_id, wp_cache_get( 'switch-test', 'switch-test' ) );
$blog_id = $this->factory->blog->create();
$cap_key = wp_get_current_user()->cap_key;
switch_to_blog( $blog_id );
$this->assertNotEquals( $cap_key, wp_get_current_user()->cap_key );
$this->assertEquals( array( $current_blog_id ), $_wp_switched_stack );
$this->assertTrue( ms_is_switched() );
$this->assertEquals( $blog_id, $wpdb->blogid );
$this->assertFalse( wp_cache_get( 'switch-test', 'switch-test' ) );
wp_cache_set( 'switch-test', $blog_id, 'switch-test' );
$this->assertEquals( $blog_id, wp_cache_get( 'switch-test', 'switch-test' ) );
switch_to_blog( $blog_id );
$this->assertEquals( array( $current_blog_id, $blog_id ), $_wp_switched_stack );
$this->assertTrue( ms_is_switched() );
$this->assertEquals( $blog_id, $wpdb->blogid );
$this->assertEquals( $blog_id, wp_cache_get( 'switch-test', 'switch-test' ) );
restore_current_blog();
$this->assertEquals( array( $current_blog_id ), $_wp_switched_stack );
$this->assertTrue( ms_is_switched() );
$this->assertEquals( $blog_id, $wpdb->blogid );
$this->assertEquals( $blog_id, wp_cache_get( 'switch-test', 'switch-test' ) );
restore_current_blog();
$this->assertEquals( $cap_key, wp_get_current_user()->cap_key );
$this->assertEquals( $current_blog_id, get_current_blog_id() );
$this->assertEquals( array(), $_wp_switched_stack );
$this->assertFalse( ms_is_switched() );
$this->assertEquals( $current_blog_id, wp_cache_get( 'switch-test', 'switch-test' ) );
$this->assertFalse( restore_current_blog() );
}
示例4: save_meta_boxes
/**
* Save meta boxes.
*
* @param int $id
* @param object $post
*/
public function save_meta_boxes($id, $post = null)
{
// Check if there was a multisite switch before.
if (is_multisite() && ms_is_switched()) {
return;
}
// Can't proceed without a id.
if (empty($id)) {
return;
}
// Check if our nonce is vailed.
if (!wp_verify_nonce(papi_get_sanitized_post('papi_meta_nonce'), 'papi_save_data')) {
return;
}
$meta_type = $this->get_meta_type();
$post = is_array($post) ? (object) $post : $post;
if ($meta_type === 'post' && ($post_type = get_post_type_object($post->post_type))) {
// Check so the id is a post id and not a autosave post.
if ($this->valid_post_id($id)) {
return;
}
// Check the `edit_posts` capability before we continue.
if (!current_user_can($post_type->cap->edit_posts)) {
return;
}
// Save post revision data.
if ($parent_id = wp_is_post_revision($id)) {
$slugs = papi_get_slugs($id, true);
foreach ($slugs as $slug) {
papi_update_field($id, $slug, papi_get_field($parent_id, $slug));
}
}
}
if ($meta_type === 'term' && ($taxonomy = get_taxonomy(papi_get_taxonomy()))) {
// Check the `edit_terms` capability before we continue.
if ($taxonomy && !current_user_can($taxonomy->cap->edit_terms)) {
return;
}
}
$this->save_properties($id);
}
示例5: save_postdata
/**
* Save the WP SEO metadata for posts.
*
* @internal $_POST parameters are validated via sanitize_post_meta()
*
* @param int $post_id Post ID.
*
* @return bool|void Boolean false if invalid save post request
*/
function save_postdata($post_id)
{
// Bail if this is a multisite installation and the site has been switched.
if (is_multisite() && ms_is_switched()) {
return false;
}
if ($post_id === null) {
return false;
}
if (wp_is_post_revision($post_id)) {
$post_id = wp_is_post_revision($post_id);
}
clean_post_cache($post_id);
$post = get_post($post_id);
if (!is_object($post)) {
// Non-existent post.
return false;
}
do_action('wpseo_save_compare_data', $post);
$meta_boxes = apply_filters('wpseo_save_metaboxes', array());
$meta_boxes = array_merge($meta_boxes, $this->get_meta_field_defs('general', $post->post_type), $this->get_meta_field_defs('advanced'));
foreach ($meta_boxes as $key => $meta_box) {
$data = null;
if ('checkbox' === $meta_box['type']) {
$data = isset($_POST[self::$form_prefix . $key]) ? 'on' : 'off';
} else {
if (isset($_POST[self::$form_prefix . $key])) {
$data = $_POST[self::$form_prefix . $key];
}
}
if (isset($data)) {
self::set_value($key, $data, $post_id);
}
}
do_action('wpseo_saved_postdata');
}
示例6: init_settings
public function init_settings()
{
if ($this->get_setting('setup_wizard_step') == 4 && $this->get_setting('setup_complete') && !ms_is_switched()) {
global $sitepress_settings;
$this->settings = get_option('icl_sitepress_settings');
$sitepress_settings = $this->settings;
return $sitepress_settings;
}
return null;
}
示例7: icl_st_track_string
function icl_st_track_string($text, $context, $kind = ICL_STRING_TRANSLATION_STRING_TRACKING_TYPE_PAGE)
{
if (is_multisite() && ms_is_switched()) {
return;
}
require_once dirname(__FILE__) . '/gettext/wpml-string-scanner.class.php';
static $string_scanner = null;
if (!$string_scanner) {
$string_scanner = new WPML_String_Scanner();
}
$string_scanner->track_string($text, $context, $kind);
}
示例8: get_site_icon_url
/**
* Returns the Site Icon URL.
*
* @since 4.3.0
*
* @param int $size Optional. Size of the site icon. Default 512 (pixels).
* @param string $url Optional. Fallback url if no site icon is found. Default empty.
* @param int $blog_id Optional. ID of the blog to get the site icon for. Default current blog.
* @return string Site Icon URL.
*/
function get_site_icon_url($size = 512, $url = '', $blog_id = 0)
{
if (is_multisite() && (int) $blog_id !== get_current_blog_id()) {
switch_to_blog($blog_id);
}
$site_icon_id = get_option('site_icon');
if ($site_icon_id) {
if ($size >= 512) {
$size_data = 'full';
} else {
$size_data = array($size, $size);
}
$url = wp_get_attachment_image_url($site_icon_id, $size_data);
}
if (is_multisite() && ms_is_switched()) {
restore_current_blog();
}
/**
* Filter the site icon URL.
*
* @site 4.4.0
*
* @param string $url Site icon URL.
* @param int $size Size of the site icon.
* @param int $blog_id ID of the blog to get the site icon for.
*/
return apply_filters('get_site_icon_url', $url, $size, $blog_id);
}
示例9: importmedia
function importmedia($id, $prefix)
{
$delete = false;
$attached_file = get_attached_file($id);
$attached_file_option = get_post_meta($id, '_wp_attached_file', true);
$basename = wp_basename($attached_file);
$file_folder_path = trailingslashit(str_replace($basename, '', $attached_file));
$siteurl = get_option('siteurl');
$upload_path = trim(get_option('upload_path'));
if (empty($upload_path) || 'wp-content/uploads' == $upload_path) {
$dir = WP_CONTENT_DIR . '/uploads';
} elseif (0 !== strpos($upload_path, ABSPATH)) {
// $dir is absolute, $upload_path is (maybe) relative to ABSPATH
$dir = path_join(ABSPATH, $upload_path);
} else {
$dir = $upload_path;
}
if (!($url = get_option('upload_url_path'))) {
if (empty($upload_path) || 'wp-content/uploads' == $upload_path || $upload_path == $dir) {
$url = WP_CONTENT_URL . '/uploads';
} else {
$url = trailingslashit($siteurl) . $upload_path;
}
}
// Obey the value of UPLOADS. This happens as long as ms-files rewriting is disabled.
// We also sometimes obey UPLOADS when rewriting is enabled -- see the next block.
if (defined('UPLOADS') && !(is_multisite() && rtmedia_get_site_option('ms_files_rewriting'))) {
$dir = ABSPATH . UPLOADS;
$url = trailingslashit($siteurl) . UPLOADS;
}
// If multisite (and if not the main site in a post-MU network)
if (is_multisite() && !(is_main_site() && defined('MULTISITE'))) {
if (!rtmedia_get_site_option('ms_files_rewriting')) {
// If ms-files rewriting is disabled (networks created post-3.5), it is fairly straightforward:
// Append sites/%d if we're not on the main site (for post-MU networks). (The extra directory
// prevents a four-digit ID from conflicting with a year-based directory for the main site.
// But if a MU-era network has disabled ms-files rewriting manually, they don't need the extra
// directory, as they never had wp-content/uploads for the main site.)
if (defined('MULTISITE')) {
$ms_dir = '/sites/' . get_current_blog_id();
} else {
$ms_dir = '/' . get_current_blog_id();
}
$dir .= $ms_dir;
$url .= $ms_dir;
} elseif (defined('UPLOADS') && !ms_is_switched()) {
// Handle the old-form ms-files.php rewriting if the network still has that enabled.
// When ms-files rewriting is enabled, then we only listen to UPLOADS when:
// 1) we are not on the main site in a post-MU network,
// as wp-content/uploads is used there, and
// 2) we are not switched, as ms_upload_constants() hardcodes
// these constants to reflect the original blog ID.
//
// Rather than UPLOADS, we actually use BLOGUPLOADDIR if it is set, as it is absolute.
// (And it will be set, see ms_upload_constants().) Otherwise, UPLOADS can be used, as
// as it is relative to ABSPATH. For the final piece: when UPLOADS is used with ms-files
// rewriting in multisite, the resulting URL is /files. (#WP22702 for background.)
if (defined('BLOGUPLOADDIR')) {
$dir = untrailingslashit(BLOGUPLOADDIR);
} else {
$dir = ABSPATH . UPLOADS;
}
$url = trailingslashit($siteurl) . 'files';
}
}
$basedir = trailingslashit($dir);
$baseurl = trailingslashit($url);
$new_file_folder_path = trailingslashit(str_replace($basedir, $basedir . "rtMedia/{$prefix}/", $file_folder_path));
$year_month = untrailingslashit(str_replace($basedir, '', $file_folder_path));
$metadata = wp_get_attachment_metadata($id);
$backup_metadata = get_post_meta($id, '_wp_attachment_backup_sizes', true);
$instagram_thumbs = get_post_meta($id, '_instagram_thumbs', true);
$instagram_full_images = get_post_meta($id, '_instagram_full_images', true);
$instagram_metadata = get_post_meta($id, '_instagram_metadata', true);
$encoding_job_id = get_post_meta($id, 'bp-media-encoding-job-id', true);
$ffmpeg_thumbnail_ids = get_post_meta($id, 'bp_media_thumbnail_ids', true);
$ffmpeg_thumbnail = get_post_meta($id, 'bp_media_thumbnail', true);
$ffmpeg_remote_id = get_post_meta($id, 'bp_media_ffmpeg_remote_id', true);
$kaltura_remote_id = get_post_meta($id, 'bp_media_kaltura_remote_id', true);
if (wp_mkdir_p($basedir . "rtMedia/{$prefix}/" . $year_month)) {
if (copy($attached_file, str_replace($basedir, $basedir . "rtMedia/{$prefix}/", $attached_file))) {
$delete = true;
if (isset($metadata['sizes'])) {
foreach ($metadata['sizes'] as $size) {
if (!copy($file_folder_path . $size['file'], $new_file_folder_path . $size['file'])) {
$delete = false;
} else {
$delete_sizes[] = $file_folder_path . $size['file'];
$this->search_and_replace(trailingslashit($baseurl . $year_month) . $size['file'], trailingslashit($baseurl . "rtMedia/{$prefix}/" . $year_month) . $size['file']);
}
}
}
if ($backup_metadata) {
foreach ($backup_metadata as $backup_images) {
if (!copy($file_folder_path . $backup_images['file'], $new_file_folder_path . $backup_images['file'])) {
$delete = false;
} else {
$delete_sizes[] = $file_folder_path . $backup_images['file'];
$this->search_and_replace(trailingslashit($baseurl . $year_month) . $backup_images['file'], trailingslashit($baseurl . "rtMedia/{$prefix}/" . $year_month) . $backup_images['file']);
}
//.........这里部分代码省略.........
示例10: filter_stopwords_from_slug
/**
* Filter the stopwords from the slug
*
* @param string $slug The current slug, if not empty there will be done nothing.
* @param string $post_title The title which will be used in case of an empty slug.
*
* @return string
*/
public function filter_stopwords_from_slug($slug, $post_title)
{
// Don't change an existing slug.
if (isset($slug) && $slug !== '') {
return $slug;
}
// When the post title is empty, just return the slug.
if (empty($post_title)) {
return $slug;
}
// Don't change the slug if this is a multisite installation and the site has been switched.
if (is_multisite() && ms_is_switched()) {
return $slug;
}
// Don't change slug if the post is a draft, this conflicts with polylang.
// Doesn't work with filter_input() since need current value, not originally submitted one.
if ('draft' === $_POST['post_status']) {
return $slug;
}
// Lowercase the slug and strip slashes.
$new_slug = sanitize_title(stripslashes($post_title));
$stop_words = new WPSEO_Admin_Stop_Words();
return $stop_words->remove_in($new_slug);
}
示例11: wp_upload_dir
/**
* Get an array containing the current upload directory's path and url.
*
* Checks the 'upload_path' option, which should be from the web root folder,
* and if it isn't empty it will be used. If it is empty, then the path will be
* 'WP_CONTENT_DIR/uploads'. If the 'UPLOADS' constant is defined, then it will
* override the 'upload_path' option and 'WP_CONTENT_DIR/uploads' path.
*
* The upload URL path is set either by the 'upload_url_path' option or by using
* the 'WP_CONTENT_URL' constant and appending '/uploads' to the path.
*
* If the 'uploads_use_yearmonth_folders' is set to true (checkbox if checked in
* the administration settings panel), then the time will be used. The format
* will be year first and then month.
*
* If the path couldn't be created, then an error will be returned with the key
* 'error' containing the error message. The error suggests that the parent
* directory is not writable by the server.
*
* On success, the returned array will have many indices:
* 'path' - base directory and sub directory or full path to upload directory.
* 'url' - base url and sub directory or absolute URL to upload directory.
* 'subdir' - sub directory if uploads use year/month folders option is on.
* 'basedir' - path without subdir.
* 'baseurl' - URL path without subdir.
* 'error' - set to false.
*
* @since 2.0.0
* @uses apply_filters() Calls 'upload_dir' on returned array.
*
* @param string $time Optional. Time formatted in 'yyyy/mm'.
* @return array See above for description.
*/
function wp_upload_dir($time = null)
{
$siteurl = get_option('siteurl');
$upload_path = trim(get_option('upload_path'));
if (empty($upload_path) || 'wp-content/uploads' == $upload_path) {
$dir = WP_CONTENT_DIR . '/uploads';
} elseif (0 !== strpos($upload_path, ABSPATH)) {
// $dir is absolute, $upload_path is (maybe) relative to ABSPATH
$dir = path_join(ABSPATH, $upload_path);
} else {
$dir = $upload_path;
}
if (!($url = get_option('upload_url_path'))) {
if (empty($upload_path) || 'wp-content/uploads' == $upload_path || $upload_path == $dir) {
$url = WP_CONTENT_URL . '/uploads';
} else {
$url = trailingslashit($siteurl) . $upload_path;
}
}
if (defined('UPLOADS')) {
$dir = ABSPATH . UPLOADS;
$url = trailingslashit($siteurl) . UPLOADS;
}
// If multisite (if not the main site in a post-MU network)
$blog_id = get_current_blog_id();
if (is_multisite() && !(is_main_site($blog_id) && defined('MULTISITE'))) {
if (!get_site_option('ms_files_rewriting')) {
// Append sites/%d if we're not on the main site (for post-MU networks). The extra directory
// prevents a four-digit ID from conflicting with a year-based directory for the main site.
// But if a MU-era network has disabled ms-files rewriting manually, they don't need the extra
// directory, as they never had wp-content/uploads for the main site.
$ms_dir = defined('MULTISITE') ? '/sites/' : '/';
$dir .= $ms_dir . $blog_id;
$url .= $ms_dir . $blog_id;
} elseif (!ms_is_switched()) {
// Handle the old-form ms-files.php rewriting if the network still has that enabled.
if (defined('BLOGUPLOADDIR')) {
$dir = untrailingslashit(BLOGUPLOADDIR);
}
$url = str_replace(UPLOADS, 'files', $url);
}
}
$basedir = $dir;
$baseurl = $url;
$subdir = '';
if (get_option('uploads_use_yearmonth_folders')) {
// Generate the yearly and monthly dirs
if (!$time) {
$time = current_time('mysql');
}
$y = substr($time, 0, 4);
$m = substr($time, 5, 2);
$subdir = "/{$y}/{$m}";
}
$dir .= $subdir;
$url .= $subdir;
$uploads = apply_filters('upload_dir', array('path' => $dir, 'url' => $url, 'subdir' => $subdir, 'basedir' => $basedir, 'baseurl' => $baseurl, 'error' => false));
// Make sure we have an uploads dir
if (!wp_mkdir_p($uploads['path'])) {
$message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), $uploads['path']);
$uploads['error'] = $message;
}
return $uploads;
}
示例12: cud_wp_upload_dir
function cud_wp_upload_dir($time = null)
{
$upload_path = trim(get_option('upload_path'));
$basedir = '';
if (empty($upload_path) || 'wp-content/uploads' == $upload_path) {
$basedir = WP_CONTENT_DIR . '/uploads';
} elseif (0 !== strpos($upload_path, ABSPATH)) {
// $basedir is absolute, $upload_path is (maybe) relative to ABSPATH
$basedir = path_join(ABSPATH, $upload_path);
} else {
$basedir = $upload_path;
}
// Obey the value of UPLOADS. This happens as long as ms-files rewriting is disabled.
// We also sometimes obey UPLOADS when rewriting is enabled -- see the next block.
if (defined('UPLOADS') && !(is_multisite() && get_site_option('ms_files_rewriting'))) {
$basedir = ABSPATH . UPLOADS;
}
// If multisite (and if not the main site in a post-MU network)
if (is_multisite() && !(is_main_site() && defined('MULTISITE'))) {
if (!get_site_option('ms_files_rewriting')) {
// If ms-files rewriting is disabled (networks created post-3.5), it is fairly straightforward:
// Append sites/%d if we're not on the main site (for post-MU networks). (The extra directory
// prevents a four-digit ID from conflicting with a year-based directory for the main site.
// But if a MU-era network has disabled ms-files rewriting manually, they don't need the extra
// directory, as they never had wp-content/uploads for the main site.)
if (defined('MULTISITE')) {
$ms_dir = '/sites/' . get_current_blog_id();
} else {
$ms_dir = '/' . get_current_blog_id();
}
$basedir .= $ms_dir;
} elseif (defined('UPLOADS') && !ms_is_switched()) {
// Handle the old-form ms-files.php rewriting if the network still has that enabled.
// When ms-files rewriting is enabled, then we only listen to UPLOADS when:
// 1) we are not on the main site in a post-MU network,
// as wp-content/uploads is used there, and
// 2) we are not switched, as ms_upload_constants() hardcodes
// these constants to reflect the original blog ID.
//
// Rather than UPLOADS, we actually use BLOGUPLOADDIR if it is set, as it is absolute.
// (And it will be set, see ms_upload_constants().) Otherwise, UPLOADS can be used, as
// as it is relative to ABSPATH. For the final piece: when UPLOADS is used with ms-files
// rewriting in multisite, the resulting URL is /files. (#WP22702 for background.)
if (defined('BLOGUPLOADDIR')) {
$basedir = untrailingslashit(BLOGUPLOADDIR);
} else {
$basedir = ABSPATH . UPLOADS;
}
}
}
return $basedir;
}
示例13: icl_st_track_string
function icl_st_track_string($text, $domain, $kind = ICL_STRING_TRANSLATION_STRING_TRACKING_TYPE_PAGE)
{
if (is_multisite() && ms_is_switched()) {
return;
}
require_once dirname(__FILE__) . '/gettext/wpml-string-scanner.class.php';
static $string_scanner = null;
if (!$string_scanner) {
try {
$wp_filesystem = wp_filesystem_init();
$string_scanner = new WPML_String_Scanner($wp_filesystem);
} catch (Exception $e) {
trigger_error($e->getMessage(), E_USER_WARNING);
}
}
if ($string_scanner) {
$string_scanner->track_string($text, $domain, $kind);
}
}
示例14: tearDown
/**
* After a test method runs, reset any state in WordPress the test method might have changed.
*/
function tearDown()
{
global $wpdb, $wp_query, $wp;
$wpdb->query('ROLLBACK');
if (is_multisite()) {
while (ms_is_switched()) {
restore_current_blog();
}
}
$wp_query = new WP_Query();
$wp = new WP();
// Reset globals related to the post loop and `setup_postdata()`.
$post_globals = array('post', 'id', 'authordata', 'currentday', 'currentmonth', 'page', 'pages', 'multipage', 'more', 'numpages');
foreach ($post_globals as $global) {
$GLOBALS[$global] = null;
}
remove_theme_support('html5');
remove_filter('query', array($this, '_create_temporary_tables'));
remove_filter('query', array($this, '_drop_temporary_tables'));
remove_filter('wp_die_handler', array($this, 'get_wp_die_handler'));
$this->_restore_hooks();
wp_set_current_user(0);
}
示例15: save_post
public function save_post($post_id)
{
// We must be on the source blog.
if (ms_is_switched()) {
$this->debug('Blog is switched. Not broadcasting.');
return;
}
// Loop check.
if ($this->is_broadcasting()) {
$this->debug('Already broadcasting.');
return;
}
// We must handle this post type.
$post = get_post($post_id);
$action = new actions\get_post_types();
$action->execute();
if (!in_array($post->post_type, $action->post_types)) {
return $this->debug('We do not care about the %s post type.', $post->post_type);
}
// No post?
if (count($_POST) < 1) {
return $this->debug('No _POST available. Not broadcasting.');
}
// Does this post_id match up with the one in the post?
$_post_id = $_POST['ID'];
if (isset($_post_id)) {
if ($_post_id != $post_id) {
return $this->debug('Post ID %s does not match up with ID in POST %s.', $post_id, $_post_id);
}
}
// Is this post a child?
$broadcast_data = $this->get_post_broadcast_data(get_current_blog_id(), $post_id);
if ($broadcast_data->get_linked_parent() !== false) {
return $this->debug('Post is a child. Not broadcasting.');
}
// No permission.
if (!static::user_has_roles($this->get_site_option('role_broadcast'))) {
return $this->debug('User does not have permission to use Broadcast. Not broadcasting.');
}
// Save the user's last settings.
if (isset($_POST['broadcast'])) {
$this->save_last_used_settings($this->user_id(), $_POST['broadcast']);
}
$this->debug('We are currently on blog %s (%s).', get_bloginfo('blogname'), get_current_blog_id());
$broadcasting_data = new broadcasting_data(['parent_post_id' => $post_id]);
$this->debug('Preparing the broadcasting data.');
// This is to fetch the selected blogs from the meta box.
$action = new actions\prepare_broadcasting_data();
$action->broadcasting_data = $broadcasting_data;
$action->execute();
$this->debug('Broadcasting data prepared.');
if ($broadcasting_data->has_blogs()) {
$this->filters('threewp_broadcast_broadcast_post', $broadcasting_data);
} else {
$this->debug('No blogs are selected. Not broadcasting.');
}
}