plugins Archives - Justin Silver https://www.justinsilver.com/tag/plugins/ Technology, Travel, and Pictures Thu, 21 Apr 2016 17:01:31 +0000 en-US hourly 1 https://wordpress.org/?v=6.0.1 https://www.justinsilver.com/wp-content/uploads/2013/06/cropped-apple-touch-icon-160x160.png plugins Archives - Justin Silver https://www.justinsilver.com/tag/plugins/ 32 32 Unban GoDaddy / MediaTemple WordPress Plugins https://www.justinsilver.com/technology/wordpress/unban-godaddy-mediatemple-wordpress-plugins/?utm_source=rss&utm_medium=rss&utm_campaign=unban-godaddy-mediatemple-wordpress-plugins https://www.justinsilver.com/technology/wordpress/unban-godaddy-mediatemple-wordpress-plugins/#respond Thu, 17 Mar 2016 19:22:03 +0000 http://www.justinsilver.com/?p=4007 GoDaddy managed WordPress hosting, and by ownership MediaTemple as well, prevents some plugins from being activated on website. Some of these may make some sense if the conflict with caching, etc, but I feel...

The post Unban GoDaddy / MediaTemple WordPress Plugins appeared first on Justin Silver.

]]>
AmpedSense.OptimizeAdSpot('AP'); AmpedSense.OptimizeAdSpot('IL'); AmpedSense.OptimizeAdSpot('IR');

GoDaddy managed WordPress hosting, and by ownership MediaTemple as well, prevents some plugins from being activated on website. Some of these may make some sense if the conflict with caching, etc, but I feel like including a list is good enough and if you want to install that plugin on the website you’re paying for, so be it. There are several plugins that are banned in the list that I regularly use in my website development, for example Gravity Forms.

If you try to enable this plugin on a site hosted on GoDaddy or MediaTemple rather than activating, you get an error that says:

Not Available: This plugin is not allowed on our system due to performance, security, or compatibility concerns. Please contact our support with any questions.

There is a Must-Use Plugin called gd-system-plugin that includes a class called GD_System_Plugin_Blacklist. This class hooks into the plugin installer code to hide links, show errors, and otherwise prevent some plugins from being installed and activated. The way that it does this is by calling the GD_System_Plugin_Blacklist->get_blacklist() method. This method tries to get a value for get_site_transient( 'gd_system_blacklist' ) and if it’s empty, then fetches the list from a URL and caches it.

Luckily there is a filter for pre_site_transient_* so you can short circuit the whole thing.

Unban GoDaddy Plugin Code

We can’t just return an empty array here, because there is a check for empty(), but we can return our own “list” of banned plugins instead of fetching it from a URL (or even the transient cache if it was already set). Plugin code is below, but the filter could just as easily be added to another plugin, functions.php in your theme, or another mu-plugin.

/*
Plugin Name: Unban Goddady/MediaTemple Plugins
Description: Allow plugins banned by GoDaddy to be used on your site
*/
add_filter( 'pre_site_transient_gd_system_blacklist', function(){
    return array( array( 'name'=>'godaddy', 'minVersion'=>0, 'maxVersion'=>1 ) );
} );

List of Plugins Banned on GoDaddy and MediaTemple

This is the list of plugins banned by GoDaddy as of the writing of this post.

6scan-backup
6scan-protection
adminer
adsense-click-fraud-monitoring
all-in-one-seo-pack
all-in-one-wp-migration
aspose-cloud-ebook-generator
aspose-doc-exporter
backupwordpress
backwpup
broken-link-checker
contextual-related-posts
custom-contact-forms
easy-coming-soon
ezpz-one-click-backup
fancybox-for-wordpress
favicon-by-realfavicongenerator
fuzzy-seo-booster
google-analytics-for-wordpress
google-sitemap-generator
google-xml-sitemaps-with-multisite-support
gravityforms
inboundio-marketing
iwp-client
jr-referrer
leads
liveforms
miwoftp
mp3-jplayer
newsletter
nextgen-gallery
pagelines
photo-gallery
php-event-calendar
platform
pluscaptcha
pods
portable-phpmyadmin
ptengine-real-time-web-analytics-and-heatmap
quick-cache
referrer-wp
schram-kljsdfjkl
seo-alrp
sgcachepress
similar-posts
statpress
synthesis
tdwordcount
the-codetree-backup
toolspack
ultimate-member
updraft
w3-total-cache
wordpress-beta-tester
wordpress-gzip-compression
wordpress-popular-posts
wordpress-seo
work-the-flow-file-upload
wp-all-import
wp-business-intelligence-lite
wp-cache
wp-cachecom
wp-copysafe-pdf
wp-copysafe-web
wp-engine-snapshot
wp-fast-cache
wp-fastest-cache
wp-file-cache
wp-phpmyadmin
wp-postviews
wp-power-stats
wp-slimstat
wp-super-cache
wp-ultimate-csv-importer
wpengine-common
wponlinebackup
wptouch
wysija-newsletters
yet-another-featured-posts-plugin
yet-another-related-posts-plugin

