num_queries; } # ADMIN MENU function advset_menu() { add_options_page('Advanced settings', 'Advanced', 'manage_options', 'advanced-settings', 'advset_page'); } # Add plugin option in Plugins page function advset_plugin_action_links( $links, $file ) { if ( $file == plugin_basename( basename(dirname(__FILE__)).'/index.php' ) ) { $links[] = ''.__('Settings').''; } return $links; } //$configs = get_option('powerconfigs'); #print_r($configs); # Remove admin menu if( advset_option('remove_menu') ) add_filter('show_admin_bar' , '__return_false'); // Remove admin menu # Configure FeedBurner if( advset_option('feedburner') ) { function appthemes_custom_rss_feed( $output, $feed ) { //$configs = get_option('powerconfigs'); if ( strpos( $output, 'comments' ) ) return $output; if( strpos(advset_option('feedburner'), '/')===FALSE ) return esc_url( 'http://feeds.feedburner.com/'.advset_option('feedburner') ); else return esc_url( advset_option('feedburner') ); } add_action( 'feed_link', 'appthemes_custom_rss_feed', 10, 2 ); } # Favicon if( advset_option('favicon') ) { function __advsettings_favicon() { if( file_exists(TEMPLATEPATH.'/favicon.ico') ) echo ''."\r\n"; elseif( file_exists(TEMPLATEPATH.'/favicon.png') ) echo ''."\r\n"; } add_action( 'wp_head', '__advsettings_favicon' ); } # Add blog description meta tag if( advset_option('description') ) { function __advsettings_blog_description() { //$configs = get_option('powerconfigs'); if(is_home() || !advset_option('single_metas')) echo ''."\r\n"; } add_action( 'wp_head', '__advsettings_blog_description' ); } # Add description and keyword meta tag in posts if( advset_option('single_metas') ) { function __advsettings_single_metas() { global $post; if( is_single() || is_page() ) { $tag_list = get_the_terms( $post->ID, 'post_tag' ); if( $tag_list ) { foreach( $tag_list as $tag ) $tag_array[] = $tag->name; echo ''."\r\n"; } $excerpt = strip_tags($post->post_content); $excerpt = strip_shortcodes($excerpt); $excerpt = str_replace(array('\n', '\r', '\t'), ' ', $excerpt); $excerpt = substr($excerpt, 0, 125); if( !empty($excerpt) ) echo ''."\r\n"; } } add_action( 'wp_head', '__advsettings_single_metas' ); } # Remove header generator if( advset_option('remove_generator') ) remove_action('wp_head', 'wp_generator'); # Remove WLW if( advset_option('remove_wlw') ) remove_action('wp_head', 'wlwmanifest_link'); # Thumbnails support if( advset_option('add_thumbs') ) { add_theme_support( 'post-thumbnails' ); if( !current_theme_supports('post-thumbnails') ) define( 'ADVSET_THUMBS', '1' ); } # JPEG Quality if( advset_option('jpeg_quality', 0)>0 && $_SERVER['HTTP_HOST']!='localhost' ) { add_filter('jpeg_quality', '____jpeg_quality'); function ____jpeg_quality(){ return (int) advset_option('jpeg_quality'); } } # REL External if( advset_option('rel_external') ) { function ____replace_targets( $content ) { $content = str_replace('target="_self"', '', $content); return str_replace('target="_blank"', 'rel="external"', $content); } add_filter( 'the_content', '____replace_targets' ); } # Fix post type pagination if( advset_option('post_type_pag') ) { # following are code adapted from Custom Post Type Category Pagination Fix by jdantzer function fix_category_pagination($qs){ if(isset($qs['category_name']) && isset($qs['paged'])){ $qs['post_type'] = get_post_types($args = array( 'public' => true, '_builtin' => false )); array_push($qs['post_type'],'post'); } return $qs; } add_filter('request', 'fix_category_pagination'); } # REL External if( advset_option('disable_auto_save') ) { function __advsettings_disable_auto_save(){ wp_deregister_script('autosave'); } add_action( 'wp_print_scripts', '__advsettings_disable_auto_save' ); } # Remove wptexturize if( advset_option('remove_wptexturize') ) { remove_filter('the_content', 'wptexturize'); remove_filter('comment_text', 'wptexturize'); remove_filter('the_excerpt', 'wptexturize'); } # Filtering the code if( advset_option('compress') || advset_option('remove_comments') ) { add_action('template_redirect','____template'); function ____template() { ob_start('____template2'); } function ____template2($code) { if( advset_option('remove_comments') ) $code = preg_replace('//', '', $code); if( advset_option('compress') ) $code = trim( preg_replace( '/\s+(?![^<>]*<\/pre>)/', ' ', $code ) ); /* Acentos */ #$code = str_encode( $code ); return $code; } } # Remove comments system if( advset_option('remove_comments_system') ) { function __av_comments_close( $open, $post_id ) { #$post = get_post( $post_id ); #if ( 'page' == $post->post_type ) #$open = false; return false; } add_filter( 'comments_open', '__av_comments_close', 10, 2 ); function __av_empty_comments_array( $open, $post_id ) { return array(); } add_filter( 'comments_array', '__av_empty_comments_array', 10, 2 ); // Removes from admin menu function __av_remove_admin_menus() { remove_menu_page( 'edit-comments.php' ); } add_action( 'admin_menu', '__av_remove_admin_menus' ); // Removes from admin bar function __av_admin_bar_render() { global $wp_admin_bar; $wp_admin_bar->remove_menu('comments'); } add_action( 'wp_before_admin_bar_render', '__av_admin_bar_render' ); } # Google Analytics if( advset_option('analytics') ) { add_action('wp_footer', '____analytics'); // Load custom styles function ____analytics(){ //$configs = get_option('powerconfigs'); echo ''; } } # Remove admin menu if( advset_option('show_query_num') ) { function __show_sql_query_num(){ if( !current_user_can('manage_options') ) return; global $wpdb; echo '
'. $wpdb->num_queries.' '.__('SQL queries have been executed to show this page in '). timer_stop().__('seconds'). '
'; } add_action('wp_footer', '__show_sql_query_num'); } # Remove [...] from the excerpt /*if( $configs['remove_etc'] ) { function __trim_excerpt( $text ) { return rtrim( $text, '[...]' ); } add_filter('get_the_excerpt', '__trim_excerpt'); }*/ # author_bio if( advset_option('author_bio') ) { function advset_author_bio ($content=''){ return $content.'
'. get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'author_bio_avatar_size', 100 ) ) .'

