예제 #1
0
                }
            }
        }
    }
}
if (!empty($IDs)) {
    foreach ($IDs as $currentKey => $ID) {
        $instance[$currentKey] = msc_getDefaultAtts($ID, $atts[$currentKey]);
        msc_processHeaders($ID, $instance[$currentKey]);
    }
    if (isset($cfg['_defaultContent'])) {
        $content = $cfg['_defaultContent'];
    } else {
        $content = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus et feugiat eros. Praesent ac justo orci, quis ornare mi. Quisque dictum eleifend diam, eu congue augue congue ultrices. Proin convallis auctor neque, semper luctus libero pulvinar vel.";
    }
    $outPutCode = msc_doShortcode($instance[0]['atts'], $content, $shortcodes[0]);
    global $wp_scripts;
    $headerscripts = $preheaderscripts . $headerscripts;
}
?>
<!DOCTYPE html>
<html>
    <head>
        <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
        <title>Element Preview</title>       
        <?php 
wp_head();
?>
        <style>
        html{padding: 0 28px;}
        </style>
예제 #2
0
function msc_contentPrefilter($template)
{
    global $wp_query, $contentPrefilters, $footerOutput, $headerscripts, $phpincludes;
    if (!empty($contentPrefilters)) {
        foreach ($contentPrefilters as $postID => $newContent) {
            //vardump($newContent);
            foreach ($wp_query->posts as $postKey => $post) {
                if ($postID == $post->ID) {
                    $wp_query->posts[$postKey]->post_content = trim($newContent);
                    //vardump($wp_query->posts[$postKey]->post_content, false);
                    //vardump($newContent);
                }
            }
        }
    }
    // Custom do shortcode - disabled for now :(
    return $template;
    $Elements = get_option('CE_ELEMENTS');
    foreach ($Elements as $key => $el) {
        if (empty($el['state'])) {
            unset($Elements[$key]);
        }
    }
    if (empty($Elements)) {
        return $template;
    }
    foreach ($wp_query->posts as $postKey => $post) {
        $Used = msc_getUsedShortcodes($post->post_content, array(), true);
        foreach ($Used[2] as $key => $shortcode) {
            $options = $Elements[$Used[7][$key]];
            if (!empty($Used[3][$key])) {
                $setAtts = shortcode_parse_atts($Used[3][$key]);
            } else {
                $setAtts = array();
            }
            if (!empty($options['variables'])) {
                $atts = array();
                foreach ($options['variables']['names'] as $varkey => $variable) {
                    if ($options['variables']['type'][$varkey] == 'Dropdown') {
                        $options['variables']['defaults'][$varkey] = trim(strtok($options['variables']['defaults'][$varkey], ','));
                    }
                    if (!empty($options['variables']['multiple'][$varkey])) {
                        $endLoop = true;
                        $loopIndex = 1;
                        while ($endLoop) {
                            if (isset($setAtts[$variable . '_' . $loopIndex])) {
                                $atts[$variable . '_' . $loopIndex] = $setAtts[$variable . '_' . $loopIndex];
                                $loopIndex++;
                            } else {
                                if ($loopIndex === 1) {
                                    $atts[$variable . '_' . $loopIndex] = $options['variables']['defaults'][$varkey];
                                }
                                $endLoop = false;
                            }
                        }
                    } else {
                        $atts[$variable] = $options['variables']['defaults'][$varkey];
                    }
                }
            }
            if (!empty($setAtts) && !empty($atts)) {
                $Atts = shortcode_atts($atts, $setAtts);
            } else {
                $Atts = false;
            }
            //need to replace the shortcode found with the new code below!!
            $newContent = trim(msc_doShortcode($Atts, $Used[5][$key], $options['shortcode']));
            $post->post_content = str_replace($Used[0][$key], $newContent, $post->post_content);
            //vardump($Used[5][$key], false);
            //vardump(msc_doShortcode($Atts, $post->post_content, $options['shortcode']));
        }
    }
    //die;
    return $template;
}
예제 #3
0
파일: widget.php 프로젝트: gpreets/newlab
 function widget($args, $instance)
 {
     $Element = get_option($instance['_element']);
     $Elements = get_option('CE_ELEMENTS');
     if ($Element['_elementType'] != 2 && $Element['_elementType'] != 3 || empty($Elements[$instance['_element']]['state'])) {
         return;
     }
     extract($args);
     if (!empty($instance['_content']) && $Element['_shortcodeType'] == '2') {
         $content = $instance['_content'];
         unset($instance['_content']);
     } else {
         $content = false;
     }
     foreach ($instance as $key => $val) {
         $instance[$key] = strip_tags($val);
     }
     if ($Element['_widgetWrap'] == '2') {
         echo $before_widget;
     }
     if ($Element['_widgetTitle'] == '2') {
         echo $before_title . $instance['_title'] . $after_title;
     }
     echo msc_doShortcode($instance, $content, $Element['_shortcode']);
     if ($Element['_widgetWrap'] == '2') {
         echo $after_widget;
     }
 }
예제 #4
0
                    $atts[$currentKey] = shortcode_parse_atts($used[3][$currentKey]);
                } else {
                    $atts[$currentKey] = array();
                }
                $IDs[$currentKey] = $element;
                $shortcodes[$currentKey] = $options['shortcode'];
            }
        }
    }
}
if (!empty($IDs)) {
    foreach ($IDs as $currentKey => $ID) {
        $instance[$currentKey] = msc_getDefaultAtts($ID, $atts[$currentKey]);
        msc_processHeaders($ID, $instance[$currentKey]['atts']);
    }
    $outPutCode = msc_doShortcode($instance[0]['atts'], "Yes, if you make it look like an electrical fire. When you do things right, people won't be sure you've done anything at all. And why did 'I' have to take a cab? You've killed me! Oh, you've killed me!", $shortcodes[0]);
}
wp_enqueue_script('jquery');
wp_enqueue_style('msc-preview', MYSHORTCODES_URL . 'styles/preview.css');
wp_enqueue_style('msc-core', MYSHORTCODES_URL . 'styles/core.css');
wp_enqueue_style('msc-panel', MYSHORTCODES_URL . 'styles/panel.css');
wp_enqueue_style('msc-minicolors', MYSHORTCODES_URL . 'styles/minicolors.css');
wp_enqueue_script('msc-minicolors', MYSHORTCODES_URL . 'libs/js/minicolors.js');
wp_enqueue_script('msc-jsshell', MYSHORTCODES_URL . 'libs/js/shell.js');
function get_current_screen()
{
    $out = new stdClass();
    $out->base = false;
    return $out;
}
class WP_Admin_Bar_remove