Debugging WordPress with PhpStorm and a local deploy setup - wordpress

I like to keep my project files clean.
E.g. I keep all the files I manipulate in my project folder, and deploy them on to my local developer server on save.
e.g. if I write a theme for WordPress I create:
wp-content
wp-content/themes/
wp-content/themes/mytheme
I certainly don't keep all the files of the whole WordPress installation in my project.
I include those over the include path, then it shows as external libraries
those include all files of WordPress including mine.
Now here comes trouble
When I now press F3 on one of my functions I get "Choose declaration"
well I don't want code on my local deployment never! I always want to code in my project source files, that is, not in "external libraries"
so basically
when I add the include path, I want to have the ability to say
"excluded sub-directory of that include path"
so I can exclude my deployed files from the library. Do you understand what I mean?
is that possible?
"well just remove the include path"
no! without include path I cannot debug. Without include path I don't get auto-complete

I figured it out
the trick was in the end to not use "include path" but the project structure editor and add a different content root folder.
FIle - project structure
or
CTRL + ALT + SHIT + S
looks like this:
click on your module, click on add content root folder, click on the target deploy folder of your deployment scripts, and then exclude the stuff you don't like
it will create a new folder in the project explorer but i don't care about that really.
Remove it from the include that i mentioned in my post earlier, i mean from settings - php - external libraries. YOu don't need that any longer
hope it helps

Related

Netbeans step through out of project tree files for debugging (PHP)

I am writing a Wordpress plugin that depends on another plugin with netbeans.
The project is just containing the files of my plugin and I want to keep it that way to have a clean git repository.
The problem:
I rely on another plugin and want to understand how that plugin works. For this, I want to "step through" the other plugin.
I want to do this on my localhost configuration.
I have basically two destinations:
The project is in my home directory in my github folder
The server files are under c:\wamp64\www\wordpress ...., where the localhost is running
The project is essentially set up correctly to copy files from my github directory to the localhost path (Properties -> Sources)
Then:
I set an include path to the localhost -> wordpress folder in the project properties, and when I now search for a definition in my code that refers to the other plugin, the corresponding file is opened (did not work before setting the include path)
Debugging essentially works, but when I step into a function of the other plugin, the bar becomes grey and the corresponding file is not opened.
Can I change some setting for netbeans to open up the other file (not in the project tree) and step through it?
I have found a reasonable workaround.
I just created a new PHP project in Netbeans with existing sources.
As source, I used the entire wordpress installation in the wamp server path, i.e. c:\wamp64\www\wordpress
I can now 'debug' and step through this new project, but I also need to add the corresponding breakpoints in the files from the server path.
It requires some discipline as I have to open the files from my plugin twice, once in the server path and once in the project path, but only edit the files in the project path.
It works 'ok', but I would still be interested to hear if someone has a more proper solution to this.

Where to put the live-search-docs config file in all in one alfresco project?

I have been going through some blog posts that tell how to customize the live search . What is not clear to me is where should I place the live-search-docs.get.config.xml file in my all-in-one-share project so that it is bootstrapped and deployed in the correct location.
Please can some one advise where the file should be placed in my all-in-one alfresco project?
From the link below
https://www.bluefishgroup.com/insights/ecm/adding-metadata-fields-to-simple-search-and-live-search-with-alfresco-5/
they suggest the search query customization file to be placed under
These files can now be modified to add additional metadata fields as
needed. Once the files have been updated, they should be deployed to
the ‘extensions’ directory so that they will override the out of the
box configuration. If you are deploying your code as a custom AMP
file, the files should target the following directory:
tomcat/webapps/alfresco/WEB-INF/classes/alfresco/extension/templates/webscripts/org/alfresco/slingshot/search
if my file needs to end up in the above path in my WAR, where exactly should I place the search file in my all-in-one alfresco project so that its deployed to the above folder? I would like this to be bootstrapped with my all in one project. I tried putting the file under src/main/resources/alfresco/site-webscripts with the remaining path for the file but that did not work.
Thanks
The easiest way is to create a copy of that file in:
my-all-in-one-project-platform-jar/src/main/resources/alfresco/extension/templates/webscripts/org/alfresco/slingshot/search/
where, of course, my-all-in-one-project-platform-jar must be substituted with the name that you have specified when the project was created with the all-in-one archetype.
The file in the extension subpath will override the corresponding OOTB files.
See Web scripts

How would I go about creating a simple file builder?

