/wp-content/plugins/transposh-translation-filter-for-wordpress/widgets/flags/tpw_flags.php
PHP | 51 lines | 15 code | 7 blank | 29 comment | 0 complexity | 457da41fe4e893bc26f563abb642c97a MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, AGPL-1.0
- <?php
- /*
- Plugin Name: Flags
- Plugin URI: http://transposh.org/
- Description: Widget with flags links
- Author: Team Transposh
- Version: 1.0
- Author URI: http://transposh.org/
- License: GPL (http://www.gnu.org/licenses/gpl.txt)
- */
- /*
- * Transposh v0.8.3
- * http://transposh.org/
- *
- * Copyright 2012, Team Transposh
- * Licensed under the GPL Version 2 or higher.
- * http://transposh.org/license
- *
- * Date: Mon, 28 May 2012 14:38:35 +0300
- */
- /**
- * This function allows the widget to tell the invoker if it needs to calculate different urls per language, here it is needed
- * @return boolean
- */
- class tpw_flags extends transposh_base_widget {
- /**
- * Creates the list of flags
- * @global transposh_plugin $my_transposh_plugin
- * @param array $args - http://trac.transposh.org/wiki/WidgetWritingGuide#functiontp_widgets_doargs
- */
- static function tp_widget_do($args) {
- global $my_transposh_plugin;
- // we calculate the plugin path part, so we can link the images there
- $plugpath = parse_url($my_transposh_plugin->transposh_plugin_url, PHP_URL_PATH);
- echo "<div class=\"" . NO_TRANSLATE_CLASS . " transposh_flags\" >";
- foreach ($args as $langrecord) {
- echo "<a href=\"{$langrecord['url']}\"" . ($langrecord['active'] ? ' class="tr_active"' : '' ) . '>' .
- transposh_utils::display_flag("$plugpath/img/flags", $langrecord['flag'], $langrecord['langorig'], false) .
- "</a>";
- }
- echo "</div>";
- }
- }
- ?>