WordPress.org

Plugin Reviews

The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

iG:Syntax Hiliter

A plugin to easily present source code on your site with syntax highlighting and formatting (as seen in code editors, IDEs).

2 reviews
Average Rating
3 out of 5 stars
Lot's of problems, I'd give it zero starts if possible
By ,

Among other problems:

1- Doesn't set up for scrolling of the source, at a minimum horizontal scrolling should be set to auto. It would also be nice to be able set a maximum vertical or horizontal height for the code display.

2 - Not all lines are numbered. At first I thought it was not numbering comment lines but looking lower I see it doesn't number other lines either.

I copied the code from a php file, 38 lines of code, and posted it between shortcode tags - but this plugin only numbers 18 of them. The opening tag I used was [sourcecode language="php"]

3- It also doesn't handle all end of lines correctly- look below, you'll see that the function statement, on a separate line in the code, is appended to ending line of a comment block. Other lines are also appended to other lines.

This is how the code copies and pastes out of a post formatted by this plugin.

<!--?php /***************************************************************************************************************** Hook 'pre-get-posts' filter to include private posts in text search This function will check to see if the main query is being processed, that the user can read private posts, and that a search is being processed and, if all are true, it adds 'post_status' to the query so that private and public posts will be included in the search. The original code from https://wordpress.org/support/topic/display-private-posts-in-the-wp-search-results-for-logged-in-users?replies=6 I made some modifications to clarify it and such & added the all important comments. ********************************************************************************************************************/ function Novell2016_include_private_posts_in_search_per_capabilities( $query ) { if (($query->is_main_query() === true ) &&                            // Is this the main query?<br ?--> (is_search() === true)) { // And is this a search request?
    (current_user_can('read_private_posts') === true) && // And can the user read private posts?
    ($query->set( 'post_status', array ( 'publish', 'private' ) )); // Yes to all - add post-status to the query
    // and specify that private and public
    // posts are included in search
    }
    }

    // Hang the function on the hook
    add_action( 'pre_get_posts', 'Novell2016_include_private_posts_in_search_per_capabilities' );

    /********************************************************************************************************************/
    ?>
    <script type="text/javascript">// <![CDATA[
    alert("I'm here);
    one(iii);
    jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
    // ]]></script>

Also - I entered the text in the WP editor in "text mode" and between then and saving th epost, those "]]" were added at the end.

Yes, I know it is only supposted to handle PHP - I put in other other stuff to see if it could safely handle HTML or JS -- that is, "sanitize it."

Hre's the original code as I pasted it in:

<?php
/*****************************************************************************************************************

	Hook 'pre-get-posts' filter to include private posts in text search

	This function will check to see if the main query is being processed, that the user can read private posts,
	and that a search is being processed and, if all are true, it adds 'post_status' to the query so that
	private and public posts will be included in the search. 

	The original code from
	https://wordpress.org/support/topic/display-private-posts-in-the-wp-search-results-for-logged-in-users?replies=6

	I made some modifications to clarify it and such & added the all important comments.

********************************************************************************************************************/
function Novell2016_include_private_posts_in_search_per_capabilities( $query ) {
	if (($query->is_main_query() === true ) &&  							// Is this the main query?
		(is_search() === true)) {										// And is this a search request?
		(current_user_can('read_private_posts') === true) && 			// And can the user read private posts?
		($query->set( 'post_status', array ( 'publish', 'private' ) ));		// Yes to all - add post-status to the query
																			//   and specify that private and public
																			//   posts are included in search
	}
}

// Hang the function on the hook
add_action( 'pre_get_posts', 'Novell2016_include_private_posts_in_search_per_capabilities' );

/********************************************************************************************************************/
?>
<script type="text/javascript">
alert("I'm here);
one(iii);
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
</script>

Any differences in indents and other formatting in the original code, above, and what it looks like in my editor, is simply be because of the software used here on this forum.

This plugin in is useless for me.ed by a button.

Brilliant
By , for WP 4.0

4.3
Needed something fast and furious, and this delivered in spades. Great!

You must log in to submit a review. You can also log in or register using the form near the top of this page.