/** * Load the EF_Dashboard class as an Edit Flow module */ function __construct() { // Register the module with Edit Flow $this->module_url = $this->get_module_url(__FILE__); $args = array('title' => __('Dashboard Widgets', 'edit-flow'), 'short_description' => __('Track your content from the WordPress dashboard.', 'edit-flow'), 'extended_description' => __('Enable dashboard widgets to quickly get an overview of what state your content is in.', 'edit-flow'), 'module_url' => $this->module_url, 'img_url' => $this->module_url . 'lib/dashboard_s128.png', 'slug' => 'dashboard', 'post_type_support' => 'ef_dashboard', 'default_options' => array('enabled' => 'on', 'post_status_widget' => 'on', 'my_posts_widget' => 'on', 'notepad_widget' => 'on'), 'configure_page_cb' => 'print_configure_view', 'configure_link_text' => __('Widget Options', 'edit-flow')); $this->module = EditFlow()->register_module('dashboard', $args); }
/** * Register the module with Edit Flow but don't do anything else */ function __construct() { // Register the module with Edit Flow $this->module_url = $this->get_module_url(__FILE__); $args = array('title' => __('Edit Flow', 'edit-flow'), 'short_description' => __('Edit Flow redefines your WordPress publishing workflow.', 'edit-flow'), 'extended_description' => __('Enable any of the features below to take control of your workflow. Custom statuses, email notifications, editorial comments, and more help you and your team save time so everyone can focus on what matters most: the content.', 'edit-flow'), 'module_url' => $this->module_url, 'img_url' => $this->module_url . 'lib/eflogo_s128.png', 'slug' => 'settings', 'settings_slug' => 'ef-settings', 'default_options' => array('enabled' => 'on'), 'configure_page_cb' => 'print_default_settings', 'autoload' => true); $this->module = EditFlow()->register_module('settings', $args); }
/** * Construct the EF_Editorial_Metadata class */ function __construct() { $this->module_url = $this->get_module_url(__FILE__); // Register the module with Edit Flow $args = array('title' => __('Editorial Metadata', 'edit-flow'), 'short_description' => __('Track details about your posts in progress.', 'edit-flow'), 'extended_description' => __('Log details on every assignment using configurable editorial metadata. It’s completely customizable; create fields for everything from due date to location to contact information to role assignments.', 'edit-flow'), 'module_url' => $this->module_url, 'img_url' => $this->module_url . 'lib/editorial_metadata_s128.png', 'slug' => 'editorial-metadata', 'default_options' => array('enabled' => 'on', 'post_types' => array('post' => 'on', 'page' => 'off')), 'messages' => array('term-added' => __("Metadata term added.", 'edit-flow'), 'term-updated' => __("Metadata term updated.", 'edit-flow'), 'term-missing' => __("Metadata term doesn't exist.", 'edit-flow'), 'term-deleted' => __("Metadata term deleted.", 'edit-flow'), 'term-position-updated' => __("Term order updated.", 'edit-flow'), 'term-visibility-changed' => __("Term visibility changed.", 'edit-flow')), 'configure_page_cb' => 'print_configure_view', 'settings_help_tab' => array('id' => 'ef-editorial-metadata-overview', 'title' => __('Overview', 'edit-flow'), 'content' => __('<p>Keep track of important details about your content with editorial metadata. This feature allows you to create as many date, text, number, etc. fields as you like, and then use them to store information like contact details, required word count, or the location of an interview.</p><p>Once you’ve set your fields up, editorial metadata integrates with both the calendar and the story budget. Make an editorial metadata item visible to have it appear to the rest of your team. Keep it hidden to restrict the information between the writer and their editor.</p>', 'edit-flow')), 'settings_help_sidebar' => __('<p><strong>For more information:</strong></p><p><a href="http://editflow.org/features/editorial-metadata/">Editorial Metadata Documentation</a></p><p><a href="http://wordpress.org/tags/edit-flow?forum_id=10">Edit Flow Forum</a></p><p><a href="https://github.com/danielbachhuber/Edit-Flow">Edit Flow on Github</a></p>', 'edit-flow')); EditFlow()->register_module($this->module_name, $args); }
function __construct() { $this->module_url = $this->get_module_url(__FILE__); // Register the module with Edit Flow $args = array('title' => __('Editorial Comments', 'edit-flow'), 'short_description' => __('Share internal notes with your team.', 'edit-flow'), 'extended_description' => __('Use editorial comments to hold a private discussion about a post. Communicate directly with your writers or editors about what works and what needs to be improved for each piece.', 'edit-flow'), 'module_url' => $this->module_url, 'img_url' => $this->module_url . 'lib/editorial_comments_s128.png', 'slug' => 'editorial-comments', 'default_options' => array('enabled' => 'on', 'post_types' => array('post' => 'on', 'page' => 'on')), 'configure_page_cb' => 'print_configure_view', 'configure_link_text' => __('Choose Post Types', 'edit-flow'), 'autoload' => false, 'settings_help_tab' => array('id' => 'ef-editorial-comments-overview', 'title' => __('Overview', 'edit-flow'), 'content' => __('<p>Editorial comments help you cut down on email overload and keep the conversation close to where it matters: your content. Threaded commenting in the admin, similar to what you find at the end of a blog post, allows writers and editors to privately leave feedback and discuss what needs to be changed before publication.</p><p>Anyone with access to view the story in progress will also have the ability to comment on it. If you have notifications enabled, those following the post will receive an email every time a comment is left.</p>', 'edit-flow')), 'settings_help_sidebar' => __('<p><strong>For more information:</strong></p><p><a href="http://editflow.org/features/editorial-comments/">Editorial Comments Documentation</a></p><p><a href="http://wordpress.org/tags/edit-flow?forum_id=10">Edit Flow Forum</a></p><p><a href="https://github.com/danielbachhuber/Edit-Flow">Edit Flow on Github</a></p>', 'edit-flow')); $this->module = EditFlow()->register_module('editorial_comments', $args); }
/** * Register the module with Edit Flow but don't do anything else */ function __construct() { $this->module_url = $this->get_module_url(__FILE__); // Register the module with Edit Flow $args = array('title' => __('Custom Statuses', 'edit-flow'), 'short_description' => __('Create custom post statuses to define the stages of your workflow.', 'edit-flow'), 'extended_description' => __('Create your own post statuses to add structure your publishing workflow. You can change existing or add new ones anytime, and drag and drop to change their order.', 'edit-flow'), 'module_url' => $this->module_url, 'img_url' => $this->module_url . 'lib/custom_status_s128.png', 'slug' => 'custom-status', 'default_options' => array('enabled' => 'on', 'default_status' => 'pitch', 'always_show_dropdown' => 'off', 'post_types' => array('post' => 'on', 'page' => 'on')), 'post_type_support' => 'ef_custom_statuses', 'configure_page_cb' => 'print_configure_view', 'configure_link_text' => __('Edit Statuses', 'edit-flow'), 'messages' => array('status-added' => __('Post status created.', 'edit-flow'), 'status-missing' => __("Post status doesn't exist.", 'edit-flow'), 'default-status-changed' => __('Default post status has been changed.', 'edit-flow'), 'term-updated' => __("Post status updated.", 'edit-flow'), 'status-deleted' => __('Post status deleted.', 'edit-flow'), 'status-position-updated' => __("Status order updated.", 'edit-flow')), 'autoload' => false, 'settings_help_tab' => array('id' => 'ef-custom-status-overview', 'title' => __('Overview', 'edit-flow'), 'content' => __('<p>Edit Flow’s custom statuses allow you to define the most important stages of your editorial workflow. Out of the box, WordPress only offers “Draft” and “Pending Review” as post states. With custom statuses, you can create your own post states like “In Progress”, “Pitch”, or “Waiting for Edit” and keep or delete the originals. You can also drag and drop statuses to set the best order for your workflow.</p><p>Custom statuses are fully integrated into the rest of Edit Flow and the WordPress admin. On the calendar and story budget, you can filter your view to see only posts of a specific post state. Furthermore, email notifications can be sent to a specific group of users when a post changes state.</p>', 'edit-flow')), 'settings_help_sidebar' => __('<p><strong>For more information:</strong></p><p><a href="http://editflow.org/features/custom-statuses/">Custom Status Documentation</a></p><p><a href="http://wordpress.org/tags/edit-flow?forum_id=10">Edit Flow Forum</a></p><p><a href="https://github.com/danielbachhuber/Edit-Flow">Edit Flow on Github</a></p>', 'edit-flow')); $this->module = EditFlow()->register_module('custom_status', $args); }
/** * Register the module with Edit Flow but don't do anything else */ function __construct() { // Register the module with Edit Flow $this->module_url = $this->get_module_url(__FILE__); $args = array('title' => __('Notifications', 'edit-flow'), 'short_description' => __('Update your team of important changes to your content.', 'edit-flow'), 'extended_description' => __('With email notifications, you can keep everyone updated about what’s happening with a given content. Each status change or editorial comment sends out an email notification to users subscribed to a post. User groups can be used to manage who receives notifications on what.', 'edit-flow'), 'module_url' => $this->module_url, 'img_url' => $this->module_url . 'lib/notifications_s128.png', 'slug' => 'notifications', 'default_options' => array('enabled' => 'on', 'post_types' => array('post' => 'on', 'page' => 'on'), 'always_notify_admin' => 'off'), 'configure_page_cb' => 'print_configure_view', 'post_type_support' => 'ef_notification', 'autoload' => false, 'settings_help_tab' => array('id' => 'ef-notifications-overview', 'title' => __('Overview', 'edit-flow'), 'content' => __('<p>Notifications ensure you keep up to date with progress your most important content. Users can be subscribed to notifications on a post one by one or by selecting user groups.</p><p>When enabled, email notifications can be sent when a post changes status or an editorial comment is left by a writer or an editor.</p>', 'edit-flow')), 'settings_help_sidebar' => __('<p><strong>For more information:</strong></p><p><a href="http://editflow.org/features/notifications/">Notifications Documentation</a></p><p><a href="http://wordpress.org/tags/edit-flow?forum_id=10">Edit Flow Forum</a></p><p><a href="https://github.com/danielbachhuber/Edit-Flow">Edit Flow on Github</a></p>', 'edit-flow')); $this->module = EditFlow()->register_module('notifications', $args); }
/** * Register the module with Edit Flow but don't do anything else */ function __construct() { $this->module_url = $this->get_module_url(__FILE__); // Register the module with Edit Flow $args = array('title' => __('Story Budget', 'edit-flow'), 'short_description' => sprintf(__('View the status of all your content <a href="%s">at a glance</a>.', 'edit-flow'), admin_url('index.php?page=story-budget')), 'extended_description' => __('Use the story budget to see how content on your site is progressing. Filter by specific categories or date ranges to see details about each post in progress.', 'edit-flow'), 'module_url' => $this->module_url, 'img_url' => $this->module_url . 'lib/story_budget_s128.png', 'slug' => 'story-budget', 'default_options' => array('enabled' => 'on'), 'configure_page_cb' => false, 'autoload' => false); $this->module = EditFlow()->register_module('story_budget', $args); }
/** * Register the module with Edit Flow but don't do anything else * * @since 0.7 */ function __construct() { $this->module_url = $this->get_module_url(__FILE__); // Register the User Groups module with Edit Flow $args = array('title' => __('User Groups', 'edit-flow'), 'short_description' => __('Organize your users into groups to mimic your organizational structure.', 'edit-flow'), 'extended_description' => __('Configure user groups to organize all of the users on your site. Each user can be in many user groups and you can change them at any time.', 'edit-flow'), 'module_url' => $this->module_url, 'img_url' => $this->module_url . 'lib/usergroups_s128.png', 'slug' => 'user-groups', 'default_options' => array('enabled' => 'on', 'post_types' => array('post' => 'on', 'page' => 'off')), 'messages' => array('usergroup-added' => __("User group created. Feel free to add users to the usergroup.", 'edit-flow'), 'usergroup-updated' => __("User group updated.", 'edit-flow'), 'usergroup-missing' => __("User group doesn't exist.", 'edit-flow'), 'usergroup-deleted' => __("User group deleted.", 'edit-flow')), 'configure_page_cb' => 'print_configure_view', 'configure_link_text' => __('Manage User Groups', 'edit-flow'), 'autoload' => false, 'settings_help_tab' => array('id' => 'ef-user-groups-overview', 'title' => __('Overview', 'edit-flow'), 'content' => __('<p>For those with many people involved in the publishing process, user groups helps you keep them organized.</p><p>Currently, user groups are primarily used for subscribing a set of users to a post for notifications.</p>', 'edit-flow')), 'settings_help_sidebar' => __('<p><strong>For more information:</strong></p><p><a href="http://editflow.org/features/user-groups/">User Groups Documentation</a></p><p><a href="http://wordpress.org/tags/edit-flow?forum_id=10">Edit Flow Forum</a></p><p><a href="https://github.com/danielbachhuber/Edit-Flow">Edit Flow on Github</a></p>', 'edit-flow')); $this->module = EditFlow()->register_module('user_groups', $args); }
/** * Test modules loading */ function test_editflow_register_module() { $EditFlow = EditFlow(); $module_real = strtolower('calendar'); $module_args = array('title' => $module_real); $module_return = $EditFlow->register_module($module_real, $module_args); $this->assertTrue($module_real == $module_return->name); }
/** * Construct the EF_Calendar class */ function __construct() { global $edit_flow; $this->module_url = $this->get_module_url(__FILE__); // Register the module with Edit Flow $args = array('title' => __('Calendar', 'edit-flow'), 'short_description' => __('View upcoming content in a customizable calendar.', 'edit-flow'), 'extended_description' => __('Edit Flow’s calendar lets you see your posts over a customizable date range. Filter by status or click on the post title to see its details. Drag and drop posts between days to change their publication date date.', 'edit-flow'), 'module_url' => $this->module_url, 'img_url' => $this->module_url . 'lib/calendar_s128.png', 'slug' => 'calendar', 'post_type_support' => 'ef_calendar', 'default_options' => array('enabled' => 'on', 'post_types' => array('post' => 'on', 'page' => 'off')), 'messages' => array('post-date-updated' => __("Post date updated.", 'edit-flow'), 'update-error' => __('There was an error updating the post. Please try again.', 'edit-flow'), 'published-post-ajax' => __("Updating the post date dynamically doesn't work for published content. Please <a href='%s'>edit the post</a>.", 'edit-flow')), 'configure_page_cb' => 'print_configure_view', 'configure_link_text' => __('Calendar Options', 'edit-flow'), 'settings_help_tab' => array('id' => 'ef-calendar-overview', 'title' => __('Overview', 'edit-flow'), 'content' => __('<p>The calendar is a convenient week-by-week or month-by-month view into your content. Quickly see which stories are on track to being published on time, and which will need extra effort.</p>', 'edit-flow')), 'settings_help_sidebar' => __('<p><strong>For more information:</strong></p><p><a href="http://editflow.org/features/calendar/">Calendar Documentation</a></p><p><a href="http://wordpress.org/tags/edit-flow?forum_id=10">Edit Flow Forum</a></p><p><a href="https://github.com/danielbachhuber/Edit-Flow">Edit Flow on Github</a></p>', 'edit-flow')); $this->module = EditFlow()->register_module('calendar', $args); }
/** * Overrides the options of 'custom_status' module so that it * works on the Edit Feed Source screen. * * @return null */ public function allow_custom_status_for_feed_source( ) { $edit_flow = EditFlow(); $module_name = 'custom_status'; if( !isset($edit_flow->modules->{$module_name}) ) return; $module = $edit_flow->modules->{$module_name}; $module->options->post_types['wprss_feed'] = 'on'; }
/** * Handle a dashboard note being created or updated * * @since 0.8 */ public function handle_notepad_update() { global $pagenow; if ('index.php' != $pagenow || (empty($_REQUEST['action']) || 'dashboard-notepad' != $_REQUEST['action'])) { return; } check_admin_referer('dashboard-notepad'); if (!current_user_can($this->edit_cap)) { wp_die(EditFlow()->dashboard->messages['invalid-permissions']); } $current_id = (int) $_REQUEST['notepad-id']; $current_notepad = get_post($current_id); $new_note = array('post_content' => wp_filter_nohtml_kses($_REQUEST['note']), 'post_type' => self::notepad_post_type, 'post_status' => 'draft', 'post_author' => get_current_user_id()); if ($current_notepad && self::notepad_post_type == $current_notepad->post_type && !isset($_REQUEST['create-note'])) { $new_note['ID'] = $current_id; wp_update_post($new_note); } else { wp_insert_post($new_note); } wp_safe_redirect(wp_get_referer()); exit; }
/** * ajax_ef_calendar_update_metadata * Update the metadata from the calendar. * @return string representing the overlay * * @since 0.8 */ function handle_ajax_update_metadata() { global $wpdb; if (!wp_verify_nonce($_POST['nonce'], 'ef-calendar-modify')) { $this->print_ajax_response('error', $this->module->messages['nonce-failed']); } // Check that we got a proper post $post_id = (int) $_POST['post_id']; $post = get_post($post_id); if (!$post) { $this->print_ajax_response('error', $this->module->messages['missing-post']); } if ($post->post_type == 'page') { $edit_check = 'edit_page'; } else { $edit_check = 'edit_post'; } if (!current_user_can($edit_check, $post->ID)) { $this->print_ajax_response('error', $this->module->messages['invalid-permissions']); } // Check that the user can modify the post if (!$this->current_user_can_modify_post($post)) { $this->print_ajax_response('error', $this->module->messages['invalid-permissions']); } $default_types = array('author', 'taxonomy'); $metadata_types = array(); if (!$this->module_enabled('editorial_metadata')) { $this->print_ajax_response('error', $this->module->messages['update-error']); } $metadata_types = array_keys(EditFlow()->editorial_metadata->get_supported_metadata_types()); // Update an editorial metadata field if (isset($_POST['metadata_type']) && in_array($_POST['metadata_type'], $metadata_types)) { $post_meta_key = sanitize_text_field('_ef_editorial_meta_' . $_POST['metadata_type'] . '_' . $_POST['metadata_term']); //Javascript date parsing is terrible, so use strtotime in php if ($_POST['metadata_type'] == 'date') { $metadata_value = strtotime(sanitize_text_field($_POST['metadata_value'])); } else { $metadata_value = sanitize_text_field($_POST['metadata_value']); } update_post_meta($post->ID, $post_meta_key, $metadata_value); $response = 'success'; } else { switch ($_POST['metadata_type']) { case 'taxonomy': case 'taxonomy hierarchical': $response = wp_set_post_terms($post->ID, $_POST['metadata_value'], $_POST['metadata_term']); break; default: $response = new WP_Error('invalid-type', __('Invalid metadata type', 'edit-flow')); break; } } //Assuming we've got to this point, just regurgitate the value if (!is_wp_error($response)) { $this->print_ajax_response('success', $_POST['metadata_value']); } else { $this->print_ajax_response('error', __('Metadata could not be updated.', 'edit-flow')); } }
/** * Gets the name of the default custom status. If custom statuses are disabled, * returns 'draft'. * * @return str Name of the status */ function get_default_post_status() { // Check if custom status module is enabled $custom_status_module = EditFlow()->custom_status->module->options; if ($custom_status_module->enabled == 'on') { return $custom_status_module->default_status; } else { return 'draft'; } }