xml 用于PhpStorm的WordPress实时模板
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xml 用于PhpStorm的WordPress实时模板相关的知识,希望对你有一定的参考价值。
1. Close PhpStorm.
2. Download [`WordPress.xml`](https://gist.github.com/Rarst/183c38c499515b6d8609/raw/WordPress.xml) configuration file from this gist.
3. Place file into `.WebIdeXX/config/templates` in your user profile directory, [differs by operating system](http://www.jetbrains.com/phpstorm/webhelp/project-and-ide-settings.html).
4. Restart PhpStorm.
5. `WordPress` template group should be available in `Settings` > `Live Templates`.
6. Suggest functions to add in comments! :)
<?xml version="1.0" encoding="UTF-8"?>
<templateSet group="WordPress">
<template name="aa" value="add_action( '$hook$', '$callback$' ); $END$" description="add_action" toReformat="false" toShortenFQNames="true">
<variable name="hook" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="callback" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="SQL" value="false" />
<option name="JSP" value="false" />
<option name="CSS_PROPERTY_VALUE" value="false" />
<option name="CSS_DECLARATION_BLOCK" value="false" />
<option name="CSS_RULESET_LIST" value="false" />
<option name="CSS" value="false" />
<option name="CUCUMBER_FEATURE_FILE" value="false" />
<option name="JAVA_SCRIPT" value="false" />
<option name="TypeScript" value="false" />
<option name="HAML" value="false" />
<option name="PHP" value="true" />
<option name="OTHER" value="false" />
</context>
</template>
<template name="aam" value="add_action( '$hook$', array( $class$, '$method$' ) );$END$" description="add_action > method" toReformat="false" toShortenFQNames="true">
<variable name="hook" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="class" expression=""$this"" defaultValue="" alwaysStopAt="true" />
<variable name="method" expression="hook" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="SQL" value="false" />
<option name="JSP" value="false" />
<option name="CSS_PROPERTY_VALUE" value="false" />
<option name="CSS_DECLARATION_BLOCK" value="false" />
<option name="CSS_RULESET_LIST" value="false" />
<option name="CSS" value="false" />
<option name="CUCUMBER_FEATURE_FILE" value="false" />
<option name="JAVA_SCRIPT" value="false" />
<option name="TypeScript" value="false" />
<option name="HAML" value="false" />
<option name="PHP" value="true" />
<option name="OTHER" value="false" />
</context>
</template>
<template name="afm" value="add_filter( '$hook$', array( $class$, '$method$' ) );$END$" description="add_filter > method" toReformat="false" toShortenFQNames="true">
<variable name="hook" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="class" expression=""$this"" defaultValue="" alwaysStopAt="true" />
<variable name="method" expression="hook" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="SQL" value="false" />
<option name="JSP" value="false" />
<option name="CSS_PROPERTY_VALUE" value="false" />
<option name="CSS_DECLARATION_BLOCK" value="false" />
<option name="CSS_RULESET_LIST" value="false" />
<option name="CSS" value="false" />
<option name="CUCUMBER_FEATURE_FILE" value="false" />
<option name="JAVA_SCRIPT" value="false" />
<option name="TypeScript" value="false" />
<option name="HAML" value="false" />
<option name="PHP" value="true" />
<option name="OTHER" value="false" />
</context>
</template>
<template name="ea" value="esc_attr( $SELECTION$ )" description="esc_attr" toReformat="false" toShortenFQNames="true">
<context>
<option name="HTML_TEXT" value="true" />
<option name="HTML" value="true" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="SQL" value="false" />
<option name="JSP" value="false" />
<option name="CSS_PROPERTY_VALUE" value="false" />
<option name="CSS_DECLARATION_BLOCK" value="false" />
<option name="CSS_RULESET_LIST" value="false" />
<option name="CSS" value="false" />
<option name="CUCUMBER_FEATURE_FILE" value="false" />
<option name="JAVA_SCRIPT" value="false" />
<option name="TypeScript" value="false" />
<option name="HAML" value="false" />
<option name="PHP" value="true" />
<option name="OTHER" value="false" />
</context>
</template>
<template name="wpa" value="$$$args$ = wp_parse_args( $$$source$, array( 	$key$ => $value$, ) );" description="wp_parse_args" toReformat="true" toShortenFQNames="true">
<variable name="args" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="source" expression="args" defaultValue="" alwaysStopAt="true" />
<variable name="key" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="value" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="SQL" value="false" />
<option name="JSP" value="false" />
<option name="CSS_PROPERTY_VALUE" value="false" />
<option name="CSS_DECLARATION_BLOCK" value="false" />
<option name="CSS_RULESET_LIST" value="false" />
<option name="CSS" value="false" />
<option name="CUCUMBER_FEATURE_FILE" value="false" />
<option name="JAVA_SCRIPT" value="false" />
<option name="TypeScript" value="false" />
<option name="HAML" value="false" />
<option name="PHP" value="true" />
<option name="OTHER" value="false" />
</context>
</template>
<template name="af" value="add_filter( '$hook$', '$callback$' ); $END$" description="add_filter" toReformat="false" toShortenFQNames="true">
<variable name="hook" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="callback" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="SQL" value="false" />
<option name="JSP" value="false" />
<option name="CSS_PROPERTY_VALUE" value="false" />
<option name="CSS_DECLARATION_BLOCK" value="false" />
<option name="CSS_RULESET_LIST" value="false" />
<option name="CSS" value="false" />
<option name="CUCUMBER_FEATURE_FILE" value="false" />
<option name="JAVA_SCRIPT" value="false" />
<option name="TypeScript" value="false" />
<option name="HAML" value="false" />
<option name="PHP" value="true" />
<option name="OTHER" value="false" />
</context>
</template>
<template name="__" value="__( $SELECTION$, '$textdomain$' )" description="__" toReformat="false" toShortenFQNames="true">
<variable name="textdomain" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="true" />
<option name="HTML" value="true" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="SQL" value="false" />
<option name="JSP" value="false" />
<option name="CSS_PROPERTY_VALUE" value="false" />
<option name="CSS_DECLARATION_BLOCK" value="false" />
<option name="CSS_RULESET_LIST" value="false" />
<option name="CSS" value="false" />
<option name="CUCUMBER_FEATURE_FILE" value="false" />
<option name="JAVA_SCRIPT" value="false" />
<option name="TypeScript" value="false" />
<option name="HAML" value="false" />
<option name="PHP" value="true" />
<option name="OTHER" value="false" />
</context>
</template>
<template name="aafu" value="add_action( '$hook$', function () { 	$END$ } );" description="add_action > closure" toReformat="false" toShortenFQNames="true">
<variable name="hook" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="SQL" value="false" />
<option name="JSP" value="false" />
<option name="CSS_PROPERTY_VALUE" value="false" />
<option name="CSS_DECLARATION_BLOCK" value="false" />
<option name="CSS_RULESET_LIST" value="false" />
<option name="CSS" value="false" />
<option name="CUCUMBER_FEATURE_FILE" value="false" />
<option name="JAVA_SCRIPT" value="false" />
<option name="TypeScript" value="false" />
<option name="HAML" value="false" />
<option name="PHP" value="true" />
<option name="OTHER" value="false" />
</context>
</template>
<template name="rpt" value="register_post_type( '$SLUG$', array( 	'description' => '$DESCRIPTION$', 	'labels' => array( 		'name' => _x( '$PLURAL$', 'post type general name', '$DOMAIN$' ), 		'singular_name' => _x( '$SINGULAR$', 'post type singular name', '$DOMAIN$' ), 		'menu_name' => _x( '$PLURAL$', 'admin menu', '$DOMAIN$' ), 		'name_admin_bar' => _x( '$SINGULAR$', 'add new $SLUG$ on admin bar', '$DOMAIN$' ), 		'add_new' => _x( 'Add New', 'post_type', '$DOMAIN$' ), 		'add_new_item' => __( 'Add New $SINGULAR$', '$DOMAIN$' ), 		'edit_item' => __( 'Edit $SINGULAR$', '$DOMAIN$' ), 		'new_item' => __( 'New $SINGULAR$', '$DOMAIN$' ), 		'view_item' => __( 'View $SINGULAR$', '$DOMAIN$' ), 		'search_items' => __( 'Search $PLURAL$', '$DOMAIN$' ), 		'not_found' => __( 'No $PLURALLOWERCASE$ found.', '$DOMAIN$' ), 		'not_found_in_trash' => __( 'No $PLURALLOWERCASE$ found in Trash.', '$DOMAIN$' ), 		'parent_item_colon' => __( 'Parent $SINGULAR$:', '$DOMAIN$' ), 		'all_items' => __( 'All $PLURAL$', '$DOMAIN$' ), 	), 	'public' => $PUBLIC$, 	'hierarchical' => $HIERARCHICAL$, 	'exclude_from_search' => $NOSEARCH$, 	'publicly_queryable' => $QUERYABLE$, 	'show_ui' => $UI$, 	'show_in_menu' => $MENU$, 	'show_in_nav_menus' => $NAVMENU$, 	'show_in_admin_bar' => $ADMINBAR$, 	'menu_position' => $MENUPOS$, 	'menu_icon' => $ICON$, 	'capability_type' => '$CAPABILITY$', 	'capabilities' => array(), 	'map_meta_cap' => null, 	'supports' => array( 'title', 'editor' ), 	'register_meta_box_cb' => $METABOX$, 	'taxonomies' => array(), 	'has_archive' => $ARCHIVE$, 	'rewrite' => array( 		'slug' => '$SLUG$', 		'with_front' => $WITHFRONT$, 		'feeds' => $FEEDS$, 		'pages' => $PAGES$, 	), 	'query_var' => $QUERYVAR$, 	'can_export' => $EXPORT$, ) ); $END$" description="register_post_type" toReformat="true" toShortenFQNames="true">
<variable name="SLUG" expression="" defaultValue=""post-type"" alwaysStopAt="true" />
<variable name="DESCRIPTION" expression="" defaultValue="""" alwaysStopAt="true" />
<variable name="PLURAL" expression="" defaultValue=""Posts"" alwaysStopAt="true" />
<variable name="SINGULAR" expression="" defaultValue=""Post"" alwaysStopAt="true" />
<variable name="DOMAIN" expression="" defaultValue=""text-domain"" alwaysStopAt="true" />
<variable name="PLURALLOWERCASE" expression="decapitalize(PLURAL)" defaultValue="" alwaysStopAt="false" />
<variable name="PUBLIC" expression="enum("false", "true")" defaultValue=""false"" alwaysStopAt="true" />
<variable name="HIERARCHICAL" expression="enum("false", "true")" defaultValue=""false"" alwaysStopAt="true" />
<variable name="NOSEARCH" expression="enum("true","false")" defaultValue=""true"" alwaysStopAt="true" />
<variable name="QUERYABLE" expression="" defaultValue="PUBLIC" alwaysStopAt="false" />
<variable name="UI" expression="" defaultValue="PUBLIC" alwaysStopAt="false" />
<variable name="MENU" expression="" defaultValue="UI" alwaysStopAt="false" />
<variable name="NAVMENU" expression="" defaultValue="PUBLIC" alwaysStopAt="false" />
<variable name="ADMINBAR" expression="" defaultValue="MENU" alwaysStopAt="false" />
<variable name="MENUPOS" expression="enum("null","5","10","15","20","25","60","65","70","75","80","100")" defaultValue="null" alwaysStopAt="true" />
<variable name="ICON" expression="" defaultValue=""null"" alwaysStopAt="true" />
<variable name="CAPABILITY" expression="" defaultValue=""post"" alwaysStopAt="true" />
<variable name="METABOX" expression="" defaultValue=""null"" alwaysStopAt="true" />
<variable name="ARCHIVE" expression="" defaultValue=""false"" alwaysStopAt="true" />
<variable name="WITHFRONT" expression="enum("true","false")" defaultValue=""true"" alwaysStopAt="true" />
<variable name="FEEDS" expression="" defaultValue="ARCHIVE" alwaysStopAt="false" />
<variable name="PAGES" expression="enum("true","false")" defaultValue=""true"" alwaysStopAt="true" />
<variable name="QUERYVAR" expression="" defaultValue=""true"" alwaysStopAt="true" />
<variable name="EXPORT" expression="enum("true","false")" defaultValue="" alwaysStopAt="true" />
<context>
<option name="PHP" value="true" />
</context>
</template>
<template name="rt" value="register_taxonomy( '$SLUG$', array($OBJECT$), array( 	'description' => '$DESCRIPTION$', 	'labels' => array( 		'name' => _x( '$PLURAL$', 'taxonomy general name', '$DOMAIN$' ), 		'singular_name' => _x( '$SINGULAR$', 'taxonomy singular name', '$DOMAIN$' ), 		'search_items' => __( 'Search $PLURAL$', '$DOMAIN$' ), 		'popular_items' => __( 'Popular $PLURAL$', '$DOMAIN$' ), 		'all_items' => __( 'All $PLURAL$', '$DOMAIN$' ), 		'parent_item' => __( 'Parent $SINGULAR$', '$DOMAIN$' ), 		'parent_item_colon' => __( 'Parent $SINGULAR$:', '$DOMAIN$' ), 		'edit_item' => __( 'Edit $SINGULAR$', '$DOMAIN$' ), 		'view_item' => __( 'View $SINGULAR$', '$DOMAIN$' ), 		'update_item' => __( 'Update $SINGULAR$', '$DOMAIN$' ), 		'add_new_item' => __( 'Add New $SINGULAR$', '$DOMAIN$' ), 		'new_item_name' => __( 'New $SINGULAR$ Name', '$DOMAIN$' ), 		'separate_items_with_commas' => __( 'Separate $PLURALLOWERCASE$ with commas', '$DOMAIN$' ), 		'add_or_remove_items' => __( 'Add or remove $PLURALLOWERCASE$', '$DOMAIN$' ), 		'choose_from_most_used' => __( 'Choose from the most used $PLURALLOWERCASE$', '$DOMAIN$' ), 		'not_found' => __( 'No $PLURALLOWERCASE$ found.', '$DOMAIN$' ), 	), 	'public' => $PUBLIC$, 	'show_ui' => $UI$, 	'show_in_nav_menus' => $MENU$, 	'show_tagcloud' => $TAGCLOUD$, 	'meta_box_cb' => $METABOX$, 	'show_admin_column' => $ADMINCOLUMN$, 	'hierarchical' => $HIERARCHICAL$, 	'query_var' => '$QUERYVAR$', 	'rewrite' => array( 		'slug' => '$REWRITESLUG$', 		'with_front' => $REWRITEFRONT$, 		'hierarchical' => $REWRITEHIERARCHICAL$, 	), 	'capabilities' => array(), ) );" description="register_taxonomy" toReformat="true" toShortenFQNames="true">
<variable name="SLUG" expression="" defaultValue=""taxonomy"" alwaysStopAt="true" />
<variable name="OBJECT" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="DESCRIPTION" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="PLURAL" expression="" defaultValue=""Tags"" alwaysStopAt="true" />
<variable name="SINGULAR" expression="" defaultValue=""Tag"" alwaysStopAt="true" />
<variable name="DOMAIN" expression="" defaultValue=""text-domain"" alwaysStopAt="true" />
<variable name="PLURALLOWERCASE" expression="decapitalize(PLURAL)" defaultValue="" alwaysStopAt="false" />
<variable name="PUBLIC" expression="enum("true","false")" defaultValue=""true"" alwaysStopAt="true" />
<variable name="UI" expression="" defaultValue="PUBLIC" alwaysStopAt="false" />
<variable name="MENU" expression="" defaultValue="PUBLIC" alwaysStopAt="false" />
<variable name="TAGCLOUD" expression="" defaultValue="UI" alwaysStopAt="false" />
<variable name="METABOX" expression="" defaultValue=""null"" alwaysStopAt="true" />
<variable name="ADMINCOLUMN" expression="enum("false","true")" defaultValue="false" alwaysStopAt="true" />
<variable name="HIERARCHICAL" expression="enum("false","true")" defaultValue="false" alwaysStopAt="true" />
<variable name="QUERYVAR" expression="" defaultValue="SLUG" alwaysStopAt="true" />
<variable name="REWRITESLUG" expression="" defaultValue="SLUG" alwaysStopAt="true" />
<variable name="REWRITEFRONT" expression="enum("true","false")" defaultValue="true" alwaysStopAt="true" />
<variable name="REWRITEHIERARCHICAL" expression="enum("true","false")" defaultValue="true" alwaysStopAt="true" />
<context>
<option name="PHP" value="true" />
</context>
</template>
</templateSet>
以上是关于xml 用于PhpStorm的WordPress实时模板的主要内容,如果未能解决你的问题,请参考以下文章
xml Webstorm / PHPStorm的Keystone代码样式方案