Changeset 3028594
- Timestamp:
- 01/30/2024 08:09:13 AM (23 months ago)
- Location:
- viitor-shortcodes/trunk
- Files:
-
- 7 edited
-
includes/admin/class-ww-vcsc-admin.php (modified) (7 diffs)
-
includes/admin/forms/ww-vcsc-popup.php (modified) (5 diffs)
-
includes/class-ww-vcsc-scripts.php (modified) (5 diffs)
-
includes/class-ww-vcsc-shortcodes.php (modified) (5 diffs)
-
index.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
-
ww-wp-shortcodes.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
viitor-shortcodes/trunk/includes/admin/class-ww-vcsc-admin.php
r1754949 r3028594 1 1 <?php 2 2 3 // Exit if accessed directly 4 if ( !defined( 'ABSPATH' ) ) exit; 3 // Exit if accessed directly. 4 if ( ! defined( 'ABSPATH' ) ) { 5 exit; 6 } 5 7 6 8 /** … … 13 15 */ 14 16 class Ww_Wpsc_Admin { 15 17 16 18 public $scripts; 17 18 public function __construct() { 19 19 20 public function __construct() { 21 20 22 global $ww_vcsc_scripts; 21 23 $this->scripts = $ww_vcsc_scripts; 22 24 } 23 25 24 26 /** 25 27 * Register Buttons … … 30 32 * @since 1.0.0 31 33 */ 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; 37 39 } 38 39 40 41 40 42 /** 41 43 * Editor Pop Up Script … … 47 49 */ 48 50 public function ww_vcsc_shortcode_editor_button_script( $plugin_array ) { 49 51 50 52 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; 57 57 } 58 58 59 59 /** 60 60 * Shortcode Button … … 65 65 * @since 1.0.0 66 66 */ 67 68 67 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' ) ) { 71 70 return; 72 71 } 73 72 74 73 if ( get_user_option( 'rich_editing' ) == 'true' ) { 75 74 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' ) ); 77 76 } 78 77 } 79 78 80 79 /** 81 80 * Pop Up On Editor … … 87 86 */ 88 87 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'; 91 90 } 92 91 93 92 /** 94 93 * Adding Hooks … … 98 97 */ 99 98 public function add_hooks() { 100 101 // shortcode button 99 100 // shortcode button. 102 101 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' ) ); 108 106 } 109 107 } 110 ?> -
viitor-shortcodes/trunk/includes/admin/forms/ww-vcsc-popup.php
r1754949 r3028594 1 <?php 1 <?php 2 2 3 // Exit if accessed directly 4 if ( !defined( 'ABSPATH' ) ) exit; 3 // Exit if accessed directly. 4 if ( ! defined( 'ABSPATH' ) ) { 5 exit; 6 } 5 7 6 8 /** 7 * Short ocde UI9 * Shortcode UI 8 10 * 9 11 * This is the code for the pop up editor, which shows up when an user clicks … … 19 21 20 22 <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> 23 25 </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> 25 27 <div class="ww-vcsc-popup-container"> 26 28 <table class="form-table"> … … 28 30 <tr> 29 31 <th scope="row"> 30 <label><?php _e( 'Select a Shortcode', 'wwvcsc' ); ?></label>32 <label><?php _e( 'Select a Shortcode', 'wwvcsc' ); ?></label> 31 33 </th> 32 34 <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> 38 40 </td> 39 41 </tr> 40 42 </tbody> 41 43 </table> 42 44 43 45 <div id="ww_vcsc_box_type" class="ww-vcsc-shortcodes-options"> 44 46 <table class="form-table"> … … 46 48 <tr> 47 49 <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> 49 51 </th> 50 52 <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> 59 61 </td> 60 62 </tr> 61 63 <tr> 62 64 <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> 64 66 </th> 65 67 <td> … … 70 72 </table> 71 73 </div><!--.ww-vcsc-popup-box-type--> 72 <div id="ww_vcsc_insert_container" >74 <div id="ww_vcsc_insert_container"> 73 75 <input type="button" class="button-secondary" id="ww_vcsc_insert_shortcode" value="<?php _e( 'Insert Shortcode', 'wwvcsc' ); ?>"> 74 76 </div> 75 76 </div> 77 77 78 </div> 79 78 80 </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 1 1 <?php 2 2 3 // Exit if accessed directly 4 if ( !defined( 'ABSPATH' ) ) exit; 3 // Exit if accessed directly. 4 if ( ! defined( 'ABSPATH' ) ) { 5 exit; 6 } 5 7 6 8 /** … … 14 16 */ 15 17 class Ww_Wpsc_Scripts { 16 18 17 19 public function __construct() { 18 19 20 } 20 21 21 22 /** 22 * Enqueue Styles 23 * Enqueue Styles 23 24 * 24 25 * Enqueue Style Sheet for public … … 27 28 * @since 1.0.0 28 29 */ 29 30 30 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' ); 33 33 wp_enqueue_style( 'ww-vcsc-public-style' ); 34 35 34 } 36 35 37 36 /** 38 37 * Enqueuing Styles … … 46 45 47 46 $pages_hook_suffix = array( 'post.php', 'post-new.php' ); 48 49 // Check pages when you needed50 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. 53 52 wp_register_style( 'ww-vcsc-admin', WW_WPSC_URL . 'includes/css/ww-vcsc-admin.css', array(), null ); 54 53 wp_enqueue_style( 'ww-vcsc-admin' ); 55 54 56 55 } 57 56 } 58 57 59 58 /** 60 59 * Adding Hooks … … 67 66 public function add_hooks() { 68 67 69 // add style for front side68 // add style for front side. 70 69 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' ) ); 75 73 } 76 74 } 77 ?> -
viitor-shortcodes/trunk/includes/class-ww-vcsc-shortcodes.php
r1796379 r3028594 1 1 <?php 2 2 3 // Exit if accessed directly 4 if ( !defined( 'ABSPATH' ) ) exit; 3 // Exit if accessed directly. 4 if ( ! defined( 'ABSPATH' ) ) { 5 exit; 6 } 5 7 6 8 /** … … 14 16 */ 15 17 class Ww_Wpsc_Shortcodes { 16 17 public function __construct(){ 18 18 19 public function __construct() { 19 20 } 20 21 21 22 /** 22 23 * Replace Shortcode with Custom Content … … 24 25 * @param $atts this will handles to various attributes which are passed in shortcodes 25 26 * @param $content this will return the your replaced content 26 * 27 * 27 28 * @package WP Shortcodes 28 * @since 1.0.0 29 * @since 1.0.0 29 30 */ 30 31 31 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 46 53 return $content; 47 54 } … … 52 59 * @since 1.0.0 53 60 */ 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. 58 64 $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 61 67 return $content; 62 68 } 63 69 64 70 /** 65 71 * Adding Hooks … … 69 75 */ 70 76 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' ) ); 76 81 } 77 82 } 78 ?> -
viitor-shortcodes/trunk/index.php
r1754949 r3028594 1 1 <?php 2 2 // Silence is golden. 3 ?> -
viitor-shortcodes/trunk/readme.txt
r2894207 r3028594 4 4 Tags:Viitor, Shortcodes, Shortcode, Button, box, page, Download Button, Error Button, Standard Button, Info Button 5 5 Requires at least: 3.8 6 Tested up to: 6. 26 Tested up to: 6.4.2 7 7 Requires PHP: 5.2.4 8 8 Stable tag: trunk -
viitor-shortcodes/trunk/ww-wp-shortcodes.php
r2262338 r3028594 1 1 <?php 2 /*3 Plugin Name: Viitor Button Shortcodes4 Plugin URI: https://viitorcloud.com/blog/5 Description: Button shortcodes and shortcodes attributes.6 Version: 1.0.07 Author: Viitorcloud8 Author URI: https://viitorcloud.com/9 */10 11 2 /** 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 * 14 10 * @package WP Shortcodes 15 11 * @since 1.0.0 16 12 */ 17 13 18 // Exit if accessed directly 19 if ( !defined( 'ABSPATH' ) ) exit; 14 // Exit if accessed directly. 15 if ( ! defined( 'ABSPATH' ) ) { 16 exit; 17 } 20 18 21 19 global $wpdb; 22 20 23 if ( !defined( 'WW_WPSC_DIR' ) ) {24 define( 'WW_WPSC_DIR', dirname( __FILE__ ) ); // plugin dir21 if ( ! defined( 'WW_WPSC_DIR' ) ) { 22 define( 'WW_WPSC_DIR', __DIR__ ); // plugin dir. 25 23 } 26 if ( !defined( 'WW_WPSC_ADMIN' ) ) {27 define( 'WW_WPSC_ADMIN', WW_WPSC_DIR . '/includes/admin' ); // plugin admin dir 24 if ( ! defined( 'WW_WPSC_ADMIN' ) ) { 25 define( 'WW_WPSC_ADMIN', WW_WPSC_DIR . '/includes/admin' ); // plugin admin dir. 28 26 } 29 if ( !defined( 'WW_WPSC_URL' ) ) {30 define( 'WW_WPSC_URL', plugin_dir_url( __FILE__ ) ); // plugin url 27 if ( ! defined( 'WW_WPSC_URL' ) ) { 28 define( 'WW_WPSC_URL', plugin_dir_url( __FILE__ ) ); // plugin url. 31 29 } 32 if ( !defined( 'WW_WPSC_IMG_URL' ) ) {33 define( 'WW_WPSC_IMG_URL', WW_WPSC_URL . 'includes/images' ); // plugin images url 30 if ( ! defined( 'WW_WPSC_IMG_URL' ) ) { 31 define( 'WW_WPSC_IMG_URL', WW_WPSC_URL . 'includes/images' ); // plugin images url. 34 32 } 35 if ( !defined( 'WW_WPSC_TEXT_DOMAIN' ) ) {36 define( 'WW_WPSC_TEXT_DOMAIN', 'wwvcsc' ); // text domain for doing language translation 33 if ( ! defined( 'WW_WPSC_TEXT_DOMAIN' ) ) { 34 define( 'WW_WPSC_TEXT_DOMAIN', 'wwvcsc' ); // text domain for doing language translation. 37 35 } 38 36 39 37 /** 40 38 * Load Text Domain 41 * 39 * 42 40 * This gets the plugin ready for translation. 43 * 41 * 44 42 * @package WP Shortcodes 45 43 * @since 1.0.0 … … 49 47 /** 50 48 * Activation hook 51 * 49 * 52 50 * Register plugin activation hook. 53 * 51 * 54 52 * @package WP Shortcodes 55 53 * @since 1.0.0 … … 62 60 * 63 61 * Register plugin deactivation hook. 64 * 62 * 65 63 * @package WP Shortcodes 66 64 * @since 1.0.0 … … 70 68 71 69 /** 72 * Plugin Setup Activation hook call back 70 * Plugin Setup Activation hook call back 73 71 * 74 * Initial setup of the plugin setting default options 72 * Initial setup of the plugin setting default options 75 73 * and database tables creations. 76 * 74 * 77 75 * @package WP Shortcodes 78 76 * @since 1.0.0 79 77 */ 80 78 function ww_vcsc_install() { 81 79 82 80 global $wpdb; 83 81 } … … 93 91 */ 94 92 function ww_vcsc_uninstall() { 95 93 96 94 global $wpdb; 97 95 } … … 99 97 /** 100 98 * Initialize all global variables 101 * 99 * 102 100 * @package WP Shortcodes 103 101 * @since 1.0.0 104 102 */ 105 103 106 global $ww_vcsc_scripts, $ww_vcsc_admin,$ww_vcsc_shortcodes;104 global $ww_vcsc_scripts, $ww_vcsc_admin, $ww_vcsc_shortcodes; 107 105 108 106 /** … … 114 112 * @since 1.0.0 115 113 */ 116 require_once ( WW_WPSC_DIR . '/includes/class-ww-vcsc-scripts.php');114 require_once WW_WPSC_DIR . '/includes/class-ww-vcsc-scripts.php'; 117 115 $ww_vcsc_scripts = new Ww_Wpsc_Scripts(); 118 116 $ww_vcsc_scripts->add_hooks(); 119 117 120 // includes admin class file121 require_once ( WW_WPSC_ADMIN . '/class-ww-vcsc-admin.php');118 // includes admin class file. 119 require_once WW_WPSC_ADMIN . '/class-ww-vcsc-admin.php'; 122 120 $ww_vcsc_admin = new Ww_Wpsc_Admin(); 123 121 $ww_vcsc_admin->add_hooks(); 124 122 125 // includes shortcode class file126 require_once ( WW_WPSC_DIR . '/includes/class-ww-vcsc-shortcodes.php');123 // includes shortcode class file. 124 require_once WW_WPSC_DIR . '/includes/class-ww-vcsc-shortcodes.php'; 127 125 $ww_vcsc_shortcodes = new Ww_Wpsc_Shortcodes(); 128 126 $ww_vcsc_shortcodes->add_hooks(); 129 130 ?>
Note: See TracChangeset
for help on using the changeset viewer.