wp/lib/blobfolio/wp/bm/debug.php
public function get_results($collapsed=true) {
		if (!$this->file) {
			return false;
		}

		$results = array(
			'RESULT'=>'',
			'TESTS'=>$this->tests,
			'ENVIRONMENT'=>array(
				'WORDPRESS'=>static::$wordpress,
				'WHITELIST'=>array(
					'EXTENSIONS'=>array(),
					'MIME TYPES'=>array(),
				),
				'PHP'=>static::$php,
			),
		);

		// Populate the authorized file types.
		foreach (static::$mimes as $k=>$v) {
			$results['ENVIRONMENT']['WHITELIST']['MIME TYPES'][] = strtolower(sanitize_mime_type($v));
			$exts = explode('|', $k);
			foreach ($exts as $v2) {
				$v2 = trim(strtolower($v2));
				$v2 = ltrim($v2, '.');
				$results['ENVIRONMENT']['WHITELIST']['EXTENSIONS'][] = $v2;
			}
		}
		foreach ($results['ENVIRONMENT']['WHITELIST'] as $k=>$v) {
			$results['ENVIRONMENT']['WHITELIST'][$k] = array_unique($results['ENVIRONMENT']['WHITELIST'][$k]);
			sort($results['ENVIRONMENT']['WHITELIST'][$k]);
		}

		$this->errors = array_values(array_unique($this->errors));
		if (count($this->errors)) {
			$results['RESULT'] = __('The following error(s) were found:', 'blob-mimes') . "\n * " . implode("\n * ", $this->errors);
		}
		else {
			$results['RESULT'] = __('You *should* be able to upload this file. If not, a plugin or theme might be interfering with the process.', 'blob-mimes');
		}

		// If we aren't collapsing, we're done.
		if (!$collapsed) {
			return $results;
		}

		$out = array();
		foreach ($results as $k=>$v) {
			if ('RESULT' !== $k) {
				$out[] = '';
				$out[] = '';
			}

			// Section header.
			$out[] = $this->make_results_header($k);

			// Just print results.
			if ('RESULT' === $k) {
				$out[] = $this->make_results_value($v);
				continue;
			}

			if (!is_array($v) || !count($v)) {
				continue;
			}

			// Other Subsections.
			foreach ($v as $k2=>$v2) {
				if (!is_array($v2) || !count($v2)) {
					continue;
				}

				// Subsection header.
				$out[] = '';
				$out[] = $this->make_results_header($k2, false);

				foreach ($v2 as $k3=>$v3) {
					$key = str_replace('_', ' ', strtoupper($k3));

					// An array.
					if (is_array($v3)) {
						if (!count($v3)) {
							$out[] = $this->make_results_value('N/A', false, $key);
						}
						else {
							// Indexed array.
							$indexed = true;
							foreach (array_keys($v3) as $k4) {
								if (!is_numeric($k4)) {
									$indexed = false;
									break;
								}
							}

							// Keys don't matter, just group everything.
							if ($indexed) {
								// PHP extensions don't need separate lines.
								if (
									('EXTENSIONS' === $key) ||
									('MIME TYPES' === $key)
								) {
									$value = implode('; ', $v3);
								}
								else {
									$value = implode("\n", $v3);
								}
								$out[] = $this->make_results_value($value, true, $key);
							}
							// Break out associative arrays.
							else {
								$tmp = array();
								foreach ($v3 as $k4=>$v4) {
									$k4 = '[' . str_replace('_', ' ', strtolower($k4)) . ']';
									if (is_bool($v4)) {
										$value = $v4 ? 'TRUE' : 'FALSE';
									}
									else {
										$value = $v4;
									}
									$tmp[] = __($k4, 'blob-mimes') . " $value";
								}
								$out[] = $this->make_results_value(implode("\n", $tmp), true, $key);
							}
						}
					}
					// A string.
					else {
						$out[] = $this->make_results_value($v3, true, $key);
					}
				}
			}
		}

		return implode("\n", $out);
	}
