本文整理汇总了PHP中TGM_Plugin_Activation::get_instance方法的典型用法代码示例。如果您正苦于以下问题:PHP TGM_Plugin_Activation::get_instance方法的具体用法?PHP TGM_Plugin_Activation::get_instance怎么用?PHP TGM_Plugin_Activation::get_instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGM_Plugin_Activation
的用法示例。
在下文中一共展示了TGM_Plugin_Activation::get_instance方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: oxy_fix_tgm_double_nag
function oxy_fix_tgm_double_nag()
{
global $current_screen;
if (strpos($current_screen->base, THEME_SHORT) !== false || isset($current_screen->post_type) && $current_screen->post_type === 'oxy_swatch') {
$tgmpa = TGM_Plugin_Activation::get_instance();
remove_action('admin_notices', array($tgmpa, 'notices'));
}
}
示例2: lbmn_required_plugins_install_check
/**
* ----------------------------------------------------------------------
* Check if required plugins were manually installed
*/
function lbmn_required_plugins_install_check()
{
if (TGM_Plugin_Activation::get_instance()->is_tgmpa_complete()) {
// Update theme option '_required_plugins_installed'
update_option(LBMN_THEME_NAME . '_required_plugins_installed', true);
// Mark first step 'Install Plugins' as done
echo '<script type="text/javascript">jQuery(\'.step-plugins\').addClass(\'step-completed\');</script>';
} else {
update_option(LBMN_THEME_NAME . '_required_plugins_installed', false);
}
}
示例3: themify_theme_required_plugins_admin_menu
/**
* Relocate the tgmpa admin menu under Themify
*
* @since 1.0.0
*/
function themify_theme_required_plugins_admin_menu()
{
// Make sure privileges are correct to see the page
if (!current_user_can('install_plugins')) {
return;
}
TGM_Plugin_Activation::get_instance()->populate_file_path();
foreach (TGM_Plugin_Activation::get_instance()->plugins as $plugin) {
if (!is_plugin_active($plugin['file_path'])) {
add_submenu_page('themify', __('Install Plugins', 'themify'), __('Install Plugins', 'themify'), 'manage_options', 'themify-install-plugins', array(TGM_Plugin_Activation::get_instance(), 'install_plugins_page'));
break;
}
}
}
示例4: lbmn_required_plugins_install_check
/**
* ----------------------------------------------------------------------
* Check if required plugins were manually installed
*/
function lbmn_required_plugins_install_check()
{
if (TGM_Plugin_Activation::get_instance()->is_tgmpa_complete()) {
// Update theme option '_required_plugins_installed'
update_option(LBMN_THEME_NAME . '_required_plugins_installed', true);
// Mark first step 'Install Plugins' as done
echo '<script type="text/javascript">jQuery(\'.step-plugins\').addClass(\'step-completed\');</script>';
} else {
update_option(LBMN_THEME_NAME . '_required_plugins_installed', false);
}
// if ( ! get_option( LBMN_THEME_NAME . '_required_plugins_installed' ) ) {
// Proceed only if '_required_plugins_installed' not already market as true
/*
global $tgmpa_settings_errors;
$current_tgmpa_message = '';
if (is_array($tgmpa_settings_errors)) {
foreach ($tgmpa_settings_errors as $message) {
$current_tgmpa_message .= $message['message'];
}
}
$current_wpadmin_screen = get_current_screen();
lbmn_debug_console( $current_wpadmin_screen->id );
// Don't check on TGMPA installation page as there is no notices
// if ($current_wpadmin_screen->id != 'appearance_page_install-required-plugins' ) {
if ($current_wpadmin_screen->id == 'themes' ) {
// echo "MESSAGE: $current_tgmpa_message";
// If message has no link to install-required-plugins page then all
// required plugins has been installed
if ( ! stristr($current_tgmpa_message, 'install-required-plugins') ) {
// Update theme option '_required_plugins_installed'
update_option( LBMN_THEME_NAME . '_required_plugins_installed', true);
// Mark first step 'Install Plugins' as done
echo '<script type="text/javascript">jQuery(\'.step-plugins\').addClass(\'step-completed\');</script>';
} else {
update_option( LBMN_THEME_NAME . '_required_plugins_installed', false);
}
lbmn_debug_console( get_option (LBMN_THEME_NAME . '_required_plugins_installed') );
}
// }
*/
}
示例5: load_tgm_plugin_activation
/**
* Ensure only one instance of the class is ever invoked.
*/
function load_tgm_plugin_activation()
{
$GLOBALS['foreverwood'] = TGM_Plugin_Activation::get_instance();
}
示例6: get_instance
* Returns the singleton instance of the class.
*
* @since 2.4.0
*
* @return object The TGM_Plugin_Activation object.
*/
public static function get_instance()
{
if (!isset(self::$instance) && !self::$instance instanceof TGM_Plugin_Activation) {
self::$instance = new TGM_Plugin_Activation();
}
return self::$instance;
}
}
// Ensure only one instance of the class is ever invoked.
$tgmpa = TGM_Plugin_Activation::get_instance();
}
if (!function_exists('tgmpa')) {
/**
* Helper function to register a collection of required plugins.
*
* @since 2.0.0
* @api
*
* @param array $plugins An array of plugin arrays.
* @param array $config Optional. An array of configuration values.
*/
function tgmpa($plugins, $config = array())
{
foreach ($plugins as $plugin) {
TGM_Plugin_Activation::$instance->register($plugin);
示例7: admin_notices
/**
* Renders admin notes in case there are errors or notices on bootstrap init
*
* @author peshkov@UD
*/
public function admin_notices()
{
global $wp_version;
//** Don't show the message if the user has no 'activate plugins' permission. */
if (!function_exists('wp_get_current_user')) {
require_once ABSPATH . 'wp-includes/pluggable.php';
}
if (!current_user_can('activate_plugins')) {
return;
}
//** Don't show the message if on a multisite and the user isn't a super user. */
if (is_multisite() && !is_super_admin()) {
return;
}
//** Ignore messages on TGM Plugin Activation page */
if (TGM_Plugin_Activation::get_instance()->is_tgmpa_page()) {
return;
}
$errors = apply_filters('ud:errors:admin_notices', $this->errors, $this->args);
$messages = apply_filters('ud:messages:admin_notices', $this->messages, $this->args);
$warnings = apply_filters('ud:warnings:admin_notices', $this->warnings, $this->args);
if (!empty($errors) || !empty($messages) || !empty($warnings)) {
echo "<style>.ud-admin-notice a { text-decoration: underline !important; } .ud-admin-notice { display: block !important; } .ud-admin-notice.update-nag { border-color: #ffba00 !important; }</style>";
}
//** Errors Block */
if (!empty($errors) && is_array($errors)) {
$message = '<ul style="list-style:disc inside;"><li>' . implode('</li><li>', $errors) . '</li></ul>';
$message = sprintf(__('<p><b>%s</b> is not active due to following errors:</p> %s', $this->domain), $this->name, $message);
if (!empty($this->action_links['errors']) && is_array($this->action_links['errors'])) {
$message .= '<p>' . implode(' | ', $this->action_links['errors']) . '</p>';
}
echo '<div class="ud-admin-notice error fade" style="padding:11px;">' . $message . '</div>';
}
//** Warnings Block */
if (!empty($warnings) && is_array($warnings)) {
$message = '<ul style="list-style:disc inside;"><li>' . implode('</li><li>', $warnings) . '</li></ul>';
$message = sprintf(__('<p><b>%s</b> has the following warnings:</p> %s', $this->domain), $this->name, $message);
if (!empty($this->action_links['errors']) && is_array($this->action_links['errors'])) {
$message .= '<p>' . implode(' | ', $this->action_links['errors']) . '</p>';
}
echo '<div class="ud-admin-notice updated update-nag fade" style="padding:11px;">' . $message . '</div>';
}
//** Determine if message has been dismissed */
$dismissed = get_option('dismissed_notice_' . sanitize_key($this->name));
if (empty($dismissed)) {
//** Notices Block */
if (!empty($messages) && is_array($messages)) {
$message = '<ul style="list-style:disc inside;"><li>' . implode('</li><li>', $messages) . '</li></ul>';
if (!empty($errors)) {
$message = sprintf(__('<p><b>%s</b> has the following additional notices:</p> %s', $this->domain), $this->name, $message);
} else {
$message = sprintf(__('<p><b>%s</b> is active, but has the following notices:</p> %s', $this->domain), $this->name, $message);
}
if ($this->dismiss) {
$this->action_links['messages'][] = '<a class="dismiss-notice" href="' . add_query_arg('udan-dismiss-' . sanitize_key($this->name), 'true') . '" target="_parent">' . __('Dismiss this notice', $this->domain) . '</a>';
}
$message .= '<p>' . implode(' | ', $this->action_links['messages']) . '</p>';
echo '<div class="ud-admin-notice updated fade" style="padding:11px;">' . $message . '</div>';
}
}
}
示例8: get_instance
* Returns the singleton instance of the class.
*
* @since 2.4.0
*
* @return object The TGM_Plugin_Activation object.
*/
public static function get_instance()
{
if (!isset(self::$instance) && !self::$instance instanceof TGM_Plugin_Activation) {
self::$instance = new TGM_Plugin_Activation();
}
return self::$instance;
}
}
// Ensure only one instance of the class is ever invoked.
$adler = TGM_Plugin_Activation::get_instance();
}
if (!function_exists('adler')) {
/**
* Helper function to register a collection of required plugins.
*
* @since 2.0.0
* @api
*
* @param array $plugins An array of plugin arrays.
* @param array $config Optional. An array of configuration values.
*/
function adler($plugins, $config = array())
{
foreach ($plugins as $plugin) {
TGM_Plugin_Activation::$instance->register($plugin);
示例9: get_instance
* Returns the singleton instance of the class.
*
* @since 2.4.0
*
* @return object The TGM_Plugin_Activation object.
*/
public static function get_instance()
{
if (!isset(self::$instance) && !self::$instance instanceof TGM_Plugin_Activation) {
self::$instance = new TGM_Plugin_Activation();
}
return self::$instance;
}
}
// Ensure only one instance of the class is ever invoked.
$galanight = TGM_Plugin_Activation::get_instance();
}
if (!function_exists('galanight_tgmpa')) {
/**
* Helper function to register a collection of required plugins.
*
* @since 2.0.0
* @api
*
* @param array $plugins An array of plugin arrays.
* @param array $config Optional. An array of configuration values.
*/
function galanight_tgmpa($plugins, $config = array())
{
foreach ($plugins as $plugin) {
TGM_Plugin_Activation::$instance->register($plugin);
示例10: plugins_dependencies
/**
* Determine if plugin/theme requires or recommends another plugin(s)
*
* @author peshkov@UD
*/
private function plugins_dependencies()
{
/**
* Dependencies must be checked before plugins_loaded hook to prevent issues!
*
* The current condition fixes incorrect behaviour on custom 'Install Plugins' page
* after activation plugin which has own dependencies.
*
* The condition belongs to WordPress 4.3 and higher.
*/
if (did_action('plugins_loaded')) {
return;
}
$plugins = $this->get_schema('extra.schemas.dependencies.plugins');
if (!empty($plugins) && is_array($plugins)) {
$tgma = TGM_Plugin_Activation::get_instance();
foreach ($plugins as $plugin) {
$plugin['_referrer'] = get_class($this);
$plugin['_referrer_name'] = $this->name;
$tgma->register($plugin);
}
$this->is_tgma = true;
}
}
示例11: get_instance
* Returns the singleton instance of the class.
*
* @since 2.4.0
*
* @return object The TGM_Plugin_Activation object.
*/
public static function get_instance()
{
if (!isset(self::$instance) && !self::$instance instanceof TGM_Plugin_Activation) {
self::$instance = new TGM_Plugin_Activation();
}
return self::$instance;
}
}
// Ensure only one instance of the class is ever invoked.
$fruitful = TGM_Plugin_Activation::get_instance();
}
if (!function_exists('fruitful')) {
/**
* Helper function to register a collection of required plugins.
*
* @since 2.0.0
* @api
*
* @param array $plugins An array of plugin arrays.
* @param array $config Optional. An array of configuration values.
*/
function fruitful($plugins, $config = array())
{
foreach ($plugins as $plugin) {
TGM_Plugin_Activation::$instance->register($plugin);
示例12:
} else {
echo '<p>Click the add key button below to add a collection key</p>';
}
?>
</tbody>
</table>
</p>
<?php
if (count($payload)) {
?>
<input type="button" id="wpcore_addrow" class="button button-large" value="Add another collection key" />
<a href="<?php
echo TGM_Plugin_Activation::get_instance()->parent_slug;
?>
?page=<?php
echo TGM_Plugin_Activation::get_instance()->menu;
?>
" class="button button-large float-right">Install Plugins</a>
<?php
} else {
?>
<input type="button" id="wpcore_addrow" class="button button-large" value="Add a collection key" />
<?php
}
?>
</p>
<hr>
<?php