Plugin Directory

Changeset 582536


Ignore:
Timestamp:
08/07/2012 05:37:27 AM (14 years ago)
Author:
bartee
Message:

NEW VERSION, fixing some path resolving issues

Location:
shortcode-reference/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • shortcode-reference/trunk

  • shortcode-reference/trunk/conf/include.php

    r318972 r582536  
    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*
     36**/
     37function shortcode_reference_scripts() {
     38    $referrer = realpath(dirname(__FILE__));
     39    wp_enqueue_style( 'shortcode-reference-style', plugins_url('/css/shortcode-reference.css', $referrer) );
     40    wp_enqueue_script( 'shortcode-reference-js', plugins_url('/js/shortcode-reference.js', $referrer) );
     41}
     42
     43/**
    3544 * A little utility-function to retrieve the shortcode's details. Executed in a custom action
    3645 */
     
    4049    $ShortcodeReferenceUIManager->getReference($shortcode);
    4150}
    42 
    43 wp_register_style('shortcode-reference-style', SHORTCODE_REFERENCE_PLUGIN_DIR.'/css/shortcode-reference.css',false);
  • shortcode-reference/trunk/css/shortcode-reference.css

    r318972 r582536  
    1818}
    1919.shortcode_reference_list .shortcode_reference_item.highlight {
    20     background: #E4F2FDs;
     20    background: #E4F2FD;
     21    margin: 0;
    2122}
    22 
    2323.shortcode_reference_list .shortcode_reference_item.selected {
    2424    background: #EEEEEE;
  • shortcode-reference/trunk/lib/ShortcodeReference.php

    r318972 r582536  
    1616     * @var ReflectionFunction
    1717     */
    18     private $_function_reflection;
     18    private $_function_reflection;
     19
     20    /**
     21     * @var string
     22     */
     23    private $_filepath;
    1924   
    2025    /**
     
    6974            $this->_known_tags = array();
    7075            $desc = $this->_function_reflection->getDocComment();
    71             $matches = preg_split('/\n/',$desc);
    7276            $parsed_desc = '';
    73             $start_pattern = '/w*\/\*\*w*/';
    74             foreach ($matches as $match) {
    75                 if (preg_match($start_pattern, $match,$submatch)){
    76                     // skip it
    77                 } else if (preg_match('/w*\*\//',$match,$submatch)){
    78                     $offset = strpos($match,'*/')-1;
    79                     $final_line.= trim(substr($match,0,-$offset)).'
     77            if ($desc){
     78                $matches = preg_split('/\n/',$desc);
     79                $start_pattern = '/w*\/\*\*w*/';
     80                foreach ($matches as $match) {
     81                    if (preg_match($start_pattern, $match,$submatch)){
     82                        // skip it
     83                    } else if (preg_match('/w*\*\//',$match,$submatch)){
     84                        $offset = strpos($match,'*/')-1;
     85                        $final_line.= trim(substr($match,0,-$offset)).'
    8086';
    81                     if ($final_line != ''){
    82                         $parsed_desc .= $final_line;
    83                     }
    84                 } else if (preg_match('/w*\*/',$match,$submatch)){
    85                     if (preg_match('/@/',$match,$submatch)){
    86                         $offset = strpos($match,'@')+1;
    87                         $tag = trim(substr($match,$offset,strlen($match)-$offset));
    88                         $this->addTagFromString($tag);
    89                     } else {
    90                         $offset = strpos($match,'*')+1;
    91                         $parsed_desc .= trim(substr($match,$offset,strlen($match)-$offset)).'
    92     ';
     87                        if ($final_line != ''){
     88                            $parsed_desc .= $final_line;
     89                        }
     90                    } else if (preg_match('/w*\*/',$match,$submatch)){
     91                        if (preg_match('/@/',$match,$submatch)){
     92                            $offset = strpos($match,'@')+1;
     93                            $tag = trim(substr($match,$offset,strlen($match)-$offset));
     94                            $this->addTagFromString($tag);
     95                        } else {
     96                            $offset = strpos($match,'*')+1;
     97                            $parsed_desc .= trim(substr($match,$offset,strlen($match)-$offset)).'
     98        ';
     99                        }
    93100                    }
    94101                }
     
    108115    public function getReference(){
    109116        $absolute_path = $this->_function_reflection->getFileName();
     117        $this->_filepath = $absolute_path;
    110118        if (strpos($absolute_path, ABSPATH)>=0){
    111119            /**
     
    126134   
    127135    /**
     136     * Retrieve the absolute file path
     137     *
     138     * @return string
     139     */
     140    public function getFilePath(){
     141        return $this->_filepath;
     142    }
     143   
     144    /**
    128145     * Get the options for the function
    129146     *
     
    160177     */
    161178    public function getUrl(){
     179       
    162180        if (!$this->_url){
     181           
    163182            $is_plugin = strpos($this->getReference(),'Plugin:');
    164183            if ($this->getReference() == 'WordPress function'){
     
    166185                $this->_url ='http://codex.wordpress.org/index.php?title=Special:Search&search='.$this->_shortcode.'_Shortcode';
    167186            } else if ($is_plugin !== false){
    168                
    169                 $plugin_path = str_replace('Plugin: ','',$this->getReference());
    170                 $plugin_info = get_plugin_data(WP_PLUGIN_DIR.'/'.$plugin_path.'/'.$plugin_path.'.php');
     187                $plugin_info = get_plugin_data($this->_filepath);
    171188               
    172189                if (is_array($plugin_info) && key_exists('PluginURI',$plugin_info)){
  • shortcode-reference/trunk/readme.txt

    r329675 r582536  
    44Tags: shortcode, reference, post, page, links
    55Requires at least: 3.0
    6 Tested up to: 3.0.1
     6Tested up to: 3.4.1
    77Stable tag: trunk
    88
    9 This plugin will provide a list and details about available shortcodes in your current installment. And all when you need it most.
    10 
    11 When you are actually editing your content.
     9This plugin will provide a list and details about available shortcodes in your current installment. All when you need it most.
     10When editing your content.
    1211
    1312== Description ==
     
    4443
    4544== Changelog ==
     45= 0.2 =
     46* Changed resolving of the plugin's css/js files
     47* Made file lookup case sensitive
    4648
    4749= 0.1 =
  • shortcode-reference/trunk/shortcode_reference.php

    r330871 r582536  
    33  * Plugin Name: Shortcode Reference
    44  * Plugin URI: http://www.linkedin.com/in/bartstroeken
    5   * Version: 0.1
     5  * Version: 0.2
    66  * Author: Bart Stroeken
    77  * Author URI: http://www.linkedin.com/in/bartstroeken
     
    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.