Skip to content

Commit

Permalink
content-extras plugin plan
Browse files Browse the repository at this point in the history
  • Loading branch information
szepeviktor committed Oct 28, 2014
1 parent 10bf01f commit b5dd749
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,12 @@ Please select a folder in the list above to see your plugin's development.
- assets/icon-128x128.png
- assets/icon-256x256.png
- assets/screenshot-1.jpg

### Content plugin categories

1. bulk edit aid
+ lenghten Menu taxonomy selector
+ Post navigator subm
+ Keep category tree
1. integration
1. UI cleaning
22 changes: 22 additions & 0 deletions content-extras/media-url-column.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/*
Plugin Name: Media URL Column
Plugin Description: Adds URL column to the Media list page with autoselect.
*/


add_filter( 'manage_media_columns', 'muc_column' );
add_action( 'manage_media_custom_column', 'muc_value', 10, 2 );

function muc_column( $cols ) {
$cols['media_url'] = "URL";
return $cols;
}

function muc_value( $column_name, $id ) {
if ( 'media_url' === $column_name )
printf( '<input class="media-url-input nameless-input" style="width:100%%" type="text" readonly="" onclick="%s" value="%s" />',
'jQuery(this).select();',
wp_get_attachment_url( $id )
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ private function check() {

// block non-static requests from CDN
// but allow robots.txt
if ( ! empty( $this->cdn_headers ) && 'robots.txt' !== $request_path ) {
if ( ! empty( $this->cdn_headers ) && '/robots.txt' !== $request_path ) {
$commons = array_intersect( $this->cdn_headers, array_keys( $_SERVER ) );
if ( $commons === $this->cdn_headers ) {
// workaround to prevent edge server banning
//TODO block these from .htaccess
$this->prefix = 'Attack from CDN: ';
//TODO block these by another method
$this->trigger_count = 1;
$this->prefix = 'Attack through CDN: ';
return 'bad_request_cdn_attack';
}
}
Expand Down

0 comments on commit b5dd749

Please sign in to comment.