/**
 		@brief		Return the admin scripts object.
 		@details	The object is simply a collection.
 		@since		2014-12-03 19:04:16
 	**/
 public function admin_scripts()
 {
     if (!isset($this->__admin_scripts)) {
         $this->__admin_scripts = ThreeWP_Broadcast()->collection();
     }
     return $this->__admin_scripts;
 }
Example #2
0
 public function handle_blog_and_post_id($o)
 {
     $blog_id = intval($o->inputs->blog_id->get_value());
     $post_id = intval($o->inputs->post_id->get_value());
     if ($blog_id < 1) {
         $blog_id = get_current_blog_id();
     }
     $bcd = ThreeWP_Broadcast()->get_post_broadcast_data($blog_id, $post_id);
     $text = sprintf('<pre>%s</pre>', var_export($bcd, true));
     $o->r .= $this->broadcast()->message($text);
 }
 /**
 		@brief		Constructor.
 		@details
 
 		If you're broadcasting something related to a current broadcast (a post that refers to another post in an ACF relationship field, for example),
 		give the original broadcasting_data object as the parameter in order to inherit all the settings.
 
 		@since		2015-06-16 21:51:44
 	**/
 public function __construct($options = [])
 {
     $options = (array) $options;
     // Import any known values from the options object.
     foreach ($options as $key => $value) {
         if (property_exists($this, $key)) {
             $this->{$key} = $value;
         }
     }
     // The custom fields object should be cloned.
     if (isset($options['custom_fields'])) {
         if (is_object($this->custom_fields)) {
             $this->custom_fields = clone $options['custom_fields'];
         }
     }
     if (!$this->parent_post_id) {
         throw new Exception('Specify the parent post ID property when creating the broadcasting_data object.');
     }
     if ($this->equivalent_posts === null) {
         $this->equivalent_posts = new equivalent_posts();
     }
     if ($this->_POST === null) {
         $this->_POST = $_POST;
     }
     if ($this->parent_blog_id === null) {
         $this->parent_blog_id = get_current_blog_id();
     }
     switch_to_blog($this->parent_blog_id);
     if ($this->post === null) {
         $this->post = get_post($this->parent_post_id);
     }
     if ($this->upload_dir === null) {
         $this->upload_dir = wp_upload_dir();
     }
     $this->post_type_object = get_post_type_object($this->post->post_type);
     $this->post_type_supports_thumbnails = post_type_supports($this->post->post_type, 'thumbnail');
     //$this->post_type_supports_custom_fields = post_type_supports( $this->post->post_type, 'custom-fields' );
     $this->post_type_supports_custom_fields = true;
     $this->post_type_is_hierarchical = $this->post_type_object->hierarchical;
     if ($this->meta_box_data === null) {
         $this->meta_box_data = ThreeWP_Broadcast()->create_meta_box($this->post);
         // Allow plugins to modify the meta box with their own info.
         $action = new actions\prepare_meta_box();
         $action->meta_box_data = $this->meta_box_data;
         $action->execute();
     }
     // Post the form.
     if (!$this->meta_box_data->form->has_posted) {
         $this->meta_box_data->form->post()->use_post_values();
     }
     restore_current_blog();
     // Clear the blogs, in case we were given a broadcasting_data object as a parameter.
     $this->blogs = new blog_collection();
 }
 public function remove_premium_pack_info_menu()
 {
     ThreeWP_Broadcast()->menu_page()->forget('threewp_broadcast_premium_pack_info');
 }
Example #5
0
 public static function store_container()
 {
     return ThreeWP_Broadcast();
 }
Example #6
0
 /**
 		@brief		This overrides the SDK's load language in order to load all of the pack plugin translations from a single file.
 		@details	A note about translations.
 
 					Note that if you're trying to call the _ functions of, say, the meta box, the _() function that will be called will be that of Broadcast, not of this plugin.
 
 					So instead of writing:
 
 					$mbd->lock_post = $form->checkbox( 'lock_post' )
 						->label_( 'Lock the post' )
 
 					You have to ask the plugin itself to translate the string first, before it is given to the form:
 
 					$mbd->lock_post = $form->checkbox( 'lock_post' )
 						->label( $this->_( 'Lock the post' ) )
 
 
 		@since		2015-10-03 15:32:24
 	**/
 public function load_language($domain = '')
 {
     $this->language_domain = 'Broadcast_Pack';
     $directory = ThreeWP_Broadcast()->paths('path_from_plugin_directory') . '/src/premium_pack/lang/';
     // Allow people to load their own pot files.
     $directory = apply_filters('Broadcast_Pack_language_directory', $directory);
     load_plugin_textdomain($this->language_domain, false, $directory);
 }
 /**
 		@brief		Constructor.
 		@since		2014-10-31 13:20:10
 	**/
 public function _construct()
 {
     $this->actions = ThreeWP_Broadcast()->collection();
 }
 /**
 		@brief		All official BC plugin packs have one EDD url.
 		@since		2015-10-29 12:18:23
 	**/
 public function edd_get_url()
 {
     return ThreeWP_Broadcast()->plugin_pack()->edd_get_url();
 }
Example #9
0
 /**
 		@brief		Convenience method to return an array of blog IDs on which the post has children.
 		@since		2015-06-25 16:32:56
 	**/
 private function _get_post_children($post_id)
 {
     $r = [];
     // Retrieve the broadcast_data of this post.
     $broadcast_data = ThreeWP_Broadcast()->get_post_broadcast_data(get_current_blog_id(), $post_id);
     if (!$broadcast_data->has_linked_children()) {
         return $r;
     }
     foreach ($broadcast_data->get_linked_children() as $child_blog_id => $child_post_id) {
         $r[] = $child_blog_id;
     }
     return $r;
 }