The post Unban GoDaddy / MediaTemple WordPress Plugins appeared first on Justin Silver.

]]>
https://www.justinsilver.com/technology/wordpress/unban-godaddy-mediatemple-wordpress-plugins/feed/ 0
WordPress Plugin: Custom Functions.php https://www.justinsilver.com/technology/wordpress/wordpress-plugins/wordpress-plugin-custom-functions-php/?utm_source=rss&utm_medium=rss&utm_campaign=wordpress-plugin-custom-functions-php https://www.justinsilver.com/technology/wordpress/wordpress-plugins/wordpress-plugin-custom-functions-php/#respond Wed, 07 Nov 2012 19:04:23 +0000 http://justin.ag/?p=2814 One of the limitations of adding code to your theme’s function.php file is that these modifications are lost if you change themes, and another is that it is executed after your plugin files are...

The post WordPress Plugin: Custom Functions.php appeared first on Justin Silver.

]]>
AmpedSense.OptimizeAdSpot('AP'); AmpedSense.OptimizeAdSpot('IL'); AmpedSense.OptimizeAdSpot('IR');

One of the limitations of adding code to your theme’s function.php file is that these modifications are lost if you change themes, and another is that it is executed after your plugin files are loaded. This means that if you want to modify any behavior in your other plugins that call filtered functions but aren’t hooked to WordPress Actions, you’re out of luck.

I have worked around this on all my sites by creating a custom plugin to handle all of my non-theme specific additions. The only thing this plugin does is ensure that it is loaded first when you activate it, and then pulls in the contents of a functions.php file in the parent plugins directory. The result is that you have custom code running before any of your other plugins. The functions.php file is specifically not included, but it would just but a standard PHP file like the one in your theme.

This file is always up to date based on the trunk of my SVN repository.

custom-functions.php

<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.23.1</center>
</body>
</html>

The post WordPress Plugin: Custom Functions.php appeared first on Justin Silver.

]]>
https://www.justinsilver.com/technology/wordpress/wordpress-plugins/wordpress-plugin-custom-functions-php/feed/ 0
Remote Content Shortcode https://www.justinsilver.com/technology/wordpress/wordpress-plugin-remote-content-shortcode/?utm_source=rss&utm_medium=rss&utm_campaign=wordpress-plugin-remote-content-shortcode https://www.justinsilver.com/technology/wordpress/wordpress-plugin-remote-content-shortcode/#comments Sun, 04 Nov 2012 05:06:44 +0000 http://justin.ag/?p=2779 Note: This plugin is now part of the WordPress Plugin Repository as Remote Content Shortcode. The Remote Content Shortcode plugin will enable a shortcode to display remote content embedded into a post or page....

The post Remote Content Shortcode appeared first on Justin Silver.

]]>
AmpedSense.OptimizeAdSpot('AP'); AmpedSense.OptimizeAdSpot('IL'); AmpedSense.OptimizeAdSpot('IR');

Note: This plugin is now part of the WordPress Plugin Repository as Remote Content Shortcode.

The Remote Content Shortcode plugin will enable a shortcode to display remote content embedded into a post or page. In fact, it is being used to embed the code below from my SVN server. To use it, just place the code in your page where you want to remote content to be placed.

[remote_content url="http://www.example.com"/]

