WP_Press_This_Plugin example

/** * Ajax handler for saving a post from Press This. * * @since 4.2.0 * @deprecated 4.9.0 */
function wp_ajax_press_this_save_post() {
    _deprecated_function( __FUNCTION__, '4.9.0' );
    if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) {
        include WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php';
        $wp_press_this = new WP_Press_This_Plugin();
        $wp_press_this->save_post();
    } else {
        wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) );
    }
}

/** * Ajax handler for creating new category from Press This. * * @since 4.2.0 * @deprecated 4.9.0 */
$plugin_slug = 'press-this';
    $plugin_file = 'press-this/press-this-plugin.php';

    if ( ! current_user_can( 'edit_posts' ) || ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
        wp_die(
            __( 'Sorry, you are not allowed to create posts as this user.' ),
            __( 'You need a higher level of permission.' ),
            403
        );
    } elseif ( is_plugin_active( $plugin_file ) ) {
        include WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php';
        $wp_press_this = new WP_Press_This_Plugin();
        $wp_press_this->html();
    } elseif ( current_user_can( 'activate_plugins' ) ) {
        if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_file ) ) {
            $url    = wp_nonce_url(
                add_query_arg(
                    array(
                        'action' => 'activate',
                        'plugin' => $plugin_file,
                        'from'   => 'press-this',
                    ),
                    admin_url( 'plugins.php' )
                ),
Home | Imprint | This part of the site doesn't use cookies.