/** * Add Plugins * * Adds the new buttons to the plugin array. * * @package Shortcodes Pro * @subpackage Main Class * @since 1.0 * */ function add_plugins($plugin_array) { if (isset($this->buttons_by_row) && !empty($this->buttons_by_row)) { foreach ($this->buttons_by_row as $row) { foreach ($row as $buttons) { if (is_array($buttons)) { $button_name = $buttons[0]; } else { $button_name = $buttons; } $safe_slug = mv_shortcodes_pro_safe_slug($button_name); $plugin_array[$safe_slug] = plugins_url(MV_SHORTCODES_PRO_FOLDER . '/inc/shortcodespro-edit-js.php'); } } } return $plugin_array; }
// create shortcode variables $shortcode_title = $shortcode->post_title; $shortcode_desc = get_post_meta($shortcode->ID, 'desc', true); $shortcode_type = get_post_meta($shortcode->ID, 'type', true); $shortcode_attributes = get_post_meta($shortcode->ID, 'attributes', true); $total_attributes = get_post_meta($shortcode->ID, 'totalattr', true); $shortcode_width_meta = (int) get_post_meta($shortcode->ID, 'width', true); $shortcode_height_meta = (int) get_post_meta($shortcode->ID, 'height', true); $shortcode_prevent = get_post_meta($shortcode->ID, 'prevent', true); // create button title $button_title = $shortcode_desc ? $shortcode_title . ': ' . $shortcode_desc : $shortcode_title; // Verify shortcode with/height dimensions $shortcode_width = $shortcode_width_meta > 490 ? $shortcode_width_meta : 490; $shortcode_height = $shortcode_height_meta > 300 ? $shortcode_height_meta : 300; // remove slashes from the slug $safe_slug = mv_shortcodes_pro_safe_slug($shortcode->post_name); // verify the overlay is needed if ($shortcode_type == 'insert-custom-code') { if ($total_attributes == NULL or (int) $total_attributes == 0 or $shortcode_attributes != "on") { $shortcode_type = 'default'; } } // start this button output $out .= "tinymce.create('tinymce.plugins." . $safe_slug . "', { init : function(ed, url) {\n\t\t\t\t\ted.addButton('" . $safe_slug . "', {\n\t\t\t\t\ttitle : '" . esc_js($button_title) . "',\n"; // check button image if (function_exists('has_post_thumbnail')) { if (has_post_thumbnail($shortcode->ID)) { $image_url = wp_get_attachment_image_src(get_post_thumbnail_id($shortcode->ID)); $out .= "image : '" . esc_url($image_url[0]) . "', "; } }