Plugin Directory

Changeset 1136125


Ignore:
Timestamp:
04/16/2015 11:57:31 AM (11 years ago)
Author:
Trendwerk
Message:

3.2.2

Location:
multiple-content-blocks
Files:
21 added
4 edited

Legend:

Unmodified
Added
Removed
  • multiple-content-blocks/trunk/README.md

    r1132124 r1136125  
    99If you're using Composer to manage WordPress, add this plugin to your project's dependencies. Run:
    1010```sh
    11 composer require trendwerk/multiple-content-blocks 3.2.1
     11composer require trendwerk/multiple-content-blocks 3.2.2
    1212```
    1313
     
    1515```json
    1616"require": {
    17     "trendwerk/multiple-content-blocks": "3.2.1"
     17    "trendwerk/multiple-content-blocks": "3.2.2"
    1818},
    1919```
  • multiple-content-blocks/trunk/assets/inc/class-mcb.php

    r1132124 r1136125  
    2020        //Admin CSS
    2121        add_action( 'admin_enqueue_scripts', array( $this, 'add_css' ) );
     22
     23        //Allow auto-draft to be previewed
     24        add_action( 'wp_loaded', array( $this, 'auto_draft_preview' ) );
    2225    }
    2326   
     
    7679
    7780                if( 'one-liner' == $type )
    78                   echo '<input type="text" name="' . $id . '" value="' . htmlentities( get_post_meta( $post->ID, '_mcb-' . $id, true ), ENT_COMPAT, 'UTF-8', false ) . '" />';
     81                  echo '<input type="text" name="_mcb_' . $id . '" value="' . htmlentities( get_post_meta( $post->ID, '_mcb-' . $id, true ), ENT_COMPAT, 'UTF-8', false ) . '" />';
    7982                else
    8083                    wp_editor( get_post_meta( $post->ID, '_mcb-' . $id, true ), '_mcb_' . $id, array(
     
    225228        $type = get_post_type_object( $post->post_type );
    226229       
    227         if( 'publish' == $post->post_status && $type->public ) {
     230        if( $type->public ) {
    228231            $args = array();
     232
    229233            $request_url = get_permalink( $post_id );
    230234
     235            /**
     236             * Preview link (for drafts and auto-drafts)
     237             */
     238            $request_url = apply_filters( 'preview_post_link', add_query_arg( '_mcb_preview', 'true', add_query_arg( 'preview', 'true', $request_url ) ) );
     239
     240            /**
     241             * Send (auth) cookies
     242             */
     243            if( 0 < count( $_COOKIE ) ) {
     244                $args['cookies'] = array();
     245
     246                foreach( $_COOKIE as $name => $value )
     247                    $args['cookies'][] = new WP_Http_Cookie( array(
     248                        'name'  => $name,
     249                        'value' => $value,
     250                    ) );
     251            }       
     252
     253            /**
     254             * Basic HTTP authentication
     255             */
    231256            if( isset( $_SERVER['PHP_AUTH_USER'] ) && 0 < strlen( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) && 0 < strlen( $_SERVER['PHP_AUTH_PW'] ) )
    232257                $args['headers'] = array(
     
    273298        return $inactive_blocks;
    274299    }
     300
     301    /**
     302     * Allow auto-draft to be previewed when MCB makes a request
     303     */
     304    function auto_draft_preview() {
     305        if( ! is_user_logged_in() )
     306            return;
     307
     308        if( ! isset( $_GET['p'] ) && ! isset( $_GET['page_id'] ) )
     309            return;
     310
     311        if( ! current_user_can( 'edit_post', isset( $_GET['p'] ) ? absint( $_GET['p'] ) : absint( $_GET['page_id'] ) ) )
     312            return;
     313
     314        if( ! isset( $_GET['_mcb_preview'] ) || 'true' !== $_GET['_mcb_preview'] )
     315            return;
     316
     317        global $wp_post_statuses;
     318
     319        if( ! isset( $wp_post_statuses['auto-draft'] ) )
     320            return;
     321
     322        $wp_post_statuses['auto-draft']->protected = true;
     323    }
     324
    275325} new MCB;
  • multiple-content-blocks/trunk/multiple-content-blocks.php

    r1132124 r1136125  
    99 * Author URI: https://github.com/trendwerk/
    1010 *
    11  * Version: 3.2.1
     11 * Version: 3.2.2
    1212 *
    1313 * @package MCB
  • multiple-content-blocks/trunk/readme.txt

    r1132124 r1136125  
    2929== Changelog ==
    3030
     31= 3.2.2 =
     32* Improvement: Support for drafts and auto-drafts, thanks for testing [Luuk de Vlieger](https://github.com/luukdv)
     33* Bugfix: Fix one-liners not being saved properly in 3.2.1, props [Ross Grant](https://github.com/iamrossgrant)
     34
    3135= 3.2.1 =
    3236* Feature: Added basic HTTP auth support
Note: See TracChangeset for help on using the changeset viewer.