'. sprintf( __( 'About %s' ), get_the_author() ) .'

'. get_the_author_meta( 'description' ) .'
'; } add_filter('the_content', 'advset_author_bio'); } # author_bio if( advset_option('author_bio_html') ) remove_filter('pre_user_description', 'wp_filter_kses'); # auto post thumbnails if( advset_option('auto_thumbs') ) { // based on "auto posts plugin" 3.3.2 // check post status function advset_check_post_status( $new_status='' ) { global $post_ID; if ('publish' == $new_status) advset_publish_post($post_ID); } // function advset_publish_post( $post_id ) { global $wpdb; // First check whether Post Thumbnail is already set for this post. if (get_post_meta($post_id, '_thumbnail_id', true) || get_post_meta($post_id, 'skip_post_thumb', true)) return; $post = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE id = $post_id"); // Initialize variable used to store list of matched images as per provided regular expression $matches = array(); // Get all images from post's body preg_match_all('/<\s*img [^\>]*src\s*=\s*[\""\']?([^\""\'>]*)/i', $post[0]->post_content, $matches); if (count($matches)) { foreach ($matches[0] as $key => $image) { /** * If the image is from wordpress's own media gallery, then it appends the thumbmail id to a css class. * Look for this id in the IMG tag. */ preg_match('/wp-image-([\d]*)/i', $image, $thumb_id); $thumb_id = $thumb_id[1]; // If thumb id is not found, try to look for the image in DB. Thanks to "Erwin Vrolijk" for providing this code. if (!$thumb_id) { $image = substr($image, strpos($image, '"')+1); $result = $wpdb->get_results("SELECT ID FROM {$wpdb->posts} WHERE guid = '".$image."'"); $thumb_id = $result[0]->ID; } // Ok. Still no id found. Some other way used to insert the image in post. Now we must fetch the image from URL and do the needful. if (!$thumb_id) { $thumb_id = advset_generate_post_thumbnail($matches, $key, $post[0]->post_content, $post_id); } // If we succeed in generating thumg, let's update post meta if ($thumb_id) { update_post_meta( $post_id, '_thumbnail_id', $thumb_id ); break; } } } } function advset_generate_post_thumbnail( $matches, $key, $post_content, $post_id ) { // Make sure to assign correct title to the image. Extract it from img tag $imageTitle = ''; preg_match_all('/<\s*img [^\>]*title\s*=\s*[\""\']?([^\""\'>]*)/i', $post_content, $matchesTitle); if (count($matchesTitle) && isset($matchesTitle[1])) { $imageTitle = $matchesTitle[1][$key]; } // Get the URL now for further processing $imageUrl = $matches[1][$key]; // Get the file name $filename = substr($imageUrl, (strrpos($imageUrl, '/'))+1); if ( !(($uploads = wp_upload_dir(current_time('mysql')) ) && false === $uploads['error']) ) return null; // Generate unique file name $filename = wp_unique_filename( $uploads['path'], $filename ); // Move the file to the uploads dir $new_file = $uploads['path'] . "/$filename"; if (!ini_get('allow_url_fopen')) $file_data = curl_get_file_contents($imageUrl); else $file_data = @file_get_contents($imageUrl); if (!$file_data) { return null; } file_put_contents($new_file, $file_data); // Set correct file permissions $stat = stat( dirname( $new_file )); $perms = $stat['mode'] & 0000666; @ chmod( $new_file, $perms ); // Get the file type. Must to use it as a post thumbnail. $wp_filetype = wp_check_filetype( $filename, $mimes ); extract( $wp_filetype ); // No file type! No point to proceed further if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) ) { return null; } // Compute the URL $url = $uploads['url'] . "/$filename"; // Construct the attachment array $attachment = array( 'post_mime_type' => $type, 'guid' => $url, 'post_parent' => null, 'post_title' => $imageTitle, 'post_content' => '', ); $thumb_id = wp_insert_attachment($attachment, $file, $post_id); if ( !is_wp_error($thumb_id) ) { require_once(ABSPATH . '/wp-admin/includes/image.php'); // Added fix by misthero as suggested wp_update_attachment_metadata( $thumb_id, wp_generate_attachment_metadata( $thumb_id, $new_file ) ); update_attached_file( $thumb_id, $new_file ); return $thumb_id; } return null; } add_action('transition_post_status', 'advset_check_post_status'); if( !function_exists('curl_get_file_contents') ) { function curl_get_file_contents($URL) { $c = curl_init(); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_URL, $URL); $contents = curl_exec($c); curl_close($c); if ($contents) { return $contents; } return FALSE; } } } # author_bio if( $_POST && (advset_option('max_image_size_w')>0 || advset_option('max_image_size_h')>0) ) { // From "Resize at Upload Plus" 1.3 /* This function will apply changes to the uploaded file */ function advset_resize_image( $array ) { // $array contains file, url, type if ($array['type'] == 'image/jpeg' OR $array['type'] == 'image/gif' OR $array['type'] == 'image/png') { // there is a file to handle, so include the class and get the variables require_once( dirname(__FILE__).'/class.resize.php' ); $maxwidth = advset_option('max_image_size_w'); $maxheight = advset_option('max_image_size_h'); $imagesize = getimagesize($array['file']); // $imagesize[0] = width, $imagesize[1] = height if ( $maxwidth == 0 OR $maxheight == 0) { if ($maxwidth==0) { $objResize = new RVJ_ImageResize($array['file'], $array['file'], 'H', $maxheight); } if ($maxheight==0) { $objResize = new RVJ_ImageResize($array['file'], $array['file'], 'W', $maxwidth); } } else { if ( ($imagesize[0] >= $imagesize[1]) AND ($maxwidth * $imagesize[1] / $imagesize[0] <= $maxheight) ) { $objResize = new RVJ_ImageResize($array['file'], $array['file'], 'W', $maxwidth); } else { $objResize = new RVJ_ImageResize($array['file'], $array['file'], 'H', $maxheight); } } } // if return $array; } // function add_action('wp_handle_upload', 'advset_resize_image'); } // translate to pt_BR if( is_admin() && defined('WPLANG') && WPLANG=='pt_BR' ) { add_filter( 'gettext', 'advset_translate', 10, 3 ); global $advset_ptbr; $advset_ptbr = array( 'Save changes' => 'Salvar alterações', 'width' => 'largura', 'height' => 'altura', 'Contents' => 'Conteúdo', 'System' => 'Sistema', 'HTML Code output' => 'Saída do código HTML', 'Hide top admin menu' => 'Esconde menu de administrador do topo', 'Automatically add a FavIcon' => 'Adicionar um FavIcon automático para a página', 'when there is a favicon.ico or favicon.png file in the template folder' => 'sempre que houver um arquivo favicon.ico ou favicon.png na pasta do modelo', 'Add a description meta tag using the blog description' => 'Adicionar uma meta tag de descrição usando a descrição do blog', 'Add description and keywords meta tags in each posts' => 'Adicionar uma meta tags de descrição e palavras-chave em cada post', 'Remove header WordPress generator meta tag' => 'Remover meta tag de "gerado pelo WordPress"', 'Remove header WLW Manifest meta tag' => 'Remover meta tag WLW Manifest', 'Current theme already has post thumbnail support' => 'Tema atual já tem suporte a imagem destacada (thumbnails)', 'Automatically generate the Post Thumbnail' => 'Gerar imagem destacada automaticamente', 'from the first image in post' => 'gera a partir da primeira imagem encontrada no post', 'Set JPEG quality to' => 'Alterar qualidade do JPEG para', 'when send and resize images' => 'no momento em que envia ou redimensiona imagens', 'Resize image at upload to max size' => 'Redimensionar a imagem no upload no tamanho máximo', 'if zero resize to max height or dont resize if both is zero' => 'Se zero, redimenciona para largura máxima ou nada faz se os dois valores forem zero', 'if zero resize to max width or dont resize if both is zero' => 'Se zero, redimenciona para altura máxima ou nada faz se os dois valores forem zero', 'Insert author bio in each post' => 'Adicionar descrição do autor em cada post', 'Remove comments system' => 'Remover sistema de comentários', 'Fix post type pagination' => 'Corrige paginação de "post types"', 'Disable Posts Auto Saving' => 'Desabilita função de auto-salvar', 'Compress all code' => 'Comprime todo o código', 'transformations of quotes to smart quotes, apostrophes, dashes, ellipses, the trademark symbol, and the multiplication symbol' => 'estilização de áspas, apóstrofos, elípses, traços, e multiplicação dos símbolos', 'Remove all HTML comments' => 'Remover todos os comentários em HTML', 'Display total number of executed SQL queries and page loading time' => 'Mostrar o total de SQLs executadas e o tempo de carregamento da página', 'only admin users can see this' => 'apenas administradores poderão ver', 'inserts a javascript code in the footer' => 'adicionar um código em javascript no final do código HTML', 'Allow HTML in user profiles' => 'Permitir códigos HTML na descrição de perfil dos usuários', //'' => '', ); } function advset_translate( $text ) { global $advset_ptbr; $array = $advset_ptbr; if( isset($array[$text]) ) return $array[$text]; else return $text; } // ----------------------------------------------------------------------- # THE AMIND PAGE function advset_page() { //$configs = get_option('powerconfigs'); ?>
{$external_plugin_name} Plugin? "); ?>

Advanced settings









: