Plugin Directory

Changeset 2340904


Ignore:
Timestamp:
07/15/2020 11:26:49 AM (6 years ago)
Author:
easycontent
Message:

1.0.5 update

Location:
easycontent/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • easycontent/trunk/app/Post.php

    r2285656 r2340904  
    190190    {
    191191        try {
     192            $parameters = [
     193                'title' => $this->_wpPostObject->post_title,
     194                'content' => $this->_wpPostObject->post_content,
     195                'meta_title' => $this->getMetaTitle(),
     196                'meta_description' => $this->getMetaDescription(),
     197                'featured_image' => $this->getFeaturedImageUrl(),
     198                'excerpt' => $this->_wpPostObject->post_excerpt,
     199                'tags' => $this->getPostTagsNames(),
     200                'custom_post_slug' => $this->getPostSlug()
     201            ];
     202
     203            if ( ! $this->isSynced() ) {
     204                $parameters['categories'] = CategoriesMapper::getRelatedCategoriesList( $this->_wpPostObject );
     205            }
     206
    192207            // Creates API model to perform requests
    193208            $article = ! $this->isSynced()
    194                 ? Article::create( [
    195                     'title' => $this->_wpPostObject->post_title,
    196                     'content' => $this->_wpPostObject->post_content,
    197                     'categories' => CategoriesMapper::getRelatedCategoriesList( $this->_wpPostObject ),
    198                     'meta_title' => $this->getMetaTitle(),
    199                     'meta_description' => $this->getMetaDescription()
    200                 ] )
    201                 : ( new Article( $this->getArticle()->id ) )->addNewRevision( [
    202                     'title' => $this->_wpPostObject->post_title,
    203                     'content' => $this->_wpPostObject->post_content,
    204                     'meta_title' => $this->getMetaTitle(),
    205                     'meta_description' => $this->getMetaDescription()
    206                 ] );
     209                ? Article::create( $parameters )
     210                : ( new Article( $this->getArticle()->id ) )->addNewRevision( $parameters );
    207211
    208212
     
    333337
    334338
     339    public function getFeaturedImageUrl()
     340    {
     341        return get_the_post_thumbnail_url( $this->_wpPostObject, 'full' ) ?: '';
     342    }
     343
     344
     345    public function getPostSlug()
     346    {
     347        return get_post_field( 'post_name', $this->_wpPostObject );
     348    }
     349
     350
     351    public function getPostTagsNames()
     352    {
     353        /** @var \WP_Term[]|false|\WP_Error */
     354        $tags = get_the_tags( $this->_wpPostObject->ID );
     355
     356        if ( false === $tags || is_wp_error( $tags ) ) {
     357            return [];
     358        }
     359
     360        $strings = [];
     361
     362        /** @var \WP_Term $tag */
     363        foreach ( $tags as $tag ) {
     364            $strings[] = $tag->name;
     365        }
     366
     367        return $strings;
     368    }
     369
     370
    335371    public function setContent($content = '')
    336372    {
  • easycontent/trunk/easycontent-wp.php

    r2327436 r2340904  
    44 * Plugin URI:  https://easycontent.io
    55 * Description: Imports articles from EasyContent to your wordpress site and exports articles from your wordpress site to EasyContent
    6  * Version: 1.0.4
     6 * Version: 1.0.5
    77 * Requires at least: 5.0.7
    88 * Requires PHP: 5.6
     
    2121
    2222if ( ! defined( 'EASYCONTENT_PLUGIN_VERSION' ) ) {
    23     define( 'EASYCONTENT_PLUGIN_VERSION', '1.0.4' );
     23    define( 'EASYCONTENT_PLUGIN_VERSION', '1.0.5' );
    2424}
    2525
  • easycontent/trunk/readme.txt

    r2327436 r2340904  
    44Tags:               easycontent, easy content, workflow, approval, collaboration, import, export, manage writers, publishing, content flow, editorial, approval process, content tool
    55Requires at least:  5.0.7
    6 Tested up to:       5.4
     6Tested up to:       5.3
    77Requires PHP:       5.6
    88Stable tag:         1.0.4
     
    6161== Changelog ==
    6262
     63= 1.0.5 =
     64* Better EasyContent.io integration
     65
    6366= 1.0.4 =
    6467* Plugin now uses only public API key
Note: See TracChangeset for help on using the changeset viewer.