Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial checkin of functional script
- Loading branch information
0 parents
commit 4e757f8
Showing
5 changed files
with
298 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*v1.0* (2010-07-06) | ||
|
||
* Initial script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2010 Aaron Gustafson (http://easy-designs.net) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
== ft.easy_language_select.php | ||
|
||
Language dropdown for ExpressionEngine using FieldFrame. | ||
|
||
== Current Version | ||
|
||
1.0 (6 July 2010) | ||
|
||
== Requirements | ||
|
||
FieldFrame | ||
|
||
== License | ||
|
||
ft.easy_language_select.php is distributed under the liberal MIT License. |
125 changes: 125 additions & 0 deletions
125
system/extensions/fieldtypes/easy_language_select/ft.easy_language_select.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
<?php | ||
|
||
if ( ! defined('EXT')) exit('Invalid file request'); | ||
|
||
|
||
/** | ||
* Easy Language Select FieldFrame Class | ||
* | ||
* @package Easy Language Select | ||
* @author Aaron Gustafson <aaron@easy-designs.net> | ||
* @copyright Copyright (c) 2010 Aaron Gustafson | ||
* @license MIT | ||
*/ | ||
class Easy_language_select extends Fieldframe_Multi_Fieldtype { | ||
|
||
/** | ||
* Fieldtype Info | ||
* @var array | ||
*/ | ||
var $info = array( | ||
'name' => 'Easy Language Select', | ||
'version' => '1.0.0', | ||
'desc' => 'A language drop-down list built upon EE\'s internal language selector', | ||
'docs_url' => '', | ||
'versions_xml_url' => '' | ||
); | ||
|
||
/** | ||
* Displays the field settings form. | ||
* @param array $field_settings Previously-saved field settings. | ||
* @return array An associative array. | ||
*/ | ||
function display_field_settings( $field_settings ) | ||
{ | ||
$SD = new Fieldframe_SettingsDisplay(); | ||
|
||
$r = $SD->block() . | ||
$SD->row( array( | ||
$SD->label('translate_languages'), | ||
$SD->radio_group('localize', 'y', array('n' => 'no', 'y' => 'yes')) | ||
) ) . | ||
$SD->block_c(); | ||
|
||
// Set our return data. | ||
return array( | ||
'cell1' => '', | ||
'cell2' => $r, | ||
'formatting_available' => FALSE, | ||
'direction_available' => FALSE | ||
); | ||
} | ||
|
||
/** | ||
* Display Field | ||
* | ||
* @param string $field_name The field's name | ||
* @param mixed $field_data The field's current value | ||
* @param array $field_settings The field's settings | ||
* @return string The field's HTML | ||
*/ | ||
function display_field($field_name, $field_data, $field_settings) | ||
{ | ||
global $DSP, $PREFS, $FNS, $LANG; | ||
$LANG->fetch_language_file(strtolower(__CLASS__)); | ||
|
||
if ( empty( $field_data ) ) $field_data = $PREFS->ini('xml_lang'); | ||
|
||
$file = PATH.'lib/languages'.EXT; | ||
if ( ! file_exists($file) ) return FALSE; | ||
include($file); | ||
|
||
$r = $DSP->input_select_header($field_name); | ||
foreach ( $languages as $key => $val ) | ||
{ | ||
$localized = $LANG->line($key); | ||
if ( $field_settings['localize'] == 'y' && | ||
$PREFS->ini('xml_lang') != $val && | ||
! empty( $localized ) ) $key = "{$localized} ({$key})"; | ||
$r .= $DSP->input_select_option( $val, $key, ($field_data == $val) ? 1 : ''); | ||
} | ||
$r .= $DSP->input_select_footer(); | ||
|
||
return $r; | ||
} | ||
|
||
/** | ||
* Display Cell | ||
* | ||
* @param string $cell_name The cell's name | ||
* @param mixed $cell_data The cell's current value | ||
* @param array $cell_settings The cell's settings | ||
* @return string The cell's HTML | ||
*/ | ||
function display_cell($cell_name, $cell_data, $cell_settings) | ||
{ | ||
return $this->display_field($cell_name, $cell_data, $cell_settings); | ||
} | ||
|
||
/** | ||
* Display Tag | ||
* | ||
* @param array $params Name/value pairs from the opening tag | ||
* @param string $tagdata Chunk of tagdata between field tag pairs | ||
* @param string $field_data Currently saved field value | ||
* @param array $field_settings The field's settings | ||
* @return string relationship references | ||
*/ | ||
function display_tag($params, $tagdata, $field_data, $field_settings) | ||
{ | ||
global $LANG; | ||
$LANG->fetch_language_file(strtolower(__CLASS__)); | ||
|
||
$file = PATH.'lib/languages'.EXT; | ||
if ( ! file_exists($file) ) return FALSE; | ||
include($file); | ||
|
||
$languages = array_flip( $languages ); | ||
$language = $languages[$field_data]; | ||
|
||
$localized = $LANG->line($language); | ||
|
||
return ! empty( $localized ) ? $localized : $language; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
<?php | ||
|
||
$L = array( | ||
|
||
'translate_languages' => 'Translate languages?', | ||
'no' => 'No', | ||
'yes' => 'Yes', | ||
|
||
/* =Languages */ | ||
'Albanian' => 'Shqiptar', | ||
'Arabic' => 'العربية', | ||
'Abkhazian' => 'Аҧсуа бызшәа', | ||
'Amharic' => 'አማርኛ', | ||
'Afar' => 'Qafár af', | ||
'Armenian' => 'Հայաստան', | ||
'Assamese' => 'অসমীয়া', | ||
'Byelorussian' => 'Беларускі', | ||
'Azerbaijani' => 'آذربایجان دیلی', | ||
'Bashkir' => 'башҡорт теле', | ||
'Bulgarian' => 'Български', | ||
'Bhutani' => 'بلوچی', | ||
'Breton' => 'Brezhoneg', | ||
'Bengali/Bangla' => 'বাংলা', | ||
'Croatian' => 'Hrvatski', | ||
'Corsican' => 'Corsu', | ||
'Catalan' => 'Català', | ||
'Czech' => 'Český', | ||
'Danish' => 'Danske', | ||
'Dutch' => 'Nederlands', | ||
'Cambodian' => 'ភាសាខ្មែរ', | ||
'Burmese' => 'မြန်မာဘာသာ', | ||
'Estonian' => 'Eesti', | ||
'Farsi' => 'فارسی', | ||
'Finnish' => 'Suomi', | ||
'Basque' => 'Euskara', | ||
'Fiji' => 'Na vosa vaka-Viti', | ||
'French' => 'Français', | ||
'German' => 'Deutsch', | ||
'Galician' => 'Galego', | ||
'Frisian' => 'Frysk', | ||
'Greek' => 'Ελληνικά', | ||
'Faroese' => 'føroyskt', | ||
'Guarani' => 'Guaraní', | ||
'Greenlandic' => 'Kalaallisut', | ||
'Gujarati' => 'ગુજરાતી', | ||
'Hindi' => 'हिन्दी', | ||
'Hungarian' => 'Magyar', | ||
'Hausa' => 'هَوْسَ', | ||
'Hebrew' => 'עברית', | ||
'Irish' => 'Gaeilge', | ||
'Indonesian' => 'Indonesia', | ||
'Icelandic' => 'Íslenska', | ||
'Italian' => 'Italiano', | ||
'Japanese' => '日本語', | ||
'Inupiak' => 'Iñupiaq', | ||
'Korean' => '한국의', | ||
'Inuktitut' => 'ᐃᓄᒃᑎᑐᑦ', | ||
'Javanese' => 'Basa Jawa', | ||
'Kazakh' => 'Қазақ тілі', | ||
'Kannada' => 'ಕನ್ನಡ', | ||
'Kashmiri' => 'कॉशुर', | ||
'Kurdish' => 'كوردی', | ||
'Kirghiz' => 'Кыргыз тили', | ||
'Latin' => 'Lingua Latīna', | ||
'Lithuanian' => 'Lietuvos', | ||
'Latvian;Lettish' => 'Latvijas; Latviešu', | ||
'Laothian' => 'ພາສາລາວ', | ||
'Macedonian' => 'Македонски', | ||
'Maori' => 'Māori', | ||
'Moldavian' => 'Moldovenesc', | ||
'Mongolian' => 'Монгол', | ||
'Malay' => 'Melayu', | ||
'Marathi' => 'मराठी', | ||
'Maltese' => 'Malti', | ||
'Malayalam' => 'മലയാളം', | ||
'Norwegian' => 'Norsk', | ||
'Nepali' => 'नेपाली', | ||
'Nauru' => 'Ekaiairũ Naoero', | ||
'Occitan' => 'Lenga d\'òc', | ||
'Afan (Oromo)' => 'Oromiffa', | ||
'Lingala' => 'Ngala', | ||
'Polish' => 'Polski', | ||
'Portuguese' => 'Português', | ||
'Oriya' => 'ଓଡିଆ', | ||
'Pashto/Pushto' => 'پښتو', | ||
'Punjabi' => 'ਪੰਜਾਬੀ', | ||
'Russian' => 'Русский', | ||
'Romanian' => 'Română', | ||
'Quechua' => 'Qhichwa Simi', | ||
'Rhaeto-Romance' => 'Romansch', | ||
'Sangho' => 'yângâ tî sängö', | ||
'Sanskrit' => 'संस्कृतभाषा', | ||
'Sindhi' => 'سنڌي', | ||
'Slovak' => 'Slovenský', | ||
'Serbo-Croatian' => 'Cрпскохрватски', | ||
'Singhalese' => 'siṁhala', | ||
'Slovenian' => 'Slovenski', | ||
'Serbian' => 'Српски', | ||
'Shona' => 'chiShona', | ||
'Samoan' => 'Gagana Sāmoa', | ||
'Spanish' => 'Español', | ||
'Sundanese' => 'Basa Sunda', | ||
'Swedish' => 'Svenska', | ||
'Thai' => 'ภาษาไทย', | ||
'Tamil' => 'தமிழ்', | ||
'Telugu' => 'తెలుగు', | ||
'Tajik' => 'тоҷикӣ', | ||
'Tigrinya' => 'ትግርኛ', | ||
'Setswana' => 'Tswana', | ||
'Turkmen' => 'түркменче', | ||
'Turkish' => 'Türk', | ||
'Tonga' => 'lea faka-Tonga', | ||
'Somali' => 'Afsoomaali', | ||
'Tibetan' => 'བོད་སྐད་', | ||
'Tsonga' => 'Xitsonga', | ||
'Ukrainian' => 'Український', | ||
'Uigur' => 'ئۇيغۇر', | ||
'Tatar' => 'Татарча', | ||
'Urdu' => 'اردو', | ||
'Welsh' => 'Cymru', | ||
'Volapuk' => 'Volapük', | ||
'Vietnamese' => 'Việt', | ||
'Xhosa' => 'isiXhosa', | ||
'Uzbek' => 'O‘zbek', | ||
'Zhuang' => 'Vahcuengh', | ||
'Yiddish' => 'ייִדיש', | ||
'Yoruba' => 'èdèe Yorùbá', | ||
'Chinese' => '中文', | ||
'Zulu' => 'isiZulu', | ||
|
||
/* END */ | ||
''=>'' | ||
); | ||
|
||
?> |