Changeset 1260100
- Timestamp:
- 10/06/2015 02:39:02 AM (10 years ago)
- Location:
- my-optional-modules/trunk
- Files:
-
- 2 deleted
- 4 edited
-
class.myoptionalmodules-modules.php (modified) (7 diffs)
-
function.category-ids.php (deleted)
-
function.exclude-categories.php (deleted)
-
function.exclude.php (modified) (2 diffs)
-
plugin.php (modified) (4 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
my-optional-modules/trunk/class.myoptionalmodules-modules.php
r1255257 r1260100 18 18 function __construct() { 19 19 if ( get_option ( 'myoptionalmodules_javascripttofooter' ) ) { 20 add_action ( 'wp_enqueue_scripts' , array ( $this , ' remove' ) );20 add_action ( 'wp_enqueue_scripts' , array ( $this , 'move_to_footer' ) ); 21 21 add_action ( 'wp_footer' , 'wp_enqueue_scripts' , 5 ); 22 22 add_action ( 'wp_footer' , 'wp_print_head_scripts' , 5 ); … … 112 112 113 113 /** 114 * Extras -> Javascript-to-footer 115 * Remove enqueued scripts from wp_head 114 Extras 115 Javascript-to-Footer 116 Attempts to move all .js to the footer 117 Theme must have wp_footer() for this to work. 116 118 */ 117 function remove(){118 remove_action ( 'wp_head' , 'wp_print_head_scripts', 9 );119 remove_action ( 'wp_head' , 'wp_enqueue_scripts', 1 );120 } 121 119 function move_to_footer(){ 120 remove_action( 'wp_head', 'wp_print_head_scripts', 9 ); 121 remove_action( 'wp_head', 'wp_enqueue_scripts', 1 ); 122 } 123 122 124 /** 123 * Extras -> Enable Exclude Posts 124 * Exclude posts from the loop based on several 125 * parameters (set in options). 126 */ 127 function exclude( $query ) { 125 Extras 126 Enable Exclude Posts 127 Allows the admin to exclude posts from various 128 parts of the blog based on different parameters. 129 */ 130 function exclude( $query ){ 128 131 $count = 0; 129 132 ++$count; 130 if ( 1 == $count ){133 if( 1 == $count ){ 131 134 include( 'function.exclude.php' ); 132 135 } 133 136 } 134 137 135 // Twitter Field for User Profiles 138 139 140 141 142 /** 143 Adds a Twitter handle field to the user profile 144 when Enable Meta Tags is enabled. 145 */ 136 146 function twitter( $profile_fields ){ 137 147 $profile_fields['twitter_personal'] = 'Twitter handle'; 138 148 return $profile_fields; 139 149 } 140 141 // Meta Tags (og:/Twitter) 142 function meta() { 143 144 global $post, $wp; 145 146 $author = null; 147 148 // OG: 150 151 /** 152 Enable 153 Enable Meta Tags 154 Enables meta tags for posts, in the form 155 of OG:tags. 156 */ 157 function meta(){ 158 159 global $post; 160 global $wp; 161 162 $author = null; 149 163 $id = null; 150 164 $title = null; … … 164 178 $num = null; 165 179 166 if( is_single() || is_page() ) 180 if( is_single() || is_page() ){ 167 181 $id = $post->ID; 168 169 if( is_single() || is_page() || is_author() ) 182 } 183 184 if( is_single() || is_page() || is_author() ){ 170 185 $author = $post->post_author; 186 } 171 187 172 188 $og_type = 'image'; 173 189 174 190 if( is_single() || is_page() ) { 175 $type = 'article';176 $title = sanitize_text_field ( str_replace ( '\'' , '' , get_post_field ( 'post_title' , $id ) ) );177 $image = wp_get_attachment_image_src ( get_post_thumbnail_id ( $id ) , 'single-post-thumbnail' );178 $image = $image[0];179 $url = get_permalink( $id );180 $site = get_bloginfo( 'name' );181 $excerpt = strip_tags ( esc_html ( preg_replace ( '/\s\s+/i' , '' , get_the_excerpt ( ) ) ) );191 $type = 'article'; 192 $title = sanitize_text_field ( str_replace ( '\'' , '' , get_post_field ( 'post_title' , $id ) ) ); 193 $image = wp_get_attachment_image_src ( get_post_thumbnail_id ( $id ) , 'single-post-thumbnail' ); 194 $image = $image[0]; 195 $url = get_permalink( $id ); 196 $site = get_bloginfo( 'name' ); 197 $excerpt = strip_tags ( esc_html ( preg_replace ( '/\s\s+/i' , '' , get_the_excerpt ( ) ) ) ); 182 198 } else { 183 $title = get_bloginfo ( 'name' );184 $url = esc_url ( home_url ( '/' ) );185 $type = 'website';199 $title = get_bloginfo ( 'name' ); 200 $url = esc_url ( home_url ( '/' ) ); 201 $type = 'website'; 186 202 } 187 203 … … 215 231 if ( $modified_time ): echo "\n<meta property='article:modified_time' content='{$modified_time}' />"; endif; 216 232 if ( $modified_time ): echo "\n<meta property='og:updated_time' content='{$modified_time}' />"; endif; 217 if ($posttags): 233 234 if( $posttags ){ 218 235 echo "\n<meta property='article:tag' content='"; 219 236 foreach( $posttags as $tag ): … … 224 241 endforeach; 225 242 echo "' />"; 226 endif; 227 243 } 244 245 $author = null; 228 246 $id = null; 229 247 $title = null; … … 246 264 $card = null; 247 265 $attribution = null; 248 249 266 if( is_single() || is_page() ) { 250 267 $card = 'summary'; 251 268 $attribution = get_the_author_meta ( 'twitter_personal' , $author ); 252 269 $attribution = sanitize_text_field ( str_replace ( array ( '@' , '\'' ) , '' , $attribution ) ); 253 254 270 if( $attribution ) { 255 271 $card = sanitize_text_field ( $card ); 256 272 $attribution = sanitize_text_field ( $attribution ); 257 258 273 if( $card ) echo "\n<meta name='twitter:card' content='{$card}'>"; 259 274 if( $attribution ) echo "\n<meta name='twitter:creator' content='@{$attribution}'>"; 260 261 275 } 262 263 276 $card = null; 264 277 $attribution = null; 265 266 278 } 267 279 268 280 // Noindex/Noarchive archives/404s/search results to avoid duplicate content 269 281 if( 270 is_search() ||271 is_404() ||282 is_search() || 283 is_404() || 272 284 is_archive() 273 285 ){ … … 277 289 echo "\n\n"; 278 290 279 $author = null;280 281 291 } 282 292 283 293 // Horizontal Gallery Shortcode 284 function horizontal_gallery_shortcode() { 285 286 add_shortcode ( 'gallery' , array ( $this , 'shortcode_output' ) ); 287 294 function horizontal_gallery_shortcode(){ 295 add_shortcode( 'gallery', array( $this, 'shortcode_output' )); 288 296 } 289 297 -
my-optional-modules/trunk/function.exclude.php
r1255257 r1260100 3 3 * FUNCTION(ality) Exclude Posts 4 4 * 5 * File last update: 10. 1.95 * File last update: 10.2 6 6 * 7 7 * Alter the query to remove posts based on many parameters … … 308 308 if ( intval ( $chck_users ) || intval ( $chck_cats ) || intval ( $chck_tags ) ): 309 309 add_filter( 'the_content', 'myoptionalmodules_destroy_content_view', 20 ); 310 function myoptionalmodules_destroy_content_view( $content ) { 311 if( is_single() ): 312 $content = '<div class="mom-unauthorized-content">You do not have permission to view this content.</div>'; 313 return do_shortcode ( $content ); 314 endif; 315 } 316 endif; 310 if(!function_exists('myoptionalmodules_destroy_content_view')){ 311 function myoptionalmodules_destroy_content_view( $content ) { 312 if( is_single() ): 313 $content = '<div class="mom-unauthorized-content">You do not have permission to view this content.</div>'; 314 return do_shortcode ( $content ); 315 endif; 316 } 317 } 318 endif; -
my-optional-modules/trunk/plugin.php
r1255257 r1260100 4 4 Plugin URI: 5 5 Description: Optional modules and additions for Wordpress. 6 Version: 10. 1.96 Version: 10.2 7 7 Author: boyevul 8 8 Author URI: … … 39 39 */ 40 40 41 /** 42 * Initial Plugin Setup 43 */ 41 44 define ( 'MyOptionalModules', true ); 45 46 /** 47 * We need pluggable for certain plugin actions 48 */ 49 require_once ( ABSPATH . 'wp-includes/pluggable.php' ); 42 50 43 51 /** … … 52 60 } 53 61 54 require_once ( ABSPATH . 'wp-includes/pluggable.php' ); 55 include ( 'function.category-ids.php' ); 56 57 if ( get_option ( 'myoptionalmodules_exclude' ) ) { include ( 'function.exclude-categories.php' ); } 58 if ( get_option ( 'myoptionalmodules_recentpostswidget' ) ) { include ( 'function.recent-posts.php' ); } 62 /** 63 * Include plugin files 64 */ 65 if ( get_option ( 'myoptionalmodules_recentpostswidget' ) ) { 66 include ( 'function.recent-posts.php' ); 67 } 59 68 if ( get_option ( 'myoptionalmodules_pluginshortcodes' ) ) { 60 if( get_option ( 'myoptionalmodules_miniloopamount' ) && get_option ( 'myoptionalmodules_miniloopstyle' ) && get_option ( 'myoptionalmodules_miniloopmeta' ) ) { 69 if ( 70 get_option ( 'myoptionalmodules_miniloopamount' ) && 71 get_option ( 'myoptionalmodules_miniloopstyle' ) && 72 get_option ( 'myoptionalmodules_miniloopmeta' ) 73 ) { 61 74 include ( 'function.shortcode.myoptionalmodules-miniloop.php' ); 62 75 } … … 69 82 include ( 'class.myoptionalmodules-modules.php' ); 70 83 84 /** 85 * Admin functionality 86 */ 71 87 if( current_user_can( 'edit_dashboard' ) && is_admin() ) { 72 88 class myoptionalmodules_admin_css { -
my-optional-modules/trunk/readme.txt
r1255259 r1260100 1 1 === My Optional Modules === 2 2 Contributors: boyevul 3 Tags: reddit, meta, og, twitter, facebook, google, description, title, 404, comments, version, pingbacks, author, date, archives, disable, horizontal, galleries, font awesome, share, RSS, DNSBL, garbage, removal, trash, footer, lazy load,exclude, remove, hide, front page, search results, authors, categories, tags, single post, miniloop, attachment, media, embedder, oEmbed3 Tags: reddit, meta, og, twitter, facebook, google, description, title, 404, comments, version, pingbacks, author, date, archives, disable, horizontal, galleries, font awesome, share, RSS, DNSBL, garbage, removal, trash, footer, exclude, remove, hide, front page, search results, authors, categories, tags, single post, miniloop, attachment, media, embedder, oEmbed 4 4 Requires at least: 4.1 5 5 Tested up to: 4.3.2 6 Stable tag: 10. 1.96 Stable tag: 10.2 7 7 8 8 An assortment of functions to enhance WordPress. … … 105 105 106 106 == Changelog == 107 = 10.2 = 108 * *Release Date - 5th, October, 2015* 109 * fixed an error when excluding posts based on user levels 110 107 111 = 10.1.9 = 108 112 * *Release Date - 28th, September, 2015*
Note: See TracChangeset
for help on using the changeset viewer.