Plugin Directory

Changeset 577868


Ignore:
Timestamp:
07/26/2012 10:47:27 PM (14 years ago)
Author:
bartee
Message:

Made some changes to generalize the include-mechanism

Location:
shortcode-reference/branches/20120726_include_fix
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • shortcode-reference/branches/20120726_include_fix/conf/include.php

    r318972 r577868  
    11<?php
    22 /**
    3   * This file contains some utilities to get the extension working.  
     3  * This file contains some utilities to get the extension working.
    44  **/
    5 define (SHORTCODE_REFERENCE_PLUGIN_DIR, '/'.str_replace(array(ABSPATH,conf),array('',''),dirname(__FILE__)));
    65
    76/**
     
    3332
    3433/**
     34* Function to include static files for using this plugins.
     35* Thanks to Stephanie Leary for the suggestion!
     36*
     37*
     38**/
     39function shortcode_reference_scripts() {
     40    $referrer = realpath(dirname(__FILE__));
     41    wp_enqueue_style( 'shortcode-reference-style', plugins_url('/css/shortcode-reference.css', $referrer) );
     42    wp_enqueue_script( 'shortcode-reference-js', plugins_url('/js/shortcode-reference.js', $referrer) );
     43}
     44
     45/**
    3546 * A little utility-function to retrieve the shortcode's details. Executed in a custom action
    3647 */
     
    4051    $ShortcodeReferenceUIManager->getReference($shortcode);
    4152}
    42 
    43 wp_register_style('shortcode-reference-style', SHORTCODE_REFERENCE_PLUGIN_DIR.'/css/shortcode-reference.css',false);
  • shortcode-reference/branches/20120726_include_fix/shortcode_reference.php

    r330871 r577868  
    1010if (version_compare(phpversion(),'5.0.0','gt')) {
    1111    require_once 'conf/include.php';
    12    
    13     wp_enqueue_style('shortcode-reference-style');
    14     wp_enqueue_script('shortcode-reference-js', SHORTCODE_REFERENCE_PLUGIN_DIR.'/js/shortcode-reference.js', null,null,true);
    15    
     12
    1613    $dir = dirname(__FILE__).'/lib';
    1714    shortcode_overview_util_require_files($dir);
     
    1916     * Add an extra meta-box
    2017     */
     18    add_action('admin_head-post.php', 'shortcode_reference_scripts');
     19    add_action('admin_head-post-new.php', 'shortcode_reference_scripts');
     20   
    2121    add_action('add_meta_boxes','shortcode_reference_render_meta_box');
    2222    add_action('wp_ajax_shortcode_reference_find_shortcode', 'shortcode_reference_get_reference');
Note: See TracChangeset for help on using the changeset viewer.