function rcl_saveform_data_script($content, $data)
{
    $idform = 'form-' . $data->post_type . '-';
    $idform .= $data->post_id ? $data->post_id : 0;
    $content .= '<script type="text/javascript" src="' . rcl_addon_url('js/sisyphus.min.js', __FILE__) . '"></script>' . '<script>jQuery( function() { jQuery( "#' . $idform . '" ).sisyphus({timeout:10}) } );</script>';
    return $content;
}
 function output_style()
 {
     global $rcl_options;
     if (isset($rcl_options['minify_css']) && $rcl_options['minify_css'] == 1) {
         return;
     }
     wp_enqueue_style($this->id, rcl_addon_url('style.css', $this->path));
 }
 function get_scripts_message_rcl($script)
 {
     global $rcl_options;
     $ajaxdata = "type: 'POST', data: dataString, dataType: 'json', url: wpurl+'wp-admin/admin-ajax.php',";
     $words = isset($rcl_options['ms_limit_words']) && $rcl_options['ms_limit_words'] ? $rcl_options['ms_limit_words'] : 400;
     $script .= "\n\t\t\tjQuery('#private-smiles').hover(\n\t\t\t\tfunction(){\n\t\t\t\t  jQuery('#private-smiles .smiles').show();\n\t\t\t\t},\n\t\t\t\tfunction(){\n\t\t\t\t  jQuery('#private-smiles .smiles').hide();\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tjQuery('#rcl-new-mess').on('click','.view-form',function(){\n\t\t\t\tjQuery('#rcl-new-mess .prmess').slideDown();\n\t\t\t\tjQuery(this).slideUp();\n\t\t\t\treturn false;\n\t\t\t});\n\n\t\t\tjQuery('.delete_old_message').delay(60000).fadeOut();\n\n\t\t\tfunction count_word_in_message(word){\n\t\t\t\tvar count = {$words} - word.val().length;\n\t\t\t\treturn count;\n\t\t\t}\n\n\t\t\tfunction get_color_count_word(count){\n\t\t\t\tvar color;\n\t\t\t\tif(count>150) color = 'green';\n\t\t\t\tif(count<150) color = 'orange';\n\t\t\t\tif(count<50) color = 'red';\n\t\t\t\treturn color;\n\t\t\t}\n\n\t\t\tjQuery('#lk-content').on('keyup','#content_mess',function(){\n\t\t\t\tvar word = jQuery(this);\n\t\t\t\tcount = count_word_in_message(word);\n\t\t\t\tcolor = get_color_count_word(count);\n\t\t\t\tjQuery('#count-word').css('color', color).text(count);\n\t\t\t\tif(word.val().length > " . ($words - 1) . ")\n\t\t\t\tword.val(word.val().substr(0, " . ($words - 1) . "));\n\t\t\t});\n\n\t\t\tjQuery('#rcl-new-mess').on('keyup','#minicontent_mess',function(){\n\t\t\t\tvar word = jQuery(this);\n\t\t\t\tcount = count_word_in_message(word);\n\t\t\t\tcolor = get_color_count_word(count);\n\t\t\t\tjQuery('#minicount-word').css('color', color).text(count);\n\t\t\t\tif(word.val().length > " . ($words - 1) . ")\n\t\t\t\tword.val(word.val().substr(0, " . ($words - 1) . "));\n\t\t\t});\n\n\t\t\tjQuery.ionSound({\n\t\t\t\tsounds: ['e-oh','water_droplet'],\n\t\t\t\tpath: '" . rcl_addon_url('sounds/', __FILE__) . "',\n\t\t\t\tmultiPlay: false,\n\t\t\t\tvolume: '0.5'\n\t\t\t});\n\n\t\t/* Добавление личного сообщения */\n\t\t\tfunction add_private_message_recall(){\n\t\t\t\tvar content_mess = encodeURIComponent(jQuery('#content_mess').attr('value'));\n\t\t\t\tvar widget = jQuery('#widget-mess').attr('value');\n\t\t\t\tvar adressat_mess = jQuery('#adressat_mess').attr('value');\n\t\t\t\tif(adressat_mess=='0'){\n\t\t\t\t\trcl_notice('Выберите собеседника!','error'); return false;\n\t\t\t\t}\n\t\t\t\tvar online = jQuery('#online').attr('value');\n\t\t\t\tmax_sec_update_rcl = 0;\n\t\t\t\tjQuery('#content_mess').attr('value', '');\n\t\t\t\tif(content_mess)\n\t\t\t\t\tvar dataString = 'action=add_private_message_recall&content_mess='+content_mess+'&adressat_mess='+adressat_mess+'&online='+online+'&widget='+widget+'&user_ID='+user_ID;\n\t\t\t\telse\n\t\t\t\t\treturn false;\n\t\t\t\tjQuery.ajax({\n\t\t\t\t\t" . $ajaxdata . "\n\t\t\t\t\tsuccess: function(data){\n\t\t\t\t\t\tif(data['recall']==100){\n\t\t\t\t\t\t\tjQuery('.new_mess').replaceWith(data['message_block']);";
     if (!$rcl_options['sort_mess']) {
         $script .= "var div = jQuery('#resize-content');\n                                                        div.scrollTop( div.get(0).scrollHeight );";
     }
     $script .= "}\n\t\t\t\t\t\tif(data['recall']==200){\n\t\t\t\t\t\t\tjQuery('#privatemess').html(data['message_block']).fadeOut(5000);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tjQuery('#lk-content').on('click','.addmess',function(){\n\t\t\tvar content_text = jQuery('#content_mess').val();\n\t\t\tif(content_text) add_private_message_recall();\n\t\t\treturn false;\n\t\t\t});\n\n\t\t\tctrl = false;\n\n\t\t\tfunction breakText() {\n\t\t\t  var caret = jQuery('#content_mess').getSelection().start;\n\t\t\t  jQuery('#content_mess').insertText('" . '\\r\\n' . "', caret, false).setSelection(caret+1, caret+1);\n\t\t\t}\n\n\t\t\tjQuery('#content_mess').keydown(function(event){\n\t\t\t  switch (event.which) {\n\t\t\t\tcase 13: return false;\n\t\t\t\tcase 17: ctrl = true;\n\t\t\t  }\n\t\t\t});\n\n\t\t\tjQuery('#content_mess').keyup(function(event){\n\t\t\tvar content_text = jQuery('#content_mess').val();\n\t\t\t  switch (event.which) {\n\t\t\t\tcase 13:\n\t\t\t\t  if (ctrl){\n\t\t\t\t  if(content_text)\n\t\t\t\t\tadd_private_message_recall();\n\t\t\t\t\treturn false;\n\t\t\t\t  }\n\t\t\t\t  breakText();\n\t\t\t\tbreak;\n\t\t\t\tcase 17: ctrl = false;\n\t\t\t  }\n\t\t\t});\n\n\t\t\tfunction add_private_minimessage_recall(){\n\t\t\t\tvar content_mess = jQuery('#minicontent_mess').attr('value');\n\t\t\t\tvar widget = jQuery('#widget-mess').attr('value');\n\t\t\t\tvar adressat_mess = jQuery('#miniadressat_mess').attr('value');\n\t\t\t\tif(content_mess)\n\t\t\t\t\tvar dataString = 'action=add_private_message_recall&content_mess='+content_mess+'&adressat_mess='+adressat_mess+'&widget='+widget+'&user_ID='+user_ID;\n\t\t\t\telse\n\t\t\t\t\treturn false;\n\t\t\t\tjQuery.ajax({\n\t\t\t\t\t" . $ajaxdata . "\n\t\t\t\t\tsuccess: function(data){\n\t\t\t\t\t\tif(data['recall']==200){\n\t\t\t\t\t\t\tjQuery('#privatemess').html(data['message_block']).fadeOut(5000);\n\t\t\t\t\t\t\tjQuery('#rcl-new-mess').delay(2000).queue(function () {jQuery('#rcl-new-mess').empty();jQuery('#rcl-new-mess').dequeue();});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tjQuery('#rcl-new-mess').on('click','.miniaddmess',function(){\n\t\t\tvar content_text = jQuery('#rcl-new-mess #minicontent_mess').val();\n\t\t\tif(content_text)\n                            add_private_minimessage_recall();\n\t\t\t});\n\n\t\t\tctrl = false;\n\n\t\t\tfunction minibreakText() {\n\t\t\t  var caret = jQuery('#minicontent_mess').getSelection().start;\n\t\t\t  jQuery('#minicontent_mess').insertText('" . '\\r\\n' . "', caret, false).setSelection(caret+1, caret+1);\n\t\t\t}\n\n\t\t\tjQuery('#minicontent_mess').keydown(function(event){\n\t\t\t  switch (event.which) {\n\t\t\t\tcase 13: return false;\n\t\t\t\tcase 17: ctrl = true;\n\t\t\t  }\n\t\t\t});\n\n\t\t/* Отмечаем сообщение как прочтенное */\n\t\t\tjQuery('#rcl-new-mess').on('click','.close-mess-window',function(){\n\t\t\t\tvar id_mess = parseInt(jQuery(this).attr('id').replace(/\\D+/g,''));\n\t\t\t\tvar dataString = 'action=close_new_message_recall&id_mess='+id_mess+'&user_ID='+user_ID;\n\t\t\t\tjQuery.ajax({\n\t\t\t\t\t" . $ajaxdata . "\n\t\t\t\t\tsuccess: function(data){\n\t\t\t\t\t\tif(data['recall']==100){\n\t\t\t\t\t\t\tjQuery('#privatemess').html(data['message_block']).fadeOut(5000);\n\t\t\t\t\t\t\tjQuery('#rcl-new-mess').delay(2000).queue(function () {jQuery('#rcl-new-mess').empty();jQuery('#rcl-new-mess').dequeue();});\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trcl_notice('Ошибка!','error');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t});\n\t\t/* Добавление в черный список */\n\t\t\tjQuery('#manage-blacklist').click(function(){\n\t\t\t\tvar user_id = jQuery(this).data('contact');\n\t\t\t\tvar dataString = 'action=manage_blacklist_recall&user_id='+user_id;\n\t\t\t\tjQuery.ajax({\n\t\t\t\t\t" . $ajaxdata . "\n\t\t\t\t\tsuccess: function(data){\n\t\t\t\t\t\tif(data['otvet']==100){\n\t\t\t\t\t\t\tjQuery('#manage-blacklist').replaceWith(data['content']);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trcl_notice('Ошибка!','error');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t});\n\t\tjQuery('#lk-content').on('click','.remove_black_list',function(){\n\t\t\t\tvar id_user = jQuery(this).data('contact');\n\t\t\t\tvar dataString = 'action=remove_ban_list_rcl&id_user='******'&user_ID='+user_ID;\n\t\t\t\tjQuery.ajax({\n\t\t\t\t\t" . $ajaxdata . "\n\t\t\t\t\tsuccess: function(data){\n\t\t\t\t\t\tif(data['otvet']==100){\n\t\t\t\t\t\t\t jQuery('.history-'+data['id_user']).remove();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trcl_notice('Ошибка!','error');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t});\n\t\t/* Удаление истории переписки */\n\t\t\tjQuery('#lk-content').on('click','.del_history',function(){\n\t\t\t\tvar id_user = jQuery(this).data('contact');\n\t\t\t\tvar dataString = 'action=delete_history_private_recall&id_user='******'&user_ID='+user_ID;\n\t\t\t\tjQuery.ajax({\n\t\t\t\t\t" . $ajaxdata . "\n\t\t\t\t\tsuccess: function(data){\n\t\t\t\t\t\tif(data['otvet']==100){\n\t\t\t\t\t\t\t jQuery('.history-'+data['id_user']).remove();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trcl_notice('Ошибка!','error');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t});\n\n\t\t/* Получаем старые сообщения в переписке */\n\t\t\tjQuery('#lk-content').on('click','.old_message',function(){\n\t\t\t\trcl_preloader_show('#tab-privat > div');\n\t\t\t\tblock_mess++;\n\t\t\t\tvar dataString = 'action=get_old_private_message_recall&block_mess='+block_mess+'&old_num_mess='+old_num_mess+'&user='******'&user_ID='+user_ID;\n\n\t\t\t\tjQuery.ajax({\n\t\t\t\t\t" . $ajaxdata . "\n\t\t\t\t\tsuccess: function(data){\n\t\t\t\t\t\tif(data['recall']==100){\n\t\t\t\t\t\t\tjQuery('.old_mess_block').replaceWith(data['message_block']);\n\t\t\t\t\t\t\told_num_mess = data['num_mess_now'];\n\t\t\t\t\t\t}\n\t\t\t\t\t\trcl_preloader_hide();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t});\n\n\t\tjQuery('#lk-content').on('click','#get-important-rcl',function(){\n\t\t\trcl_preloader_show('#tab-privat > div');\n\t\t\tif(jQuery(this).hasClass('important')){\n\t\t\t\tjQuery(this).removeClass('important').text('Вся переписка');\n\t\t\t\tvar type = 0;\n\t\t\t\tif(block_mess) block_mess = 1;\n\t\t\t}else{\n\t\t\t\tjQuery(this).addClass('important').text('Важные сообщения');\n\t\t\t\tvar type = 1;\n\t\t\t}\n\t\t\t\tvar userid = parseInt(jQuery('.wprecallblock').attr('id').replace(/\\D+/g,''));\n\t\t\t\tvar dataString = 'action=get_important_message_rcl&user='******'&type='+type+'&user_ID='+user_ID;\n\n\t\t\t\tjQuery.ajax({\n\t\t\t\t\t" . $ajaxdata . "\n\t\t\t\t\tsuccess: function(data){\n\t\t\t\t\t\tif(data['recall']==100){\n\t\t\t\t\t\t\tjQuery('#message-list').html(data['content']);\n\t\t\t\t\t\t}\n\t\t\t\t\t\trcl_preloader_hide();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t});\n\n\t\tjQuery('#lk-content').on('click','#tab-privat .sec_block_button',function(){\n\t\t\t\tif(jQuery(this).hasClass('active'))return false;\n                                rcl_preloader_show('#tab-privat > div');\n\t\t\t\tvar days = jQuery(this).attr('data');\n\t\t\t\tjQuery('.correspond .sec_block_button').removeClass('active');\n\t\t\t\tjQuery(this).addClass('active');\n\t\t\t\tvar dataString = 'action=get_interval_contacts_rcl&days='+days+'&user_ID='+user_ID;\n\t\t\t\tjQuery.ajax({\n\t\t\t\t\t" . $ajaxdata . "\n\t\t\t\t\tsuccess: function(data){\n\t\t\t\t\t\tif(data['recall']==100){\n\t\t\t\t\t\t\tjQuery('.correspond #contact-lists').html(data['message_block']);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trcl_notice('Ошибка!','error');\n\t\t\t\t\t\t}\n                                                rcl_preloader_hide();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t});\n\t\tjQuery('#lk-content').on('click','#get-all-contacts',function(){\n\t\t\tvar dataString = 'action=get_interval_contacts_rcl&days=0&user_ID='+user_ID;\n\n\t\t\tjQuery.ajax({\n\t\t\t\t" . $ajaxdata . "\n\t\t\t\tsuccess: function(data){\n\t\t\t\t\tif(data['recall']==100){\n\t\t\t\t\t\tjQuery('#rcl-overlay').fadeIn();\n\t\t\t\t\t\tjQuery('#rcl-popup').html('<a href=# class=close-popup></a>'+data['message_block']);\n\t\t\t\t\t\tvar screen_top = jQuery(window).scrollTop();\n\t\t\t\t\t\tvar popup_h = jQuery('#rcl-popup').height();\n\t\t\t\t\t\tvar window_h = jQuery(window).height();\n\t\t\t\t\t\tscreen_top = screen_top + 60;\n\t\t\t\t\t\tjQuery('#rcl-popup').css('top', screen_top+'px').delay(100).slideDown(400);\n\t\t\t\t\t}else{\n\t\t\t\t\t\trcl_notice('Ошибка!','error');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn false;\n\t\t});\n\t\tjQuery('#lk-content').on('click','#message-list .important',function(){\n\t\t\tupdate_important_rcl(jQuery(this).attr('idmess'));\n\t\t\treturn false;\n\t\t});\n\t\tfunction update_important_rcl(id_mess){\n\t\t\tvar dataString = 'action=update_important_rcl&id_mess='+id_mess+'&user_ID='+user_ID;\n\t\t\tjQuery.ajax({\n\t\t\t\t" . $ajaxdata . "\n\t\t\t\tsuccess: function(data){\n\t\t\t\t\tif(data['res']==100) jQuery('#message-'+id_mess+' .important').addClass('active');\n\t\t\t\t\tif(data['res']==200) jQuery('#message-'+id_mess+' .important').removeClass('active');\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn false;\n\t\t}\n\t\t";
     return $script;
 }
Beispiel #4
0
function rmag_admin_scripts()
{
    wp_enqueue_script('jquery');
    wp_enqueue_script('rmag_admin_scripts', rcl_addon_url('js/admin.js', __FILE__));
}
function rcl_get_group_thumbnail($group_id, $size = 'thumbnail')
{
    $avatar_id = rcl_get_group_option($group_id, 'avatar_id');
    if (!$avatar_id) {
        $url = rcl_addon_url('img/group-avatar.png', __FILE__);
    } else {
        $image_attributes = wp_get_attachment_image_src($avatar_id, $size);
        $url = $image_attributes[0];
    }
    $attr = isset($image_attributes) ? "width='.{$image_attributes['1']}.' height='.{$image_attributes['2']}.'" : '';
    $content = '<img src="' . $url . '" ' . $attr . '>';
    if (rcl_is_group_single()) {
        $content = apply_filters('rcl_group_thumbnail', $content);
    }
    return $content;
}