示例#1
0
    /**
     * @covers Geissler\CSL\Data\Abbreviation::set
     * @covers Geissler\CSL\Data\Abbreviation::get
     */
    public function testGet()
    {
        $json = '{
    "default": {
        "container-title": {
            "Journal of Irreproducible Results": "J. Irrep. Res."
        }
    }
}';
        $this->assertInstanceOf($this->class, $this->object->set($json));
        $this->assertEquals('J. Irrep. Res.', $this->object->get('container-title', 'Journal of Irreproducible Results'));
    }
 /**
  * Parse the shortcode and render as a string, probably with a template
  * @param array $arguments the list of attributes of the shortcode
  * @param string $content the shortcode content
  * @param ShortcodeParser $parser the ShortcodeParser instance
  * @param string $shortcode the raw shortcode being parsed
  * @return String
  **/
 public static function parse_shortcode($arguments, $content, $parser, $shortcode)
 {
     if (empty($arguments['id'])) {
         return;
     }
     if (array_key_exists('id', $arguments) && $arguments['id']) {
         $abbreviation = Abbreviation::get()->byID($arguments['id']);
     }
     if (!$abbreviation) {
         return;
     }
     if (array_key_exists('title', $arguments) && $arguments['title']) {
         $abbreviation->Title = $arguments['title'];
     }
     $template = new SSViewer('AbbreviationShortcode');
     return $template->process($abbreviation);
 }
 public function getItems()
 {
     return Abbreviation::get()->sort('Title');
 }