public function testvideoinfo() { $u = "http://openapi.youku.com/v2/shows/videos.json?client_id=ce905694ae10ccab&show_id=z0375f6ec568a11e4a080"; //videoinfo($u); assertEqual("ssss", videoinfo($u)); }
<div id="logo"> <h1><a href="#">Luying</a></h1> <span>cs242 Final Project</span> </div> <div id="menu"> <ul> <li ><a href="index.php" accesskey="1" title="">Homepage</a></li> <li class="current_page_item"><a href="info.php" accesskey="1" title="">Currently Watching Info</a></li> </div> </div> <div id="main"> <h1>Info Page</h1> <div id="featured"> <div> <?php include 'parse.php'; //get id from the info.php $newid = $_GET['id']; $vid = $_GET['show_id']; showinfo('http://api.douban.com/v2/movie/subject/' . $newid); videoinfo('http://openapi.youku.com/v2/shows/videos.json?client_id=ce905694ae10ccab&show_id=' . $vid); ?> </div> </div> </div> </div> </body> </html>
function get_single_table_values($fields) { // extraction des champs/valeurs d'une page global $post; $id = $post->ID; $data = array(); // source : inc-table.php if (array_search('id', $fields) !== false) { $data['id'] = $id; } if (array_search('title', $fields) !== false) { $data['title'] = get_the_title(); } if (array_search('abrege', $fields) !== false) { $data['abrege'] = get_field('abrege', $id); } if (array_search('couleur', $fields) !== false) { $data['couleur'] = get_field('couleur'); } if (array_search('link', $fields) !== false) { $data['link'] = get_permalink(); } if (array_search('link-base', $fields) !== false) { $data['link-base'] = basename(get_permalink()); } if (array_search('status', $fields) !== false) { $data['status'] = get_post_status(); } if (array_search('position', $fields) !== false) { // l'array position brut $pos = get_post_meta(get_the_ID(), 'table_position', true); if (!$pos) { $pos = [1, 1, 1]; } $data['position'] = $pos; } if (array_search('position-details', $fields) !== false) { // les paramètres séparés $pos = get_post_meta(get_the_ID(), 'table_position', true); if (!$pos) { $pos = [1, 1, 1]; } $data['top'] = $pos[0]; $data['left'] = $pos[1]; $data['scale'] = $pos[2]; } if (array_search('elements', $fields) !== false) { $elmts_ = get_post_meta(get_the_ID(), 'elements', true); $elmts = []; // il faut ajouter les détails de chaque élément foreach ($elmts_ as $elmt) { $id = $elmt['id']; // depuis /themes/.../functions.php $elmt['abrege'] = get_field('abrege', $id); $elmt['type'] = get_field('type', $id); $elmt['date'] = get_field('annee', $id); $elmt['legende'] = $legende = fabriqueLegende($id); if ($elmt['type'] != "") { if ($elmt['type'] == 'image') { $imageInfos = get_field('image', $id); $elmt['src_medium'] = $imageInfos['sizes']['medium']; $elmt['src_large'] = $imageInfos['sizes']['large']; $elmt['src_full'] = $imageInfos[url]; // champs inutiles unset($elmt['fontSize']); unset($elmt['lineHeight']); unset($elmt['ombre']); } else { if ($elmt['type'] == 'video') { $videoUrl = get_field('vid_url', $id); $video = videoinfo($videoUrl); $elmt['video'] = $video; // ['iframe'=>url, 'thumb'=>...] } } } $elmts[] = $elmt; } $data['elements'] = $elmts; } if (array_search('notes', $fields) !== false) { $data['notes'] = get_post_meta(get_the_ID(), 'notes', true); } if (array_search('lignes', $fields) !== false) { $data['lignes'] = get_post_meta(get_the_ID(), 'lignes', true); } if (array_search('author-id', $fields) !== false) { $data['author-id'] = get_the_author_id(); } if (array_search('author-name', $fields) !== false) { $data['author-name'] = get_the_author(); } // + de détails sur l'auteur : status, level, etc // https://codex.wordpress.org/Function_Reference/get_the_author_meta return $data; }