Inpsyde\MultilingualPress\Factory\NonceFactory::create PHP Метод

create() публичный Метод

Returns a new nonce object, instantiated with the given arguments.
С версии: 3.0.0
public create ( array $args = [], string $class = '' ) : Inpsyde\MultilingualPress\Common\Nonce\Nonce
$args array Optional. Constructor arguments. Defaults to empty array.
$class string Optional. Fully qualified class name. Defaults to empty string.
Результат Inpsyde\MultilingualPress\Common\Nonce\Nonce Nonce object.
    public function create(array $args = [], $class = '');

Usage Example

 /**
  * Register one box for each connected site.
  *
  * @param int     $blog_id
  * @param WP_Post $post
  *
  * @return void
  */
 private function register_metabox_per_language($blog_id, WP_Post $post)
 {
     $remote_post = $this->data->get_remote_post($post, $blog_id);
     $lang = $this->data->get_remote_language($blog_id);
     $title = $this->get_metabox_title($blog_id, $remote_post, $lang);
     $metabox_data = ['remote_blog_id' => $blog_id, 'remote_post' => $remote_post, 'language' => $lang];
     $view = new Mlp_Translation_Metabox_View($this->nonce_factory->create(["save_translation_of_post_{$post->ID}_for_site_{$blog_id}"]));
     add_meta_box("inpsyde_multilingual_{$blog_id}", $title, [$view, 'render'], null, 'advanced', 'default', $metabox_data);
     if (empty($remote_post->dummy)) {
         $this->register_metabox_view_details($view, $post, $blog_id);
     } else {
         $callback = [$view, 'show_translation_checkbox'];
         /**
          * Filter the post translator activation checkbox callback.
          *
          * @param array|string $callback Callback name or class-method array.
          */
         $checkbox_callback = apply_filters('mlp_post_translator_activation_checkbox', $callback);
         if ($checkbox_callback) {
             add_action("mlp_translation_meta_box_top_{$blog_id}", $checkbox_callback, 10, 3);
         }
     }
     /**
      * Runs after registration of the meta box for the given blog's language.
      *
      * @param WP_Post $post    Post object.
      * @param int     $blog_id Blog ID.
      */
     do_action('mlp_translation_meta_box_registered', $post, $blog_id);
 }
All Usage Examples Of Inpsyde\MultilingualPress\Factory\NonceFactory::create
NonceFactory