public/wordpress/wp-content/plugins/backupbuddy/controllers/actions.php
/*	content_editor_backup_reminder_on_update()
	 *	
	 *	On post / page save injects an additional reminder to remember to back the site up if reminders are enabled.
	 *	
	 *	@param		array		$messages		Array of messages to be displayed.
	 *	@return		array						Returns modified array (or original if this is not the message to edit).
	 */


On post / page save injects an additional reminder to remember to back the site up if reminders are enabled.

@param          array           $messages               Array of messages to be displayed.
@return         array                                           Returns modified array (or original if this is not the message to edit).
On post / page save injects an additional reminder to remember to back the site up if reminders are enabled . @param array $messages Array of messages to be displayed . @return array Returns modified array ( or original if this is not the message to edit ) .
function content_editor_backup_reminder_on_update( $messages ) {
		if ( !isset( $messages['post'] ) ) { 
			return $messages;
		}
		$admin_url = '';
		if ( is_multisite() && current_user_can( 'manage_network' ) ) { 
			return $messages;
		} elseif( !is_multisite() && current_user_can( pb_backupbuddy::$options['role_access'] ) ) { 
			$admin_url = admin_url( 'admin.php' );
		} else {
			return $messages;
		}
		$fullbackup = esc_url( add_query_arg( array(
				'page' => 'pb_backupbuddy_backup',
				'backupbuddy_backup' => '2'
			), $admin_url
		) );
		$dbbackup = esc_url( add_query_arg( array(
				'page' => 'pb_backupbuddy_backup',
				'backupbuddy_backup' => '1'
			), $admin_url
		) );
		$backup_message = " | <a href='{$dbbackup}'>" . __('Database Backup', 'it-l10n-backupbuddy' ) . "</a> | <a href='{$fullbackup}'>" . __('Full Backup', 'it-l10n-backupbuddy' ) . "</a>";
		$reminder_posts = array(); 
		$reminder_pages = array(); 
		$others = array(); 
		foreach ( $messages['post'] as $num => $message ) {
			$message .= $backup_message;
			if ( $num == 0 ) {
			$message = ''; 
			}
			array_push( $reminder_posts, $message ); 
		}
		$reminder_posts = array( 'post' => $reminder_posts ); 
		foreach ( $messages['page'] as $num => $message ) {
			$message .= $backup_message;
			if ( $num == 0 ) {
				$message = ''; 
			}
			array_push( $reminder_pages, $message ); 
		}
		$reminder_pages = array( 'page' => $reminder_pages ); 
		$reminder = array_merge( $reminder_posts, $reminder_pages );
		foreach ( $messages as $type => $message ) {
			if ( ( $type == 'post' ) || ( $type == 'page' ) ) { 
				continue;
			}
			$others[$type] = $message; 
		}
		$reminder = array_merge( $reminder, $others ); 
		return $reminder;
	}
function content_editor_backup_reminder_on_update ( $ messages ) { if ( ! isset ( $ messages [ 'post' ] ) ) { return $ messages ; } $ admin_url = '' ; if ( is_multisite ( ) && current_user_can ( 'manage_network' ) ) { return $ messages ; } elseif ( ! is_multisite ( ) && current_user_can ( pb_backupbuddy :: $ options [ 'role_access' ] ) ) { $ admin_url = admin_url ( 'admin.php' ) ; } else { return $ messages ; } $ fullbackup = esc_url ( add_query_arg ( array ( 'page' => 'pb_backupbuddy_backup' , 'backupbuddy_backup' => '2' ) , $ admin_url ) ) ; $ dbbackup = esc_url ( add_query_arg ( array ( 'page' => 'pb_backupbuddy_backup' , 'backupbuddy_backup' => '1' ) , $ admin_url ) ) ; $ backup_message = "  | <a href=' { $ dbbackup } '> " . __ ( 'Database Backup' , 'it-l10n-backupbuddy' ) . " </a> | <a href=' { $ fullbackup } '> " . __ ( 'Full Backup' , 'it-l10n-backupbuddy' ) . " </a> " ; $ reminder_posts = array ( ) ; $ reminder_pages = array ( ) ; $ others = array ( ) ; foreach ( $ messages [ 'post' ] as $ num => $ message ) { $ message .= $ backup_message ; if ( $ num == 0 ) { $ message = '' ; } array_push ( $ reminder_posts , $ message ) ; } $ reminder_posts = array ( 'post' => $ reminder_posts ) ; foreach ( $ messages [ 'page' ] as $ num => $ message ) { $ message .= $ backup_message ; if ( $ num == 0 ) { $ message = '' ; } array_push ( $ reminder_pages , $ message ) ; } $ reminder_pages = array ( 'page' => $ reminder_pages ) ; $ reminder = array_merge ( $ reminder_posts , $ reminder_pages ) ; foreach ( $ messages as $ type => $ message ) { if ( ( $ type == 'post' ) || ( $ type == 'page' ) ) { continue ; } $ others [ $ type ] = $ message ; } $ reminder = array_merge ( $ reminder , $ others ) ; return $ reminder ; }
content_editor_backup_reminder_on_update()
content_editor_backup_reminder_on_update ()
// Fixes conflict with Simpler CSS plugin. Issue #226. //Only show the backup message for network admins or adminstrators // Network Admin in multisite. Don't show messages in this case. //$admin_url = admin_url( 'network/admin.php' ); // User with access in standalone. // empty array to store customized post messages array // empty array to store customized page messages array // An empty array to store the array for custom post types // The first element in the messages['post'] array is always empty // Insert/copy the modified message value to the last element of reminder array // Apply the post key to the first dimension of messages array // The first element in the messages['page'] array is always empty // Insert/copy the modified message value to the last element of reminder array // Apply the page key to the first dimension of messages array // Skip the post key since it is already defined // Since message is an array, this statement forms 2D array // Merge the arrays in the others array with reminder array in order to form an appropriate format for messages array