Example #1
0
function motopressCEAddTools()
{
    require_once 'includes/ce/Access.php';
    $ceAccess = new MPCEAccess();
    $motopressCELibrary = new MPCELibrary();
    do_action_ref_array('mp_library', array(&$motopressCELibrary));
    $postType = get_post_type();
    $postTypes = get_option('motopress-ce-options');
    if (!$postTypes) {
        $postTypes = array();
    }
    if (in_array($postType, $postTypes) && post_type_supports($postType, 'editor') && $ceAccess->hasAccess()) {
        global $motopressCESettings;
        wp_localize_script('jquery', 'motopress', $motopressCESettings['motopress_localize']);
        wp_localize_script('jquery', 'motopressCE', array('postID' => get_the_ID(), 'nonces' => array('motopress_ce_get_wp_settings' => wp_create_nonce('wp_ajax_motopress_ce_get_wp_settings'), 'motopress_ce_render_content' => wp_create_nonce('wp_ajax_motopress_ce_render_content'), 'motopress_ce_remove_temporary_post' => wp_create_nonce('wp_ajax_motopress_ce_remove_temporary_post'), 'motopress_ce_get_library' => wp_create_nonce('wp_ajax_motopress_ce_get_library'), 'motopress_ce_render_shortcode' => wp_create_nonce('wp_ajax_motopress_ce_render_shortcode'), 'motopress_ce_get_attachment_thumbnail' => wp_create_nonce('wp_ajax_motopress_ce_get_attachment_thumbnail'), 'motopress_ce_colorpicker_update_palettes' => wp_create_nonce('wp_ajax_motopress_ce_colorpicker_update_palettes'), 'motopress_ce_render_youtube_bg' => wp_create_nonce('wp_ajax_motopress_ce_render_youtube_bg'), 'motopress_ce_render_video_bg' => wp_create_nonce('wp_ajax_motopress_ce_render_video_bg'))));
        add_action('admin_head', 'motopressCEAddCEBtn');
        add_action('admin_footer', 'motopressCEHTML');
        //admin_head
        motopressCECheckDomainMapping();
        wp_register_style('mpce-style', plugin_dir_url(__FILE__) . 'includes/css/style.css', null, $motopressCESettings['plugin_version']);
        wp_enqueue_style('mpce-style');
        wp_register_style('mpce', plugin_dir_url(__FILE__) . 'mp/ce/css/ce.css', null, $motopressCESettings['plugin_version']);
        wp_enqueue_style('mpce');
        wp_register_script('mpce-knob', plugin_dir_url(__FILE__) . 'knob/jquery.knob.min.js', array(), $motopressCESettings['plugin_version']);
        wp_enqueue_script('mpce-knob');
        if (get_user_meta(get_current_user_id(), 'rich_editing', true) === 'false' && !wp_script_is('editor')) {
            wp_enqueue_script('editor');
        }
        wp_enqueue_script('wp-link');
    }
}
Example #2
0
function motopressCEAddTools()
{
    require_once 'includes/ce/Access.php';
    $ceAccess = new MPCEAccess();
    global $isMotoPressCEPage;
    $isMotoPressCEPage = true;
    $motopressCELibrary = getMotopressCELibrary();
    $postType = get_post_type();
    $postTypes = get_option('motopress-ce-options');
    if (!$postTypes) {
        $postTypes = array();
    }
    $gridObjects = $motopressCELibrary->getGridObjects();
    $renderedShortcodes = array('grid' => array(), 'empty' => array());
    // Rendered Grid Objects
    foreach (array($gridObjects['row']['shortcode'], $gridObjects['row']['inner'], $gridObjects['span']['shortcode'], $gridObjects['span']['inner']) as $shortcodeName) {
        $shortcode = generateShortcodeFromLibrary($shortcodeName);
        $renderedShortcodes['grid'][$shortcodeName] = do_shortcode($shortcode);
    }
    // Rendered Empty Spans
    foreach (array($gridObjects['span']['shortcode'], $gridObjects['span']['inner']) as $shortcodeName) {
        $shortcode = generateShortcodeFromLibrary($shortcodeName, array('motopress-empty', 'mp-hidden-phone'));
        $renderedShortcodes['empty'][$shortcodeName] = do_shortcode($shortcode);
    }
    if (in_array($postType, $postTypes) && post_type_supports($postType, 'editor') && $ceAccess->hasAccess()) {
        global $motopressCESettings, $motopressCELang;
        wp_localize_script('jquery', 'motopress', $motopressCESettings['motopress_localize']);
        wp_localize_script('jquery', 'motopressCE', array('postID' => get_the_ID(), 'nonces' => array('motopress_ce_get_wp_settings' => wp_create_nonce('wp_ajax_motopress_ce_get_wp_settings'), 'motopress_ce_render_content' => wp_create_nonce('wp_ajax_motopress_ce_render_content'), 'motopress_ce_remove_temporary_post' => wp_create_nonce('wp_ajax_motopress_ce_remove_temporary_post'), 'motopress_ce_render_shortcode' => wp_create_nonce('wp_ajax_motopress_ce_render_shortcode'), 'motopress_ce_render_template' => wp_create_nonce('wp_ajax_motopress_ce_render_template'), 'motopress_ce_get_attachment_thumbnail' => wp_create_nonce('wp_ajax_motopress_ce_get_attachment_thumbnail'), 'motopress_ce_colorpicker_update_palettes' => wp_create_nonce('wp_ajax_motopress_ce_colorpicker_update_palettes'), 'motopress_ce_render_youtube_bg' => wp_create_nonce('wp_ajax_motopress_ce_render_youtube_bg'), 'motopress_ce_render_video_bg' => wp_create_nonce('wp_ajax_motopress_ce_render_video_bg'), 'motopress_ce_update_lite_status' => wp_create_nonce('wp_ajax_motopress_ce_update_lite_status'), 'motopress_ce_get_translations' => wp_create_nonce('wp_ajax_motopress_ce_get_translations')), 'settings' => array('wp' => $motopressCESettings, 'library' => $motopressCELibrary->getData(), 'translations' => $motopressCELang), 'rendered_shortcodes' => $renderedShortcodes));
        add_action('admin_head', 'motopressCEAddCEBtn');
        add_action('admin_footer', 'motopressCEHTML');
        //admin_head
        motopressCECheckDomainMapping();
        wp_register_style('mpce-style', $motopressCESettings['plugin_dir_url'] . 'includes/css/style.css', null, $motopressCESettings['plugin_version']);
        wp_enqueue_style('mpce-style');
        wp_register_style('mpce', $motopressCESettings['plugin_dir_url'] . 'mp/ce/css/ce.css', null, $motopressCESettings['plugin_version']);
        wp_enqueue_style('mpce');
        $customPreloaderImageSrc = apply_filters('mpce_preloader_src', false);
        if ($customPreloaderImageSrc) {
            echo '<style type="text/css">#motopress-preload{background-image: url("' . esc_url($customPreloaderImageSrc) . '") !important;}</style>';
        }
        wp_register_script('mpce-knob', $motopressCESettings['plugin_dir_url'] . 'knob/jquery.knob.min.js', array(), $motopressCESettings['plugin_version']);
        wp_enqueue_script('mpce-knob');
        if (get_user_meta(get_current_user_id(), 'rich_editing', true) === 'false' && !wp_script_is('editor')) {
            wp_enqueue_script('editor');
        }
        wp_enqueue_script('wp-link');
    }
}
function motopress_edit_link($actions, $post)
{
    global $motopressCELang, $motopressCESettings;
    require_once 'includes/ce/Access.php';
    $ceAccess = new MPCEAccess();
    $ceEnabledPostTypes = get_option('motopress-ce-options', array());
    $isHideLinkEditWith = apply_filters('mpce_hide_link_edit_with', false);
    if (!$isHideLinkEditWith && $ceAccess->hasAccess($post->ID) && in_array($post->post_type, $ceEnabledPostTypes)) {
        $newActions = array();
        foreach ($actions as $action => $value) {
            $newActions[$action] = $value;
            if ($action === 'inline hide-if-no-js') {
                $newActions['motopress_edit_link'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(strtr($motopressCELang->CEAdminBarMenu, array('%BrandName%' => $motopressCESettings['brand_name']))) . '" onclick="sessionStorage.setItem(&quot;motopressPluginAutoOpen&quot;, true);">' . strtr($motopressCELang->CEAdminBarMenu, array('%BrandName%' => $motopressCESettings['brand_name'])) . '</a>';
            }
        }
        return $newActions;
    } else {
        return $actions;
    }
}
Example #4
0
<?php

if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
    require_once dirname(__FILE__) . '/ce/Access.php';
    $ceAccess = new MPCEAccess();
    $access = $ceAccess->hasAccess($_POST['postID']);
    if (!$access) {
        require_once 'functions.php';
        require_once 'getLanguageDict.php';
        global $motopressCELang;
        $motopressCELang = motopressCEGetLanguageDict();
        motopressCESetError($motopressCELang->permissionDenied);
    }
}
function motopress_edit_link($actions, $post)
{
    global $motopressCELang;
    require_once 'includes/ce/Access.php';
    $ceAccess = new MPCEAccess();
    $ceEnabledPostTypes = get_option('motopress-ce-options', array());
    if ($ceAccess->hasAccess($post->ID) && in_array($post->post_type, $ceEnabledPostTypes)) {
        $newActions = array();
        foreach ($actions as $action => $value) {
            $newActions[$action] = $value;
            if ($action === 'inline hide-if-no-js') {
                $newActions['motopress_edit_link'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr($motopressCELang->CEAdminBarMenu) . '" onclick="sessionStorage.setItem(&quot;motopressPluginAutoOpen&quot;, true);">' . $motopressCELang->CEAdminBarMenu . '</a>';
            }
        }
        return $newActions;
    } else {
        return $actions;
    }
}