<?php
/*
Description: FF XIV Item Link
Shortcode: [14item itemname="name"]
*/
// Returns a well formed XIVDB Link
function xivdb_link($Page, $Arguments = NULL)
{
$Link = "http://xivdb.com/?". strtolower($Page);
if ($Arguments && is_array($Arguments))
{
$i = 0;
foreach($Arguments as $A)
{
$Arguments[$i] = str_ireplace(" ", "-", $A);
$i++;
}
if ($Arguments) { $Link .= '/'. implode("/", $Arguments); }
}
return $Link;
}
// Obtain the array: [MD] => ID
$itemids = json_decode(file_get_contents("items.json"), true);
// Format the item name from Lodestone into MD5
$mdname = md5(strtolower($itemname));
// Get the real id that can be used for XIVDB
$realid = $itemids[$mdname];
echo '<a href="'. xivdb_link('item', [$realid, $itemname]) . '">'. $itemname .'</a>';
?>
Comments
0 B
|👍
/👎