Forum Replies Created

Viewing 15 replies - 31 through 45 (of 108 total)
  • Thread Starter mac2net

    (@mac2net)

    Hi Michael

    The problem is SVGs have a whole new set of nomenclature.

    Instead it looks like the following code successfully modified the wysiwyg field.
    I could add a conditional to only execute in a narrow circumstance.

    Cheers
    Mike

    PS I cobbled this together from the Attached Posts Field sample.

    Class mywysisyg_CMB2_Sanitize {
    
    	public function __construct() {
    			add_action( 'cmb2_sanitize_wysiwyg', array( $this, 'sanitize' ), 10, 2 );
    			}
    	public function sanitize( $sanitized_val, $val ) {
    			if ( ! empty( $val ) ) {
    				return htmlspecialchars_decode( stripslashes( $val ) );
    			}
    			return $sanitized_val;
    			}
    	}
     $cmb2_wysiwyg = new mywysisyg_CMB2_Sanitize();
    Thread Starter mac2net

    (@mac2net)

    I did some investigation.
    I am using the Text Control plugin which protects content, excerpts and comments (if I want) from the WP filter – wp_kses_post.

    I think what I need to do is replace the sanitize code with that of the code text areas:

    return htmlspecialchars_decode( stripslashes( $this->value ) );

    Is there any way to do this in an outside function in my custom metabox plugin (in which CMB2 is enclosed) so I will be able to control where this happens?

    Thanks
    Mike

    /**
    	 * Sanitize textareas and wysiwyg fields
    	 * @since  1.0.1
    	 * @return string       Sanitized data
    	 */
    	public function textarea() {
    		return is_array( $this->value ) ? array_map( 'wp_kses_post', $this->value ) : wp_kses_post( $this->value );
    	}
    
    	/**
    	 * Sanitize code textareas
    	 * @since  1.0.2
    	 * @return string       Sanitized data
    	 */
    	public function textarea_code( $repeat = false ) {
    		if ( $repeat_value = $this->_check_repeat( __FUNCTION__, $repeat ) ) {
    			return $repeat_value;
    		}
    
    		return htmlspecialchars_decode( stripslashes( $this->value ) );
    	}
    Thread Starter mac2net

    (@mac2net)

    Uploading SVG is easy to configure.
    The problem is the wysiwyg field is filtering out the sag tag and SVG-CSS styles like fill.
    But in the normal content this doesn’t happen.

    Thread Starter mac2net

    (@mac2net)

    Saving the post.
    Thanks. Mike

    Thread Starter mac2net

    (@mac2net)

    I didn’t finish this, but the key is to get the data out of the settings

    I added this

    <p>Jonradio settings:<br />
    <?php print_r(get_option( 'jr_mt_settings' )) ?>
    </p>

    to the

    admin-sections.php

    file of the plugin under

    function jr_mt_aliases_expl()

    Line 479.

    This will show you the array in which to search the URL you want to query to match it with the permalink of the post query object to determine if you want to display the metabox.

    Thread Starter mac2net

    (@mac2net)

    I think I figured it out.๐Ÿ‘

    Thread Starter mac2net

    (@mac2net)

    Thanks.
    No problem with the parent – checked that already.

    I think my child CSS was based on 1.0.8 with header, menu and sidebar sitting on top of one another, but now the header and menu are nested inside the sidebar with the funny javascript so I have to re-examine the width, padding and margin.

    I got the wide expansion to stop but now the header menu start at left:0 and then shift out. I will get it.
    Thanks again.

    Thread Starter mac2net

    (@mac2net)

    Sorry, maybe I wasn’t clear:

    1. CMB2 – no problem
    2. CPTs – no problem

    Now I just need to figure out to query the plugin for a match in the settings in order to display the metabox. Do you know this?

    Thanks
    Mike

    Thread Starter mac2net

    (@mac2net)

    Sorry, why did you resolve this?

    Thread Starter mac2net

    (@mac2net)

    Hi
    Congrats and thanks for the update.
    As I don’t think I am implementing any edgy/outlier cases, should I just follow the Notable Changes guidelines for upgrading?

    I am also going to retire another plugin but I am confident this won’t be problematic.

    Thanks
    Mike

    Thread Starter mac2net

    (@mac2net)

    Hi Weston

    I just checked another site and editing/saving meta data is working.
    The biggest difference between sites is the one that’s not working is part of a multisite.
    I will have to do some playing to see if in fact it’s a conflict with another plugin.

    Cheers
    Mike

    Thread Starter mac2net

    (@mac2net)

    Hi Weston

    Now it seems to be working including my small patch to add another post type.

    Some feedback:

    1. There is no linkage between the Previewed post and the Customizer panel. So when previewing a post, the Customizer fields don’t change to reflect that post and selecting a post in the Customizer doesn’t change the Preview. I can sync them manually.
    2. The plugin uses the traditional Custom Fields UI and shows a fieldโ€™s ID, instead of Name (which I guess is optional in WordPress). But since the Customizer is for users, it might be better to use Name if there is one and to use the Metabox UI rather than the Custom Fields UI.
    3. Iโ€™m using Posts2Posts which are not displaying at all. I see this data is stored in a separate table with a different structure. I suggest (easier said than done) some kind of API to add 3rd party metaboxes to deal with this and other (many Iโ€™m sure) cases like this.
    4. Are edits of fields in the Customizer supposed to work? That doesn’t seem to be happening.

    I will give you more feedback as other things come to my attention.

    Cheers
    Mike

    Thread Starter mac2net

    (@mac2net)

    Thanks.
    I’m in the middle of troubleshooting a bunch of things with another eye on the news (I’m in Europe).

    In my developer 5doc content site I use custom post types. The plugin seems not be conflicting but not showing any posts.

    In class-wp-cusomize-posts.php line 95 I modified it to:

    'type' => array('post','content'),

    to add the contentcustom post type.
    Do I need to make any other mods?

    Before giving you the list of other plugins that conflict I will test the new version.

    Cheers
    Mike

    Thread Starter mac2net

    (@mac2net)

    Hi Weston

    Thanks. i found the conflict – JetPack.
    So while I apologise for wasting a bit of your time, hopefully since it is very widely used, this info is helpful.

    I will play a bit with the plugin and make another post here ASAP.

    Cheers
    Mike

Viewing 15 replies - 31 through 45 (of 108 total)