From 4b663598ea5236f7f2239625a964ac4538c38ef7 Mon Sep 17 00:00:00 2001 From: martec Date: Mon, 6 Oct 2014 07:30:07 +0900 Subject: [PATCH] PM support --- images/rest.png | Bin 0 -> 623 bytes .../admin/config_quickadveditor.lang.php | 10 +- inc/plugins/quickadveditor.php | 200 ++++++++++++++++-- 3 files changed, 189 insertions(+), 21 deletions(-) create mode 100644 images/rest.png diff --git a/images/rest.png b/images/rest.png new file mode 100644 index 0000000000000000000000000000000000000000..813c22af30c1b72e6bab19ab46554658cee26bdc GIT binary patch literal 623 zcmV-#0+9WQP)aSC?c}TO~;3#Yw+4+?$%`O$z18sQt8!E=(0BO&0g-tQR~A; zAuMz^>c6MoLU|d^TT3K0FO+`XGGBGeM zEF%~Y3O+$GasU7TwMj%lR2b7`%+(HqKoCID*%qj~ySux)mnu-V|No1^CJiLL50l-K z$pDUMWOH=_aLqgrG0S$d*^<$@0P=O*yIbLQ?lA_w{e|PsG);SSJRA;t=JB>UKKJA4 z7~z2=*{8LQ5alu|6eb-Mt_*v7r2(Ml_c`qpv{WjCS*aWVpkyc*D1)S8DiNme3n5`@ zYn4)Fgh7UcG3<9c)#Yy;$rhT4T0I32h0tnd2&AIdi+}O-Utd~w7+($xIsE_t002ov JPDHLkV1m^1BKrUU literal 0 HcmV?d00001 diff --git a/inc/languages/english/admin/config_quickadveditor.lang.php b/inc/languages/english/admin/config_quickadveditor.lang.php index 7b74d1c..312feca 100644 --- a/inc/languages/english/admin/config_quickadveditor.lang.php +++ b/inc/languages/english/admin/config_quickadveditor.lang.php @@ -2,6 +2,10 @@ $l['quickadveditor_plug_desc'] = 'Advanced editor in quick reply'; $l['quickadveditor_sett_desc'] = 'Settings related to the Quick Advanced Editor.'; +$l['quickadveditor_qurp_heigh_title'] = 'Height of the editor in quick reply'; +$l['quickadveditor_qurp_heigh_desc'] = 'Set the height of the editor in quick reply (value in px).'; +$l['quickadveditor_qued_heigh_title'] = 'Height of the editor in quick edit'; +$l['quickadveditor_qued_heigh_desc'] = 'Set the height of the editor in quick edit (value in px).'; $l['quickadveditor_smile_title'] = 'Show Smile Box in Quick Reply'; $l['quickadveditor_smile_desc'] = 'Set to no if you do not want to show the smile box in quick reply.'; $l['quickadveditor_qedit_title'] = 'Show SCEditor in Quick Edit'; @@ -12,8 +16,8 @@ $l['quickadveditor_canonical_desc'] = 'Set to no if you do not want enable canonical link feature, this feature required by Auto Save Draft. If you use canonical link feature of google seo plugin, you can disable this feature.'; $l['quickadveditor_save_title'] = 'Language for save action'; $l['quickadveditor_save_desc'] = 'Define the phrase that appears when the message is saved.'; -$l['quickadveditor_restor_title'] = 'Language for restore action'; -$l['quickadveditor_restor_desc'] = 'Define the phrase that appears when the message is restored.'; +$l['quickadveditor_restor_title'] = 'Language for restore button'; +$l['quickadveditor_restor_desc'] = 'Define the phrase that appears to restore button.'; $l['quickadveditor_save_default'] = 'Auto Save: Message Saved.'; -$l['quickadveditor_restor_default'] = 'Auto Save: Message Restored.'; +$l['quickadveditor_restor_default'] = 'Restore'; ?> \ No newline at end of file diff --git a/inc/plugins/quickadveditor.php b/inc/plugins/quickadveditor.php index 5e46fab..effd668 100644 --- a/inc/plugins/quickadveditor.php +++ b/inc/plugins/quickadveditor.php @@ -19,7 +19,7 @@ function quickadveditor_info () "website" => "", "author" => "martec", "authorsite" => "", - "version" => "5.1.1", + "version" => "5.5.0", "guid" => "", "compatibility" => "18*" ); @@ -39,13 +39,33 @@ function quickadveditor_install() 'isdefault' => '0' )); + $db->insert_query('settings', array( + 'name' => 'quickadveditor_qurp_heigh', + 'title' => $lang->quickadveditor_qurp_heigh_title, + 'description' => $lang->quickadveditor_qurp_heigh_desc, + 'optionscode' => 'text', + 'value' => '280', + 'disporder' => '1', + 'gid' => $groupid + )); + + $db->insert_query('settings', array( + 'name' => 'quickadveditor_qued_heigh', + 'title' => $lang->quickadveditor_qued_heigh_title, + 'description' => $lang->quickadveditor_qued_heigh_desc, + 'optionscode' => 'text', + 'value' => '300', + 'disporder' => '2', + 'gid' => $groupid + )); + $db->insert_query('settings', array( 'name' => 'quickadveditor_smile', 'title' => $lang->quickadveditor_smile_title, 'description' => $lang->quickadveditor_smile_desc, 'optionscode' => 'onoff', 'value' => '0', - 'disporder' => '1', + 'disporder' => '3', 'gid' => $groupid )); @@ -55,7 +75,7 @@ function quickadveditor_install() 'description' => $lang->quickadveditor_qedit_desc, 'optionscode' => 'onoff', 'value' => '1', - 'disporder' => '2', + 'disporder' => '4', 'gid' => $groupid )); @@ -65,7 +85,7 @@ function quickadveditor_install() 'description' => $lang->quickadveditor_autosave_desc, 'optionscode' => 'onoff', 'value' => '1', - 'disporder' => '3', + 'disporder' => '5', 'gid' => $groupid )); @@ -75,7 +95,7 @@ function quickadveditor_install() 'description' => $lang->quickadveditor_canonical_desc, 'optionscode' => 'onoff', 'value' => '1', - 'disporder' => '4', + 'disporder' => '6', 'gid' => $groupid )); @@ -85,7 +105,7 @@ function quickadveditor_install() 'description' => $lang->quickadveditor_save_desc, 'optionscode' => 'text', 'value' => $lang->quickadveditor_save_default, - 'disporder' => '5', + 'disporder' => '7', 'gid' => $groupid )); @@ -95,7 +115,7 @@ function quickadveditor_install() 'description' => $lang->quickadveditor_restor_desc, 'optionscode' => 'text', 'value' => $lang->quickadveditor_restor_default, - 'disporder' => '6', + 'disporder' => '8', 'gid' => $groupid )); @@ -230,13 +250,13 @@ function quickadveditor_activate() setTimeout(function() { restitem = localStorage.getItem(link_can + \'quickreply\'); if (restitem) { - if(!\$(\'#autosave\').length) { - \$(\'
\', { id: \'autosave\', class: \'bottom-right\' }).appendTo(\'body\'); - } - setTimeout(function() { - \$(\'#autosave\').jGrowl(\'{\$mybb->settings[\'quickadveditor_restor_lang\']}\', { life: 500 }); - },200); - MyBBEditor.val(restitem); + var restorebut = [ + \'settings[\'quickadveditor_restor_lang\']}\" onclick=\"MyBBEditor.insert(restitem);\">\', + \'
{\$mybb->settings[\'quickadveditor_restor_lang\']}
\', + \'
\' + ]; + + \$(restorebut.join(\'\')).appendTo(\'.sceditor-group:last\'); } },600); MyBBEditor.blur(function(e) { @@ -276,18 +296,125 @@ function quickadveditor_activate() ); $db->insert_query("templates", $template); + $template2 = array( + "tid" => NULL, + "title" => "codebutquick_pm", + "template" => "asset_url}/jscripts/sceditor/editor_themes/{\$theme[\'editortheme\']}\" type=\"text/css\" media=\"all\" /> + + +", + "sid" => "-1" + ); + $db->insert_query("templates", $template2); + find_replace_templatesets( 'showthread_quickreply', '#' . preg_quote('') . '#i', '{$codebutquick}' ); + find_replace_templatesets( + 'private_quickreply', + '#' . preg_quote('') . '#i', + '{$codebutquick}' + ); + find_replace_templatesets( 'showthread_quickreply', '#' . preg_quote('{$lang->message_note}
') . '#i', '{$lang->message_note}
{$smilieinserter}' ); + find_replace_templatesets( + 'private_quickreply', + '#' . preg_quote('{$lang->message_note}
') . '#i', + '{$lang->message_note}
{$smilieinserter}' + ); + find_replace_templatesets( 'showthread', '#' . preg_quote('') . '#i', @@ -309,6 +436,7 @@ function quickadveditor_deactivate() include_once MYBB_ROOT."inc/adminfunctions_templates.php"; $db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='codebutquick'"); + $db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='codebutquick_pm'"); find_replace_templatesets( 'showthread_quickreply', @@ -316,12 +444,24 @@ function quickadveditor_deactivate() '' ); + find_replace_templatesets( + 'private_quickreply', + '#' . preg_quote('{$codebutquick}') . '#i', + '' + ); + find_replace_templatesets( 'showthread_quickreply', '#' . preg_quote('{$lang->message_note}
{$smilieinserter}') . '#i', '{$lang->message_note}
' ); + find_replace_templatesets( + 'private_quickreply', + '#' . preg_quote('{$lang->message_note}
{$smilieinserter}') . '#i', + '{$lang->message_note}
' + ); + find_replace_templatesets( 'showthread', '#' . preg_quote(' @@ -348,10 +488,18 @@ function advedt_cache_codebutquick() if (THIS_SCRIPT == 'showthread.php') { if($mybb->settings['quickadveditor_smile'] != 0) { - $templatelist .= 'codebutquick,smilieinsert,smilieinsert_smilie,smilieinsert_getmore'; + $templatelist .= 'codebutquick,smilieinsert,smilieinsert_smilie,smilieinsert_getmore'; } else { - $templatelist .= 'codebutquick'; + $templatelist .= 'codebutquick'; + } + } + if (THIS_SCRIPT == 'private.php') { + if($mybb->settings['quickadveditor_smile'] != 0) { + $templatelist .= 'codebutquick_pm,smilieinsert,smilieinsert_smilie,smilieinsert_getmore'; + } + else { + $templatelist .= 'codebutquick_pm'; } } } @@ -577,14 +725,18 @@ function mycode_inserter_quick_lite($smilies = true) $sourcemode = "MyBBEditor.sourceMode(true);"; } - eval("\$codeinsertquick = \"".$templates->get("codebutquick")."\";"); + if (!strpos($_SERVER['PHP_SELF'],'private.php')) { + eval("\$codeinsertquick = \"".$templates->get("codebutquick")."\";"); + } + else { + eval("\$codeinsertquick = \"".$templates->get("codebutquick_pm")."\";"); + } } return $codeinsertquick; } $plugins->add_hook("showthread_start", "codebuttonsquick_lite"); - function codebuttonsquick_lite () { global $smilieinserter, $codebutquick, $codebutquickedt, $mybb; @@ -599,6 +751,18 @@ function codebuttonsquick_lite () { } } +$plugins->add_hook("private_start", "codebuttonsquick_lite_pm"); +function codebuttonsquick_lite_pm () { + + global $smilieinserter, $codebutquick, $mybb; + + $codebutquick = mycode_inserter_quick_lite(); + $smilieinserter = ''; + if($mybb->settings['quickadveditor_smile'] != 0) { + $smilieinserter = build_clickable_smilies(); + } +} + $plugins->add_hook('postbit', 'canonical_postbit'); function canonical_lite($link)