Drakonas icon

Untitled

Drakonas | PRO | 03/12/15 11:51:26 PM UTC | 0 ⭐ | 436 👁️ | Never ⏰ | []
PHP |

870 B

|

None

|

0 👍

/

0 👎

<?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

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