MAGEEWP

Themes for WordPress

MAGEEWP

Themes for WordPress

Homepage Forums Mageewp Page Layout Plugin activation error code

This topic contains 3 replies, has 4 voices, and was last updated by  buyessayream 3 weeks ago.

  • Author
    Posts
  • #57154

    Academies
    Participant
    • Topics: 1
    • Replies: 0
    • Total posts: 1

    When I try to activate the Magee Page Layout plugin, I get the following error:
    Parse error: syntax error, unexpected T_SL in /home/content/92/8625692/html/wp-content/plugins/mageewp-page-layout/includes/mpl.actions.php on line 353

    how do I get rid of this?

    The code block before and after Line 353 says:

    if (isset($post) && isset($post->post_content_filtered) && !empty( $post->post_content_filtered)) {
    $post->post_content = html_entity_decode (stripslashes_deep($post->post_content_filtered));
    $regex = <<‘END’
    /
    (
    (?: [\x00-\x7F]
    | [\xC0-\xDF][\x80-\xBF]
    | [\xE0-\xEF][\x80-\xBF]{2}
    | [\xF0-\xF7][\x80-\xBF]{3}
    ){1,100}
    )
    | ( [\x80-\xBF] )
    | ( [\xC0-\xFF] )
    /x
    END;

    $post->post_content = preg_replace_callback($regex, “mpl_utf8replacer”, $post->post_content);

    }

    ?>
    <div id=”mpl-switcher-buttons”>
    <?php do_action(‘mpl-switcher-buttons’); ?>
    ‘)” class=”mpl-button green alignleft” id=”mpl-switch-builder”>
    “/>
    <?php _e(‘Mageewp Page Layout’, ‘mageewp-page-layout’); ?>

    </div>
    <script type=”text/javascript”>
    function switch_live_editor(site_url) {
    var id = jQuery(‘#post_ID’).val(),
    type = jQuery(‘#post_type’).val();

    if (typeof(id) == ‘undefined’)
    alert(‘Please save or submit first!’);
    else if (typeof(type) == ‘undefined’)
    alert(‘type’);
    else if (jQuery(‘#original_post_status’).val() == ‘auto-draft’ || jQuery(‘#original_post_status’).val() == ‘draft’)
    alert(‘Please publish!’);
    else window.open(site_url + ‘/wp-admin/?page=mageewp_page_layout&mpl_action=live-editor&id=’ + id);

    if (e !== undefined)
    e.preventDefault();

    return false;
    }
    </script>
    <?php
    }

    /*
    * Put post settings forms after editor
    */
    function mpl_after_editor ($post) {

    if (!is_admin() || !mpl_admin_enable())
    return;

    global $mpl;

    echo ‘<div style=”display:none;”>’;

    $data = array(
    “mode” => “”,
    “classes” => “”,
    “css” => “”,

    );

    if (isset($post ) && isset( $post->ID ) && !empty( $post->ID)) {
    $get_data = (array)get_post_meta ($post->ID , ‘mpl_data’, true);
    if (!empty($get_data) && is_array($get_data)) {
    foreach ($get_data as $name => $value) {
    if (isset($data[$name]))
    $data[$name] = $value;
    }
    }
    }

    if ($mpl->action == ‘live-editor’ || (defined(‘MPL_FORCE_DEFAULT’) && MPL_FORCE_DEFAULT === true)) {
    $data[‘mode’] = ‘mpl’;
    }

    foreach ($data as $key => $val) {
    echo ‘<input type=”hidden” name=”mpl_post_meta[‘.$key.’]” id=”mpl-page-cfg-‘.$key.'” value=”‘.esc_attr($val).'” />’;
    }

    $global_optimized = array_merge(array(‘enable’ => ”, ‘global’ => ”, ‘advanced’ => ”), (array)get_option(‘mpl_optimized’));

    if ($data[‘mode’] == ‘mpl’){

    echo ‘<style type=”text/css”>’.
    ‘#postdivrich{visibility: hidden;position:relative;}#mpl-switcher-buttons{display:none;}’.
    ‘</style>’.
    ‘<script tyle=”text/javascript”>’.
    ‘if(document.getElementById(“postdivrich”))document.getElementById(“postdivrich”).className+=” first-load”;’.
    ‘</script>’;

    }

    echo ‘<script tyle=”text/javascript”>var mpl_global_optimized = ‘.json_encode($global_optimized).’;</script>’;

    echo ‘</div>’;
    }

    // stop TinyMCE from removing <br> tags
    function mpl_tinymce_fix($in) {

    //don’t remove line breaks
    $in[‘remove_linebreaks’] = false;

    // convert newline characters to BR
    $in[‘convert_newlines_to_brs’] = true;

    // don’t remove redundant BR
    $in[‘remove_redundant_brs’] = false;

    return $in;

    }
    add_filter (‘tiny_mce_before_init’, ‘mpl_tinymce_fix’);

    /*
    * Load builder template at footer
    */

    function mpl_admin_footer() {

    if (is_admin() && !mpl_admin_enable())
    return;

    do_action(‘mpl_before_admin_footer’);

    require_once MPL_PATH.’/includes/mpl.js_languages.php’;
    require_once MPL_PATH.’/includes/mpl.nocache_templates.php’;

    do_action(‘mpl_after_admin_footer’);
    }

    /*
    * Save post settings
    */
    add_action(‘save_post’, ‘mpl_process_save’, 10, 2);
    function mpl_process_save ($post_id, $post) {

    if (!isset($_POST[‘content’]) || !isset($_POST[‘post_ID’]) || !current_user_can(‘publish_pages’))
    return;

    global $wpdb, $mpl;
    $id = $_POST[‘post_ID’];
    if (isset($_POST[‘mpl_post_meta’]) && is_array($_POST[‘mpl_post_meta’])) {
    $meta = mpl_process_save_meta($id, $_POST[‘mpl_post_meta’]);
    }

    $meta = get_post_meta( $id, ‘mpl_data’, FALSE );
    /*
    * Create cache when MPL active
    */
    if (isset($meta[‘mode’]) && $meta[‘mode’] == ‘mpl’)
    {
    require_once MPL_PATH.’/includes/mpl.front.php’;

    $content = stripslashes_deep( $_POST[‘content’] );
    $content_processed = ”;

    if (!empty($content))
    {
    /*
    * we don’t have body class if the plugin was disabled
    */
    $ext = ‘<style type=”text/css” id=”mpl-basic-css”>’.mpl_basic_layout_css().'</style>’;
    $ext .= ‘<p class=”mpl-off-notice”>’.__(‘Notice: You are using wrong way to display MPL Content’, ‘mageewp-page-layout’).'</p>’;

    $content_processed = $mpl->do_shortcode ($content);

    if (empty($content_processed))
    {
    $content_processed = $ext.$content_processed;

    $content_processed = str_replace(
    array( “\n”, ‘body.mpl-css-system’ ),
    array( “”, ‘html body’ ),
    $content_processed
    );
    $content_processed = preg_replace(‘/(?<=\>)[\s]+(?=\<)/i’, ”, $content_processed);
    }

    }

    $data = array(
    ‘ID’ => $id,
    ‘post_title’ => $_POST[‘post_title’],
    ‘post_content’ => $content_processed,
    ‘post_content_filtered’ => $content
    );

    if (current_user_can(‘publish_pages’))
    $data[‘post_status’] = ‘publish’;

    $wpdb->update(

    $wpdb->prefix.’posts’,

    $data,

    array( ‘ID’ => $id )
    );
    }
    else{
    if( $_POST[‘action’] !== ‘inline-save’){
    $wpdb->update(
    $wpdb->prefix.’posts’,
    array(
    ‘ID’ => $id,
    ‘post_content_filtered’ => ”
    ),
    array( ‘ID’ => $id )
    );
    }
    }
    }

    function mpl_process_save_meta($id, $meta = array()) {

    global $mpl;

    if (isset($mpl->optimized)) {
    $permalink = get_the_permalink($id);
    if (!empty($permalink))
    $mpl->optimized->delete_cache(get_the_permalink($id));
    $mpl->optimized->delete_cache(site_url());
    }

    $param = (array)get_post_meta ($id, ‘mpl_data’, true);

    if (!is_array($meta))
    $meta = array();

    foreach(
    array( “mode” => “”,’css’ => ”, ‘classes’ => ”)
    as $key => $value
    ) {
    if (!isset($meta[$key]))
    $meta[$key] = ”;
    }

    if (!add_post_meta( $id, ‘mpl_data’, $meta, true)) {
    foreach ($meta as $key => $value) {
    $param[$key] = $value;
    }
    update_post_meta( $id, ‘mpl_data’, $param );
    return $param;
    } return $meta;
    }

    /*
    * Include admin pages’ file
    */
    function mpl_force_default_editor() {
    // Force the editor switch to tinyMCE when the builder is active
    //allowed: tinymce, html, test
    return ‘tinymce’;
    }

    add_filter(‘single_template’, ‘mpl_content_template’);
    function mpl_content_template($single) {

    global $wp_query, $post;

    if ($post->post_type == “mpl-section”)
    {
    if (file_exists(MPL_PATH.’/includes/single-section.php’))
    return MPL_PATH.’/includes/single-section.php’;
    }

    return $single;
    }

    add_filter(‘page_row_actions’, ‘mpl_content_row_actions’, 10, 2);
    add_filter(‘post_row_actions’, ‘mpl_content_row_actions’, 10, 2);

    function mpl_content_row_actions ($actions, $post) {

    global $mpl;
    if (!current_user_can(‘edit_posts’))
    return $actions;
    $mpl_contents = $mpl->get_support_content_types();

    // Check for your post type.
    if (in_array($post->post_type, $mpl_contents))
    {
    $actions = array_merge($actions, array(
    ‘mpl’ => sprintf( ‘%2$s‘,
    esc_url(admin_url(‘/?page=mageewp_page_layout&mpl_action=live-editor&id=’ .$post->ID)),
    __(‘Mageewp Page Layout’, ‘mageewp-page-layout’)
    )
    )
    );
    }

    return $actions;
    }

    add_filter (‘mpl_autocomplete_widget_content’, ‘mpl_widget_content_autocomplete’);
    function mpl_widget_content_autocomplete(){

    global $mpl;
    $mpl_contents = $mpl->get_support_content_types();
    $mpl_contents = implode(‘,’, $mpl_contents);

    $query = array(
    ‘post_type’ => explode(‘,’, $mpl_contents),
    ‘posts_per_page’ => 30,
    ‘post_status’ => ‘publish’,
    ‘s’ => isset($_POST[‘s’]) ? esc_attr($_POST[‘s’]) : ”
    );

    $posts = new WP_Query($query);
    $data = array();
    if ($posts->have_posts())
    {

    while ($posts->have_posts())
    {

    $posts->the_post();

    $type = get_post_type();
    $type = str_replace (array(‘mpl-‘, ‘_’, ‘-‘),array(‘MPL ‘, ‘ ‘, ‘ ‘), $type);
    $type = ucwords ($type);

    $data[get_the_ID()] = esc_attr( $type.’ – ‘.get_the_title() );

    }

    }

    return $data;

    }

    add_filter (‘wp_get_attachment_image_src’, ‘mpl_get_attachment_image_src’, 999, 4);
    function mpl_get_attachment_image_src ($image = ”, $id = ”, $size = ‘full’, $icon = ”) {

    if (is_array($image))
    return $image;

    // Move all attachs from xml to transient
    mpl_set_transient_xml_attachs();

    $atch = get_transient(‘mpl_attach_xml_’.$id);

    if (!empty($atch) && is_array($atch)){

    if (isset($atch[‘expiration’]) && ($atch[‘expiration’] === 0 || $atch[‘expiration’] > time())) {
    if ($size == ‘full’ || !isset($atch[‘metadata’][‘sizes’][$size])) {

    return array(
    $atch[‘url’],
    $atch[‘metadata’][‘width’],
    $atch[‘metadata’][‘height’],

    );

    }else{

    $url = explode(‘/’, $atch[‘url’]);
    array_pop($url);
    $url = implode(‘/’, $url).’/’;
    $atch = $atch[‘metadata’][‘sizes’][$size];

    return array(
    $url.$atch[‘file’],
    $atch[‘width’],
    $atch[‘height’],

    );
    }
    }else{
    delete_transient(‘mpl_attach_xml_’.$id);
    }
    }

    /*return array(
    MPL_URL.’/assets/images/get_start.jpg’,
    2000,
    1000,

    );
    */

    return array(
    ”,
    ”,
    ”,

    );
    }

    add_filter( ‘the_content_export’, ‘mpl_the_content_export’);
    function mpl_the_content_export( $data ){

    global $post, $mpl;

    $allows_types = $mpl->get_support_content_types();

    if (in_array($post->post_type, $allows_types) && !empty( $post->post_content_filtered))
    return $post->post_content_filtered;
    else
    return $data;
    }

    //frontend edit inline
    if (!function_exists(‘mpl_page_content_edit’)) {
    function mpl_page_content_edit($wp_admin_bar) {
    global $post,$mpl;
    if (!is_object($wp_admin_bar)) {
    global $wp_admin_bar;
    }
    if ( is_page() ) {
    $wp_admin_bar->add_menu( array(
    ‘id’ => ‘mpl_inline-admin-bar-link’,
    ‘title’ => __( ‘Mageewp Page Layout’, ‘jasmine’ ),
    ‘href’ => esc_url( admin_url(‘/?page=mageewp_page_layout&mpl_action=live-editor&id=’ .$post->ID) ),
    ‘meta’ => array( ‘class’ => ‘mpl_inline-link’ ),
    ) );
    }
    }
    add_action(‘admin_bar_menu’, ‘mpl_page_content_edit’,1000);
    }

  • #57183

    Magee
    Keymaster
    • Topics: 30
    • Replies: 1853
    • Total posts: 1883

    Please update your plugin to version 2.0.5.

  • #59221

    thingstodoingoa
    Participant
    • Topics: 0
    • Replies: 1
    • Total posts: 1

    Thank you for this information.

  • #61364

    buyessayream
    Participant
    • Topics: 0
    • Replies: 1
    • Total posts: 1

    Thank you for info

You must be logged in to reply to this topic.