Aptana changing all <h1> to some snippet? - aptana

I'm writing a php file, and whenever I start to type
<h1>
I get this "snippet" of sorts,
//
// aptanavfs254116982902025803overrides.inc
// wordpress
//
// Created by Mike on 2011-08-15.
// Copyright 2011 Mike. All rights reserved.
//
What is this? I guess snippet is the wrong term. Template seems to be the wrong term. Googling doesn't seem to reveal people with this similar problem.
(Using Aptana Studio 3)
EDIT: I've found that it's somehow a shortcut for "Insert Comment Header" but there is still nothing that guides me to a preference to change this.

The "Insert Comment Header" command is actually contributed by the source ruble. It looks like the trigger keyword is "head", so if you start typing 'he' it will show this command as a suggestion. If you would like to remove this, you would need to edit the ruble.
Go to Commands > Source > Edit this ruble, to open the ruble. Then under the commands folder, open the insert_source_header.rb. You can then edi the "cmd.trigger" field to something else so it doesn't get triggered when you type "head".
For more information on editing rubles, you can always go to
http://wiki.appcelerator.org/display/tis/Modifying+an+existing+Ruble
(There should be information there to do more advanced things with rubles)

Related

Fix for the "The following theme is missing from the file system" error in Drupal 7

I keep getting this same error from bugsnag for my site, and I'm unsure how to fix it/why it's popping up in the first place.
User Warning ยท The following theme is missing from the file system: <em class="placeholder">Theme_Name</em>. For information about how to fix this, see the documentation page.
The theme that it claims it is missing is the only theme I have for the site and is the one it is currently using. Besides overloading my bugsnag reporting, it's not causing any issues. Is there a way to resolve this? I checked the documentation page and all the articles I found only refer to modules.
It's likely that the there is an old reference of Theme_Name in the systems table of your database.
You can look for the references that your Drupal instance is checking against by running this query:
SELECT name, status, filename FROM system WHERE type = 'theme' AND name = 'Theme_Name';
Find the reference that doesn't look quite right, preferably by the name of "Theme_Name", and delete it.
DELETE FROM system WHERE type = 'theme' AND name = 'Theme_Name' AND status = 0 AND filename = 'path/to/Theme_Name.info' LIMIT 1;
Once deleted, flush your Drupal caches.
Well this is embarrassing. The source of the problem was that I was adding an image using:
src="<?= drupal_get_path('theme','Theme_Name'); ?>/sites/all/themes/theme_name/img/image.png">
The first problem is that the theme name I was calling was using capitals when the actual theme was all in lower case. But to actually resolve the problem I changed the image call to:
src="<?= drupal_get_path('theme',$GLOBALS['theme']); ?>/img/image.png">
Unsure if this turns out to be the same problem others have had, but that's what fixed it for me. If you're getting this error I'd suggest double checking how your src's are being called. Thanks to everyone that answered/responded!

Execute custom function after purchase a course/complete an order in LearnPress?

I need to execute a function immediately when someone purchases a course or an order gets completed successfully. The function I am trying to execute is actually called an API. I don't see an appropriate Hook from LearnPress.
It works perfectly when I use "user_register"(when someone registers this hook fire) hook but it doesn't work when I use this "learn_press_confirm_order" hook given by LearnPress.
Do you guys know is there any appropriate way that I can follow and achieve this. Thank You for your time
First off, your Lime API key should be treated as a password - don't share it on the web! Go to your LimeLM Account right now, choose 'Settings', and choose 'Generate New Key'. I'll wait :)
There's nothing obviously wrong with your code, so I would debug it like this:
Put a die('setup'); immediately after the add_action. We want to be sure that this file is actually being called. If it is, remove the die.
Wordpress and LearnPress are fantastic, because you've got the source code. Go to wp-content/plugins/learnpress and type (on Linux or something *nix)
grep -R "learn_press_confirm_order" .
This will show you all the files that reference this action. There is only one:
./templates/order/confirm.php: transaction_method, $order->get_id() ); ?>
So pull up an editor and edit wp-content/plugins/learnpress/templates/order/confirm.php. You need to determine:
Whether the file is being run at all when you order. (Use die right at the top, or error_log if you can see your webserver/php log files.)
I'm fairly certain at this point you will have found the error, but there's a chance for some reason you're getting to this page, but the action isn't being called. So you might need to work out the exact flow of control on this confirm.php page. Again, die or error_log.
You can make live changes to the code of learnpress, to help you debug it. Most people are afraid to dig into other people's code, but that's the great power of open source. You can just reinstall learnpress when you're done.
Looking forward to hearing how it goes :)

Is it possible to show all options in Tokenize2?

