本文整理汇总了PHP中Jetpack::is_plugin_active方法的典型用法代码示例。如果您正苦于以下问题:PHP Jetpack::is_plugin_active方法的具体用法?PHP Jetpack::is_plugin_active怎么用?PHP Jetpack::is_plugin_active使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jetpack
的用法示例。
在下文中一共展示了Jetpack::is_plugin_active方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: format_plugin
protected function format_plugin($plugin_file, $plugin_data)
{
$plugin = array();
$plugin['id'] = preg_replace("/(.+)\\.php\$/", "\$1", $plugin_file);
$plugin['slug'] = Jetpack_Autoupdate::get_plugin_slug($plugin_file);
$plugin['active'] = Jetpack::is_plugin_active($plugin_file);
$plugin['name'] = $plugin_data['Name'];
$plugin['plugin_url'] = $plugin_data['PluginURI'];
$plugin['version'] = $plugin_data['Version'];
$plugin['description'] = $plugin_data['Description'];
$plugin['author'] = $plugin_data['Author'];
$plugin['author_url'] = $plugin_data['AuthorURI'];
$plugin['network'] = $plugin_data['Network'];
$plugin['update'] = $this->get_plugin_updates($plugin_file);
$plugin['next_autoupdate'] = date('Y-m-d H:i:s', wp_next_scheduled('wp_maybe_auto_update'));
$autoupdate = in_array($plugin_file, Jetpack_Options::get_option('autoupdate_plugins', array()));
$plugin['autoupdate'] = $autoupdate;
$autoupdate_translation = in_array($plugin_file, Jetpack_Options::get_option('autoupdate_plugins_translations', array()));
$plugin['autoupdate_translation'] = $autoupdate || $autoupdate_translation;
$plugin['uninstallable'] = is_uninstallable_plugin($plugin_file);
if (!empty($this->log[$plugin_file])) {
$plugin['log'] = $this->log[$plugin_file];
}
return $plugin;
}
示例2: prepare_jitms
/**
* Prepare actions according to screen and post type.
*
* @since 3.8.2
*
* @uses Jetpack_Autoupdate::get_possible_failures()
*
* @param object $screen
*/
function prepare_jitms($screen)
{
if (!current_user_can('jetpack_manage_modules')) {
return;
}
if ('edit-comments' == $screen->base && !Jetpack::is_plugin_active('akismet/akismet.php')) {
add_action('admin_enqueue_scripts', array($this, 'jitm_enqueue_files'));
add_action('admin_notices', array($this, 'akismet_msg'));
} elseif ('post' == $screen->base && (isset($_GET['message']) && 6 == $_GET['message']) && !Jetpack::is_plugin_active('vaultpress/vaultpress.php')) {
add_action('admin_enqueue_scripts', array($this, 'jitm_enqueue_files'));
add_action('edit_form_top', array($this, 'backups_after_publish_msg'));
} elseif ('update-core' == $screen->base && !Jetpack::is_plugin_active('vaultpress/vaultpress.php')) {
add_action('admin_enqueue_scripts', array($this, 'jitm_enqueue_files'));
add_action('admin_notices', array($this, 'backups_updates_msg'));
}
}
示例3: delete
protected function delete()
{
foreach ($this->plugins as $plugin) {
if (Jetpack::is_plugin_active($plugin)) {
$error = $this->log[$plugin][] = 'You cannot delete a plugin while it is active on the main site.';
continue;
}
$result = delete_plugins(array($plugin));
if (is_wp_error($result)) {
$error = $this->log[$plugin][] = $result->get_error_message();
} else {
$this->log[$plugin][] = 'Plugin deleted';
}
}
if (!$this->bulk && isset($error)) {
return new WP_Error('delete_plugin_error', $error, 400);
}
return true;
}
示例4: format_plugin
protected function format_plugin($plugin_file, $plugin_data)
{
$plugin = array();
$plugin['id'] = preg_replace("/(.+)\\.php\$/", "\$1", $plugin_file);
$plugin['slug'] = $this->get_plugin_slug($plugin_file);
$plugin['active'] = Jetpack::is_plugin_active($plugin_file);
$plugin['name'] = $plugin_data['Name'];
$plugin['plugin_url'] = $plugin_data['PluginURI'];
$plugin['version'] = $plugin_data['Version'];
$plugin['description'] = $plugin_data['Description'];
$plugin['author'] = $plugin_data['Author'];
$plugin['author_url'] = $plugin_data['AuthorURI'];
$plugin['network'] = $plugin_data['Network'];
$plugin['update'] = $this->get_plugin_updates($plugin_file);
$plugin['autoupdate'] = in_array($plugin_file, Jetpack_Options::get_option('autoupdate_plugins', array()));
if (!empty($this->log[$plugin_file])) {
$plugin['log'] = $this->log[$plugin_file];
}
return $plugin;
}
示例5: deactivate
protected function deactivate()
{
foreach ($this->plugins as $plugin) {
if (!Jetpack::is_plugin_active($plugin)) {
$error = $this->log[$plugin]['error'] = __('The Plugin is already deactivated.', 'jetpack');
continue;
}
deactivate_plugins($plugin, false, $this->network_wide);
$success = !Jetpack::is_plugin_active($plugin);
if ($success && $this->network_wide) {
$success &= !is_plugin_active_for_network($plugin);
}
if (!$success) {
$error = $this->log[$plugin]['error'] = __('There was an error deactivating your plugin', 'jetpack');
continue;
}
$this->log[$plugin][] = __('Plugin deactivated.', 'jetpack');
}
if (!$this->bulk && isset($error)) {
return new WP_Error('deactivation_error', $error);
}
}
示例6: process_submission
//.........这里部分代码省略.........
$headers = 'From: "' . $comment_author . '" <' . $from_email_addr . ">\r\n" . 'Reply-To: "' . $comment_author . '" <' . $reply_to_addr . ">\r\n" . "Content-Type: text/html; charset=\"" . get_option('blog_charset') . "\"";
/** This filter is already documented in modules/contact-form/admin.php */
$subject = apply_filters('contact_form_subject', $contact_form_subject, $all_values);
$url = $widget ? home_url('/') : get_permalink($post->ID);
$date_time_format = _x('%1$s \\a\\t %2$s', '{$date_format} \\a\\t {$time_format}', 'jetpack');
$date_time_format = sprintf($date_time_format, get_option('date_format'), get_option('time_format'));
$time = date_i18n($date_time_format, current_time('timestamp'));
// keep a copy of the feedback as a custom post type
$feedback_time = current_time('mysql');
$feedback_title = "{$comment_author} - {$feedback_time}";
$feedback_status = $is_spam === TRUE ? 'spam' : 'publish';
foreach ((array) $akismet_values as $av_key => $av_value) {
$akismet_values[$av_key] = Grunion_Contact_Form_Plugin::strip_tags($av_value);
}
foreach ((array) $all_values as $all_key => $all_value) {
$all_values[$all_key] = Grunion_Contact_Form_Plugin::strip_tags($all_value);
}
foreach ((array) $extra_values as $ev_key => $ev_value) {
$extra_values[$ev_key] = Grunion_Contact_Form_Plugin::strip_tags($ev_value);
}
/* We need to make sure that the post author is always zero for contact
* form submissions. This prevents export/import from trying to create
* new users based on form submissions from people who were logged in
* at the time.
*
* Unfortunately wp_insert_post() tries very hard to make sure the post
* author gets the currently logged in user id. That is how we ended up
* with this work around. */
add_filter('wp_insert_post_data', array($plugin, 'insert_feedback_filter'), 10, 2);
$post_id = wp_insert_post(array('post_date' => addslashes($feedback_time), 'post_type' => 'feedback', 'post_status' => addslashes($feedback_status), 'post_parent' => (int) $post->ID, 'post_title' => addslashes(wp_kses($feedback_title, array())), 'post_content' => addslashes(wp_kses($comment_content . "\n<!--more-->\n" . "AUTHOR: {$comment_author}\nAUTHOR EMAIL: {$comment_author_email}\nAUTHOR URL: {$comment_author_url}\nSUBJECT: {$subject}\nIP: {$comment_author_IP}\n" . print_r($all_values, TRUE), array())), 'post_name' => md5($feedback_title)));
// once insert has finished we don't need this filter any more
remove_filter('wp_insert_post_data', array($plugin, 'insert_feedback_filter'), 10, 2);
update_post_meta($post_id, '_feedback_extra_fields', $this->addslashes_deep($extra_values));
if (Jetpack::is_plugin_active('akismet/akismet.php')) {
update_post_meta($post_id, '_feedback_akismet_values', $this->addslashes_deep($akismet_values));
}
$message = self::get_compiled_form($post_id, $this);
array_push($message, "", __('Time:', 'jetpack') . ' ' . $time . '<br />', __('IP Address:', 'jetpack') . ' ' . $comment_author_IP . '<br />', __('Contact Form URL:', 'jetpack') . " " . $url . '<br />');
if (is_user_logged_in()) {
array_push($message, "", sprintf(__('Sent by a verified %s user.', 'jetpack'), isset($GLOBALS['current_site']->site_name) && $GLOBALS['current_site']->site_name ? $GLOBALS['current_site']->site_name : '"' . get_option('blogname') . '"'));
} else {
array_push($message, __('Sent by an unverified visitor to your site.', 'jetpack'));
}
$message = join($message, "\n");
/**
* Filters the message sent via email after a successfull form submission.
*
* @module contact-form
*
* @since 1.3.1
*
* @param string $message Feedback email message.
*/
$message = apply_filters('contact_form_message', $message);
update_post_meta($post_id, '_feedback_email', $this->addslashes_deep(compact('to', 'message')));
/**
* Fires right before the contact form message is sent via email to
* the recipient specified in the contact form.
*
* @module contact-form
*
* @since 1.3.1
*
* @param integer $post_id Post contact form lives on
* @param array $all_values Contact form fields
* @param array $extra_values Contact form fields not included in $all_values
示例7: deactivate_plugin
protected function deactivate_plugin()
{
if (!Jetpack::is_plugin_active($this->plugin)) {
return new WP_Error('plugin_already_deactivated', __('The Plugin is already deactivated.', 'jetpack'), 400);
}
$result = deactivate_plugins($this->plugin, false, $this->network_wide);
if (is_wp_error($result)) {
return new WP_Error('deactivation_error', $result->get_error_messages(), 500);
}
$success = !Jetpack::is_plugin_active($this->plugin);
if ($success && $this->network_wide) {
$success &= !is_plugin_active_for_network($this->plugin);
}
if (!$success) {
return new WP_Error('deactivation_error', $result->get_error_messages(), 500);
}
return true;
}