Esempio n. 1
0
<?php

/**
 * 
 * @param type $attr
 */
function bbpp_thankmelater_shortcode_name($atts)
{
    extract(Bbpp_ThankMeLater_Shortcoder::atts(array("email_type" => NULL, "comment" => NULL, "attr" => 0), $atts));
    if ($attr) {
        return esc_attr($comment->comment_author);
    }
    return $email_type == "html" ? esc_html($comment->comment_author) : $comment->comment_author;
}
Bbpp_ThankMeLater_Shortcoder::add("name", "bbpp_thankmelater_shortcode_name");
Esempio n. 2
0
<?php

if (!class_exists("Bbpp_ThankMeLater_TemplateHelper")) {
    require_once BBPP_THANKMELATER_PLUGIN_PATH . "TemplateHelper.php";
}
/**
 * Shortcode for a template part (e.g. the sidebar, content, etc)
 * 
 * @param type $attr
 */
function bbpp_thankmelater_shortcode_t_part($atts, $content = NULL)
{
    extract(Bbpp_ThankMeLater_Shortcoder::atts(array("email_type" => NULL, "comment" => NULL, "name" => "main"), $atts));
    $content = trim(Bbpp_ThankMeLater_Shortcoder::apply($content));
    Bbpp_ThankMeLater_TemplateHelper::add_part($name, $content);
    // Show no output. The template must explicity load this part!
    return "";
}
Bbpp_ThankMeLater_Shortcoder::add("t_part", "bbpp_thankmelater_shortcode_t_part");
Esempio n. 3
0
<?php

/**
 * 
 * @param type $attr
 */
function bbpp_thankmelater_shortcode_comment($atts, $content = NULL)
{
    extract(Bbpp_ThankMeLater_Shortcoder::atts(array("email_type" => NULL, "comment" => NULL, "maxlength" => NULL, "attr" => 0), $atts));
    $message = strip_tags($comment->comment_content);
    if ($maxlength && strlen($message) > $maxlength) {
        $message = explode("<f>", wordwrap($message, $maxlength - 3, "<f>", TRUE));
        $message = $message[0] . "...";
    }
    if ($attr) {
        return esc_attr($message);
    }
    if ($email_type == "html") {
        return esc_html($message);
    } else {
        return $message;
    }
}
Bbpp_ThankMeLater_Shortcoder::add("comment", "bbpp_thankmelater_shortcode_comment");
Esempio n. 4
0
<?php

/**
 * 
 * @param type $attr
 */
function bbpp_thankmelater_shortcode_htmlonly($atts, $content = NULL)
{
    extract(Bbpp_ThankMeLater_Shortcoder::atts(array("email_type" => NULL, "comment" => NULL, "apply_shortcodes" => 1), $atts));
    $apply_shortcodes = strtolower($apply_shortcodes);
    if ($email_type == "html") {
        if ($apply_shortcodes) {
            return Bbpp_ThankMeLater_Shortcoder::apply($content);
        } else {
            return $content;
        }
    }
    return "";
}
Bbpp_ThankMeLater_Shortcoder::add("htmlonly", "bbpp_thankmelater_shortcode_htmlonly");
Esempio n. 5
0
<?php

/**
 * Shortcode for post author's url
 * 
 * @param type $attr
 */
function bbpp_thankmelater_shortcode_author_url($atts, $content = NULL)
{
    extract(Bbpp_ThankMeLater_Shortcoder::atts(array("email_type" => NULL, "comment" => NULL, "attr" => 0), $atts));
    if ($attr) {
        return esc_attr($comment->comment_author_url);
    } else {
        return $email_type == "html" ? esc_html($comment->comment_author_url) : $comment->comment_author_url;
    }
}
Bbpp_ThankMeLater_Shortcoder::add("author_url", "bbpp_thankmelater_shortcode_author_url");
Esempio n. 6
0
    $output .= "</tr>\n";
    $output .= "</table>\n";
    // main
    $output .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"" . " width=\"600\" id=\"content-table\">\n";
    $output .= "<tr>\n";
    $output .= "<td id=\"main\" valign=\"top\">\n";
    $output .= $main;
    // end main
    $output .= "</td>\n";
    $output .= "</tr>\n";
    $output .= "</table>\n";
    // footer
    $output .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"" . " width=\"600\" id=\"footer-table\">\n";
    $output .= "<tr>\n";
    $output .= "<td id=\"footer\">\n";
    $output .= Bbpp_ThankMeLater_TemplateHelper::get_part("footer") . "\n";
    // end footer
    $output .= "</td>\n";
    $output .= "</tr>\n";
    $output .= "</table>\n";
    // end center
    $output .= "</td>\n";
    $output .= "</tr>\n";
    $output .= "</table>\n";
    $output .= "</body>\n";
    $output .= "</html>";
    return Bbpp_ThankMeLater_TemplateHelper::inline_css($output);
}
Bbpp_ThankMeLater_Shortcoder::add("t_simple", "bbpp_thankmelater_shortcode_t_simple");
Bbpp_ThankMeLater_Shortcoder::add("template_simple", "bbpp_thankmelater_shortcode_t_simple");
Esempio n. 7
0
<?php

