document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. <?php
  2. private function _meta($type,$props,$variation=false) {
  3.     $fields = array();
  4.  
  5.     switch ($type) {
  6.       case "product":
  7.         $_attributes = [
  8.           "MyCustomAttribute"  => [
  9.             "name"          => "MyCustomAttribute",
  10.             "value"         => "The Value",
  11.             "position"      => 1,
  12.             "is_visible"    => 0,
  13.             "is_variation"  => 0,
  14.             "is_taxanomy"   => 0
  15.           ]
  16.         }
  17.         $fields = array(
  18.           "algolia_posts_product_records_count" => 1,
  19.           "_sku"                                  => $props["sku"],
  20.           "_sale_price_dates_from"              => "",
  21.           "_sale_price_dates_to"                => "",
  22.           "total_sales"                         => 0,
  23.           "_tax_status"                         => "taxable",
  24.           "_tax_class"                          => "",
  25.           "_manage_stock"                       => "no",
  26.           "_backorders"                         => "no",
  27.           "_sold_individually"                  => "no",
  28.           "_weight"                             => "",
  29.           "_length"                             => "",
  30.           "_width"                              => "",
  31.           "_height"                             => "",
  32.           "_upsell_ids"                         => "a:0:{}",
  33.           "_crosssell_ids"                      => "a:0:{}",
  34.           "_purchase_note"                      => "",
  35.           "_default_attributes"                 => "a:0:{}",
  36.           "_virtual"                            => "no",
  37.           "_downloadable"                       => "no",
  38.           "_product_image_gallery"              => "",
  39.           "_download_limit"                     => "0",
  40.           "_download_expiry"                    => "0",
  41.           "_thumbnail_id"                       => $props["attachment_id"],
  42.           "_low_stock_amount"                   => "",
  43.           "_stock"                              => null,
  44.           "_stock_status"                       => "instock",
  45.           "_wc_average_rating"                  => $props["_wc_average_rating"],
  46.           "_wc_rating_count"                    => "1",
  47.           "_wc_review_count"                    => "1",
  48.           "_downloadable_files"                 => "a:0:{}",
  49.           "_product_attributes"                 => serialize($_attributes),
  50.           "_product_version"                    => "3.5.7",
  51.           "_price"                              => $props["sale_price"],
  52.           "_regular_price"                      => $props["regular_price"],
  53.           "_sale_price"                         => $props["sale_price"],
  54.           "_edit_lock"                          => "",
  55.           "_sold_individually"                  => "no"
  56.         );
  57.         if ($variation) $fields["_default_attributes"] = serialize(["variant"=>$props["variant"]]);
  58.         break;
  59.       case "variant":
  60.         $fields = array(
  61.           "_variation_description"  => "",
  62.           "_sku"                    => "",
  63.           "_regular_price"          => $props["regular_price"],
  64.           "_sale_price"             => $props["sale_price"],
  65.           "_sale_price_dates_from"  => "",
  66.           "_sale_price_dates_to"    => "",
  67.           "total_sales"             => "0",
  68.           "_tax_status"             => "taxable",
  69.           "_tax_class"              => "parent",
  70.           "_manage_stock"           => "no",
  71.           "_backorders"             => "no",
  72.           "_sold_individually"      => "no",
  73.           "_weight"                 => "",
  74.           "_length"                 => "",
  75.           "_width"                  => "",
  76.           "_height"                 => "",
  77.           "_upsell_ids"             => "a:0:{}",
  78.           "_crosssell_ids"          => "a:0:{}",
  79.           "_purchase_note"          => "",
  80.           "_default_attributes"     => "a:0:{}",
  81.           "_virtual"                => "no",
  82.           "_downloadable"           => "no",
  83.           "_product_image_gallery"  => "",
  84.           "_download_limit"         => "0",
  85.           "_download_expiry"        => "0",
  86.           "_thumbnail_id"           => $props["_thumbnail_id"],
  87.           "_low_stock_amount"       => "",
  88.           "_stock"                  => null,
  89.           "_stock_status"           => "instock",
  90.           "_wc_average_rating"      => "0",
  91.           "_wc_rating_count"        => "a:0:{}",
  92.           "_wc_review_count"        => "0",
  93.           "_downloadable_files"     => "a:0:{}",
  94.           "attribute_variant"       => $props["variant"],
  95.           "_price"                  => $props["sale_price"],
  96.           "_product_version"        => "3.5.7"
  97.         );
  98.         break;
  99.       case "attachment":
  100.         $file = sprintf(\'%d/%d/%s\',date(\'Y\'),date(\'m\'),$props["image"]."jpg");
  101.         $data = [
  102.           "width"     => 1,
  103.           "height"    => 1,
  104.           "file"      => $file,
  105.           "meta_data" => [
  106.             "aperture"          => "0",
  107.             "credit"            => "",
  108.             "camera"            => "",
  109.             "caption"           => "",
  110.             "created_timestamp" => "0",
  111.             "copyright"         => "",
  112.             "focal_length"      => "0",
  113.             "iso"               => "0",
  114.             "shutter_speed"     => "0",
  115.             "title"             => "",
  116.             "orientation"       => "0"
  117.           ]
  118.         ];
  119.         $fields = array(
  120.           "_wp_attached_file"       => $file,
  121.           "_wp_attachment_metadata" => serialize($data),
  122.           "_wc_attachment_source"   => $props["url"]
  123.         );
  124.         break;
  125.     }
  126.  
  127.     return $fields;
  128. }
  129. ?>
');