Overview
Comment:Donner l'URL vers un plugin
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e57c4023d7e180a6d4153143df0a1319ba3601e2
User & Date: bohwaz on 2014-03-21 03:45:09
Other Links: manifest | tags
Context
2014-03-21
04:15
Affichage partie admin/privée des plugins check-in: 514f512510 user: bohwaz tags: trunk
03:45
Donner l'URL vers un plugin check-in: e57c4023d7 user: bohwaz tags: trunk
03:44
rendre publique ces méthodes bien utiles check-in: 9e037ff854 user: bohwaz tags: trunk
Changes

Modified src/include/lib.template.php from [63482205cb] to [24cd7e84eb].

505
506
507
508
509
510
511


512
513
514
515
516
517
518
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520







+
+








$tpl->register_function('format_droits', 'Garradin\tpl_format_droits');

$tpl->register_function('pagination', 'Garradin\tpl_pagination');

$tpl->register_function('diff', 'Garradin\tpl_diff');
$tpl->register_function('html_champ_membre', 'Garradin\tpl_html_champ_membre');

$tpl->register_function('plugin_url', ['Garradin\utils', 'plugin_url']);

$tpl->register_modifier('get_country_name', ['Garradin\utils', 'getCountryName']);
$tpl->register_modifier('format_tel', 'Garradin\tpl_format_tel');
$tpl->register_modifier('format_wiki', 'Garradin\tpl_format_wiki');
$tpl->register_modifier('liens_wiki', 'Garradin\tpl_liens_wiki');
$tpl->register_modifier('escape_money', 'Garradin\escape_money');
$tpl->register_modifier('html_money', 'Garradin\tpl_html_money');
541
542
543
544
545
546
547
548
549
550





551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
543
544
545
546
547
548
549



550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567


568
569
570
571







-
-
-
+
+
+
+
+













-
-




        return implode(', ', $out);
    } else {
        return $v;
    }

});

$tpl->register_modifier('format_sqlite_date_to_french', function ($d) {
    if (strlen($d) == 10)
        return \DateTime::createFromFormat('Y-m-d', $d)->format('d/m/Y');
$tpl->register_modifier('format_sqlite_date_to_french', function ($d, $short = false) {
    if (strlen($d) == 10 || $short)
        return \DateTime::createFromFormat('Y-m-d', substr($d, 0, 10))->format('d/m/Y');
    elseif (strlen($d) == 16)
        return \DateTime::createFromFormat('Y-m-d H:i', $d)->format('d/m/Y H:i');
    else
        return \DateTime::createFromFormat('Y-m-d H:i:s', $d)->format('d/m/Y H:i');
});

$tpl->register_modifier('format_bytes', function ($size) {
    if ($size > (1024 * 1024))
        return round($size / 1024 / 1024, 2) . ' Mo';
    elseif ($size > 1024)
        return round($size / 1024, 2) . ' Ko';
    else
        return $size . ' ob_get_contents(oid)';
});

//$tpl->register_modifier('retard_cotisation', array('Membres', 'checkCotisation'));

$tpl->register_modifier('strftime_fr', 'Garradin\tpl_strftime_fr');
$tpl->register_modifier('date_fr', 'Garradin\tpl_date_fr');

?>

Modified src/include/lib.utils.php from [e9a05b7ff3] to [e305029466].

593
594
595
596
597
598
599
600



























593
594
595
596
597
598
599

600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626







-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
        }

        $dir->close();
        rmdir($path);

        return true;
    }
}

    static public function plugin_url($params)
    {
        if (!defined('Garradin\PLUGIN_URL'))
        {
            $url = WWW_URL . 'admin/plugin/' . $params['id'] . '/';
        }
        else
        {
            $url = PLUGIN_URL;
        }

        if (!empty($params['file']))
            $url .= $params['file'];

        if (!empty($params['query']))
        {
            $url .= '?';
            
            if (!(is_numeric($params['query']) && (int)$params['query'] === 1) && $params['query'] !== true)
                $url .= $params['query'];
        }

        return $url;
    }

}