Tokenize2 is a javacsript lib to select multiple options.
It provides a very neat UI to start writing and then get a list of options to select from. Selected options will show up as "tags" that can be removed with "x" link.
So far all is fine. But Right now you need to know what your looking for and start write at least one character to see matching alternatives.
In my scenario there are very few alternatives and they are not known to the user. I would like to show ALL options when the user clicks the input box. There is a configuration option named searchMinLength but it is already set to 0.
Is there a workaround that can be used? Maybe like triggering load and dropdown manually?
I know there are a lot of similar alternatives but I picked Tokenize2 because:
It looks clean and nice
It works in mobile browsers
I don't know if there is an "official" approach, but after some investigation I have found an acceptable workaround.
After downloading the Tokenizer2 sourceode I found the following line that triggered my attention:
if(this.input.val().length > 0){
this.trigger('tokenize:search', [this.input.val()]);
}
My interpretation is that the internal search command is not triggered unless the user input has at least one character. This line in sourcecode could easily be modified. I have filed a suggestion for this here: https://github.com/zellerda/Tokenize2/issues/26
My current workaround is to add an event listener for the select event and there trigger the internal search command. That works fine for my scenario and does not force a source code rewrite.
$("#my-dropdown").on("tokenize:select", function (e: Event, routedEvent: boolean) {
$("#my-dropdown").trigger('tokenize:search', "");
});
Tokenize2
This link worked for me GitHub
$('.tokenize-sample-demo1').on('tokenize:select', function(container){
$(this).tokenize2().trigger('tokenize:search', [$(this).tokenize2().input.val()]);
});

find all _stringbetween occurrences within a webpage

I am working on an AutoIT script to find select messages withing a chatroom type webpage, I have no problem with placing the sent text between two special characters to make them easier to find, also to filter out all of the unwanted stuff. the problem that I am having is once the _stringbetween finds what it is looking for it doesn't continue looking. For testing I have the values returning in a GUI box. If there is a way to return all text between "^","^" it would solve my problem. Here is what i have so far
$html = _StringBetween(_INetGetSource('https://dtss.campfirenow.com/room/595835'), '^','^')
MsgBox(0, "title", $html[0])
also if anyone knows of a better way to pull select messages from campfire that would also solve my problem, maybe using the star feature... If you would like to look at the source code and api's of campfire they are available on GitHub
The _stringbetween return all occurences it will find.
You can make this simple test.
#include <array.au3>
$source="^test1^blabla^test2^blabla^test3^blabla^test4^blabla^test5^blabla"
$aRes=_StringBetween($Source,"^","^")
_ArrayDisplay($aRes)
For your source I don't now what's happening but test like this :
#include <array.au3>
$Source = BinaryToString(InetRead("https://dtss.campfirenow.com/room/595835"))
$aRes=_StringBetween($Source,"^","^")
_ArrayDisplay($aRes)
If the problem persist make a paste of your source code's page and post the link.

CMS links on frontend not converting ie href=[sitetree_link_id=xx]

An issue has been noticed on one of our old sites running 2.4 where when the user creates a link in the CMS content, selecting an existing page to link to, the link is not being converted to the actual URL on the front end and all links are coming through in the format of <a href="[sitetree_link_id=12]">
What would be causing this and how do I fix it?
The tag looks like it's being set incorrectly. It should be [sitetree_link id=12], not [sitetree_link_id=12].
We later added support to the parser for [sitetree_link,id=12] so that links didn't need to contain spaces, but I can't recall if that's in 2.4 or only 3.0+.
Can you confirm that your WYSIWYG insertion is putting in that errant _? If so, you might want to checkout the handleaction_insert function in tiny_mce_imporvements.js to confirm that it has a line like so:
case 'internal':
href = '[sitetree_link id=' + this.elements.internal.value + ']';
If the inserted links don't actually have the errant _ but they aren't being parsed, then try checking your sapphire/_config.php file for this:
ShortcodeParser::get('default')->register('sitetree_link', array('SiteTree', 'link_shortcode_handler'));
If your site makes changes to the ShortcodeParser at all you might have inadvertently turned off sitetree_link support.
If all of that looks in order, perhaps the ShortcodeParser isn't being called for some reason. In HTMLText::forTemplate(), put a debug statement (I like die("I got here!");) to confirm that HTMLText::forTemplate() is actually getting called. If it's not, you might need to manually call it in some pre-processing of your Content variable. Instead of this:
$content = $this->Content;
Do this:
$content = $this->obj('Content')->forTemplate();
I hope that one of those answers help. Either way, it would be great if you could post back, so we could isolate what caused this. It might help us make the API easier to use in SilverStripe 3.1.

Resources