|
|
@@ -187,61 +187,6 @@ class FormatHelper extends TextHelper {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Country icons
|
|
|
- *
|
|
|
- * Custom paths possible:
|
|
|
- * 'imagePath' => 'PluginName./img/country_flags/',
|
|
|
- *
|
|
|
- * @param string $icon iso2 code (e.g. 'de' or 'gb')
|
|
|
- * @return string
|
|
|
- */
|
|
|
- public function countryIcon($icon = null, $returnFalseonFailure = false, $options = array(), $attr = array()) {
|
|
|
- $ending = 'gif';
|
|
|
- $image = 'unknown';
|
|
|
-
|
|
|
- if ($specific = Configure::read('Country.imagePath')) {
|
|
|
- list ($plugin, $specificPath) = pluginSplit($specific);
|
|
|
- $wwwPath = $specificPath;
|
|
|
- if ($plugin) {
|
|
|
- $wwwPath = '/' . Inflector::underscore($plugin) . '/' . $wwwPath;
|
|
|
- }
|
|
|
- if ($plugin) {
|
|
|
- $path = CakePlugin::path($plugin) . 'webroot' . DS;
|
|
|
- } else {
|
|
|
- $path = WWW_ROOT;
|
|
|
- }
|
|
|
- $path .= $specificPath . DS;
|
|
|
- } else {
|
|
|
- $wwwPath = '/tools/img/country_flags/';
|
|
|
- $path = App::pluginPath('Tools') . 'webroot' . DS . 'img' . DS . 'country_flags' . DS;
|
|
|
- }
|
|
|
-
|
|
|
- if (!empty($options) && is_array($options)) {
|
|
|
- if (!empty($options['ending'])) {
|
|
|
- $ending = $options['ending'];
|
|
|
- }
|
|
|
- }
|
|
|
- $icon = mb_strtolower($icon);
|
|
|
-
|
|
|
- if (empty($icon)) {
|
|
|
- if ($returnFalseonFailure) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- } elseif (!file_exists($path . $icon . '.' . $ending)) {
|
|
|
-
|
|
|
- //die($path . $icon . '.' . $ending);
|
|
|
- trigger_error($path . $icon . '.' . $ending . ' missing', E_USER_NOTICE);
|
|
|
-
|
|
|
- if ($returnFalseonFailure) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- } else {
|
|
|
- $image = $icon;
|
|
|
- }
|
|
|
- return $this->Html->image($wwwPath . $image . '.' . $ending, $attr);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
* @return string
|
|
|
*/
|
|
|
public function importantIcon($icon, $value) {
|
|
|
@@ -1061,54 +1006,6 @@ class FormatHelper extends TextHelper {
|
|
|
public function profilePic($uid, $e, $rights = null) {
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * FormatHelper::languageFlag()
|
|
|
- *
|
|
|
- * @param mixed $iso2
|
|
|
- * @param mixed $options
|
|
|
- * @return string
|
|
|
- */
|
|
|
- public function languageFlag($iso2, $options = array()) {
|
|
|
- $flag = '';
|
|
|
-
|
|
|
- $defaults = array('alt' => $iso2, 'title' => strtoupper($iso2));
|
|
|
- $options = array_merge($defaults, $options);
|
|
|
-
|
|
|
- $flag .= $this->Html->image('language_flags/' . strtolower($iso2) . '.gif', $options);
|
|
|
- return $flag;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * FormatHelper::countryAndProvince()
|
|
|
- *
|
|
|
- * @param mixed $array
|
|
|
- * @param mixed $options
|
|
|
- * @return string
|
|
|
- */
|
|
|
- public function countryAndProvince($array, $options = array()) {
|
|
|
- $res = '<span class="help" title="%s">%s</span>';
|
|
|
-
|
|
|
- $countryTitle = '';
|
|
|
- if (!empty($array['Country']['name'])) {
|
|
|
- $country = $array['Country']['iso2'];
|
|
|
- $countryTitle .= h($array['Country']['name']) . '';
|
|
|
- } else {
|
|
|
- $country = '';
|
|
|
- }
|
|
|
-
|
|
|
- if (!empty($array['CountryProvince']['name'])) {
|
|
|
- $countyProvince = h($array['CountryProvince']['abbr']);
|
|
|
- $countryTitle .= (!empty($countryTitle) ? ' - ' : '') . h($array['CountryProvince']['name']);
|
|
|
- } else {
|
|
|
- $countyProvince = '';
|
|
|
- $countryTitle .= '';
|
|
|
- }
|
|
|
-
|
|
|
- $content = $this->countryIcon($country) . ' ' . $countyProvince;
|
|
|
- $res = sprintf($res, $countryTitle, $content);
|
|
|
- return $res;
|
|
|
- }
|
|
|
-
|
|
|
//deprecated?
|
|
|
|
|
|
public function avatar($setting, $uid, $email = null, $options = array()) {
|