Skip to content

Commit

Permalink
Fixed mThumb PHP Notices, added Maintenance Mode bypass for wp-config…
Browse files Browse the repository at this point in the history
….php, disabled minify builder, updated domains list for mapi_extract_domain, fix for 3.9 in options framework
  • Loading branch information
Damian Taggart committed Jun 26, 2014
1 parent 5f49eb4 commit 3ec7387
Show file tree
Hide file tree
Showing 12 changed files with 7,449 additions and 7,163 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Provides a library of additional template tags, 3rd-party libraries, and functio

# Changelog:

## 0.7.4
Fixed mThumb PHP Notices, added Maintenance Mode bypass for wp-config.php, disabled minify builder, updated domains list for mapi_extract_domain, fix for 3.9 in options framework

## 0.7.3.1

Bugfix for PHP open tags, add fn mapi_get_file_extension, added mapi_get_host_by_ip and mapi_get_ip_by_host
Expand Down
28 changes: 19 additions & 9 deletions core/mapi-attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,10 @@ function mapi_featured_img($args = array()) {
return apply_filters('mapi_featured_image', FALSE); // no post thumbnail was found
}


/**
* Resizes and outputs a WordPress featured image with a caption. See mapi_featured_img for parameters.
*
* @uses mapi_featured_img
* @uses mapi_featured_img
*
* @since 0.7.2
*
Expand Down Expand Up @@ -380,10 +379,13 @@ function mapi_mthumb_config() {
} elseif(file_exists(get_template_directory().'/timthumb-config.php')) {
include(get_template_directory().'/timthumb-config.php');
} else {

// Max sizes
define('MAX_WIDTH', apply_filters('mapi_timthumb_max_width', 3600));
define('MAX_HEIGHT', apply_filters('mapi_timthumb_max_height', 3600));
if(!defined('MAX_WIDTH')) {
define('MAX_WIDTH', apply_filters('mapi_timthumb_max_width', 3600));
}
if(!defined('MAX_HEIGHT')) {
define('MAX_HEIGHT', apply_filters('mapi_timthumb_max_height', 3600));
}

// External Sites
$ALLOWED_SITES = apply_filters(
Expand All @@ -402,13 +404,21 @@ function mapi_mthumb_config() {
'mindsharestudios.com'
)
);
define('ALLOW_EXTERNAL', apply_filters('mapi_timthumb_allow_external', TRUE));
if(!defined('ALLOW_EXTERNAL')) {
define('ALLOW_EXTERNAL', apply_filters('mapi_timthumb_allow_external', TRUE));
}

// Caching
define('FILE_CACHE_DIRECTORY', apply_filters('mapi_timthumb_cache_dir', ABSPATH.'/wp-content/uploads/cache/'));
if(!defined('MAX_WIDTH')) {
define('FILE_CACHE_DIRECTORY', apply_filters('mapi_timthumb_cache_dir', ABSPATH.'/wp-content/uploads/cache/'));
}
//define('FILE_CACHE_DIRECTORY',''); // leave blank for system directory
define('FILE_CACHE_TIME_BETWEEN_CLEANS', apply_filters('mapi_timthumb_cache_interval', 172800)); // 2 days
define('BROWSER_CACHE_MAX_AGE', apply_filters('mapi_timthumb_cache_max_age', 1728000)); // 20 days
if(!defined('MAX_WIDTH')) {
define('FILE_CACHE_TIME_BETWEEN_CLEANS', apply_filters('mapi_timthumb_cache_interval', 172800)); // 2 days
}
if(!defined('MAX_WIDTH')) {
define('BROWSER_CACHE_MAX_AGE', apply_filters('mapi_timthumb_cache_max_age', 1728000)); // 20 days
}
}
}

Expand Down
8 changes: 8 additions & 0 deletions core/mapi-security.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,23 @@
* To bypass maintenance mode and enable a specific page to be viewed while logged out
* append any site URL with <code>?maintenance=bypass</code>.
*
* You can also bypass maintenance mode from within wp-config.php like so:
* <code>define('MAPI_MAINTENANCE_MODE_BYPASS', TRUE);</code>
*
* @param bool $enabled
* @param string $role
* @param string $reason
* @param string $css
* @param bool $use_503
*/
function mapi_maintenance_mode($enabled = FALSE, $role = 'Subscriber', $reason = '', $css = '', $use_503 = FALSE) {
$bypass_key = apply_filters('mapi_maintenance_mode_bypass_key', 'bypass');
if((isset($_GET['maintenance']) && $_GET['maintenance'] == $bypass_key)) {
$enabled = FALSE;
}
if(defined('MAPI_MAINTENANCE_MODE_BYPASS') && MAPI_MAINTENANCE_MODE_BYPASS == TRUE) {
$enabled = FALSE;
}
if(empty($css)) {
require_once(MAPI_DIR_PATH.'/views/mapi-maintenance-mode-css.php');
$css = $maintenance_mode_css;
Expand Down
10 changes: 7 additions & 3 deletions core/mapi-utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ function mapi_poop() {
mapi_var_dump('Poop', TRUE);
}


/**
*
* Returns an array of file URLs for a given directory filterable by file extension(s).
Expand Down Expand Up @@ -1003,13 +1002,18 @@ function mapi_edit_link() {

/**
*
* Automatically sets external (offsite) links to open in a new window or tab.
* Automatically sets external (offsite) links to open in a new window or tab. Updated to allow subdomains from the same TLD.
*
*/
function mapi_external_links() {
global $MAPI_TLD;
if(!isset($MAPI_TLD) || empty($MAPI_TLD)) {
$MAPI_TLD = mapi_extract_domain(mapi_get_url());
}

?>
<script type="text/javascript">jQuery(document).ready(function() {
jQuery("a[href^='http']:not([href*='" + document.domain + "'])").each(function() {
jQuery("a[href^='http']:not([href*='<?php echo $MAPI_TLD; ?>'])").each(function() {
jQuery(this).attr("target", "_blank");
});
});</script><?php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1779,7 +1779,7 @@ public function show_field_wysiwyg($field, $meta) {
echo "<textarea class='at-wysiwyg theEditor large-text' name='{$field['id']}' id='{$field['id']}' cols='60' rows='10'>{$meta}</textarea>";
} else {
// Use new wp_editor() since WP 3.3
wp_editor(stripslashes(stripslashes(html_entity_decode($meta))), $field['id'], array('editor_class' => 'at-wysiwyg'));
@wp_editor(stripslashes(stripslashes(html_entity_decode($meta))), $field['id'], array('editor_class' => 'at-wysiwyg'));
}
$this->show_field_end($field, $meta);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/minify-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
$min_allowDebugFlag = TRUE;
//###WPM-DEBUG-FLAG-AFTER###

$min_enableBuilder = TRUE;
$min_enableBuilder = FALSE;
$min_builderPassword = 'admin';
$min_documentRoot = '';
$min_cacheFileLocking = TRUE;
Expand Down
11 changes: 9 additions & 2 deletions lib/mthumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@
//mapi_mthumb_config();

// Max sizes
define('MAX_WIDTH', 3600);
define('MAX_HEIGHT', 3600);
if(!defined('MAX_WIDTH')) {
define('MAX_WIDTH', 3600);
}
if(!defined('MAX_HEIGHT')) {
define('MAX_HEIGHT', 3600);
}
if(!defined('MAX_FILE_SIZE')) {
define ('MAX_FILE_SIZE', 20971520); // 20MB
}

// External Sites
$ALLOWED_SITES = array(
Expand Down
13 changes: 9 additions & 4 deletions lib/mthumb/mthumb-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@
global $ALLOWED_SITES;

// Max sizes
define('MAX_WIDTH', 3600);
define('MAX_HEIGHT', 3600);
define ('MAX_FILE_SIZE', 20971520); // 20MB

if(!defined('MAX_WIDTH')) {
define('MAX_WIDTH', 3600);
}
if(!defined('MAX_HEIGHT')) {
define('MAX_HEIGHT', 3600);
}
if(!defined('MAX_FILE_SIZE')) {
define ('MAX_FILE_SIZE', 20971520); // 20MB
}
// External Sites
$ALLOWED_SITES = array(
'flickr.com',
Expand Down

0 comments on commit 3ec7387

Please sign in to comment.