By default this will just fetch the content and drop it straight into the page, which isn’t always ideal (like when you are using a code formatter like I am). Because of this, there are a few more parameters you can pass to Remote Content Shortcode:

  • url – the url that you want to request.
  • method=[ GET | POST ] – set the request type, defaults to GET.
  • timeout=[ 0-9... ] – set the request timeout in seconds, defaults to 10 seconds.
  • userpwd=[ username:password | post_meta | site_option | constant ] – the username and password to send for BASIC authentication. It is recommended to not set the username and password directly in the tag, as it will be visible on your site if this plugin is disabled, and instead use one of the other options. By order of priority, if the value matches a post meta_key the meta_value is used, if it matches a site_option the option_value is used, and if it matches a constant the constant value is used, otherwise the data is passed as is. The format is username:password.
  • htmlentities=[ false | true ] – if you want to HTML encode the content for display set to true, defaults to false.
  • strip_tags=[ false | true ] – remove all tags from the remote content (after CSS selection).
  • decode_atts=[ false | true ] – the SyntaxHighlighter plugin will HTML encode your shortcode attributes, so attr="blah" becomes attr=&quot;blah&quot;. This fixes it to the intended value when set to true, defaults to false.
  • selector=[ CSS Selectors... ] – the CSS selector or comma separated list or selectors for the content you would like to display, for example div.main-content or div.this-class #this-id, defaults to the entire document.
  • remove=[ CSS Selectors... ] – the CSS selector or comma separated list or selectors for the content that you would like to remove from the content, for example h2.this-class or div#this-id, defaults to no replacement.
  • find=[ regex ] – use a PHP regular expression to find content and replace it based on the replaceattribute, for example ~http://([^\.]*?)\.example\.com~, defaults to disabled.
  • replace=[ regex ] – the replacement text to use with the results of the find regular expression, for example https://\\1.new-domain.com, defaults to empty string replacement.
  • cache=[true| false ] – set to false to prevent the contents from being cached in the WP-Cache/WordPress transients, defaults to true for performance.
  • cache_ttl=[ 0-9... 3600 ] – the cache expiration in seconds or 0 for as long as possible, defaults to 3600 seconds.
If you specify any content for Remote Content Shortcode, it will be sent to the remote server as the request data.
[remote_content url="http://www.example.com" method="POST"]
{ json: { example: request } }
[/remote_content]

This source files for Remote Content Shortcode are always up to date based on the trunk of the WordPress Plugin SVN repository.

remote-content-shortcode.php

<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx</center>
</body>
</html>

The post Remote Content Shortcode appeared first on Justin Silver.

]]>
https://www.justinsilver.com/technology/wordpress/wordpress-plugin-remote-content-shortcode/feed/ 3
WordPress Plugin: wp-slimstat-permalinks https://www.justinsilver.com/technology/wordpress/wordpress-plugin-wp-slimstat-permalinks/?utm_source=rss&utm_medium=rss&utm_campaign=wordpress-plugin-wp-slimstat-permalinks https://www.justinsilver.com/technology/wordpress/wordpress-plugin-wp-slimstat-permalinks/#respond Sun, 04 Nov 2012 04:56:28 +0000 http://justin.ag/?p=2772 This plugin will maintain your WP SlimStat stats history for pages and posts when permalinks change for your page(s) or post(s). It does this by updating your {$wpdb->prefix)slim_stats table replacing the old permalink with...

The post WordPress Plugin: wp-slimstat-permalinks appeared first on Justin Silver.

]]>
AmpedSense.OptimizeAdSpot('AP'); AmpedSense.OptimizeAdSpot('IL'); AmpedSense.OptimizeAdSpot('IR');

This plugin will maintain your WP SlimStat stats history for pages and posts when permalinks change for your page(s) or post(s). It does this by updating your {$wpdb->prefix)slim_stats table replacing the old permalink with the new permalink in the resources column. Your permalinks can change when you update a post slug, date, etc or your permalink structure sitewide.

This file is always up to date based on the trunk of my SVN repository.

wp-slimstat-permalinks.php

<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.23.1</center>
</body>
</html>

The post WordPress Plugin: wp-slimstat-permalinks appeared first on Justin Silver.

]]>
https://www.justinsilver.com/technology/wordpress/wordpress-plugin-wp-slimstat-permalinks/feed/ 0
WP_HOME and WP_SITEURL for WordPress Multisite Development & Migration https://www.justinsilver.com/technology/wordpress/wp_home-and-wp_siteurl-for-wordpress-multisite-development-migration/?utm_source=rss&utm_medium=rss&utm_campaign=wp_home-and-wp_siteurl-for-wordpress-multisite-development-migration Fri, 19 Oct 2012 15:10:35 +0000 http://justin.ag/?p=2677 I needed to be able to copy the wp_options table(s) to my development environment as they contain configurations that are needed. To overcome the issue of not being able to set the WP_SITEURL and...

