Plugin Directory

Changeset 3087121


Ignore:
Timestamp:
05/15/2024 12:15:49 PM (11 months ago)
Author:
avi.megladon
Message:

Bug fixes

Location:
custom-post-type-pdf-attachment
Files:
48 added
3 edited

Legend:

Unmodified
Added
Removed
  • custom-post-type-pdf-attachment/trunk/custom-pdf-attachment.php

    r2513401 r3087121  
    44Plugin URI: https://wordpress.org/plugins/custom-post-type-pdf-attachment/
    55Description: This plugin will allow you to upload files to your post or pages or any other custom post types. You can either use shortcodes or functions to display attachments.
    6 Version: 3.4.5
     6Version: 3.4.6
    77Text Domain: custom-post-type-pdf-attachment
    88Author: aviplugins.com
    99Author URI: https://www.aviplugins.com/
    10 */
     10 */
    1111
    1212/**
    13       |||||   
    14     <(`0_0`)>   
    15     ()(afo)()
    16       ()-()
    17 **/
     13 *      |||||
     14 *    <(`0_0`)>
     15 *    ()(afo)()
     16 *      ()-()
     17 **/
    1818
    19 define( 'CPTA_PLUGIN_DIR', 'custom-post-type-pdf-attachment' );
    20 define( 'CPTA_PLUGIN_PATH', dirname( __FILE__ ) );
     19define('CPTA_PLUGIN_DIR', 'custom-post-type-pdf-attachment');
     20define('CPTA_PLUGIN_PATH', dirname(__FILE__));
    2121
    22 function plug_install_custom_post_type_attachment(){
    23     include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    24     if ( is_plugin_active( 'custom-post-type-attachment-pro/custom-pdf-attachment.php' ) ) {
    25         wp_die('It seems you have <strong>Custom Post Type Attachment PRO</strong> plugin activated. Please deactivate to continue.');
    26         exit;
    27     }
    28    
    29     include_once CPTA_PLUGIN_PATH . '/config/config-attachment-file-types.php';
    30     include_once CPTA_PLUGIN_PATH . '/config/config-attachment-icons.php';
     22function plug_install_custom_post_type_attachment()
     23{
     24    include_once ABSPATH . 'wp-admin/includes/plugin.php';
     25    if (is_plugin_active('custom-post-type-attachment-pro/custom-pdf-attachment.php')) {
     26        wp_die('It seems you have <strong>Custom Post Type Attachment PRO</strong> plugin activated. Please deactivate to continue.');
     27        exit;
     28    }
    3129
    32     include_once CPTA_PLUGIN_PATH . '/includes/class-form.php';
    33     include_once CPTA_PLUGIN_PATH . '/includes/class-settings.php';
    34     include_once CPTA_PLUGIN_PATH . '/includes/class-scripts.php';
    35     include_once CPTA_PLUGIN_PATH . '/includes/class-attachment.php';
    36     include_once CPTA_PLUGIN_PATH . '/includes/class-attachment-list.php';
    37     include_once CPTA_PLUGIN_PATH . '/includes/class-latest-attachment.php';
    38     include_once CPTA_PLUGIN_PATH . '/includes/class-filesize.php';
    39     include_once CPTA_PLUGIN_PATH . '/pdf-attachment-widget.php';
    40     include_once CPTA_PLUGIN_PATH . '/shortcode-functions.php';
    41     include_once CPTA_PLUGIN_PATH . '/functions.php';
    42    
    43     new CPTA_Settings;
    44     new CPTA_Scripts;
    45     new CPTA_Attachments_Init;
    46     new CPTA_Attachments_List_Init;
     30    include_once CPTA_PLUGIN_PATH . '/config/config-attachment-file-types.php';
     31    include_once CPTA_PLUGIN_PATH . '/config/config-attachment-icons.php';
     32
     33    include_once CPTA_PLUGIN_PATH . '/includes/class-form.php';
     34    include_once CPTA_PLUGIN_PATH . '/includes/class-settings.php';
     35    include_once CPTA_PLUGIN_PATH . '/includes/class-scripts.php';
     36    include_once CPTA_PLUGIN_PATH . '/includes/class-attachment.php';
     37    include_once CPTA_PLUGIN_PATH . '/includes/class-attachment-list.php';
     38    include_once CPTA_PLUGIN_PATH . '/includes/class-latest-attachment.php';
     39    include_once CPTA_PLUGIN_PATH . '/includes/class-filesize.php';
     40    include_once CPTA_PLUGIN_PATH . '/pdf-attachment-widget.php';
     41    include_once CPTA_PLUGIN_PATH . '/shortcode-functions.php';
     42    include_once CPTA_PLUGIN_PATH . '/functions.php';
     43
     44    new CPTA_Settings;
     45    new CPTA_Scripts;
     46    new CPTA_Attachments_Init;
     47    new CPTA_Attachments_List_Init;
    4748}
    4849
    49 class WP_Custom_Post_Type_Attachment_Pre_Checking {
    50     function __construct() {
    51         plug_install_custom_post_type_attachment();
    52     }
     50class WP_Custom_Post_Type_Attachment_Pre_Checking
     51{
     52    public function __construct()
     53    {
     54        plug_install_custom_post_type_attachment();
     55    }
    5356}
    5457
    5558new WP_Custom_Post_Type_Attachment_Pre_Checking;
    5659
    57 add_action( 'widgets_init', function(){ register_widget( 'PDF_Attachment_Widget' ); } );
     60add_action('widgets_init', function () {register_widget('PDF_Attachment_Widget');});
    5861
    59 add_shortcode( 'pdf_attachment', 'custom_pdf_attachment_shortcode' );
    60 add_shortcode( 'pdf_all_attachments', 'custom_pdf_all_attachments_shortcode' );
     62add_shortcode('pdf_attachment', 'custom_pdf_attachment_shortcode');
     63add_shortcode('pdf_all_attachments', 'custom_pdf_all_attachments_shortcode');
    6164
    62 add_action( 'plugins_loaded', 'cpta_load_plugin_textdomain' );
     65add_action('plugins_loaded', 'cpta_load_plugin_textdomain');
    6366
    64 register_activation_hook( __FILE__, 'cpta_setup_init' );
     67register_activation_hook(__FILE__, 'cpta_setup_init');
    6568
    66 function cpta_setup_init() {
    67     global $wpdb;
     69function cpta_setup_init()
     70{
     71    global $wpdb;
    6872
    69     // older versions compatibility //
    70     $upload_dir = wp_upload_dir();
    71     $query = "UPDATE `".$wpdb->base_prefix."postmeta` set meta_value = replace(meta_value,'".$upload_dir['baseurl']."','') WHERE `meta_key` LIKE '%cpt_pdf_attachment%'";
    72     $wpdb->query($query);
    73     // older versions compatibility //
     73    // older versions compatibility //
     74    $upload_dir = wp_upload_dir();
     75    $query = "UPDATE `" . $wpdb->base_prefix . "postmeta` set meta_value = replace(meta_value,'" . $upload_dir['baseurl'] . "','') WHERE `meta_key` LIKE '%cpt_pdf_attachment%'";
     76    $wpdb->query($query);
     77    // older versions compatibility //
    7478}
  • custom-post-type-pdf-attachment/trunk/functions.php

    r2415897 r3087121  
    11<?php
    22
    3 if(!function_exists('cpta_load_plugin_textdomain')){
    4     function cpta_load_plugin_textdomain() {
    5         load_plugin_textdomain( 'custom-post-type-pdf-attachment', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
    6     }
     3if (!function_exists('cpta_load_plugin_textdomain')) {
     4    function cpta_load_plugin_textdomain()
     5    {
     6        load_plugin_textdomain('custom-post-type-pdf-attachment', false, basename(dirname(__FILE__)) . '/languages/');
     7    }
    78}
    89
    9 if(!function_exists('cpta_get_file_url')){
    10     function cpta_get_file_url($post_id = '', $file = 1){
    11         $file_path = get_post_meta($post_id, 'cpt_pdf_attachment'.$file, true);
    12         if($file_path){
    13             $upload_dir = wp_upload_dir();
    14             return $upload_dir['baseurl'].$file_path;
    15         }
    16         return false;
    17     }
     10if (!function_exists('cpta_get_file_url')) {
     11    function cpta_get_file_url($post_id = '', $file = 1)
     12    {
     13        $file_path = esc_html(get_post_meta($post_id, 'cpt_pdf_attachment' . $file, true));
     14        if ($file_path) {
     15            $upload_dir = wp_upload_dir();
     16            return $upload_dir['baseurl'] . $file_path;
     17        }
     18        return false;
     19    }
    1820}
    1921
    20 if(!function_exists('cpta_use_media_library')){
    21     function cpta_use_media_library(){
    22         $use_default_media_library = get_option('use_default_media_library');
    23         return ($use_default_media_library == 'Yes'?true:false);
    24     }   
     22if (!function_exists('cpta_use_media_library')) {
     23    function cpta_use_media_library()
     24    {
     25        $use_default_media_library = get_option('use_default_media_library');
     26        return ($use_default_media_library == 'Yes' ? true : false);
     27    }
    2528}
  • custom-post-type-pdf-attachment/trunk/readme.txt

    r2846939 r3087121  
    44Tags: file upload, upload, custom attachment, attachment, post attachment, file attachment, upload file, pdf in post, pdf in custom post type, filepost pdf, file attachment, file, pdf, images, docs, document attachment
    55Requires at least: 2.0.2
    6 Tested up to: 6.1.1
    7 Stable tag: 3.4.5
     6Tested up to: 6.5.3
     7Stable tag: 3.4.6
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6464
    6565== Changelog ==
     66
     67= 3.4.6 =
     68* Bug fixes.
    6669
    6770= 3.4.5 =
Note: See TracChangeset for help on using the changeset viewer.