add_metadata() public méthode

Add metadata to the MIME request.
public add_metadata ( mixed $meta ) : string
$meta mixed
Résultat string
Exemple #1
0
 /**
  * Parses the API response and checks for errors.
  * TODO The exporter has an abstracted article class. Should we have
  * something similar here? That way this method could live there.
  *
  * @param string $article
  * @param array $bundles
  * @param array $meta
  * @return string
  * @since 0.2.0
  */
 private function build_content($article, $bundles = array(), $meta = null)
 {
     $bundles = array_unique($bundles);
     $content = '';
     if ($meta) {
         $content .= $this->mime_builder->add_metadata($meta);
     }
     $content .= $this->mime_builder->add_json_string('my_article', 'article.json', $article);
     foreach ($bundles as $bundle) {
         $content .= $this->mime_builder->add_content_from_file($bundle);
     }
     $content .= $this->mime_builder->close();
     return $content;
 }
 /**
  * Parses the API response and checks for errors.
  * TODO The exporter has an abstracted article class. Should we have
  * something similar here? That way this method could live there.
  *
  * @param string $article
  * @param array $bundles
  * @param array $meta
  * @return string
  * @since 0.2.0
  */
 private function build_content($article, $bundles = array(), $meta = null)
 {
     $bundles = array_unique($bundles);
     $content = '';
     // Add custom meta for request.
     $meta = apply_filters('apple_news_api_post_meta', $meta);
     if ($meta) {
         $content .= $this->mime_builder->add_metadata($meta);
     }
     $content .= $this->mime_builder->add_json_string('my_article', 'article.json', $article);
     foreach ($bundles as $bundle) {
         $content .= $this->mime_builder->add_content_from_file($bundle);
     }
     $content .= $this->mime_builder->close();
     return $content;
 }