/**
 * Shortcode for image
 * 
 * @param type $attr
 */
function bbpp_thankmelater_shortcode_img($atts, $content = NULL)
{
    extract(Bbpp_ThankMeLater_Shortcoder::atts(array("email_type" => NULL, "comment" => NULL, "src" => "", "width" => 0, "height" => 0), $atts));
    if ($email_type == "text") {
        return "";
    }
    $tag = "<img";
    $tag .= " src=\"" . htmlspecialchars($src) . "\"";
    if ($width) {
        $tag .= " width=\"" . htmlspecialchars($width) . "\"";
    }
    if ($height) {
        $tag .= " height=\"" . htmlspecialchars($height) . "\"";
    }
    return $tag;
}
Bbpp_ThankMeLater_Shortcoder::add("img", "bbpp_thankmelater_shortcode_img");
Esempio n. 8
0
<?php

/**
 * 
 * @param type $attr
 */
function bbpp_thankmelater_shortcode_snip($atts)
{
    return "";
}
Bbpp_ThankMeLater_Shortcoder::add("snip", "bbpp_thankmelater_shortcode_snip");
Esempio n. 9
0
<?php

/**
 * 
 * @param type $attr
 */
function bbpp_thankmelater_shortcode_track($atts, $content = NULL)
{
    extract(Bbpp_ThankMeLater_Shortcoder::atts(array("email_type" => NULL, "comment" => NULL, "url" => FALSE), $atts));
    $code = base64_encode($comment->comment_ID . "-" . $comment->comment_author_email);
    $track_url = get_site_url() . "/?bbpp-thankmelater-open=" . urlencode($code);
    if ($url) {
        return $track_url;
    }
    if ($email_type == "html") {
        return "<img src=\"" . $track_url . "\" width=\"1\" height=\"1\">";
    }
}
Bbpp_ThankMeLater_Shortcoder::add("track", "bbpp_thankmelater_shortcode_track");
Esempio n. 10
0
<?php

/**
 * Shortcode for post ID
 * 
 * @param type $attr
 */
function bbpp_thankmelater_shortcode_post_id($atts, $content = NULL)
{
    extract(Bbpp_ThankMeLater_Shortcoder::atts(array("email_type" => NULL, "comment" => NULL, "attr" => 0), $atts));
    if ($attr) {
        return esc_attr($comment->comment_post_ID);
    }
    return $email_type == "html" ? esc_html($comment->comment_post_ID) : $comment->comment_post_ID;
}
Bbpp_ThankMeLater_Shortcoder::add("post_id", "bbpp_thankmelater_shortcode_post_id");
Esempio n. 11
0
<?php

/**
 * Shortcode for comment author's email
 * 
 * @param type $attr
 */
