Changeset 582536
- Timestamp:
- 08/07/2012 05:37:27 AM (14 years ago)
- Location:
- shortcode-reference/trunk
- Files:
-
- 6 edited
-
. (modified) (1 prop)
-
conf/include.php (modified) (3 diffs)
-
css/shortcode-reference.css (modified) (1 diff)
-
lib/ShortcodeReference.php (modified) (6 diffs)
-
readme.txt (modified) (2 diffs)
-
shortcode_reference.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
shortcode-reference/trunk
-
Property
svn:mergeinfo
set to
/shortcode-reference/branches/20120726_include_fix merged eligible
-
Property
svn:mergeinfo
set to
-
shortcode-reference/trunk/conf/include.php
r318972 r582536 1 1 <?php 2 2 /** 3 * This file contains some utilities to get the extension working. 3 * This file contains some utilities to get the extension working. 4 4 **/ 5 define (SHORTCODE_REFERENCE_PLUGIN_DIR, '/'.str_replace(array(ABSPATH,conf),array('',''),dirname(__FILE__)));6 5 7 6 /** … … 33 32 34 33 /** 34 * Function to include static files for using this plugins. 35 * 36 **/ 37 function 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 /** 35 44 * A little utility-function to retrieve the shortcode's details. Executed in a custom action 36 45 */ … … 40 49 $ShortcodeReferenceUIManager->getReference($shortcode); 41 50 } 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 18 18 } 19 19 .shortcode_reference_list .shortcode_reference_item.highlight { 20 background: #E4F2FDs; 20 background: #E4F2FD; 21 margin: 0; 21 22 } 22 23 23 .shortcode_reference_list .shortcode_reference_item.selected { 24 24 background: #EEEEEE; -
shortcode-reference/trunk/lib/ShortcodeReference.php
r318972 r582536 16 16 * @var ReflectionFunction 17 17 */ 18 private $_function_reflection; 18 private $_function_reflection; 19 20 /** 21 * @var string 22 */ 23 private $_filepath; 19 24 20 25 /** … … 69 74 $this->_known_tags = array(); 70 75 $desc = $this->_function_reflection->getDocComment(); 71 $matches = preg_split('/\n/',$desc);72 76 $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)).' 80 86 '; 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 } 93 100 } 94 101 } … … 108 115 public function getReference(){ 109 116 $absolute_path = $this->_function_reflection->getFileName(); 117 $this->_filepath = $absolute_path; 110 118 if (strpos($absolute_path, ABSPATH)>=0){ 111 119 /** … … 126 134 127 135 /** 136 * Retrieve the absolute file path 137 * 138 * @return string 139 */ 140 public function getFilePath(){ 141 return $this->_filepath; 142 } 143 144 /** 128 145 * Get the options for the function 129 146 * … … 160 177 */ 161 178 public function getUrl(){ 179 162 180 if (!$this->_url){ 181 163 182 $is_plugin = strpos($this->getReference(),'Plugin:'); 164 183 if ($this->getReference() == 'WordPress function'){ … … 166 185 $this->_url ='http://codex.wordpress.org/index.php?title=Special:Search&search='.$this->_shortcode.'_Shortcode'; 167 186 } 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); 171 188 172 189 if (is_array($plugin_info) && key_exists('PluginURI',$plugin_info)){ -
shortcode-reference/trunk/readme.txt
r329675 r582536 4 4 Tags: shortcode, reference, post, page, links 5 5 Requires at least: 3.0 6 Tested up to: 3. 0.16 Tested up to: 3.4.1 7 7 Stable tag: trunk 8 8 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. 9 This plugin will provide a list and details about available shortcodes in your current installment. All when you need it most. 10 When editing your content. 12 11 13 12 == Description == … … 44 43 45 44 == Changelog == 45 = 0.2 = 46 * Changed resolving of the plugin's css/js files 47 * Made file lookup case sensitive 46 48 47 49 = 0.1 = -
shortcode-reference/trunk/shortcode_reference.php
r330871 r582536 3 3 * Plugin Name: Shortcode Reference 4 4 * Plugin URI: http://www.linkedin.com/in/bartstroeken 5 * Version: 0. 15 * Version: 0.2 6 6 * Author: Bart Stroeken 7 7 * Author URI: http://www.linkedin.com/in/bartstroeken … … 10 10 if (version_compare(phpversion(),'5.0.0','gt')) { 11 11 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 16 13 $dir = dirname(__FILE__).'/lib'; 17 14 shortcode_overview_util_require_files($dir); … … 19 16 * Add an extra meta-box 20 17 */ 18 add_action('admin_head-post.php', 'shortcode_reference_scripts'); 19 add_action('admin_head-post-new.php', 'shortcode_reference_scripts'); 20 21 21 add_action('add_meta_boxes','shortcode_reference_render_meta_box'); 22 22 add_action('wp_ajax_shortcode_reference_find_shortcode', 'shortcode_reference_get_reference');
Note: See TracChangeset
for help on using the changeset viewer.