Fix File
•
/
home
/
sportsfe...
/
httpdocs
/
wp-conte...
/
plugins
/
network-...
/
componen...
/
resizer
•
File:
NetsPostsThumbnailsResizer.php
•
Content:
<?php /* Plugin Name: Network Posts Ext Thumbnails Plugin URI: https://wp-plugins.johncardell.com/network-posts-extended/ Description: Network Posts Extended plugin enables you to share posts over WP Multi Site network. You can display on any blog in your network the posts selected by taxonomy from any blogs including main. Version: 0.1.0 Author: John Cardell Author URI: http://www.johncardell.com Copyright 2014 John Cardell */ namespace NetworkPosts\Components\Resizer; require_once 'NetsPostsThumbnailSizeSettings.php'; class NetsPostsThumbnailsResizer { private $blog_sizes = array(); protected $resizer_client; public function set_local_sizes( array $sizes ){ $this->blog_sizes = $sizes; } public function get_sizes(){ return $this->blog_sizes; } public function create_size( $name, $size ){ $count = 0; if( isset( $size['data']['alias'] ) ){ $name = $size['data']['alias']; } do { $alias = $this->create_alias( $name, $count ); $id = $this->generate_id( $alias ); $count++; } while( $this->find_by_id( $id ) ); $size['id'] = $id; $size['data']['alias'] = $alias; $this->set_blog_size( $id, $size ); return $size; } private function create_alias( $name, $count = 0 ){ $str = esc_attr( str_replace( ' ', '-', strtolower( $name ) ) ); if( $count ){ $str .= "-s{$count}"; } return $str; } public function set_blog_size( $id, array $size ){ $this->blog_sizes[$id] = $size; $this->save_local(); } protected function generate_id( $alias ){ return md5( $alias ); } public function count_all(){ return count( $this->get_sizes() ); } public function update_size( $id, $size ){ $old = $this->find_by_id( $id ); if( $old ){ $size['data']['alias'] = $old['data']['alias']; $this->set_blog_size( $id, $size ); return true; } return false; } public function find_by_id( $id ){ if( array_key_exists( $id, $this->blog_sizes ) ){ return $this->blog_sizes[$id]; } return null; } public function delete( $id ){ $this->delete_local_size( $id ); } public function delete_local_size( $id ){ unset( $this->blog_sizes[$id] ); $this->save_local(); } public function generate_image( $size_id, $file ){ $size = $this->find_by_id( $size_id ); if( $size ) { if ( isset( $size['crop'] ) ) { $result = image_make_intermediate_size( $file, $size['data']['width'], $size['data']['height'], array( $size['crop_x'], $size['crop_y'] ) ); } else { $result = image_make_intermediate_size( $file, $size['data']['width'], $size['data']['height'], false ); } if ( $result ) { //$image_meta = wp_get_attachment_metadata( $attachment_id ); //$result['file'] = substr( $file, strrpos( '/', $file ) ); return $result; } } return false; } protected function save_local(){ NetsPostsThumbnailSizeSettings::set_blog_image_sizes( $this->blog_sizes ); } }
•
Search:
•
Replace:
Function
Edit by line
Download
Information
Rename
Copy
Move
Delete
Chmod
List