function bbpp_thankmelater_shortcode_email($atts, $content = NULL)
{
    extract(Bbpp_ThankMeLater_Shortcoder::atts(array("email_type" => NULL, "comment" => NULL, "attr" => 0), $atts));
    if ($attr) {
        return esc_attr($comment->comment_author_email);
    }
    return $email_type == "html" ? esc_html($comment->comment_author_email) : $comment->comment_author_email;
}
Bbpp_ThankMeLater_Shortcoder::add("email", "bbpp_thankmelater_shortcode_email");
Esempio n. 12
0
        $output .= Bbpp_ThankMeLater_TemplateHelper::get_part("main");
        // end main
        $output .= "</td>\n";
        // sidebar
        $output .= "<td width=\"180\" id=\"sidebar-right\" valign=\"top\">\n";
        $output .= Bbpp_ThankMeLater_TemplateHelper::get_part("sidebar") . "\n";
        // end sidebar
        $output .= "</td>\n";
    }
    // end split into 2 columns
    $output .= "</tr>\n";
    $output .= "</table>\n";
    // footer
    $output .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"" . " width=\"600\" id=\"footer-table\">\n";
    $output .= "<tr>\n";
    $output .= "<td id=\"footer\">\n";
    $output .= Bbpp_ThankMeLater_TemplateHelper::get_part("footer") . "\n";
    // end footer
    $output .= "</td>\n";
    $output .= "</tr>\n";
    $output .= "</table>\n";
    // end center
    $output .= "</td>\n";
    $output .= "</tr>\n";
    $output .= "</table>\n";
    $output .= "</body>\n";
    $output .= "</html>";
    return Bbpp_ThankMeLater_TemplateHelper::inline_css($output);
}
Bbpp_ThankMeLater_Shortcoder::add("t_sidebar", "bbpp_thankmelater_shortcode_t_sidebar");
Esempio n. 13
0
<?php

/**
 * Shortcode for comment author's User Agent
 * 
 * @param type $attr
 */
function bbpp_thankmelater_shortcode_user_agent($atts, $content = NULL)
{
    extract(Bbpp_ThankMeLater_Shortcoder::atts(array("email_type" => NULL, "comment" => NULL, "attr" => 0), $atts));
    if ($attr) {
        return esc_attr($comment->comment_agent);
    }
    return $email_type == "html" ? esc_html($comment->comment_agent) : $comment->comment_agent;
}
Bbpp_ThankMeLater_Shortcoder::add("user_agent", "bbpp_thankmelater_shortcode_user_agent");
Esempio n. 14
0
<?php

/**
 * Shortcode for <h[0-6]>
 * 
 * @param type $attr
 */
function bbpp_thankmelater_shortcode_h($atts, $content = NULL)
{
    extract(Bbpp_ThankMeLater_Shortcoder::atts(array("email_type" => NULL, "comment" => NULL, "level" => 1), $atts));
    if ($email_type == "text") {
        return str_repeat("*", $level) . " " . $content;
    }
    return "<h{$level}>" . $content . "</h{$level}>";
}
for ($i = 1; $i <= 6; $i++) {
    Bbpp_ThankMeLater_Shortcoder::add("h{$i}", create_function("\$atts,\$content", "\$atts[\"level\"]={$i};return bbpp_thankmelater_shortcode_h(\$atts, \$content);"));
}
Esempio n. 15
0
<?php

/**
 * 
 * @param type $attr
 */
function bbpp_thankmelater_shortcode_opt_out($atts, $content = NULL)
{
    extract(Bbpp_ThankMeLater_Shortcoder::atts(array("email_type" => NULL, "comment" => NULL, "url" => TRUE), $atts));
    $code = base64_encode($comment->comment_ID . "-" . $comment->comment_author_email);
    $unsub_url = get_site_url() . "/?bbpp-thankmelater-unsubscribe=" . $code;
    if ($url) {
        return $unsub_url;
    }
    $t_html = __("We sent you this email because you left a comment on our blog. %sUnsubscribe from future emails%s.", "bbpp-thankmelater");
    $t_text = __("We sent you this email because you left a comment on our blog. Click this URL to unsubscribe from future emails: %s", "bbpp-thankmelater");
    if ($email_type == "html") {
        return "<center><small>" . sprintf($t_html, "<a href=\"" . esc_attr($unsub_url) . "\">", "</a>") . "</small></center>";
    } else {
        return sprintf($t_text, $unsub_url);
    }
}
Bbpp_ThankMeLater_Shortcoder::add("opt_out", "bbpp_thankmelater_shortcode_opt_out");
Esempio n. 16
0
<?php

/**
 * 
 * @param type $attr
 */
function bbpp_thankmelater_shortcode_textonly($atts, $content = NULL)
{
    extract(Bbpp_ThankMeLater_Shortcoder::atts(array("email_type" => NULL, "comment" => NULL, "apply_shortcodes" => 1), $atts));
    $apply_shortcodes = strtolower($apply_shortcodes);
    $content = trim($content);
    if ($email_type == "text") {
        if ($apply_shortcodes) {
            return Bbpp_ThankMeLater_Shortcoder::apply($content);
        } else {
            return $content;
        }
    }
    return "";
}
Bbpp_ThankMeLater_Shortcoder::add("textonly", "bbpp_thankmelater_shortcode_textonly");