mirror of
https://github.com/Mibew/mibew.git
synced 2025-03-03 18:38:31 +03:00
Merge branch 'text_button'
This commit is contained in:
commit
b399cf74e9
@ -25,7 +25,7 @@ use Mibew\Style\InvitationStyle;
|
||||
*
|
||||
* @param string $title Page title
|
||||
* @param string $locale 2-digit ISO-639-1 code for language
|
||||
* @param string $style name of avalabel style from styles/dialogs folder
|
||||
* @param string $style name of available style from styles/dialogs folder
|
||||
* @param string $invitation_style_name name of avalabel style from
|
||||
* styles/invitations folder
|
||||
* @param integer $group chat group id
|
||||
@ -35,6 +35,8 @@ use Mibew\Style\InvitationStyle;
|
||||
* @param bool $mod_security add rule to remove protocol from document location
|
||||
* in generated javascript code
|
||||
* @param bool $operator_code add operator code to generated button code or not
|
||||
* @param bool $disable_invitation forcibly disable invitation regadless of
|
||||
* tracking settings
|
||||
*
|
||||
* @return string Generate chat button code
|
||||
*/
|
||||
@ -48,7 +50,8 @@ function generate_button(
|
||||
$show_host,
|
||||
$force_secure,
|
||||
$mod_security,
|
||||
$operator_code
|
||||
$operator_code,
|
||||
$disable_invitation
|
||||
) {
|
||||
$app_location = get_app_location($show_host, $force_secure);
|
||||
$link = $app_location . "/client.php";
|
||||
@ -92,7 +95,7 @@ function generate_button(
|
||||
|
||||
// Generate button
|
||||
$temp = get_popup($link, "$js_link", $inner, $title, "mibew", $popup_options);
|
||||
if (Settings::get('enabletracking')) {
|
||||
if (!$disable_invitation && Settings::get('enabletracking')) {
|
||||
$widget_data = array();
|
||||
|
||||
// Get actual invitation style instance
|
||||
|
@ -296,6 +296,8 @@ page.gen_button.modsecurity=Compatibility with mod_security (modsecurity.org), t
|
||||
page.gen_button.operator_code=operator code field
|
||||
page.gen_button.sample=Example
|
||||
page.gen_button.secure_links=Use secure links (https)
|
||||
page.gen_button.text_link=text link
|
||||
page.gen_button.text_link_text=Click to chat
|
||||
page.gen_button.title=Button HTML code generation
|
||||
page.group.create_new=Create new group here.
|
||||
page.group.duplicate_name=Please choose another name because a group with that name already exists.
|
||||
|
@ -54,13 +54,19 @@ if ($invitation_style && !in_array($invitation_style, $invitation_style_list)) {
|
||||
$invitation_style = "";
|
||||
}
|
||||
|
||||
$locales_list = get_available_locales();
|
||||
|
||||
$group_id = verifyparam_groupid("group", $page['errors']);
|
||||
$show_host = verify_param("hostname", "/^on$/", "") == "on";
|
||||
$force_secure = verify_param("secure", "/^on$/", "") == "on";
|
||||
$mod_security = verify_param("modsecurity", "/^on$/", "") == "on";
|
||||
|
||||
$code_type = verify_param("codetype", "/^(button|operator_code)$/", "button");
|
||||
$code_type = verify_param("codetype", "/^(button|operator_code|text_link)$/", "button");
|
||||
$operator_code = ($code_type == "operator_code");
|
||||
$generate_button = ($code_type == "button");
|
||||
|
||||
if ($generate_button) {
|
||||
$disable_invitation = false;
|
||||
|
||||
$lang = verify_param("lang", "/^[\w-]{2,5}$/", "");
|
||||
if (!$lang || !in_array($lang, $image_locales)) {
|
||||
@ -75,6 +81,17 @@ if ($group_id) {
|
||||
$image_href .= "&group=$group_id";
|
||||
}
|
||||
$message = get_image($image_href, $size[0], $size[1]);
|
||||
}
|
||||
else {
|
||||
$disable_invitation = true;
|
||||
|
||||
$lang = verify_param("lang", "/^[\w-]{2,5}$/", "");
|
||||
if (!$lang || !in_array($lang, $locales_list)) {
|
||||
$lang = in_array(CURRENT_LOCALE, $locales_list) ? CURRENT_LOCALE : $locales_list[0];
|
||||
}
|
||||
|
||||
$message = getlocal('page.gen_button.text_link_text');
|
||||
}
|
||||
|
||||
$page['buttonCode'] = generate_button(
|
||||
"",
|
||||
@ -86,17 +103,19 @@ $page['buttonCode'] = generate_button(
|
||||
$show_host,
|
||||
$force_secure,
|
||||
$mod_security,
|
||||
$operator_code
|
||||
$operator_code,
|
||||
$disable_invitation
|
||||
);
|
||||
$page['availableImages'] = array_keys($image_locales_map);
|
||||
$page['availableLocales'] = $image_locales;
|
||||
$page['availableLocales'] = $generate_button ? $image_locales : $locales_list;
|
||||
$page['availableChatStyles'] = $style_list;
|
||||
$page['availableInvitationStyles'] = $invitation_style_list;
|
||||
$page['groups'] = get_groups_list();
|
||||
|
||||
$page['availableCodeTypes'] = array(
|
||||
'button' => getlocal('page.gen_button.button'),
|
||||
'operator_code' => getlocal('page.gen_button.operator_code')
|
||||
'operator_code' => getlocal('page.gen_button.operator_code'),
|
||||
'text_link' => getlocal('page.gen_button.text_link')
|
||||
);
|
||||
|
||||
$page['formgroup'] = $group_id;
|
||||
@ -111,6 +130,7 @@ $page['formcodetype'] = $code_type;
|
||||
|
||||
$page['enabletracking'] = Settings::get('enabletracking');
|
||||
$page['operator_code'] = $operator_code;
|
||||
$page['generateButton'] = $generate_button;
|
||||
|
||||
$page['title'] = getlocal("page.gen_button.title");
|
||||
$page['menuid'] = "getcode";
|
||||
|
@ -52,7 +52,7 @@
|
||||
</div>
|
||||
<br clear="all"/>
|
||||
|
||||
{{#unless operator_code}}
|
||||
{{#if generateButton}}
|
||||
<div class="fieldinrow">
|
||||
<label for="i" class="flabel">{{l10n "page.gen_button.choose_image"}}</label>
|
||||
<div class="fvaluenodesc">
|
||||
@ -78,7 +78,7 @@
|
||||
{{/if}}
|
||||
|
||||
<br clear="all"/>
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
|
||||
<div class="fieldinrow">
|
||||
<label for="group" class="flabel">{{l10n "page.gen_button.choose_group"}}</label>
|
||||
|
Loading…
Reference in New Issue
Block a user