Example #1
0
function juickxp_post($post_id)
{
    $juick = get_option('juickxp_custom_jid');
    $include_text = get_option('juickxp_include_text', false);
    if (!function_exists('xmpp_send')) {
        return;
    }
    $tags_s = '';
    $tags = array();
    $tags_custom = explode(' ', get_option('juickxp_jtags_custom'));
    foreach ($tags_custom as $tag) {
        if (!empty($tag)) {
            $tags[] = $tag;
        }
    }
    $post = get_post($post_id);
    $post_link = get_permalink($post_id);
    if (get_option('juickxp_jtags_categories')) {
        foreach (wp_get_object_terms($post_id, 'category') as $tag) {
            $tags[] = str_replace(' ', '-', $tag->name);
        }
    }
    if (get_option('juickxp_jtags_tags')) {
        foreach (wp_get_object_terms($post_id, 'post_tag') as $tag) {
            $tags[] = str_replace(' ', '-', $tag->name);
        }
    }
    $k = 5;
    foreach ($tags as $tag) {
        if (!$k) {
            break;
        }
        $tags_s .= "*{$tag} ";
        $k--;
    }
    if (empty($juick)) {
        $juick = '*****@*****.**';
    }
    if ($post->post_type != 'post') {
        return;
    }
    $message = $tags_s;
    $message .= $post->post_title . "\n";
    if ($include_text) {
        $message .= "\n" . strip_tags($post->post_excerpt ? $post->post_excerpt : $post->post_content) . "\n\n";
    }
    $message .= $post_link;
    xmpp_send($juick, $message);
}
Example #2
0
function xmpp_test()
{
    $jid = get_option('xmpp_default_jid');
    return xmpp_send($jid, __('XMPP Enabled works!', 'xmpp-enabled'), __('XMPP Enabled Test', 'xmpp-enabled'));
}