public function transition_post_status($new_status, $old_status, $post) { if ($old_status != 'publish' && $new_status == 'publish' && !empty($_POST['ithemes-social'])) { /** * @todo Allow custom tweet content * @todo use send-to to say which accounts should be tweeted to */ $post_title = get_the_title($post->ID); $data = array('post' => $post, 'twitter' => array()); if (!empty($_POST['ithemes-social']['twitter'])) { foreach ($_POST['ithemes-social']['twitter'] as $twitter_id => $twitter) { if (!empty($twitter['send']) && 'true' === $twitter['send'] && !empty($twitter['content'])) { $data['twitter'][$twitter_id] = $this->_handle_template_tags(stripslashes($twitter['content']), $post); } } } $result = ithemes_sync_send_urgent_notice('ithemes-sync', 'social', 'Post published', "'{$post_title}' has been published", $data); } }
function backupbuddy_sync_add_notices($arguments, $urgent = false) { require_once pb_backupbuddy::plugin_path() . '/classes/core.php'; $notifications = backupbuddy_core::getNotifications(); foreach ($notifications as &$notification) { // Skip if in the inapplicable mode. if (false === $urgent && true === $notification['urgent']) { // If NOT seeking urgents, skip urgents. continue; } if (true === $urgent && false === $notification['urgent']) { // If seeking urgents, skip non-urgents. continue; } if (true === $notification['syncSent']) { // Only send once. continue; } $notification['syncSent'] = true; // Compile data. //$data = array(); $data = $notification['data']; /* if ( ! empty( $arguments['verbose'] ) ) { // The verbose argument can be checked for in order to provide additional information that may not always be necessary. $data = $notification['data']; } */ // Send notice. if (false === $urgent) { ithemes_sync_add_notice('backupbuddy', $notification['slug'], $notification['title'], $notification['message'], $data); } elseif (true === $urgent) { ithemes_sync_send_urgent_notice('backupbuddy', $notification['slug'], $notification['title'], $notification['message'], $data); } } backupbuddy_core::replaceNotifications($notifications); // Save with syncSent updates for all notifications. return true; }
function backupbuddy_sync_add_notices($arguments, $urgent = false) { require_once pb_backupbuddy::plugin_path() . '/classes/core.php'; $notifications = backupbuddy_core::getNotifications(); foreach ($notifications as &$notification) { // Skip if in the inapplicable mode. if (false === $urgent && true === $notification['urgent']) { // If NOT seeking urgents, skip urgents. continue; } if (true === $urgent && false === $notification['urgent']) { // If seeking urgents, skip non-urgents. continue; } if (true === $notification['syncSent']) { // Only send once. continue; } $notification['syncSent'] = true; $notification['data']['datestamp'] = date('Y-m-d', $notification['time']); // Added v6.3.3.10. // Send notice. if (false === $urgent) { ithemes_sync_add_notice('backupbuddy', $notification['slug'], $notification['title'], $notification['message'], $notification['data']); } elseif (true === $urgent) { ithemes_sync_send_urgent_notice('backupbuddy', $notification['slug'], $notification['title'], $notification['message'], $notification['data']); } } backupbuddy_core::replaceNotifications($notifications); // Save with syncSent updates for all notifications. return true; }
function upgrader_process_complete($upgrader, $extra) { if (empty($extra['type'])) { return; } if ('plugin' === $extra['type']) { if ('install' === $extra['action']) { if (!($slug = $upgrader->plugin_info())) { return; } $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $slug, true, false); $data['slug'] = 'wordpress_plugin_installed'; ithemes_sync_send_urgent_notice('wordpress-plugin', 'report', 'Plugin Installed', 'Plugin Installed', $data); } if ('update' === $extra['action']) { if (!empty($extra['bulk']) && true == $extra['bulk']) { $slugs = $extra['plugins']; } else { if (empty($upgrader->skin->plugin)) { return; } $slugs = array($upgrader->skin->plugin); } foreach ($slugs as $slug) { $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $slug, true, false); $data['slug'] = 'wordpress_plugin_updated'; ithemes_sync_send_urgent_notice('wordpress-plugin', 'report', 'Plugin Updated', 'Plugin Updated', $data); } } } else { if ('theme' === $extra['type']) { if ('install' === $extra['action']) { $theme = $upgrader->theme_info(); if (!$theme) { return; } $data = array(); $data['slug'] = 'wordpress_theme_installed'; $data['name'] = $theme->get('Name'); $data['version'] = $theme->get('Version'); ithemes_sync_send_urgent_notice('wordpress-theme', 'report', 'Theme Installed', 'Theme Installed', $data); } if ('update' === $extra['action']) { if (!empty($extra['bulk']) && true == $extra['bulk']) { $slugs = $extra['themes']; } else { if (empty($upgrader->skin->theme)) { return; } $slugs = array($upgrader->skin->theme); } foreach ($slugs as $slug) { $data = array(); $data['slug'] = 'wordpress_theme_updated'; $theme = wp_get_theme($slug); $data['name'] = $theme->get('Name'); $data['version'] = $theme->get('Version'); ithemes_sync_send_urgent_notice('wordpress-theme', 'report', 'Theme Updated', 'Theme Updated', $data); } } } } }