Forgive me if this doesn't make sense but I'll do my best to explain.
I am looking into creating a piece of software/web app which will generate a package file for website themes including only the options the user would need for their project.
The best example I can think of is the underscores WordPress theme generator. But I would also like to be able to include other files. Like for example a check box that simply says "include x.js library" where if the box is checked it will include that js file or files in the folder. As well as generate the theme name, author name, theme description version number etc.
In other words I need something like underscores, that also has the option to include extra files for the development team to quickly get bespoke WordPress themes up and running whilst also including all the optional assets that we use at the firm.
You can hold the basic logic, opening, reading, editing, closing of files in a php script that's triggered when the user submits a form.
One route to manipulate files on the server with php is to use fopen.
First enable fopen in the directory in which your files you want available for download are stored. Do this by including the following in a .htaccess file in this directory:
php_value allow_url_fopen On
In whatever script you would like triggered on form submit, you can change say the author name with something like the following (you'll obviously want to target where you're writing to, I imagine with FSeek):
$downloadable_theme_index = 'index.php';
$handle = fopen($downloadable_theme_index, 'w') or die('Cannot open file: '.$downloadable_theme_index);
$new_author_name = 'Abe Lincoln';
fwrite($handle, $new_author_name);
The logic for what files are available to download could basically be form logic that provides links to download based on user input.
Additionally, there are download manager plugins available in wordpress.

Bluimp Backload folder reference issue with virtual directories

I am working on a solution which has two projects in it. One is a virtual app which works in another. The first application is the panel and the second is the website. First application can be accessed with "localhost:10001/panel" and the second with "localhost:10001". You see, I created a virtual path for the first app to work under the second one in Visual Studio and they work great that way.
The problem I am having now is about the file uplaod system, "Blueimp's jQuery-File-Upload" plugin and as backend using "Backload". I must say that these work great on a standalone project. That's why I decided to continue the project using these.
But when it comes to a setup which I explained below, I cannot access the files I upload. I installed fileupload system in the panel project, which is accessed as "localhost:10001/panel" so when I leave the default web.config configuration for backload (default is "~/files"), all files are uploaded to the "localhost:10001/panel/files" path. And after the upload when I refresh the page, all uploaded file links are referencing "localhost:10001/files/" without the "panel" folder.
In BackLoad web.config notes how to change and use root upload folders are explained like that
filesRoot: // Root upload folder. If the value starts with '~/' (e.g. ~/files) the path is relative to the web root, otherwise set an absolute local path (e.g. d:/files) [Default: "~/Files"].
I understand that having "~/" at the beggining of a folder reference shows the project's root. But I can't figure out how to reference the upload folder, instead of the default "~/files", to upload and access all files from the second project's root. When I need to reference folder between these two projects I simple use "../", or "/" to access the second project's (site) root. But doing that in "filesRoot" attribute of BackLoad config settings, all file references are starting "///file....." and shows a local path in the computer.
I simply want to upload and access the files from the "localhost:10001/files" location when I upload files from the panel. Now, I cannot even use the "localhost:10001/panel/files" path because files are uploaded to "panel/files" folder, but are accessed from "files" folder with default settings.
BTW: I am using BackLoad's WebForms Example on this project, and this is a Web Forms project.
I ended up using Files folder as a temp folder. At the time of submit, I move the file which is uploaded in Files folder, to the folder of my need. And the problem is solved.
Thanks anyway...

flex air include a directory with the installer

I am creating an AIR application using Flex. In it I need 2 directories downloads & uploads. These directories will have downloaded files & uploaded files.
But the problem is I am not able to create these 2 directories programmatically & also I am not able to include the 2 directories with the installer in the application directory.
Is there any way to create or include directories in the application directory.
Thanks
Create an empty folder inside your Flex project. Right click on your project and go to Properties->Compiler (not exact name but something like that). Make sure it has "Copy nonembedded assets to output directory" (check it if it doesn't). Click Ok.
Export a release build of your AIR app. Do NOT click Finish after the "signing" step. Follow each step until you get to the "assets" screen. It will show you a list of every file and folder in your output (bin-debug, by default) directory.
Check the files you want, uncheck the one's you don't, and click OK. Done. You have your AIR file packaged with whatever file and folder you want.
[...] But I need to create the directories in application directory. I am using: var dir = File.applicationDirectory.resolvePath("upload directory");dir.createDirectory(); And I am getting: at runtime::SecurityManager$/checkPrivilegeForCaller()
This is a know issue. AIR wouldn't allow you to write to the application directory. Instead try writing
either to the File.applicationStorageDirectory (application's scratchpad),
or to the File.documentsDirectory (stuff user might want to lookup)
Related resources:
Adobe AIR team blogpost
Use This Dear :)
var dir:File = File.applicationDirectory.resolvePath("NewFolder");
dir =new File(dir.nativePath.toString());
dir.createDirectory();
Regards
Ali Naqvi
have you tried something like the following
var dir = File.userDirectory.resolvePath("upload directory");
dir.createDirectory();
This will create the directory 'upload directory' if it does not already exist (inside the users home directory).
To add to johncblandii's anwser:
I've found that for the above to work, you also need to include the folder in the project's build path. I also had to refresh the project's file listing before flash builder recognized the folder and added it to the include options.
I just want to add another thing to johncblandii's comment: Create an empty.txt file and write something there. Because it looks like empty folders are nod allowed to be included in your packed application

Resources