Skip to content

Commit ca0d9b3

Browse files
committed
Merge branch 'nb82dev'
2 parents d4cbd2a + 54bc9ec commit ca0d9b3

19 files changed

Lines changed: 731 additions & 391 deletions

README.md

Lines changed: 53 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ This is NetBeans plugin for WordPress.
44

55
## How to enable
66

7-
`enabled` option is unchecked as default. Please check it on `project properties > Frameworks > WordPress`
7+
`enabled` option is unchecked by default. Please check it on `project properties > Frameworks > WordPress`
88

9-
## Environment
10-
- NetBeans 8.0+
9+
## Requirements
10+
11+
- NetBeans 8.2+
1112
- WordPress 3.5+
1213

1314
## Features
15+
1416
- badge icon
1517
- important files
1618
- create new WordPress project
@@ -34,38 +36,47 @@ This is NetBeans plugin for WordPress.
3436
- .htaccess (only the root directory)
3537

3638
### Create New WordPress Project
37-
You can create a new WordPress project with Wizard.
38-
39-
1. set Tools > Options > PHP > WordPress > download url(e.g. http://wordpress.org/latest.zip) or local file path(e.g. /path/to/wordpress.zip)
40-
2. check New Project > PHP > PHP Application > ... > Framework > WordPress PHP Web Blog/CMS
41-
3. select options (url / local file / wp-cli)
42-
4. finish
4339

44-
### Custome Content Name
40+
You can create a new WordPress project via a wizard.
4541

46-
If you want to use custom content name(default is `wp-content`), please set your content name to the project properties.
47-
(project properties > Framework > WordPress)
42+
1. Set Tools > Options > PHP > WordPress > download url(e.g. http://wordpress.org/latest.zip) or local file path(e.g. /path/to/wordpress.zip)
43+
2. Click File > New Project
44+
3. Check PHP > PHP Application > ... > Framework > WordPress PHP Web Blog/CMS
45+
4. Select options (url / local file / wp-cli)
46+
5. Set wp-config options
47+
6. Click the Finish button
4848

4949
#### options
50-
- Set format to project : set format option to project.properties
51-
- create wp-config.php : copy from wp-config-sample.php
50+
51+
- Set format options for WordPress to this project : add format options for WordPress to project.properties
52+
- Create a wp-config.php : copy from wp-config-sample.php
53+
54+
### Custom Content Name
55+
56+
If you want to use a custom content name (default value is `wp-content`), please set your content name to the project properties.
57+
(project properties > Framework > WordPress)
58+
If your wp-content directory is not in your WordPress Root, please set a relative path (from a source directory to wp-content directory) to `wp-content`.
5259

5360
### Code Templates
61+
5462
- wpph : wordpress plugin header
5563
- wpgpl : wordpress license comment
5664

5765
e.g. please type wpph [Tab]
5866

5967
### Zip Compress Action
68+
6069
You can compress specified pluign or theme directory as Zip file to the same hierarchy.
6170
Right-click active plugin or theme node > Zip compress
6271

6372
### Template Files
73+
6474
You can create a pluign file and readme file with new file wizard.
6575

66-
Right-click directory > New > Others > WordPress > (WordPress Plugin | WordPress Plugin Readme)
76+
Right-click a directory > New > Others > WordPress > (WordPress Plugin | WordPress Plugin Readme)
6777

6878
### Code Completion for Filter and Action
79+
6980
This feature is available the followings:
7081
- add_filter, remove_filter
7182
- add_acttion, remove_action
@@ -79,43 +90,50 @@ add_filter('the_content', 'w[Ctrl + Space]'); // e.g. start with 'w'
7990
```
8091

8192
### Display And Change Debug Status
93+
8294
WP_DEBUG value(wp-config.php) is displayed on bottom-right of IDE.
8395
If you click there, you can change WP_DEBUG value.
8496
WordPress version number is also displayed.
8597

8698
### Create New Theme Action
87-
Right-click Project > WordPress > Create Theme
99+
100+
Right-click a WordPress project node > WordPress > Create Theme
88101

89102
#### Minimum Theme
90103

91-
Just create a style.css and an empty index.php.
104+
Just create a style.css and an empty index.php to the directory which you named.
92105

93106
#### Underscores
94-
Create theme from [Underscores | A Starter Theme for WordPress](http://underscores.me/). Underscores is awesome!
107+
108+
Create a theme from [Underscores | A Starter Theme for WordPress](http://underscores.me/). Underscores is awesome!
95109
This plugin uses [Automattic/_s · GitHub](https://github.com/automattic/_s).
96110

97111
**Please note that license of created theme is GPLv2**
98112

99113
#### Barebones
100-
Create theme form [welcomebrand/Barebones · GitHub](https://github.com/welcomebrand/Barebones).
114+
115+
Create a theme form [welcomebrand/Barebones · GitHub](https://github.com/welcomebrand/Barebones).
101116

102117
### Create New Child Theme Action
103-
Right-click Project > WordPress > Create Child Theme
118+
119+
Right-click a WordPress project node > WordPress > Create Child Theme
104120

105121
- Create a new directory for child theme
106122
- Add style.css for child theme
107123

108124
### Create New Plugin Action
125+
109126
Right-click Project > WordPress > Create Plugin
110127

111-
This is very simple feature.
112-
- input plugin name(plugin_name)
113-
- create new plugin directory(plugins/plugin_name)
114-
- add main plugin file (plugins/plugin_name/plugin_name.php)
115-
- add readme file (plugins/plugin_name/readme.txt)
128+
This is very simple feature. If you input a plugin name (plugin_name)...
129+
130+
- Create a new plugin directory (plugins/plugin_name)
131+
- Add a main plugin file there (plugins/plugin_name/plugin_name.php)
132+
- Add a readme file there (plugins/plugin_name/readme.txt)
116133

117134
### Hyperlink Navigation
118-
This feature is available the followings:
135+
136+
This feature is available on the parameters of following functions:
119137
- add_filter, remove_filter
120138
- add_action, remove_action
121139

@@ -124,31 +142,31 @@ Then caret position go to function. (first parameter is available when there are
124142

125143
### Run Command
126144

127-
We can run wp-cli commands. *Please notice that this action needs so much time to get command list at first time.*
145+
You can run wp-cli commands. *Please note that this action needs so much time to get command list at first time.*
128146

129147
1. Set wp-cli script path to Options. Tools > Options > PHP > WordPress
130-
2. Select WordPress Project node
131-
3. Right-click > WordPress > RunCommand...
148+
2. Right-click a WordPress project node > WordPress > RunCommand...
132149

133150
#### wp-cli
134151

135-
Please see the followings:
152+
Please see the following links:
136153

137154
- https://github.com/wp-cli/wp-cli
138155
- http://wp-cli.org/
139156

140157
### Upgrade Notification
141158

142-
Check whether new versions (for core, plugin and theme) are available when WordPress project is opened.
143-
Furthermore, we can upgrade(run core update, core update-db, e.t.c.) WordPress with notification window if we are setting wp-cli.
159+
Check whether new versions (for core, plugin and theme) are available when a WordPress project is opened.
160+
Furthermore, you can upgrade(run core update, core update-db, e.t.c.) WordPress from a notification window if we are setting wp-cli.
144161

145162
If you don't want to check that, please uncheck `Check new version when project is opened` at Options.
146163

147164
### Create a .htaccess file for permalink
148165

149-
Right-click project node > WordPress > Create .htaccesss for permalink
166+
Right-click a WordPress project node > WordPress > Create .htaccesss for permalink
150167

151168
#### Note
169+
152170
.htaccess file for permalink can be also created with template.
153171

154172
## Version Number
@@ -166,9 +184,10 @@ Available on [Plugin Portal](http://plugins.netbeans.org/plugin/46542/php-wordpr
166184

167185
If development version exists, it will be available in the same archive as stable version.
168186

169-
### Archive
187+
### Downloads
170188

171189
[github releases](https://github.com/junichi11/netbeans-wordpress-plugin/releases)
172190

173191
## License
192+
174193
[Common Development and Distribution License (CDDL) v1.0 and GNU General Public License (GPL) v2](http://netbeans.org/cddl-gplv2.html)

manifest.mf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ Manifest-Version: 1.0
22
OpenIDE-Module: org.netbeans.modules.php.wordpress
33
OpenIDE-Module-Layer: org/netbeans/modules/php/wordpress/resources/layer.xml
44
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/wordpress/Bundle.properties
5-
OpenIDE-Module-Specification-Version: 0.9.2
5+
OpenIDE-Module-Specification-Version: 0.9.3
66
OpenIDE-Module-Install: org/netbeans/modules/php/wordpress/WordPressModuleInstall.class

src/org/netbeans/modules/php/wordpress/WordPressPhpModuleExtender.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ public boolean isValid() {
161161
if (localFile.isEmpty()) {
162162
// disable all field
163163
panel.setAllEnabled(panel, false);
164-
panel.setAllEnabled(panel.getWpConfigPanel(), false);
165164
errorMessage = Bundle.WordPressPhpModuleExtender_no_installation();
166165
return false;
167166
}
@@ -193,7 +192,6 @@ public String getWarningMessage() {
193192
@Override
194193
public Set<FileObject> extend(PhpModule pm) throws ExtendingException {
195194
panel.setAllEnabled(panel, false);
196-
panel.setAllEnabled(panel.getWpConfigPanel(), false);
197195

198196
FileObject sourceDirectory = pm.getSourceDirectory();
199197
if (panel.useUrl()) {

src/org/netbeans/modules/php/wordpress/WordPressPhpProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public void run() {
205205
return;
206206
}
207207
ValidationResult result = new WordPressModuleValidator()
208-
.validateWordPressDirectories(wordPressRoot, WordPressPreferences.getCustomContentName(phpModule))
208+
.validateWordPressDirectories(wordPressRoot, WordPressPreferences.getCustomContentName(phpModule), null)
209209
.getResult();
210210
if (result.hasWarnings()) {
211211
return;

src/org/netbeans/modules/php/wordpress/customizer/Bundle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ WordPressCustomizerExtenderPanel.wordPressRootLabel.text=WordPress Root:
1212
WordPressCustomizerExtenderPanel.wordPressRootTextField.text=
1313
WordPressCustomizerExtenderPanel.themesTextField.text=
1414
WordPressCustomizerExtenderPanel.customDirectoryPathLabel.toolTipText=empty is default directory structure
15+
WordPressCustomizerExtenderPanel.wpContentLabel.text=wp-content:
16+
WordPressCustomizerExtenderPanel.wpContentTextField.text=
17+
WordPressCustomizerExtenderPanel.jLabel1.text=(If wp-content is not in the WordPress Root)

src/org/netbeans/modules/php/wordpress/customizer/WordPressCustomizerExtender.java

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,11 @@ public class WordPressCustomizerExtender extends PhpModuleCustomizerExtender {
6969
private boolean isValid;
7070
private String originalCustomeContentName;
7171
private String errorMessage;
72+
// paths
7273
private String originalWordPressRoot;
7374
private String originalPlugins;
7475
private String originalThemes;
76+
private String originalWpContent;
7577

7678
public WordPressCustomizerExtender(PhpModule phpModule) {
7779
this.phpModule = phpModule;
@@ -125,20 +127,25 @@ private void validate() {
125127
String contentName = getPanel().getCustomContentName();
126128
FileObject sourceDirectory = phpModule.getSourceDirectory();
127129
FileObject wordPressRoot = null;
130+
FileObject wpContentDirectory = null;
128131
if (sourceDirectory != null) {
129132
wordPressRoot = sourceDirectory.getFileObject(wordPressRootDirectoryPath);
133+
if (!getPanel().getWpContentDirectory().isEmpty()) {
134+
wpContentDirectory = sourceDirectory.getFileObject(getPanel().getWpContentDirectory());
135+
}
130136
}
131137

132138
ValidationResult result = new WordPressCustomizerValidator()
133-
.validateWpContent(phpModule, wordPressRoot, contentName)
139+
.validateWpContent(phpModule, wordPressRoot, contentName, wpContentDirectory)
134140
.validateWordPressRootDirectory(phpModule, getPanel().getWordPressRootDirectory())
135141
.validatePluginsDirectory(phpModule, getPanel().getPluginsDirectory())
136142
.validateThemesDirectory(phpModule, getPanel().getThemesDirectory())
143+
.validateWpContentDirectory(phpModule, getPanel().getWpContentDirectory())
137144
.getResult();
138145

139146
if (wordPressRoot != null) {
140147
ValidationResult wpResult = new WordPressModuleValidator()
141-
.validateWordPressDirectories(wordPressRoot, contentName)
148+
.validateWordPressDirectories(wordPressRoot, contentName, wpContentDirectory)
142149
.getResult();
143150
result.merge(wpResult);
144151
}
@@ -175,20 +182,25 @@ public EnumSet<Change> save(PhpModule pm) {
175182
}
176183

177184
String wordPressRoot = getPanel().getWordPressRootDirectory();
178-
if (!originalCustomeContentName.equals(wordPressRoot)) {
185+
if (!originalWordPressRoot.equals(wordPressRoot)) {
179186
WordPressPreferences.setWordPressRootPath(phpModule, wordPressRoot);
180187
}
181188

182189
String plugins = getPanel().getPluginsDirectory();
183-
if (!originalCustomeContentName.equals(plugins)) {
190+
if (!originalPlugins.equals(plugins)) {
184191
WordPressPreferences.setPluginsPath(phpModule, plugins);
185192
}
186193

187194
String themes = getPanel().getThemesDirectory();
188-
if (!originalCustomeContentName.equals(themes)) {
195+
if (!originalThemes.equals(themes)) {
189196
WordPressPreferences.setThemesPath(phpModule, themes);
190197
}
191198

199+
String wpContent = getPanel().getWpContentDirectory();
200+
if (!originalWpContent.equals(wpContent)) {
201+
WordPressPreferences.setWpContentPath(phpModule, wpContent);
202+
}
203+
192204
WordPressModule wpModule = WordPressModule.Factory.forPhpModule(phpModule);
193205
wpModule.notifyPropertyChanged(new PropertyChangeEvent(this, WordPressModule.PROPERTY_CHANGE_WP, null, null));
194206
return EnumSet.of(Change.FRAMEWORK_CHANGE);
@@ -202,12 +214,14 @@ private WordPressCustomizerExtenderPanel getPanel() {
202214
originalWordPressRoot = WordPressPreferences.getWordPressRootPath(phpModule);
203215
originalPlugins = WordPressPreferences.getPluginsPath(phpModule);
204216
originalThemes = WordPressPreferences.getThemesPath(phpModule);
217+
originalWpContent = WordPressPreferences.getWpContentPath(phpModule);
205218
panel.setPluginEnabled(originalEnabled);
206219
panel.setCustomContentName(originalCustomeContentName);
207220
panel.setComponentsEnabled(originalEnabled);
208221
panel.setWordPressRootDirectory(originalWordPressRoot);
209222
panel.setPluginsDirectory(originalPlugins);
210223
panel.setThemesDirectory(originalThemes);
224+
panel.setWpContentDirectory(originalWpContent);
211225
}
212226

213227
return panel;

src/org/netbeans/modules/php/wordpress/customizer/WordPressCustomizerExtenderPanel.form

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,18 @@
4242
<Component id="wordPressRootLabel" alignment="0" min="-2" max="-2" attributes="0"/>
4343
<Component id="pluginsLabel" alignment="0" min="-2" max="-2" attributes="0"/>
4444
<Component id="themesLabel" alignment="0" min="-2" max="-2" attributes="0"/>
45+
<Component id="wpContentLabel" alignment="0" min="-2" max="-2" attributes="0"/>
4546
</Group>
4647
<EmptySpace max="-2" attributes="0"/>
4748
<Group type="103" groupAlignment="0" attributes="0">
49+
<Group type="102" attributes="0">
50+
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
51+
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
52+
</Group>
4853
<Component id="wordPressRootTextField" max="32767" attributes="0"/>
4954
<Component id="pluginsTextField" max="32767" attributes="0"/>
5055
<Component id="themesTextField" alignment="0" max="32767" attributes="0"/>
56+
<Component id="wpContentTextField" alignment="0" max="32767" attributes="0"/>
5157
</Group>
5258
</Group>
5359
</Group>
@@ -82,6 +88,13 @@
8288
<Component id="themesLabel" alignment="3" min="-2" max="-2" attributes="0"/>
8389
<Component id="themesTextField" alignment="3" min="-2" max="-2" attributes="0"/>
8490
</Group>
91+
<EmptySpace max="-2" attributes="0"/>
92+
<Group type="103" groupAlignment="3" attributes="0">
93+
<Component id="wpContentLabel" alignment="3" min="-2" max="-2" attributes="0"/>
94+
<Component id="wpContentTextField" alignment="3" min="-2" max="-2" attributes="0"/>
95+
</Group>
96+
<EmptySpace max="-2" attributes="0"/>
97+
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
8598
<EmptySpace max="32767" attributes="0"/>
8699
</Group>
87100
</Group>
@@ -164,5 +177,26 @@
164177
</Property>
165178
</Properties>
166179
</Component>
180+
<Component class="javax.swing.JLabel" name="wpContentLabel">
181+
<Properties>
182+
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
183+
<ResourceString bundle="org/netbeans/modules/php/wordpress/customizer/Bundle.properties" key="WordPressCustomizerExtenderPanel.wpContentLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
184+
</Property>
185+
</Properties>
186+
</Component>
187+
<Component class="javax.swing.JTextField" name="wpContentTextField">
188+
<Properties>
189+
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
190+
<ResourceString bundle="org/netbeans/modules/php/wordpress/customizer/Bundle.properties" key="WordPressCustomizerExtenderPanel.wpContentTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
191+
</Property>
192+
</Properties>
193+
</Component>
194+
<Component class="javax.swing.JLabel" name="jLabel1">
195+
<Properties>
196+
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
197+
<ResourceString bundle="org/netbeans/modules/php/wordpress/customizer/Bundle.properties" key="WordPressCustomizerExtenderPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
198+
</Property>
199+
</Properties>
200+
</Component>
167201
</SubComponents>
168202
</Form>

0 commit comments

Comments
 (0)