开发者 | webaib |
---|---|
更新时间 | 2015年12月10日 21:11 |
PHP版本: | 3.1 及以上 |
WordPress版本: | 4.4 |
版权: | GPLv2 or later |
Paste these lines into your functions.php theme file : "add_filter( 'option_pcsh_cache_duration', 'my_pcsh_cache_duration' ); function my_pcsh_cache_duration( $duration ) { $duration = DAY_IN_SECOND*3; // 3 days return $duration; }"
Paste these lines into your functions.php theme file : "add_filter( 'option_pcsh_style', 'my_pcsh_style' ); function my_pcsh_style( $scheme ) { $scheme = 'my_awesome_style'; //CSS filename into the plugin css directory return $scheme; }"
Paste these lines into your functions.php theme file : "//If you just want php, html, css and javascript support add_filter( 'pcsh_langs', '_pcsh_langs' ); function _pcsh_langs( $langs ) { $langs = array( 'php' => 'PHP', 'markup' => 'HTML', 'css' => 'CSS', 'javascript' => 'JavaScript' ); return $langs; }"
Paste these lines into your functions.php theme file : "//Take WordPress SVN, for example //register a provider add_filter( 'pcsh_services', '_pcsh_services' ); function _pcsh_services( $services ) { $services['wordpress'] = 'core.svn.wordpress.org'; return $services; } //Define pastabox lightbox inputs add_action( 'pcsh_fields', '_pcsh_fields' ); function _pcsh_fields( $fields ) { $fields['wordpress'] = array( // 'wordpress' or 'whatever' 'classes' => array( 'wordpress' ), // same value as the key 'label' => sprintf( __('File path relative to %s', 'pcsh'), 'http://core.svn.wordpress.org/' ), 'placeholder' =>'trunk/wp-config-sample.php', //if placeholder isn't defined, it will be a textarea 'name' => 'path_id' //these value return shortcode attribute (path_id, repos, name, user, version) ); return $fields; } //Build the function to retrieve the code // "pcsh_wordpress" hook name (1st param) = "pcsh_" + "wordpress" or "whatever" add_action( 'pcsh_wordpress', '_pcsh_wordpress', 10, 2 ); function _pcsh_wordpress( $source, $atts ) { extract( $atts ); if( $path_id ) { $req = wp_sprintf( 'http://core.svn.wordpress.org/%s', str_replace( 'http://core.svn.wordpress.org/', '', $path_id ) ); $code = wp_remote_get( $req ); if( ! is_wp_error( $code ) && 200 == wp_remote_retrieve_response_code( $code ) ) { $data = wp_remote_retrieve_body( $code ); $source[ 'url' ] = $req; //url to view source $source[ 'name' ] = basename( $req ); //filename $source[ 'code' ] = esc_html( $data ); //the code !!\ //$source[ 'raw' ] contain raw source code. But there are no raw source code delivered by Wordpress SVN\ } } return $source; }" Do not add you root website!! A contributor can add the shortcode to point your "wp-config.php" to read it!!