The post WP_HOME and WP_SITEURL for WordPress Multisite Development & Migration appeared first on Justin Silver.

]]>
AmpedSense.OptimizeAdSpot('AP'); AmpedSense.OptimizeAdSpot('IL'); AmpedSense.OptimizeAdSpot('IR');

I needed to be able to copy the wp_options table(s) to my development environment as they contain configurations that are needed. To overcome the issue of not being able to set the WP_SITEURL and WP_HOME values in WordPress MultiSite, I wrote a custom filter to replace the _config_wp_siteurl() and _config_wp_home() functions that are available for non-multisite installs that is included in a plugin that is available network-wide and is configured in wp-config.php. I am then able to copy all of the database tables except wp_site and wp_blogs to a local database.

I highly recommend the URL Token Replacement Techniques for WordPress 3.0 article by Chris Murphy to help handle URLs in your content.

This example assumes a subdomain multisite install, with a domain of example.com and two subdomains, www.example.com and second.example.com. The local development URLs will be www.example.local and second.example.local respectively.

WordPress Multisite Updates

Database Changes:

Update the domain value in wp_site:

UPDATE wp_site
SET domain = 'example.local'
WHERE domain = 'example.com';

Update the domain value(s) in wp_blogs:

UPDATE wp_blogs
SET domain = 'www.example.local'
WHERE domain = 'www.example.com';
UPDATE wp_blogs
SET domain = 'second.example.local'
WHERE domain = 'second.example.com';

Plugin Code:

The following plugin should be installed network-wide.

<?php
/*
Plugin Name: MultiSite WP_HOME and WP_SITEURL
Plugin URI: http://doublesharp.com/
Description: Allows wp_options values to be overwritten in wp-config.php for MultiSite
Author: Justin Silver
Version: 1.0
Author URI: http://doublesharp.com
License: GPL2
*/

/**
 * Replace this site's WP_SITEURL URL based on constant values
 *
 * @param String  $url - The original URL
 * @return String - The replaced URL if overridden in wp-config.php
 */
function _ms_config_wp_siteurl( $url = '' ) {
    if (is_multisite()):
        global $blog_id, $current_site;
        $cur_blog_id = defined( 'BLOG_ID_CURRENT_SITE' )?
            BLOG_ID_CURRENT_SITE :
            1;
        $key = ( $blog_id!=$cur_blog_id )? $blog_id.'_' : '';
        $constant = 'WP_'.$key.'SITEURL';
        if ( defined( $constant ) )
            return untrailingslashit( constant($constant) );
    endif;
    return $url;
}
add_filter( 'option_siteurl', '_ms_config_wp_siteurl' );

/**
 * Replace this site's WP_HOME URL based on constant values
 *
 * @param String  $url - The original URL
 * @return String - The replaced URL if overridden in wp-config.php
 */
function _ms_config_wp_home( $url = '' ) {
    if (is_multisite()):
        global $blog_id;
        $cur_blog_id = defined( 'BLOG_ID_CURRENT_SITE' )?
            BLOG_ID_CURRENT_SITE :
            1;
        $key = ( $blog_id!=$cur_blog_id )? $blog_id.'_' : '';
        $constant = 'WP_'.$key.'HOME';
        if ( defined( $constant ) )
            return untrailingslashit( constant($constant) );
    endif;
    return $url;
}
add_filter( 'option_home',    '_ms_config_wp_home'    );
?>

Configure wp-config.php:

Add new constants to wp-config.php. The primary site should use the standard WP_HOME and WP_SITEURL and the tertiary URLs should use WP_{$blog_id}_HOME and WP_{$blog_id}_SITEURL where {$blog_id} is the numeric blog ID value that you want to replace from the wp_blogs table.

define('WP_HOME',      'http://www.example.local');
define('WP_SITEURL',   'http://www.example.local');
define('WP_2_HOME',    'http://secondary.example.local');
define('WP_2_SITEURL', 'http://secondary.example.local');

This post is the result of a question that I originally asked on StackOverflow – Override WP_SITEURL and WP_HOME for WordPress Multisite – and ultimately answered with the help of Chris Murphy.

The post WP_HOME and WP_SITEURL for WordPress Multisite Development & Migration appeared first on Justin Silver.

]]>