Plugin Directory

Changeset 2215734


Ignore:
Timestamp:
12/20/2019 02:06:19 PM (6 years ago)
Author:
libsyn
Message:

changes for version 1.2.2.6

Location:
libsyn-podcasting/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • libsyn-podcasting/trunk/admin/functions.php

    r2213760 r2215734  
    719719            if ( !empty( $showId ) ) {
    720720                $show = $plugin->getShow( $api, $api->getShowId() );
    721                 $showTitle = $show->{'user-shows'}->show_title;
    722                 wp_add_dashboard_widget('libsyn_stats_summary', __('Libsyn Publisher Hub Stats for ' . $showTitle, 'libsyn-podcasting'),  'display_libsyn_stats_summary');
     721                if ( !empty($show) ) {
     722                    $showTitle = $show->{'user-shows'}->show_title;
     723                    wp_add_dashboard_widget('libsyn_stats_summary', __('Libsyn Publisher Hub Stats for ' . $showTitle, 'libsyn-podcasting'),  'display_libsyn_stats_summary');
     724                }
    723725            }
    724726        } catch ( Exception $e ) {
     
    742744        if ( !empty( $totalShowDownloads ) ) {
    743745            $statsShowThreeMonth = $plugin->getStatsShowThreeMonth($api, $api->getShowId());
    744             $monthArr = array_reverse( $statsShowThreeMonth->stats_show_three_month->show_three_month );
    745 
    746             $displayMonthArr = array();
     746            if ( !empty($statsShowThreeMonth) && !empty($statsShowThreeMonth->stats_show_three_month) ) {
     747                $monthArr = array_reverse( $statsShowThreeMonth->stats_show_three_month->show_three_month );
     748            } else {
     749                $monthArr = array();
     750            }
     751
     752            $displayShowMonthArr = array();
    747753            foreach ( $monthArr as $monthObj ) {
    748754                $displayShowMonthArr[] = array(
     
    823829}
    824830
    825 function displayStatsIfPresent($statsArr, $offset, $key) {
    826     if ( array_key_exists( $offset, $statsArr ) ) {
     831function displayStatsIfPresent($statsArr = array(), $offset = 0, $key = '') {
     832    if ( ( !empty($statsArr) && !empty($key) ) && array_key_exists( $offset, $statsArr ) ) {
    827833        if ( array_key_exists( $key, $statsArr[$offset] ) ) {
    828834            return $statsArr[$offset][$key];
  • libsyn-podcasting/trunk/admin/lib/Libsyn.php

    r2213760 r2215734  
    44    protected $text_dom = LIBSYN_TEXT_DOMAIN;
    55    protected $plugin_name = "Libsyn/Wordpress";
    6     protected $plugin_version = "1.2.2.5";
     6    protected $plugin_version = "1.2.2.6";
    77    protected $api_table_name = "libsyn_podcast_plugin";
    88    protected $api_base_uri = "https://api.libsyn.com";
  • libsyn-podcasting/trunk/admin/lib/Libsyn/Service.php

    r2213760 r2215734  
    8888            $logFilePath = $this->plugin_admin_dir . $this->text_dom.'.log';
    8989            $data = '';
     90            if ( function_exists('wp_is_writable') ) {
     91                $loggerWritable = wp_is_writable($logFilePath);
     92            } else {
     93                $loggerWritable = is_writable($logFilePath);
     94            }
     95
    9096            if ( file_exists($logFilePath) ) {
    91                 if ( is_writable($logFilePath) ) {
     97                if ( $loggerWritable ) {
    9298                    //check log file last modified and clear if older than a week
    9399                    if ( $this->wp_time - (60*24*7) >= filemtime($logFilePath) ) {
     
    109115                    fwrite($logFile, $data);
    110116                    fclose($logFile);
    111                     chmod($logFilePath, 0777);
     117                    @chmod($logFilePath, 0777);
    112118                } catch (Exception $e) {
    113119                    //do nothing
     
    115121            }
    116122
    117             //NOTE: We could use the logger FP as a directory also and then it will create auto date filename logs. (just pass directory instead of file below)
    118             if ( ( function_exists('wp_is_writable') && wp_is_writable($logFilePath) ) || is_writable($logFilePath) ) {
     123            if ( !isset($this->logger) ) {
     124                $this->logger = false;
     125            }
     126            if ( !isset($this->loggerFP) ) {
     127                $this->loggerFP = false;
     128            }
     129
     130            if ( $loggerWritable ) {
    119131                try {
    120                     if ( !empty($logFilePath) ) {
     132                    if ( !empty($logFilePath) && is_string($logFilePath) ) {
    121133                        $this->logger = new \Libsyn\Service\Logger($logFilePath, $this->text_dom);
    122134                        $this->loggerFP = $logFilePath;
    123                     } else {
    124                         $this->logger = false;
    125                         $this->loggerFP = false;
    126135                    }
    127136                } catch (Exception $e) {
    128                     $this->logger = false;
    129                     $this->loggerFP = false;
     137                    //Cannot Log error, no logs.
    130138                }
    131             } else {
    132                 $this->logger = false;
    133                 $this->loggerFP = false;
    134             }
    135         } else {
    136             $this->logger = false;
    137             $this->loggerFP = false;
     139            }
    138140        }
    139141
  • libsyn-podcasting/trunk/admin/lib/Libsyn/Service/Logger.php

    r2112228 r2215734  
    5353    const LOG_LEVEL_NONE = 'none';
    5454
    55    
     55
    5656    /**
    5757     * Logger constructor
     
    6262     * @param string $log_level (optional) Lowest log level to log.
    6363     */
    64     public function __construct(string $log_file, string $channel, string $log_level = null) {
     64    public function __construct($log_file, $channel, $log_level = null) {
    6565        $this->log_file  = $log_file;
    6666        $this->channel   = $channel;
     
    8888     * @param string $log_level
    8989     */
    90     public function setLogLevel(string $log_level) {
     90    public function setLogLevel($log_level) {
    9191        if (!array_key_exists($log_level, $this->LEVELS)) {
    9292            throw new \DomainException("Log level $log_level is not a valid log level. Must be one of (" . implode(', ', array_keys($this->LEVELS)) . ')');
     
    100100     * @param string $channel
    101101     */
    102     public function setChannel(string $channel) {
     102    public function setChannel($channel) {
    103103        $this->channel = $channel;
    104104    }
     
    110110     * @param bool $stdout
    111111     */
    112     public function setOutput(bool $stdout) {
     112    public function setOutput($stdout) {
    113113        $this->stdout = $stdout;
    114114    }
     
    123123     * @throws \RuntimeException
    124124     */
    125     public function debug($message = '', array $data = null) {
     125    public function debug($message = '', $data = null) {
    126126        if ($this->logAtThisLevel(LogLevel::DEBUG)) {
    127127            $this->log(LogLevel::DEBUG, $message, $data);
     
    138138     * @throws \RuntimeException
    139139     */
    140     public function info($message = '', array $data = null) {
     140    public function info($message = '', $data = null) {
    141141        if ($this->logAtThisLevel(LogLevel::INFO)) {
    142142            $this->log(LogLevel::INFO, $message, $data);
     
    153153     * @throws \RuntimeException
    154154     */
    155     public function notice($message = '', array $data = null) {
     155    public function notice($message = '', $data = null) {
    156156        if ($this->logAtThisLevel(LogLevel::NOTICE)) {
    157157            $this->log(LogLevel::NOTICE, $message, $data);
     
    169169     * @throws \RuntimeException
    170170     */
    171     public function warning($message = '', array $data = null) {
     171    public function warning($message = '', $data = null) {
    172172        if ($this->logAtThisLevel(LogLevel::WARNING)) {
    173173            $this->log(LogLevel::WARNING, $message, $data);
     
    185185     * @throws \RuntimeException
    186186     */
    187     public function error($message = '', array $data = null) {
     187    public function error($message = '', $data = null) {
    188188        if ($this->logAtThisLevel(LogLevel::ERROR)) {
    189189            $this->log(LogLevel::ERROR, $message, $data);
     
    200200     * @throws \RuntimeException
    201201     */
    202     public function critical($message = '', array $data = null) {
     202    public function critical($message = '', $data = null) {
    203203        if ($this->logAtThisLevel(LogLevel::CRITICAL)) {
    204204            $this->log(LogLevel::CRITICAL, $message, $data);
     
    216216     * @throws \RuntimeException
    217217     */
    218     public function alert($message = '', array $data = null) {
     218    public function alert($message = '', $data = null) {
    219219        if ($this->logAtThisLevel(LogLevel::ALERT)) {
    220220            $this->log(LogLevel::ALERT, $message, $data);
     
    232232     * @throws \RuntimeException
    233233     */
    234     public function emergency($message = '', array $data = null) {
     234    public function emergency($message = '', $data = null) {
    235235        if ($this->logAtThisLevel(LogLevel::EMERGENCY)) {
    236236            $this->log(LogLevel::EMERGENCY, $message, $data);
     
    248248     * @throws \RuntimeException when log file cannot be opened for writing.
    249249     */
    250     public function log($level, $message = '', array $data = null) {
     250    public function log($level, $message = '', $data = null) {
    251251        // Build log line
    252252        list($exception, $data) = $this->handleException($data);
     
    287287     * @return array  [exception, data (without exception)]
    288288     */
    289     private function handleException(array $data = null) {
     289    private function handleException($data = null) {
    290290        if (isset($data['exception']) && $data['exception'] instanceof \Throwable) {
    291291            $exception      = $data['exception'];
     
    331331     * @return string
    332332     */
    333     private function formatLogLine(string $level, string $message, string $data, string $exception_data) {
     333    private function formatLogLine($level, $message, $data, $exception_data) {
    334334        return
    335335            $this->getTime()                              . self::TAB .
  • libsyn-podcasting/trunk/readme.txt

    r2213760 r2215734  
    44Requires at least: 4.0
    55Requires PHP: 5.4
    6 Tested up to: 5.3.1
    7 Stable tag: 1.2.2.5
     6Tested up to: 5.3.2
     7Stable tag: 1.2.2.6
    88License: GPLv3 or later
    99Author URI: https://support.libsyn.com/kb/libsyn-publisher-hub/
     
    4848== Changelog ==
    4949
     50= 1.2.2.6 =
     51* Misc. compatibility bug fixes.
     52* Testing up to Wordpress 5.3.2
     53
    5054= 1.2.2.5 =
    5155* Added extra logging information for debug log.
Note: See TracChangeset for help on using the changeset viewer.