1. PHP / Говнокод #17091

    +156

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    // Real itemid is "contained" in public itemid in a bit tricky way. The formula is:
    
    public_itemid = itemid * 256 + anum
    
    // Quite easy, isn't it? Except where to get that anum. anum is some number assigned when you create a new post in LJ.
    
    // But in fact, you don't need it. Because it is always less than 256, we can avoid searching for it, and just use simple Math to find itemid.
    
    $anum = $public_itemid - floor($public_itemid / 256) * 256;
    $itemid = ($public_itemid - $anum) / 256;

    Прекрасный подход, то место, где вордпресс и ЖЖ сошлись воедино.

    http://drumrock.skipitnow.org/livejournal-tools/itemid/

    Запостил: Fike, 10 Ноября 2014

    Комментарии (1) RSS

    Добавить комментарий