/**
  * build one of jobs, with line
  *
  * @test
  */
 public function the_content_04()
 {
     $url = 'https://travis-ci.org/KamataRyo/inherit-theme-mods/jobs/130318268#L145';
     $noscript = Travis::get_noscript($url);
     $editor_label = Travis::get_editor_label();
     $this->setup_postdata(array('post_content' => $url));
     $this->expectOutputString('<div id="jobs-130318268-L145" class="oembed-travis" data-url="' . $url . '" data-author="KamataRyo" data-repo="inherit-theme-mods" data-jobs="130318268" data-line="145">' . $editor_label . $noscript . '</div>' . "\n");
     the_content();
 }
Esempio n. 2
0
 public function shortcode($p)
 {
     // parse required attributes.
     // One of two are required
     if (isset($p['builds']) && $p['builds']) {
         $type = 'builds';
         $id = $p['builds'];
     } elseif (isset($p['jobs']) && $p['jobs']) {
         $type = 'jobs';
         $id = $p['jobs'];
     } else {
         return is_feed() ? '' : self::get_embed_failure();
     }
     if (!self::is_positive_int($id)) {
         return is_feed() ? '' : self::get_embed_failure();
     }
     $html_id = "{$type}-{$id}";
     // parse optional attributes
     $url = NULL;
     if (isset($p['url']) && $p['url']) {
         $url = $p['url'];
     }
     $author = NULL;
     if (isset($p['author']) && $p['author']) {
         $author = $p['author'];
     }
     $repo = NULL;
     if (isset($p['repo']) && $p['repo']) {
         $repo = $p['repo'];
     }
     $line = NULL;
     $line_hash = '';
     if (isset($p['line']) && $p['line']) {
         $line = $p['line'];
         if (!self::is_positive_int($line)) {
             return is_feed() ? '' : self::get_embed_failure();
         }
         $html_id .= "-L{$line}";
         $line_hash = "#L{$line}";
     }
     $noscript = Travis::get_noscript($url);
     $admin_label = Travis::get_editor_label();
     return is_feed() ? $noscript : Travis::create_tag('div', array('id' => $html_id, 'class' => 'oembed-travis', 'data-url' => $url, 'data-author' => $author, 'data-repo' => $repo, "data-{$type}" => $id, 'data-line' => $line), $admin_label . $noscript);
     # xss ok
 }