PageRenderTime 30ms CodeModel.GetById 5ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-content/plugins/transposh-translation-filter-for-wordpress/widgets/flags/tpw_flags.php

https://bitbucket.org/lgorence/quickpress
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
  1. <?php
  2. /*
  3. Plugin Name: Flags
  4. Plugin URI: http://transposh.org/
  5. Description: Widget with flags links
  6. Author: Team Transposh
  7. Version: 1.0
  8. Author URI: http://transposh.org/
  9. License: GPL (http://www.gnu.org/licenses/gpl.txt)
  10. */
  11. /*
  12. * Transposh v0.8.3
  13. * http://transposh.org/
  14. *
  15. * Copyright 2012, Team Transposh
  16. * Licensed under the GPL Version 2 or higher.
  17. * http://transposh.org/license
  18. *
  19. * Date: Mon, 28 May 2012 14:38:35 +0300
  20. */
  21. /**
  22. * This function allows the widget to tell the invoker if it needs to calculate different urls per language, here it is needed
  23. * @return boolean
  24. */
  25. class tpw_flags extends transposh_base_widget {
  26. /**
  27. * Creates the list of flags
  28. * @global transposh_plugin $my_transposh_plugin
  29. * @param array $args - http://trac.transposh.org/wiki/WidgetWritingGuide#functiontp_widgets_doargs
  30. */
  31. static function tp_widget_do($args) {
  32. global $my_transposh_plugin;
  33. // we calculate the plugin path part, so we can link the images there
  34. $plugpath = parse_url($my_transposh_plugin->transposh_plugin_url, PHP_URL_PATH);
  35. echo "<div class=\"" . NO_TRANSLATE_CLASS . " transposh_flags\" >";
  36. foreach ($args as $langrecord) {
  37. echo "<a href=\"{$langrecord['url']}\"" . ($langrecord['active'] ? ' class="tr_active"' : '' ) . '>' .
  38. transposh_utils::display_flag("$plugpath/img/flags", $langrecord['flag'], $langrecord['langorig'], false) .
  39. "</a>";
  40. }
  41. echo "</div>";
  42. }
  43. }
  44. ?>