Plugin Directory

Changeset 3028594


Ignore:
Timestamp:
01/30/2024 08:09:13 AM (23 months ago)
Author:
viitorcloudvc
Message:

Update plugin files and test with the latest WordPress version

Location:
viitor-shortcodes/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • viitor-shortcodes/trunk/includes/admin/class-ww-vcsc-admin.php

    r1754949 r3028594  
    11<?php
    22
    3 // Exit if accessed directly
    4 if ( !defined( 'ABSPATH' ) ) exit;
     3// Exit if accessed directly.
     4if ( ! defined( 'ABSPATH' ) ) {
     5    exit;
     6}
    57
    68/**
     
    1315 */
    1416class Ww_Wpsc_Admin {
    15    
     17
    1618    public $scripts;
    17    
    18     public function __construct() {     
    19    
     19
     20    public function __construct() {
     21
    2022        global $ww_vcsc_scripts;
    2123        $this->scripts = $ww_vcsc_scripts;
    2224    }
    23    
     25
    2426    /**
    2527     * Register Buttons
     
    3032     * @since 1.0.0
    3133     */
    32     public function ww_vcsc_shortcode_editor_register_button( $buttons ) { 
    33    
    34         array_push( $buttons, "|", "wwvcscshortcodes" );
    35         array_push( $buttons, "|", "wwvcscsingleshortcode" );
    36         return $buttons;       
     34    public function ww_vcsc_shortcode_editor_register_button( $buttons ) {
     35
     36        array_push( $buttons, '|', 'wwvcscshortcodes' );
     37        array_push( $buttons, '|', 'wwvcscsingleshortcode' );
     38        return $buttons;
    3739    }
    38    
    39        
     40
     41
    4042    /**
    4143     * Editor Pop Up Script
     
    4749     */
    4850    public function ww_vcsc_shortcode_editor_button_script( $plugin_array ) {
    49    
     51
    5052        wp_enqueue_script( 'tinymce' );
    51        
    52        $plugin_array['wwvcscshortcodes'] = WW_WPSC_URL . 'includes/js/ww-vcsc-buttons.js';
    53        $plugin_array['wwvcscsingleshortcode'] = WW_WPSC_URL . 'includes/js/ww-vcsc-buttons.js';
    54        return $plugin_array;
    55        
    56        
     53
     54        $plugin_array['wwvcscshortcodes']      = WW_WPSC_URL . 'includes/js/ww-vcsc-buttons.js';
     55        $plugin_array['wwvcscsingleshortcode'] = WW_WPSC_URL . 'includes/js/ww-vcsc-buttons.js';
     56        return $plugin_array;
    5757    }
    58    
     58
    5959    /**
    6060     * Shortcode Button
     
    6565     * @since 1.0.0
    6666     */
    67    
    6867    public function ww_vcsc_shortcode_button() {
    69        
    70         if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) {
     68
     69        if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) {
    7170            return;
    7271        }
    73      
     72
    7473        if ( get_user_option( 'rich_editing' ) == 'true' ) {
    7574            add_filter( 'mce_external_plugins', array( $this, 'ww_vcsc_shortcode_editor_button_script' ) );
    76             add_filter( 'mce_buttons', array( $this, 'ww_vcsc_shortcode_editor_register_button' ) );         
     75            add_filter( 'mce_buttons', array( $this, 'ww_vcsc_shortcode_editor_register_button' ) );
    7776        }
    7877    }
    79    
     78
    8079    /**
    8180     * Pop Up On Editor
     
    8786     */
    8887    public function ww_vcsc_shortcode_popup_markup() {
    89        
    90         include_once( WW_WPSC_ADMIN . '/forms/ww-vcsc-popup.php' );
     88
     89        include_once WW_WPSC_ADMIN . '/forms/ww-vcsc-popup.php';
    9190    }
    92    
     91
    9392    /**
    9493     * Adding Hooks
     
    9897     */
    9998    public function add_hooks() {
    100        
    101         // shortcode button
     99
     100        // shortcode button.
    102101        add_action( 'init', array( $this, 'ww_vcsc_shortcode_button' ) );
    103        
    104         // mark up for popup
    105         add_action( 'admin_footer-post.php', array( $this,'ww_vcsc_shortcode_popup_markup' ) );
    106         add_action( 'admin_footer-post-new.php', array( $this,'ww_vcsc_shortcode_popup_markup' ) );
    107        
     102
     103        // mark up for popup.
     104        add_action( 'admin_footer-post.php', array( $this, 'ww_vcsc_shortcode_popup_markup' ) );
     105        add_action( 'admin_footer-post-new.php', array( $this, 'ww_vcsc_shortcode_popup_markup' ) );
    108106    }
    109107}
    110 ?>
  • viitor-shortcodes/trunk/includes/admin/forms/ww-vcsc-popup.php

    r1754949 r3028594  
    1 <?php 
     1<?php
    22
    3 // Exit if accessed directly
    4 if ( !defined( 'ABSPATH' ) ) exit;
     3// Exit if accessed directly.
     4if ( ! defined( 'ABSPATH' ) ) {
     5    exit;
     6}
    57
    68/**
    7  * Shortocde UI
     9 * Shortcode UI
    810 *
    911 * This is the code for the pop up editor, which shows up when an user clicks
     
    1921
    2022    <div class="ww-vcsc-header-popup">
    21         <div class="ww-vcsc-popup-header-title"><?php _e( 'Add a Shortcodes', 'wwvcsc' );?></div>
    22         <div class="ww-vcsc-popup-close"><a href="javascript:void(0);" class="ww-vcsc-popup-close-button"><img src="<?php echo WW_WPSC_IMG_URL;?>/tb-close.png"></a></div>
     23        <div class="ww-vcsc-popup-header-title"><?php _e( 'Add a Shortcodes', 'wwvcsc' ); ?></div>
     24        <div class="ww-vcsc-popup-close"><a href="javascript:void(0);" class="ww-vcsc-popup-close-button"><img src="<?php echo WW_WPSC_IMG_URL; ?>/tb-close.png"></a></div>
    2325    </div>
    24     <div class="ww-vcsc-popup-error"><?php _e( 'Select a Shortcode', 'wwvcsc' );?></div>
     26    <div class="ww-vcsc-popup-error"><?php _e( 'Select a Shortcode', 'wwvcsc' ); ?></div>
    2527    <div class="ww-vcsc-popup-container">
    2628        <table class="form-table">
     
    2830                <tr>
    2931                    <th scope="row">
    30                         <label><?php _e( 'Select a Shortcode', 'wwvcsc' );?></label>       
     32                        <label><?php _e( 'Select a Shortcode', 'wwvcsc' ); ?></label>
    3133                    </th>
    3234                    <td>
    33                         <select id="ww_vcsc_shortcode">             
    34                             <option value=""><?php _e( '--Select Shortcode--', 'wwvcsc' );?></option>
    35                             <option value="button"><?php _e( 'Button', 'wwvcsc' );?></option>
    36                             <option value="box"><?php _e( 'Box', 'wwvcsc' );?></option>
    37                         </select>       
     35                        <select id="ww_vcsc_shortcode">
     36                            <option value=""><?php _e( '--Select Shortcode--', 'wwvcsc' ); ?></option>
     37                            <option value="button"><?php _e( 'Button', 'wwvcsc' ); ?></option>
     38                            <option value="box"><?php _e( 'Box', 'wwvcsc' ); ?></option>
     39                        </select>
    3840                    </td>
    3941                </tr>
    4042            </tbody>
    4143        </table>
    42    
     44
    4345        <div id="ww_vcsc_box_type" class="ww-vcsc-shortcodes-options">
    4446            <table class="form-table">
     
    4648                    <tr>
    4749                        <th scope="row">
    48                             <label for="ww_vcsc_box_type_select"><?php _e( 'Select a Box Type :', 'wwvcsc' );?></label>     
     50                            <label for="ww_vcsc_box_type_select"><?php _e( 'Select a Box Type :', 'wwvcsc' ); ?></label>
    4951                        </th>
    5052                        <td>
    51                             <select id="ww_vcsc_box_type_select">               
    52                                 <option value=""><?php _e( '--Select Box Type--', 'wwvcsc' );?></option>
    53                                 <option value="boxstandard"><?php _e( 'Standard', 'wwvcsc' );?></option>
    54                                 <option value="boxinfo"><?php _e( 'Info', 'wwvcsc' );?></option>
    55                                 <option value="boxwarning"><?php _e( 'Warning', 'wwvcsc' );?></option>
    56                                 <option value="boxdownload"><?php _e( 'Download', 'wwvcsc' );?></option>
    57                                 <option value="boxerror"><?php _e( 'Error', 'wwvcsc' );?></option>
    58                             </select>       
     53                            <select id="ww_vcsc_box_type_select">
     54                                <option value=""><?php _e( '--Select Box Type--', 'wwvcsc' ); ?></option>
     55                                <option value="boxstandard"><?php _e( 'Standard', 'wwvcsc' ); ?></option>
     56                                <option value="boxinfo"><?php _e( 'Info', 'wwvcsc' ); ?></option>
     57                                <option value="boxwarning"><?php _e( 'Warning', 'wwvcsc' ); ?></option>
     58                                <option value="boxdownload"><?php _e( 'Download', 'wwvcsc' ); ?></option>
     59                                <option value="boxerror"><?php _e( 'Error', 'wwvcsc' ); ?></option>
     60                            </select>
    5961                        </td>
    6062                    </tr>
    6163                    <tr>
    6264                        <th scope="row">
    63                             <label for="ww_vcsc_box_content"><?php _e( 'Enter Content :', 'wwvcsc' );?></label>
     65                            <label for="ww_vcsc_box_content"><?php _e( 'Enter Content :', 'wwvcsc' ); ?></label>
    6466                        </th>
    6567                        <td>
     
    7072            </table>
    7173        </div><!--.ww-vcsc-popup-box-type-->
    72         <div id="ww_vcsc_insert_container" >
     74        <div id="ww_vcsc_insert_container">
    7375            <input type="button" class="button-secondary" id="ww_vcsc_insert_shortcode" value="<?php _e( 'Insert Shortcode', 'wwvcsc' ); ?>">
    7476        </div>
    75          
    76     </div> 
    77    
     77
     78    </div>
     79
    7880</div><!--.ww-vcsc-popup-content-->
    79 <div class="ww-vcsc-popup-overlay" ></div><!--.ww-vcsc-popup-overlay-->
     81<div class="ww-vcsc-popup-overlay"></div><!--.ww-vcsc-popup-overlay-->
  • viitor-shortcodes/trunk/includes/class-ww-vcsc-scripts.php

    r1754949 r3028594  
    11<?php
    22
    3 // Exit if accessed directly
    4 if ( !defined( 'ABSPATH' ) ) exit;
     3// Exit if accessed directly.
     4if ( ! defined( 'ABSPATH' ) ) {
     5    exit;
     6}
    57
    68/**
     
    1416 */
    1517class Ww_Wpsc_Scripts {
    16    
     18
    1719    public function __construct() {
    18        
    1920    }
    20    
     21
    2122    /**
    22      * Enqueue Styles 
     23     * Enqueue Styles
    2324     *
    2425     * Enqueue Style Sheet for public
     
    2728     * @since 1.0.0
    2829     */
    29    
    3030    public function ww_vcsc_public_styles() {
    31        
    32         wp_register_style( 'ww-vcsc-public-style', WW_WPSC_URL . 'includes/css/ww-vcsc-public.css');
     31
     32        wp_register_style( 'ww-vcsc-public-style', WW_WPSC_URL . 'includes/css/ww-vcsc-public.css' );
    3333        wp_enqueue_style( 'ww-vcsc-public-style' );
    34        
    3534    }
    36    
     35
    3736    /**
    3837     * Enqueuing Styles
     
    4645
    4746        $pages_hook_suffix = array( 'post.php', 'post-new.php' );
    48        
    49         //Check pages when you needed
    50         if( in_array( $hook_suffix, $pages_hook_suffix ) ) {
    51        
    52             // loads the required styles for the plugin settings page
     47
     48        // Check pages when you needed.
     49        if ( in_array( $hook_suffix, $pages_hook_suffix ) ) {
     50
     51            // loads the required styles for the plugin settings page.
    5352            wp_register_style( 'ww-vcsc-admin', WW_WPSC_URL . 'includes/css/ww-vcsc-admin.css', array(), null );
    5453            wp_enqueue_style( 'ww-vcsc-admin' );
    55            
     54
    5655        }
    5756    }
    58    
     57
    5958    /**
    6059     * Adding Hooks
     
    6766    public function add_hooks() {
    6867
    69         //add style for front side
     68        // add style for front side.
    7069        add_action( 'wp_enqueue_scripts', array( $this, 'ww_vcsc_public_styles' ) );
    71        
    72         // for shortcode popup         
    73         add_action( 'admin_enqueue_scripts', array( $this,'ww_vcsc_admin_styles' ) );
    74        
     70
     71        // for shortcode popup.
     72        add_action( 'admin_enqueue_scripts', array( $this, 'ww_vcsc_admin_styles' ) );
    7573    }
    7674}
    77 ?>
  • viitor-shortcodes/trunk/includes/class-ww-vcsc-shortcodes.php

    r1796379 r3028594  
    11<?php
    22
    3 // Exit if accessed directly
    4 if ( !defined( 'ABSPATH' ) ) exit;
     3// Exit if accessed directly.
     4if ( ! defined( 'ABSPATH' ) ) {
     5    exit;
     6}
    57
    68/**
     
    1416 */
    1517class Ww_Wpsc_Shortcodes {
    16    
    17     public function __construct(){
    18        
     18
     19    public function __construct() {
    1920    }
    20    
     21
    2122    /**
    2223     * Replace Shortcode with Custom Content
     
    2425     * @param $atts this will handles to various attributes which are passed in shortcodes
    2526     * @param $content this will return the your replaced content
    26      * 
     27     *
    2728     * @package WP Shortcodes
    28      * @since 1.0.0 
     29     * @since 1.0.0
    2930     */
    30    
    3131    public function ww_vcsc_boxes( $atts, $content ) {
    32        
    33         //content to replace with your content and with attributes
    34         extract( shortcode_atts( array(
    35                                 'link'     => '#',
    36                 'target' => '',
    37                 'boxtype'       =>  'boxinfo',
    38                 'showcontent'   => ''
    39         ), $atts ) );
    40        
    41         //default value for boxtype when nothing seleted
    42         if(empty($boxtype)) { $boxtype = 'boxinfo'; }
    43        
    44         $content .= '<div class="ww-vcsc-'.$boxtype.'"><a class="button" href="'.$link.'" target="'.$target.'">'.do_shortcode($showcontent).'</a></div>';
    45        
     32
     33        // content to replace with your content and with attributes.
     34        extract(
     35            shortcode_atts(
     36                array(
     37                    'link'        => '#',
     38                    'target'      => '',
     39                    'boxtype'     => 'boxinfo',
     40                    'showcontent' => '',
     41                ),
     42                $atts
     43            )
     44        );
     45
     46        // default value for box-type when nothing selected.
     47        if ( empty( $boxtype ) ) {
     48            $boxtype = 'boxinfo';
     49        }
     50
     51        $content .= '<div class="ww-vcsc-' . $boxtype . '"><a class="button" href="' . $link . '" target="' . $target . '">' . do_shortcode( $showcontent ) . '</a></div>';
     52
    4653        return $content;
    4754    }
     
    5259     * @since 1.0.0
    5360     */
    54    
    55     public function ww_vcsc_button($atts,$content) {
    56        
    57         //content to replace with your content
     61    public function ww_vcsc_button( $atts, $content ) {
     62
     63        // content to replace with your content.
    5864        $content .= '<div class="ww-vcsc-button-container">
    59         <a href="'.$link.'" class="ww-vcsc-button orange large"><span>'.__('Button','wwvcsc').'</span></a></div>'; 
    60        
     65        <a href="' . $link . '" class="ww-vcsc-button orange large"><span>' . __( 'Button', 'wwvcsc' ) . '</span></a></div>';
     66
    6167        return $content;
    6268    }
    63    
     69
    6470    /**
    6571     * Adding Hooks
     
    6975     */
    7076    public function add_hooks() {
    71        
    72         //replace shortcodes with custom content or HTML
    73         add_shortcode('ww_vcsc_boxes',array($this, 'ww_vcsc_boxes'));
    74         add_shortcode('ww_vcsc_button',array($this, 'ww_vcsc_button'));
    75        
     77
     78        // replace shortcodes with custom content or HTML.
     79        add_shortcode( 'ww_vcsc_boxes', array( $this, 'ww_vcsc_boxes' ) );
     80        add_shortcode( 'ww_vcsc_button', array( $this, 'ww_vcsc_button' ) );
    7681    }
    7782}
    78 ?>
  • viitor-shortcodes/trunk/index.php

    r1754949 r3028594  
    11<?php
    22// Silence is golden.
    3 ?>
  • viitor-shortcodes/trunk/readme.txt

    r2894207 r3028594  
    44Tags:Viitor, Shortcodes, Shortcode, Button,  box, page, Download Button, Error Button, Standard Button, Info Button
    55Requires at least: 3.8
    6 Tested up to: 6.2
     6Tested up to: 6.4.2
    77Requires PHP: 5.2.4
    88Stable tag: trunk
  • viitor-shortcodes/trunk/ww-wp-shortcodes.php

    r2262338 r3028594  
    11<?php
    2 /*
    3 Plugin Name: Viitor  Button Shortcodes
    4 Plugin URI: https://viitorcloud.com/blog/
    5 Description: Button shortcodes and shortcodes attributes.
    6 Version: 1.0.0
    7 Author: Viitorcloud
    8 Author URI: https://viitorcloud.com/
    9 */   
    10 
    112/**
    12  * Basic plugin definitions
    13  *
     3 * Plugin Name: Viitor  Button Shortcodes
     4 * Plugin URI: https://viitorcloud.com/blog/
     5 * Description: Button shortcodes and shortcodes attributes.
     6 * Version: 2.0.0
     7 * Author: Viitorcloud
     8 * Author URI: https://viitorcloud.com/
     9 *
    1410 * @package WP Shortcodes
    1511 * @since 1.0.0
    1612 */
    1713
    18 // Exit if accessed directly
    19 if ( !defined( 'ABSPATH' ) ) exit;
     14// Exit if accessed directly.
     15if ( ! defined( 'ABSPATH' ) ) {
     16    exit;
     17}
    2018
    2119global $wpdb;
    2220
    23 if( !defined( 'WW_WPSC_DIR' ) ) {
    24     define( 'WW_WPSC_DIR', dirname( __FILE__ ) ); // plugin dir
     21if ( ! defined( 'WW_WPSC_DIR' ) ) {
     22    define( 'WW_WPSC_DIR', __DIR__ ); // plugin dir.
    2523}
    26 if( !defined( 'WW_WPSC_ADMIN' ) ) {
    27     define( 'WW_WPSC_ADMIN', WW_WPSC_DIR . '/includes/admin' ); // plugin admin dir
     24if ( ! defined( 'WW_WPSC_ADMIN' ) ) {
     25    define( 'WW_WPSC_ADMIN', WW_WPSC_DIR . '/includes/admin' ); // plugin admin dir.
    2826}
    29 if( !defined( 'WW_WPSC_URL' ) ) {
    30     define( 'WW_WPSC_URL', plugin_dir_url( __FILE__ ) ); // plugin url
     27if ( ! defined( 'WW_WPSC_URL' ) ) {
     28    define( 'WW_WPSC_URL', plugin_dir_url( __FILE__ ) ); // plugin url.
    3129}
    32 if( !defined( 'WW_WPSC_IMG_URL' ) ) {
    33     define( 'WW_WPSC_IMG_URL', WW_WPSC_URL . 'includes/images' ); // plugin images url
     30if ( ! defined( 'WW_WPSC_IMG_URL' ) ) {
     31    define( 'WW_WPSC_IMG_URL', WW_WPSC_URL . 'includes/images' ); // plugin images url.
    3432}
    35 if( !defined( 'WW_WPSC_TEXT_DOMAIN' ) ) {
    36     define( 'WW_WPSC_TEXT_DOMAIN', 'wwvcsc' ); // text domain for doing language translation
     33if ( ! defined( 'WW_WPSC_TEXT_DOMAIN' ) ) {
     34    define( 'WW_WPSC_TEXT_DOMAIN', 'wwvcsc' ); // text domain for doing language translation.
    3735}
    3836
    3937/**
    4038 * Load Text Domain
    41  * 
     39 *
    4240 * This gets the plugin ready for translation.
    43  * 
     41 *
    4442 * @package WP Shortcodes
    4543 * @since 1.0.0
     
    4947/**
    5048 * Activation hook
    51  * 
     49 *
    5250 * Register plugin activation hook.
    53  * 
     51 *
    5452 * @package WP Shortcodes
    5553 * @since 1.0.0
     
    6260 *
    6361 * Register plugin deactivation hook.
    64  * 
     62 *
    6563 * @package WP Shortcodes
    6664 * @since 1.0.0
     
    7068
    7169/**
    72  * Plugin Setup Activation hook call back 
     70 * Plugin Setup Activation hook call back
    7371 *
    74  * Initial setup of the plugin setting default options 
     72 * Initial setup of the plugin setting default options
    7573 * and database tables creations.
    76  * 
     74 *
    7775 * @package WP Shortcodes
    7876 * @since 1.0.0
    7977 */
    8078function ww_vcsc_install() {
    81    
     79
    8280    global $wpdb;
    8381}
     
    9391 */
    9492function ww_vcsc_uninstall() {
    95    
     93
    9694    global $wpdb;
    9795}
     
    9997/**
    10098 * Initialize all global variables
    101  * 
     99 *
    102100 * @package WP Shortcodes
    103101 * @since 1.0.0
    104102 */
    105103
    106 global $ww_vcsc_scripts,$ww_vcsc_admin,$ww_vcsc_shortcodes;
     104global $ww_vcsc_scripts, $ww_vcsc_admin, $ww_vcsc_shortcodes;
    107105
    108106/**
     
    114112 * @since 1.0.0
    115113 */
    116 require_once( WW_WPSC_DIR . '/includes/class-ww-vcsc-scripts.php');
     114require_once WW_WPSC_DIR . '/includes/class-ww-vcsc-scripts.php';
    117115$ww_vcsc_scripts = new Ww_Wpsc_Scripts();
    118116$ww_vcsc_scripts->add_hooks();
    119117
    120 //includes admin class file
    121 require_once ( WW_WPSC_ADMIN . '/class-ww-vcsc-admin.php');
     118// includes admin class file.
     119require_once WW_WPSC_ADMIN . '/class-ww-vcsc-admin.php';
    122120$ww_vcsc_admin = new Ww_Wpsc_Admin();
    123121$ww_vcsc_admin->add_hooks();
    124122
    125 //includes shortcode class file
    126 require_once ( WW_WPSC_DIR . '/includes/class-ww-vcsc-shortcodes.php');
     123// includes shortcode class file.
     124require_once WW_WPSC_DIR . '/includes/class-ww-vcsc-shortcodes.php';
    127125$ww_vcsc_shortcodes = new Ww_Wpsc_Shortcodes();
    128126$ww_vcsc_shortcodes->add_hooks();
    129  
    130 ?>
Note: See TracChangeset for help on using the changeset viewer.