public function get_results($collapsed=true) {
		if (!$this->file) {
			return false;
		}

		$results = array(
			'RESULT'=>'',
			'TESTS'=>$this->tests,
			'ENVIRONMENT'=>array(
				'WORDPRESS'=>static::$wordpress,
				'WHITELIST'=>array(
					'EXTENSIONS'=>array(),
					'MIME TYPES'=>array(),
				),
				'PHP'=>static::$php,
			),
		);

		// Populate the authorized file types.
		foreach (static::$mimes as $k=>$v) {
			$results['ENVIRONMENT']['WHITELIST']['MIME TYPES'][] = strtolower(sanitize_mime_type($v));
			$exts = explode('|', $k);
			foreach ($exts as $v2) {
				$v2 = trim(strtolower($v2));
				$v2 = ltrim($v2, '.');
				$results['ENVIRONMENT']['WHITELIST']['EXTENSIONS'][] = $v2;
			}
		}
		foreach ($results['ENVIRONMENT']['WHITELIST'] as $k=>$v) {
			$results['ENVIRONMENT']['WHITELIST'][$k] = array_unique($results['ENVIRONMENT']['WHITELIST'][$k]);
			sort($results['ENVIRONMENT']['WHITELIST'][$k]);
		}

		$this->errors = array_values(array_unique($this->errors));
		if (count($this->errors)) {
			$results['RESULT'] = __('The following error(s) were found:', 'blob-mimes') . "\n * " . implode("\n * ", $this->errors);
		}
		else {
			$results['RESULT'] = __('You *should* be able to upload this file. If not, a plugin or theme might be interfering with the process.', 'blob-mimes');
		}

		// If we aren't collapsing, we're done.
		if (!$collapsed) {
			return $results;
		}

		$out = array();
		foreach ($results as $k=>$v) {
			if ('RESULT' !== $k) {
				$out[] = '';
				$out[] = '';
			}

			// Section header.
			$out[] = $this->make_results_header($k);

			// Just print results.
			if ('RESULT' === $k) {
				$out[] = $this->make_results_value($v);
				continue;
			}

			if (!is_array($v) || !count($v)) {
				continue;
			}

			// Other Subsections.
			foreach ($v as $k2=>$v2) {
				if (!is_array($v2) || !count($v2)) {
					continue;
				}

				// Subsection header.
				$out[] = '';
				$out[] = $this->make_results_header($k2, false);

				foreach ($v2 as $k3=>$v3) {
					$key = str_replace('_', ' ', strtoupper($k3));

					// An array.
					if (is_array($v3)) {
						if (!count($v3)) {
							$out[] = $this->make_results_value('N/A', false, $key);
						}
						else {
							// Indexed array.
							$indexed = true;
							foreach (array_keys($v3) as $k4) {
								if (!is_numeric($k4)) {
									$indexed = false;
									break;
								}
							}

							// Keys don't matter, just group everything.
							if ($indexed) {
								// PHP extensions don't need separate lines.
								if (
									('EXTENSIONS' === $key) ||
									('MIME TYPES' === $key)
								) {
									$value = implode('; ', $v3);
								}
								else {
									$value = implode("\n", $v3);
								}
								$out[] = $this->make_results_value($value, true, $key);
							}
							// Break out associative arrays.
							else {
								$tmp = array();
								foreach ($v3 as $k4=>$v4) {
									$k4 = '[' . str_replace('_', ' ', strtolower($k4)) . ']';
									if (is_bool($v4)) {
										$value = $v4 ? 'TRUE' : 'FALSE';
									}
									else {
										$value = $v4;
									}
									$tmp[] = __($k4, 'blob-mimes') . " $value";
								}
								$out[] = $this->make_results_value(implode("\n", $tmp), true, $key);
							}
						}
					}
					// A string.
					else {
						$out[] = $this->make_results_value($v3, true, $key);
					}
				}
			}
		}

		return implode("\n", $out);
	}
Get Results!

@param bool $collapsed Collapsed as string.
@return mixed Results or false.