public static function add_single_video_data(&$json_data, $opts, $prefix = 'og:video', $list_element = true) { $wpsso =& Wpsso::get_instance(); if (empty($opts) || !is_array($opts)) { if ($wpsso->debug->enabled) { $wpsso->debug->log('exiting early: options array is empty or not an array'); } return 0; // return count of videos added } $media_url = SucomUtil::get_mt_media_url($opts, $prefix); if (empty($media_url)) { if ($ngfb->debug->enabled) { $ngfb->debug->log('exiting early: ' . $prefix . ' URL values are empty'); } return 0; // return count of videos added } $ret = array('@context' => 'https://schema.org', '@type' => 'VideoObject', 'url' => esc_url($media_url)); WpssoSchema::add_data_itemprop_from_assoc($ret, $opts, array('name' => $prefix . ':title', 'description' => $prefix . ':description', 'fileFormat' => $prefix . ':type', 'width' => $prefix . ':width', 'height' => $prefix . ':height', 'duration' => $prefix . ':duration', 'uploadDate' => $prefix . ':upload_date', 'thumbnailUrl' => $prefix . ':thumbnail_url', 'embedUrl' => $prefix . ':embed_url')); if (!empty($opts[$prefix . ':has_image'])) { if (!WpssoSchema::add_single_image_data($ret['thumbnail'], $opts, 'og:image', false)) { // list_element = false unset($ret['thumbnail']); } } if (empty($list_element)) { $json_data = $ret; } else { $json_data[] = $ret; } // add an item to the list return 1; // return count of videos added }