| 1 |  |  | <?php | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * Plugin Name: Foo Gallery | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * Description: Foo Gallery is the most intuitive and extensible gallery management tool ever created for WordPress | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * Version:     1.2.18 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * Author:      FooPlugins | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * Plugin URI:  https://foo.gallery | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * Author URI:  http://fooplugins.com | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * Text Domain: foogallery | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * License:     GPL-2.0+ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * Domain Path: /languages | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | // If this file is called directly, abort. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | if ( ! defined( 'WPINC' ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | 	die; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | define( 'FOOGALLERY_SLUG', 'foogallery' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | define( 'FOOGALLERY_PATH', plugin_dir_path( __FILE__ ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | define( 'FOOGALLERY_URL', plugin_dir_url( __FILE__ ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | define( 'FOOGALLERY_FILE', __FILE__ ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | define( 'FOOGALLERY_VERSION', '1.2.18' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  * FooGallery_Plugin class | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  * @package   FooGallery | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  * @author    Brad Vincent <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |  * @license   GPL-2.0+ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |  * @link      https://github.com/fooplugins/foogallery | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |  * @copyright 2013 FooPlugins LLC | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | if ( ! class_exists( 'FooGallery_Plugin' ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | 	require_once( FOOGALLERY_PATH . 'includes/foopluginbase/bootstrapper.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | 	 * FooGallery_Plugin class. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | 	 * @package FooGallery | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  | 	 * @author  Brad Vincent <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 	class FooGallery_Plugin extends Foo_Plugin_Base_v2_3 { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | 		private static $instance; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | 		public static function get_instance() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | 			if ( ! isset(self::$instance) && ! (self::$instance instanceof FooGallery_Plugin) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  | 				self::$instance = new FooGallery_Plugin(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  | 			return self::$instance; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  | 		 * Initialize the plugin by setting localization, filters, and administration functions. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  | 		private function __construct() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  | 			//include everything we need! | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  | 			require_once( FOOGALLERY_PATH . 'includes/includes.php' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  | 			register_activation_hook( __FILE__, array( 'FooGallery_Plugin', 'activate' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  | 			//init FooPluginBase | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  | 			$this->init( FOOGALLERY_FILE, FOOGALLERY_SLUG, FOOGALLERY_VERSION, 'FooGallery' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  | 			//setup text domain | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  | 			$this->load_plugin_textdomain(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  | 			//setup gallery post type | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  | 			new FooGallery_PostTypes(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  | 			//load any extensions | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  | 			new FooGallery_Extensions_Loader(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  | 			if ( is_admin() ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  | 				new FooGallery_Admin(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  | 				add_action( 'wpmu_new_blog', array( $this, 'set_default_extensions_for_multisite_network_activated' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  | 			} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  | 				new FooGallery_Public(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  | 			new FooGallery_Thumbnails(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  | 			new FooGallery_Polylang_Compatibility(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  | 			new FooGallery_Attachment_Filters(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  | 			new FooGallery_Retina(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  | 			new FooGallery_WPThumb_Enhancements(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  | 			new FooGallery_Animated_Gif_Support(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  | 			new FooGallery_Cache(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  | 			new FooGallery_LazyLoad(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  | 			new FooGallery_Thumbnail_Dimensions(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  | 			new FooGallery_Admin_Gallery_MetaBox_Settings(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  | 			$checker = new FooGallery_Version_Check(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  | 			$checker->wire_up_checker(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  | 		 * Set default extensions when a new site is created in multisite and FooGallery is network activated | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  | 		 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  | 		 * @since 1.2.5 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  | 		 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  | 		 * @param int $blog_id The ID of the newly created site | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  | 		public function set_default_extensions_for_multisite_network_activated( $blog_id ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  | 			switch_to_blog( $blog_id ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  | 			if ( false === get_option( FOOGALLERY_EXTENSIONS_AUTO_ACTIVATED_OPTIONS_KEY, false ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  | 				$api = new FooGallery_Extensions_API(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  | 				$api->auto_activate_extensions(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  | 				update_option( FOOGALLERY_EXTENSIONS_AUTO_ACTIVATED_OPTIONS_KEY, true ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  | 			restore_current_blog(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  | 		 * Fired when the plugin is activated. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  | 		 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  | 		 * @since    1.0.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  | 		 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  | 		 * @param    boolean    $network_wide    True if WPMU superadmin uses | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  | 		 *                                       "Network Activate" action, false if | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  | 		 *                                       WPMU is disabled or plugin is | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  | 		 *                                       activated on an individual blog. | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 140 |  |  | 		 */ | 
            
                                                                        
                            
            
                                    
            
            
                | 141 |  |  | 		public static function activate( $network_wide ) { | 
            
                                                                        
                            
            
                                    
            
            
                | 142 |  |  | 			if ( function_exists( 'is_multisite' ) && is_multisite() ) { | 
            
                                                                        
                            
            
                                    
            
            
                | 143 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 144 |  |  | 				if ( $network_wide  ) { | 
            
                                                                        
                            
            
                                    
            
            
                | 145 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 146 |  |  | 					// Get all blog ids | 
            
                                                                        
                            
            
                                    
            
            
                | 147 |  |  | 					$blog_ids = self::get_blog_ids(); | 
            
                                                                        
                            
            
                                    
            
            
                | 148 |  |  | 					if ( is_array( $blog_ids ) ) { | 
            
                                                                        
                            
            
                                    
            
            
                | 149 |  |  | 						foreach ( $blog_ids as $blog_id ) { | 
            
                                                                        
                            
            
                                    
            
            
                | 150 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 151 |  |  | 							switch_to_blog( $blog_id ); | 
            
                                                                        
                            
            
                                    
            
            
                | 152 |  |  | 							self::single_activate(); | 
            
                                                                        
                            
            
                                    
            
            
                | 153 |  |  | 						} | 
            
                                                                        
                            
            
                                    
            
            
                | 154 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 155 |  |  | 						restore_current_blog(); | 
            
                                                                        
                            
            
                                    
            
            
                | 156 |  |  | 					} | 
            
                                                                        
                            
            
                                    
            
            
                | 157 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 158 |  |  | 				} else { | 
            
                                                                        
                            
            
                                    
            
            
                | 159 |  |  | 					self::single_activate(); | 
            
                                                                        
                            
            
                                    
            
            
                | 160 |  |  | 				} | 
            
                                                                        
                            
            
                                    
            
            
                | 161 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 162 |  |  | 			} else { | 
            
                                                                        
                            
            
                                    
            
            
                | 163 |  |  | 				self::single_activate( false ); | 
            
                                                                        
                            
            
                                    
            
            
                | 164 |  |  | 			} | 
            
                                                                        
                            
            
                                    
            
            
                | 165 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  | 		 * Fired for each blog when the plugin is activated. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  | 		 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  | 		 * @since    1.0.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  | 		private static function single_activate( $multisite = true ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  | 			if ( false === get_option( FOOGALLERY_EXTENSIONS_AUTO_ACTIVATED_OPTIONS_KEY, false ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  | 				$api = new FooGallery_Extensions_API(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  | 				$api->auto_activate_extensions(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  | 				update_option( FOOGALLERY_EXTENSIONS_AUTO_ACTIVATED_OPTIONS_KEY, true ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  | 			if ( false === $multisite ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  | 				//Make sure we redirect to the welcome page | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  | 				set_transient( FOOGALLERY_ACTIVATION_REDIRECT_TRANSIENT_KEY, true, 30 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  | 			//force a version check on activation to make sure housekeeping is performed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  | 			foogallery_perform_version_check(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  | 		/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  | 		 * Get all blog ids of blogs in the current network that are: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  | 		 * - not archived | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  | 		 * - not spam | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  | 		 * - not deleted | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  | 		 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  | 		 * @since    1.0.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  | 		 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  | 		 * @return   array|false    The blog ids, false if no matches. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  | 		 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  | 		private static function get_blog_ids() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  | 			if ( function_exists( 'wp_get_sites' ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  | 				$sites = wp_get_sites(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  | 				$blog_ids = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  | 				foreach ( $sites as $site ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  | 					$blog_ids[] = $site['blog_id']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  | 				return $blog_ids; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  | 			} else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  | 				//pre WP 3.7 - do this the old way! | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  | 				global $wpdb; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  | 				// get an array of blog ids | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  | 				$sql = "SELECT blog_id FROM $wpdb->blogs WHERE archived = '0' AND spam = '0' AND deleted = '0'"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  | 				return $wpdb->get_col( $sql ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 222 |  |  | FooGallery_Plugin::get_instance(); | 
            
                                                        
            
                                    
            
            
                | 223 |  |  |  | 
            
                        
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.