コード例 #1
0
ファイル: functions.php プロジェクト: adisonc/MaineLearning
function rw_cryptx_shortcode($atts, $content = null)
{
    global $cryptX_var;
    if (@$cryptX_var[autolink]) {
        $content = rw_cryptx_autolink($content, true);
    }
    $content = rw_cryptx_encryptx($content, true);
    $content = rw_cryptx_linktext($content, true);
    return $content;
}
コード例 #2
0
ファイル: cryptx.php プロジェクト: adisonc/MaineLearning
/**
* New Template functions...
* $content = string to convert
* $args    = string/array with the following parameters
* 				array('text' => "", 'css_class' => "", 'css_id' => "", 'echo' => 1)
*				or
*				"text=&css_class=&css_id=&echo=1"
*/
function encryptx($content, $args = "")
{
    global $cryptX_var;
    $is_shortcode = true;
    // Parse incomming $args into an array and merge it with $defaults
    $encryptx_vars = rw_loadDefaults($args);
    // OPTIONAL: Declare each item in $args as its own variable i.e. $type, $before.
    // extract( $args, EXTR_SKIP );
    $tmp = explode("?", $content);
    $content = $tmp[0];
    $params = !empty($tmp[1]) ? $tmp[1] : '';
    if ($encryptx_vars['autolink']) {
        $content = rw_cryptx_autolink($content, true);
        if (!empty($params)) {
            $content = preg_replace('/(.*\\")(.*)(\\".*>)(.*)(<\\/a>)/i', '$1$2?' . $params . '$3$4$5', $content);
        }
    }
    $content = rw_cryptx_encryptx($content, true);
    $content = rw_cryptx_linktext($content, true);
    if (!empty($encryptx_vars['text'])) {
        $content = preg_replace('/(.*">)(.*)(<.*)/i', '$1' . $encryptx_vars['text'] . '$3', $content);
    }
    if (!empty($encryptx_vars['css_id'])) {
        $content = preg_replace('/(.*)(">)/i', '$1" id="' . $encryptx_vars['css_id'] . '">', $content);
    }
    if (!empty($encryptx_vars['css_class'])) {
        $content = preg_replace('/(.*)(">)/i', '$1" class="' . $encryptx_vars['css_class'] . '">', $content);
    }
    $is_shortcode = false;
    if (!$encryptx_vars['echo']) {
        return $content;
    }
    echo $content;
}