Plugin Directory

Changeset 2707715


Ignore:
Timestamp:
04/10/2022 09:56:23 PM (4 years ago)
Author:
logtivity
Message:

release 1.14.0

Location:
logtivity
Files:
56 added
9 edited

Legend:

Unmodified
Added
Removed
  • logtivity/trunk/Logs/Core/Logtivity_Post.php

    r2699882 r2707715  
    4444                )
    4545                ->setContext($post->post_title)
    46                 ->addMeta('Post ID', $post->ID)
    47                 ->addMeta('Post Type', $post->post_type)
     46                ->setPostType($post->post_type)
     47                ->setPostId($post->ID)
    4848                ->send();
    4949        }
     
    7373        }
    7474
    75         $log = Logtivity_Logger::log()
     75        $revision = $this->getRevision($post_id);
     76
     77        Logtivity_Logger::log()
    7678            ->setAction($this->action ?? $this->getPostTypeLabel($post->ID) . ' Updated')
    7779            ->setContext($post->post_title)
    78             ->addMeta('Post ID', $post->ID)
     80            ->setPostType($post->post_type)
     81            ->setPostId($post->ID)
    7982            ->addMeta('Post Title', $post->post_title)
    80             ->addMeta('Post Type', $post->post_type)
    81             ->addMeta('Post Status', $post->post_status);
    82 
    83         if ($revision = $this->getRevision($post_id)) {
    84             $log->addMeta('View Revision', $revision);
    85         }
    86 
    87         $log->send();
     83            ->addMeta('Post Status', $post->post_status)
     84            ->addMetaIf($revision, 'View Revision', $revision)
     85            ->send();
    8886
    8987        update_post_meta($post_id, 'logtivity_last_logged', (new \DateTime())->format('Y-m-d H:i:s'));
     
    113111            ->setAction($this->getPostTypeLabel($post_id) . ' Trashed')
    114112            ->setContext(logtivity_get_the_title($post_id))
    115             ->addMeta('Post ID', $post_id)
    116             ->addMeta('Post Type', get_post_type($post_id))
     113            ->setPostType(get_post_type($post_id))
     114            ->setPostId($post_id)
    117115            ->addMeta('Post Title', logtivity_get_the_title($post_id))
    118116            ->send();
     
    126124            )
    127125            ->setContext($post->post_title)
    128             ->addMeta('Post ID', $post->ID)
    129             ->addMeta('Post Type', $post->post_type)
     126            ->setPostType($post->post_type)
     127            ->setPostId($post->ID)
    130128            ->addMeta('Post Title', $post->post_title)
    131129            ->send();
     
    147145            )
    148146            ->setContext(logtivity_get_the_title($post_id))
    149             ->addMeta('Post ID', $post_id)
    150             ->addMeta('Post Type', get_post_type($post_id))
     147            ->setPostType(get_post_type($post_id))
     148            ->setPostId($post_id)
    151149            ->addMeta('Post Title', logtivity_get_the_title($post_id))
    152150            ->send();
  • logtivity/trunk/Logs/Core/Logtivity_Term.php

    r2699882 r2707715  
    33class Logtivity_Term
    44{
     5    protected $ignoreTaxonomies = [
     6        'nav_menu',
     7        'edd_log_type',
     8    ];
     9
    510    public function __construct()
    611    {
     
    1217    public function termCreated($term_id, $tt_id, $taxonomy)
    1318    {
     19        if (in_array($taxonomy, $this->ignoreTaxonomies)) {
     20            return;
     21        }
     22
    1423        $term = get_term_by('id', $term_id, $taxonomy);
    1524
     
    2635    public function termUpdated($term_id, $taxonomy)
    2736    {
     37        if (in_array($taxonomy, $this->ignoreTaxonomies)) {
     38            return;
     39        }
     40
    2841        $term = get_term_by('id', $term_id, $taxonomy);
    2942
     
    4053    public function termDeleted($term, $tt_id, $taxonomy, $deleted_term, $object_ids)
    4154    {
     55        if (in_array($taxonomy, $this->ignoreTaxonomies)) {
     56            return;
     57        }
     58
    4259        return Logtivity_Logger::log()
    4360            ->setAction('Term Deleted')
  • logtivity/trunk/Logs/Download_Monitor/Logtivity_Download_Monitor.php

    r2556628 r2707715  
    1313            ->setAction('File Downloaded')
    1414            ->setContext($download->get_title())
     15            ->setPostType(get_post_type($download->get_id()))
     16            ->setPostId($download->get_id())
    1517            ->addMeta('Download Slug', $download->get_slug())
    1618            ->addMeta('Download ID', $download->get_id())
  • logtivity/trunk/Logs/Easy_Digital_Downloads/Logtivity_Easy_Digital_Downloads.php

    r2642335 r2707715  
    1818        $log = Logtivity_Logger::log()
    1919            ->setAction('Download Added to Cart')
    20             ->setContext(logtivity_get_the_title($download_id));
     20            ->setContext(logtivity_get_the_title($download_id))
     21            ->setPostId($download_id);
    2122
    2223        $prices = edd_get_variable_prices($download_id);
     
    136137            ->setAction('File Downloaded')
    137138            ->setContext($this->getDownloadTitle($download->get_ID(), $args['price_id'] ?? null))
     139            ->setPostId($download->get_ID())
    138140            ->addMeta('Payment Key', $this->getPaymentKey($payment));
    139141
  • logtivity/trunk/Logs/Logtivity_Abstract_Logger.php

    r2577481 r2707715  
    126126    protected function getPostTypeLabel($post_id)
    127127    {
    128         return ucwords( str_replace(['_', '-'], ' ', get_post_type($post_id)) );
     128        return $this->formatLabel(get_post_type($post_id));
     129    }
     130
     131    protected function formatLabel($label)
     132    {
     133        return ucwords( str_replace(['_', '-'], ' ', $label) );
    129134    }
    130135}
  • logtivity/trunk/Services/Logtivity_Logger.php

    r2647971 r2707715  
    3131     */
    3232    public $context;
     33   
     34    /**
     35     * The post type, if relevant for a given log
     36     *
     37     * @var string
     38     */
     39    public $post_type;
     40
     41    /**
     42     * The post ID, if relevant for a given log
     43     *
     44     * @var integer
     45     */
     46    public $post_id;
    3347
    3448    /**
     
    128142
    129143    /**
     144     * Set the post_type string before sending.
     145     *
     146     * @param string
     147     */
     148    public function setPostType($post_type)
     149    {
     150        $this->post_type = $post_type;
     151
     152        return $this;
     153    }
     154
     155    /**
     156     * Set the post_id before sending.
     157     *
     158     * @param integer
     159     */
     160    public function setPostId($post_id)
     161    {
     162        $this->post_id = $post_id;
     163
     164        return $this;
     165    }
     166
     167    /**
    130168     * Add to an array any additional information you would like to pass to this log.
    131169     *
     
    144182    }
    145183
     184    /**
     185     * Add the meta if the first condition is true
     186     *
     187     * @param boolean $condition
     188     * @param string  $key   
     189     * @param mixed  $value
     190     */
     191    public function addMetaIf($condition = false, $key, $value)
     192    {
     193        if ($condition) {
     194            $this->addMeta($key, $value);
     195        }
     196
     197        return $this;
     198    }
     199
    146200    /**
    147201     * Add to an array of user meta you would like to pass to this log.
     
    210264            'action' => $this->action,
    211265            'context' => $this->context,
     266            'post_type' => $this->post_type,
     267            'post_id' => $this->post_id,
    212268            'meta' => $this->getMeta(),
    213269            'user_id' => $this->getUserID(),
  • logtivity/trunk/logtivity.php

    r2699882 r2707715  
    55 * Plugin URI:  https://logtivity.io
    66 * Description: Dedicated Event Monitoring for WordPress using Logtivity.io.
    7  * Version:     1.13.0
     7 * Version:     1.14.0
    88 * Author:      Logtivity
    99 * Text Domain: logtivity
     
    1212class Logtivity
    1313{
    14     protected $version = '1.13.0';
     14    protected $version = '1.14.0';
    1515
    1616    /**
     
    4646        'Logs/Core/Logtivity_Comment',
    4747        'Logs/Core/Logtivity_Term',
     48        'Logs/Core/Logtivity_Meta',
    4849    ];
    4950
  • logtivity/trunk/readme.md

    r2699882 r2707715  
    55Requires at least: 4.7
    66Tested up to: 5.8
    7 Stable tag: 1.13.0
     7Stable tag: 1.14.0
    88Requires PHP: 7.0
    99License: GPLv2 or later
     
    279279== Changelog ==
    280280
     281= 1.14.0 =
     282
     283_Release Date – Sunday 10th April 2022_
     284
     285* Add logging of post meta changes.
     286
    281287= 1.13.0 =
    282288
  • logtivity/trunk/readme.txt

    r2699882 r2707715  
    55Requires at least: 4.7
    66Tested up to: 5.8
    7 Stable tag: 1.13.0
     7Stable tag: 1.14.0
    88Requires PHP: 7.0
    99License: GPLv2 or later
     
    279279== Changelog ==
    280280
     281= 1.14.0 =
     282
     283_Release Date – Sunday 10th April 2022_
     284
     285* Add logging of post meta changes.
     286
    281287= 1.13.0 =
    282288
Note: See TracChangeset for help on using the changeset viewer.