/** * Setup * * @since 2.2 * @internal */ static function _setup() { add_action('admin_enqueue_scripts', array('WPSubtitle_Pointers', '_pointer_load')); // Post Pointers $post_types = WPSubtitle::get_supported_post_types(); foreach ($post_types as $post_type) { add_filter('wps_subtitle_admin_pointers-' . $post_type, array('WPSubtitle_Pointers', '_post_type_pointers')); } }
/** * Verify Post Edit Capability * * @since 2.0.1 * @internal * * @param int $post_id Post ID. * @return bool */ static function _verify_post_edit_capability($post_id) { $post_types_obj = (array) get_post_types(array('_builtin' => false), 'objects'); // Check supported post type if (isset($_POST['post_type']) && WPSubtitle::is_supported_post_type($_POST['post_type'])) { if ('page' == $_POST['post_type'] && current_user_can('edit_page', $post_id)) { return true; } elseif ('post' == $_POST['post_type'] && current_user_can('edit_post', $post_id)) { return true; } elseif (current_user_can($post_types_obj[$_POST['post_type']]->cap->edit_post, $post_id)) { return true; } } return false; }
/** * Get the Subtitle * * @since 1.0 * * @uses WPSubtitle::get_the_subtitle() * * @param int|object $post Post ID or object. * @param string $before Before the subtitle. * @param string $after After the subtitle. * @param bool $echo Output if true, return if false. * @return string The subtitle string. */ function get_the_subtitle($post = 0, $before = '', $after = '', $echo = false) { $subtitle = WPSubtitle::get_the_subtitle($post); if (!empty($subtitle)) { $subtitle = $before . $subtitle . $after; } if (!$echo) { return $subtitle; } echo $subtitle; }
/** * Get the Subtitle * * @since 2.0 * * @uses WPSubtitle::_get_post_meta() * @uses apply_filters( 'wps_subtitle' ) * * @param int|object $post Post ID or object. * @return string The filtered subtitle meta value. */ static function get_the_subtitle($post = 0) { $post = get_post($post); if ($post && WPSubtitle::is_supported_post_type($post->post_type)) { $subtitle = WPSubtitle::_get_post_meta($post); return apply_filters('wps_subtitle', $subtitle, $post); } return ''; }
/** * Get the Subtitle * * @since 1.0 * * @uses WPSubtitle::get_the_subtitle() * * @param int|object $post Post ID or object. * @param string $before Before the subtitle. * @param string $after After the subtitle. * @param bool $echo Output if true, return if false. * @return string The subtitle string. */ function get_the_subtitle($post = 0, $before = '', $after = '', $echo = true) { $subtitle = WPSubtitle::get_the_subtitle($post); if (!empty($subtitle)) { $subtitle = wptexturize($before . $subtitle . $after); } if (!$echo) { return $subtitle; } echo $subtitle; }