Skip to content

Instantly share code, notes, and snippets.

@wpsmith
Last active September 1, 2015 15:26
Show Gist options
  • Save wpsmith/ea3a00a59537fc9161c7 to your computer and use it in GitHub Desktop.
Save wpsmith/ea3a00a59537fc9161c7 to your computer and use it in GitHub Desktop.
Blog: Describing PHPStorm
<?php
/**
* Determines whether we are in debug mode or not based on WP_DEBUG & SCRIPT_DEBUG
*
* @return bool Whether we are in debug mode.
*/
function wps_is_debug() {
return ( ( defined( 'WP_DEBUG' ) && WP_DEBUG ) || ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) );
}
<?php
function wps_get_plugin_info( $plugin ) {
static $plugins = array();
if ( isset( $plugins[ $plugin ] ) ) {
return $plugins[ $plugin ];
}
if ( !function_exists( 'plugins_api' ) ) {
require_once( ABSPATH . '/wp-admin/includes/plugin-install.php' );
}
$info = plugins_api( 'plugin_information', array( 'slug' => $plugin ) );
$plugins[ $plugin ] = $info;
return $info;
}
<?php
function wps_get_plugin_info( $plugin ) {
static $plugins = array();
if ( $plugin != 'myplugin' ) {
return false;
}
if ( isset( $plugins[ $plugin ] ) ) {
return $plugins[ $plugin ];
}
if ( ! function_exists( 'plugins_api' ) ) {
require_once( ABSPATH . '/wp-admin/includes/plugin-install.php' );
}
$info = plugins_api( 'plugin_information', array( 'slug' => $plugin ) );
$plugins[ $plugin ] = $info;
return $info;
}
<?php
function wps_get_plugin_info($plugin) {
static $plugins=array();
if ($plugin!='myplugin')
return false;
if (isset($plugins[$plugin]))
return $plugins[$plugin];
if ( !function_exists( 'plugins_api' ) )
require_once(ABSPATH.'/wp-admin/includes/plugin-install.php');
$info=plugins_api('plugin_information',array('slug'=>$plugin));
$plugins[$plugin]=$info;
return $info;
}
<?php
/**
* @return bool
*/
<?php
/*
*
*/
<?php
/**
* @param $plugin
*
* @return object
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment