From 3e4366ab0d4d168902e4c077c1af792004fb6929 Mon Sep 17 00:00:00 2001 From: Sven Date: Mon, 16 Feb 2015 12:54:23 +0100 Subject: [PATCH] Added plugin settings language support --- .../admin/config_thankyoulike.lang.php | 58 ++++++++++++ inc/plugins/thankyoulike.php | 90 ++++++++++--------- 2 files changed, 104 insertions(+), 44 deletions(-) create mode 100644 inc/languages/english/admin/config_thankyoulike.lang.php diff --git a/inc/languages/english/admin/config_thankyoulike.lang.php b/inc/languages/english/admin/config_thankyoulike.lang.php new file mode 100644 index 0000000..6fa6b98 --- /dev/null +++ b/inc/languages/english/admin/config_thankyoulike.lang.php @@ -0,0 +1,58 @@ +*Edited for MyBB 1.8 by: AliReza_Tofighi
*Maintained by: SvePu and Eldenroot
*Sources: GitHub"; +$l['tyl_info_desc_recount'] = "Recount Thank Yous/Likes"; +$l['tyl_info_desc_configsettings'] = "Configure Settings"; +$l['tyl_info_desc_warning'] = "Warning! tyl_unlock file located! Uninstalling will remove ALL the thankyou/like data from the database. If you would like to preserve the thankyou/like data while uninstalling then remove the tyl_unlock file from the forum root folder."; + +$l['tyl_title'] = "Thank You/Like System"; +$l['tyl_desc'] = "Settings to customize the Thank You/Like System Plugin"; + +$l['tyl_enabled_title'] = "Enable/Disable"; +$l['tyl_enabled_desc'] = "Enable/Disable the Thank You/Like System"; + +$l['tyl_thankslike_title'] = "Thank You or Like"; +$l['tyl_thankslike_desc'] = "Choose if you want to use the Thank You system or the Like System."; + +$l['tyl_firstall_title'] = "First Post only or All"; +$l['tyl_firstall_desc'] = "Do you want the thanks or Like to be given on the first post of a thread only or on all the posts of a thread?"; + +$l['tyl_firstalloverwrite_title'] = "Special option for Display TYL-Buttons in ALL Posts"; +$l['tyl_firstalloverwrite_desc'] = "Overwrite the above selected option All in certain forums (choose only forums - no categories)"; + +$l['tyl_removing_title'] = "Allow Removing"; +$l['tyl_removing_desc'] = "Do you want to allow the removing of Thanks/Like from a post already Thanked/Liked?"; + +$l['tyl_closedthreads_title'] = "Allow in Closed Threads"; +$l['tyl_closedthreads_desc'] = "Do you want to allow to give Thanks/Like in closed threads?"; + +$l['tyl_exclude_title'] = "Excluded Forums"; +$l['tyl_exclude_desc'] = "Select forums where you do not want the threads and posts to use the thank you/like system. (only forums - no categories)"; + +$l['tyl_unameformat_title'] = "Format Usernames"; +$l['tyl_unameformat_desc'] = "Do you want to format the usernames in the thank/list according to their groups?"; + +$l['tyl_hideforgroups_title'] = "Hide ThankYou/Like Button"; +$l['tyl_hideforgroups_desc'] = "Select User Groups which cannot see Thanks/Like button."; + +$l['tyl_showdt_title'] = "Show Date/Time"; +$l['tyl_showdt_desc'] = "Do you want to show the Date/Time the thanks/like was received in the Thanks/Like list?"; + +$l['tyl_dtformat_title'] = "Date/Time Format"; +$l['tyl_dtformat_desc'] = "Set the format you want to use to show the Date/Time in the thank/like list.
Format is same as the one used by PHP\'s date() function.
Example format: m-d-Y h:i A <<will show>> 12-31-2009 12:01 PM"; + +$l['tyl_sortorder_title'] = "Sort Order"; +$l['tyl_sortorder_desc'] = "Select the sort order for the thanks/like list."; + +$l['tyl_collapsible_title'] = "Thanks/Like List Collapsible"; +$l['tyl_collapsible_desc'] = "Do you want the thanks/like list to be collapsible (Show/Hide ability)?"; + +$l['tyl_colldefault_title'] = "Default Collapsible State"; +$l['tyl_colldefault_desc'] = "If you want the list to be collapsible, what is the default state you want it in when the page loads, open or closed(hidden)?"; +?> \ No newline at end of file diff --git a/inc/plugins/thankyoulike.php b/inc/plugins/thankyoulike.php index a1a8e87..275f176 100644 --- a/inc/plugins/thankyoulike.php +++ b/inc/plugins/thankyoulike.php @@ -42,20 +42,21 @@ function thankyoulike_info() { - global $plugins_cache, $mybb, $db; + global $plugins_cache, $mybb, $db, $lang; + $lang->load('config_thankyoulike'); $codename = basename(__FILE__, ".php"); $prefix = 'g33k_'.$codename.'_'; $info = array( - "name" => "Thank You/Like System", - "description" => "Adds option for users to Thank the user for the post or 'Like' the post.
*Edited for MyBB 1.8 by: AliReza_Tofighi
*Maintained by: SvePu and Eldenroot
*Sources: GitHub", - "website" => "http://www.geekplugins.com/mybb/thankyoulikesystem", - "author" => "- G33K -", - "authorsite" => "http://community.mybboard.net/user-19236.html", - "version" => "1.9", - "codename" => "thankyoulikesystem", - "compatibility" => "18*" + "name" => $db->escape_string($lang->tyl_info_title), + "description" => $db->escape_string($lang->tyl_info_desc), + "website" => "http://www.geekplugins.com/mybb/thankyoulikesystem", + "author" => "- G33K -", + "authorsite" => "http://community.mybboard.net/user-19236.html", + "version" => "1.9", + "codename" => "thankyoulikesystem", + "compatibility" => "18*" ); $info_desc = ''; @@ -63,12 +64,12 @@ function thankyoulike_info() $group = $db->fetch_array($result); if(!empty($group['gid'])) { - $info_desc .= "[Configure Settings]"; + $info_desc .= "[".$db->escape_string($lang->tyl_info_desc_configsettings)."]"; } if(is_array($plugins_cache) && is_array($plugins_cache['active']) && $plugins_cache['active'][$codename]) { - $info_desc .= "[Recount Thank Yous/Likes]"; + $info_desc .= "[".$db->escape_string($lang->tyl_info_desc_recount)."]"; $info_desc .= '
@@ -85,7 +86,7 @@ function thankyoulike_info() if(file_exists(MYBB_ROOT."tyl_unlock")) { // Show warning if tyl_unlock file exists letting user know that uninstalling will remove everything from the database - $info['description'] .= ""; + $info['description'] .= ""; } return $info; @@ -93,7 +94,8 @@ function thankyoulike_info() function thankyoulike_install() { - global $mybb, $db; + global $mybb, $db, $lang; + $lang->load('config_thankyoulike'); $codename = basename(__FILE__, ".php"); $prefix = 'g33k_'.$codename.'_'; @@ -175,8 +177,8 @@ function thankyoulike_install() $setting_group = array( 'name' => $prefix.'settings', - 'title' => 'Thank You/Like System', - 'description' => 'Settings to customize the Thank You/Like System Plugin', + 'title' => $db->escape_string($lang->tyl_title), + 'description' => $db->escape_string($lang->tyl_desc), 'disporder' => intval($disporder), 'isdefault' => 0 ); @@ -184,71 +186,71 @@ function thankyoulike_install() $gid = $db->insert_id(); $settings = array( - 'enabled' => array( - 'title' => 'Enable/Disable', - 'description' => 'Enable/Disable the Thank You/Like System', + 'enabled' => array( + 'title' => $lang->tyl_enabled_title, + 'description' => $lang->tyl_enabled_desc, 'optionscode' => 'onoff', 'value' => '1'), 'thankslike' => array( - 'title' => 'Thank You or Like', - 'description' => 'Choose if you want to use the Thank You system or the Like System.', + 'title' => $lang->tyl_thankslike_title, + 'description' => $lang->tyl_thankslike_desc, 'optionscode' => 'radio thanks=Use Thank You like=Use Like', 'value' => 'thanks'), 'firstall' => array( - 'title' => 'First Post only or All', - 'description' => 'Do you want the thanks or Like to be given on the first post of a thread only or on all the posts of a thread?.', + 'title' => $lang->tyl_firstall_title, + 'description' => $lang->tyl_firstall_desc, 'optionscode' => 'radio first=First Post Only all=All Posts', 'value' => 'first'), 'firstalloverwrite' => array( - 'title' => 'Special option for Display TYL-Buttons in ALL Posts.', - 'description' => 'Overwrite the above selected option All in certain forums (choose only forums - no categories)', + 'title' => $lang->tyl_firstalloverwrite_title, + 'description' => $lang->tyl_firstalloverwrite_desc, 'optionscode' => 'forumselect', 'value' => ''), 'removing' => array( - 'title' => 'Allow Removing', - 'description' => 'Do you want to allow the removing of Thanks/Like from a post already Thanked/Liked?', + 'title' => $lang->tyl_removing_title, + 'description' => $lang->tyl_removing_desc, 'optionscode' => 'yesno', 'value' => '0'), 'closedthreads' => array( - 'title' => 'Allow in Closed Threads', - 'description' => 'Do you want to allow to give Thanks/Like in closed threads?', + 'title' => $lang->tyl_closedthreads_title, + 'description' => $lang->tyl_closedthreads_desc, 'optionscode' => 'yesno', 'value' => '0'), 'exclude' => array( - 'title' => 'Excluded Forums', - 'description' => 'Select forums where you do not want the threads and posts to use the thank you/like system. (only forums - no categories)', + 'title' => $lang->tyl_exclude_title, + 'description' => $lang->tyl_exclude_desc, 'optionscode' => 'forumselect', 'value' => ''), 'unameformat' => array( - 'title' => 'Format Usernames', - 'description' => 'Do you want to format the usernames in the thank/list according to their groups?', + 'title' => $lang->tyl_unameformat_title, + 'description' => $lang->tyl_unameformat_desc, 'optionscode' => 'yesno', 'value' => '1'), 'hideforgroups' => array( - 'title' => 'Hide ThankYou/Like Button', - 'description' => 'Select User Groups which cannot see Thanks/Like button.', + 'title' => $lang->tyl_hideforgroups_title, + 'description' => $lang->tyl_hideforgroups_desc, 'optionscode' => 'groupselect', 'value' => '1,7'), 'showdt' => array( - 'title' => 'Show Date/Time', - 'description' => 'Do you want to show the Date/Time the thanks/like was received in the Thanks/Like list?', + 'title' => $lang->tyl_showdt_title, + 'description' => $lang->tyl_showdt_desc, 'optionscode' => 'radio none=Not Display nexttoname=Display next to user name astitle=Display on mouse over username', 'value' => 'astitle'), 'dtformat' => array( - 'title' => 'Date/Time Format', - 'description' => 'Set the format you want to use to show the Date/Time in the thank/like list.
Format is same as the one used by PHP\'s date() function.
Example format: m-d-Y h:i A <<will show>> 12-31-2009 12:01 PM', + 'title' => $lang->tyl_dtformat_title, + 'description' => $lang->tyl_dtformat_desc, 'optionscode' => 'text', 'value' => 'm-d-Y'), 'sortorder' => array( - 'title' => 'Sort Order', - 'description' => 'Select the sort order for the thanks/like list.', + 'title' => $lang->tyl_sortorder_title, + 'description' => $lang->tyl_sortorder_desc, 'optionscode' => 'select userasc=Username Ascending userdesc=Username Descending @@ -256,13 +258,13 @@ function thankyoulike_install() dtdesc=Date/Time Added Descending', 'value' => 'userasc'), 'collapsible' => array( - 'title' => 'Thanks/Like List Collapsible', - 'description' => 'Do you want the thanks/like list to be collapsible (Show/Hide ability)?', + 'title' => $lang->tyl_collapsible_title, + 'description' => $lang->tyl_collapsible_desc, 'optionscode' => 'yesno', 'value' => '1'), 'colldefault' => array( - 'title' => 'Default Collapsible State', - 'description' => 'If you want the list to be collapsible, what is the default state you want it in when the page loads, open or closed(hidden)?', + 'title' => $lang->tyl_colldefault_title, + 'description' => $lang->tyl_colldefault_desc, 'optionscode' => 'radio open=List Shown closed=List Hidden (Collapsed)',