Tag: php

HOWTO: Displaying Blogger feeds with PHP

This HOWTO is going to follow the basic structure of the Python one. To start out you'll have to grab the Zend Google data Client Library and then set the include_path so you can use it We then import the parts the we'll need: One of the first things we're going to have to do is authenticate with google services. There are two ways to do this: AuthSub proxy authentication which has a user login using their own credentials, and ClientLogin username/password au thentication where you send a username and…

GWTPHP = Google Web Toolkit + PHP 5

I know there is a pretty high number of programmers who haven't tried to dable GWT yet because out of the box, the back end is java only. PHP developers rejoice! _Unlike most of the other frameworks, GwtPHP is a framework for both client and server part. In GwtPHP you don’t need to hack JavaScript, you work with modern, object oriented languages. User interface (client) is programmed in Java, then compiled by Google Web Toolkit (GWT) to browser-dependent JavaScript. Server part uses PHP 5. _ Not yet…

Quick Google Authentication in PHP

Here is a quick way to authenticate against Google and retrieve a protected feed. It does not use the supported ClientLogin method but it does allow you to get to some unsupported feeds (Reader, Bookmarks, etc) The Zend Gdata library is required

Wordpress Plugin: Displaying your Google Reader RSS subscriptions

I've been meaning to write this code for a while, and I really wanted to take a stab at writing a wordpress plugin so here it goes. The following takes in Google user credentials, and allows the user to display what RSS feeds they subscribe to on their wordpress blog Example: The RSS that I read Update: This plugin is now hosted by wordpress. click here

SyntaxHighlighter Evolved

I'm currently in the process of migrating gpowerd.net over to this domain and onto wordpress. SyntaxHighlighter has been upgraded quite a bit since I last wrote about it.  I came across a great plugin to handle the code highlighting for me on wordpress.  I love the plugin, didn't have to go into the wordpress template. It doesn't support the old pre syntax that I had been using previously but it was simple to add in. Patch to add this to 2.3.8 is below, Thanks to Alex for the plugin

Displaying Custom Attributes on the Product Page in Magento

At some point you may not want to use the canned attributes.phtml groupings that magento provides, or you just want to cherry pick which attributes to show on your product listing page template/catalog/product/view.phtml

Using widgets outside of the CMS in Magento

Magento ships with widget functionality that lets you build out data models and then reuse them on product and CMS pages. If you want to use these in a custom template however, you are out of luck.  This can be done by extending the Widget Collection class. Create the following directory structure: Copy into your new directory The Mage_Widget_Model_Mysql4_Widget_Instance_Collection comes with a store filter but thats about it.  To be more usefull we are going to add a type filter, a title filter, and a…

Magento: Want CKEditor to appear on Category edit pages in Magento?

It is pretty common to replace the TinyMCE editor in the Magento Admin with the CKEditor using this extension However, the way magento ajaxes the form fields into view on the category pages breaks this functionality. This snippet should help anyone trying to get it to work in in add this at the bottom but inside the script tag

Want to trace the call stack in Magento?

Update: This code is also available on Github as a Mageno module This has helped me immensely in situations like "Where is this getting called from??!?" Create a helper like so: That can be called from anywhere: ``PHP Mage::helper('stack/callstack')->toFirePhp(); Mage::helper('stack/callstack')->toLog(); .../app/code/community/Timbroder/Stack/Helper/Callstack.php line 16 calls get_callstack() .../app/design/frontend/mongoose/default/template/catalog/cms/bikes_bmx.phtml line 12 calls toLog() .../app/design…

Extending a Magento Controller

We're ajaxing part of the Magento shopping cart so we need to modify/extend some of the cart controller functionality.  Sometimes when modifying controller's you have to worry about updating the routes. For this, we don't need to, we still want all the urls to be used the same way. app/code/local/Ai/Checkout/etc/config.xml: app/code/local/Ai/Checkout/controllers/CartController.php:

Creating a stateless request in Magento

Have you ever wanted to create a stateless request in Magento? Something that doesn't touch any of Magento's sessions?  We were having issues with some of the ajax calls on our cart and checkout pages mucking with the user's cart and had get stateless on these calls.  The issue we were having was our checkout page was loading, then a javascript include was going out and bringing code from a 3rd party relevance engine into our dom, which was in turn calling back an ajax request to our servers.  This issue…

Important Magento Security Update – Zend Platform Vulnerability

While doing routine sanity checks, on of our QA Engineers, Sammy Shaar, was alerted about an important Magento security update. The vulnerability potentially allows an attacker to read any file on the web server where the Zend XMLRPC functionality is enabled. This might include password files, configuration files, and possibly even databases if they are stored on the same machine as the Magento web server. To see if you site has been affected, please see this page. Luckily, Magento has released patches for…

How to Remove or Change the way Wordpress Links to Images in Posts

By default, WordPress will link directly to an image in the category or post view. In a project I was working on today I wanted to change that. On the category view I wanted the image just to link to the post, and in the post, I didn’t want a link at all. Useful trick I found below:

Fixing YouTube embeds in Wordpress

In some wordpress themes, youtube embeds just show up as a black screen. As discussed here, the solution is adding a transparency setting to the iframe's src. However, the solution in that thread only works if the src is right next to the frameborder. Updated code below if you are running into this problem New thread in the wordpress forums can be found here. (The original was closed)

PHP7 Vagrant Box

I’m keeping a close eye (or as much as I can anyway) on PHP7 and what it means for the future of the language. Installing in your local dev machine is risky, especially if you have ongoing work. As usual, Vagrant comes to the rescue! Rasmus Lerdorf has put together a Vagrant box to ease in the setup and isolate your testing. If you use Atlas, check out the box here. Otherwise, the readme is available on Github

Setup and Teardown the Database Once Per Test Suite in PHPUnit

I'm working on a series of integration tests where I want to set up and reset the database for each run. This could easily be done in the setUp and tearDown methods, but doing the full db each time is slow. Yes, I could just do the tables I need, but I was curious, and now I don't have to worry about which tables are setup in my testing DB. In this example, I'm using Laravel's migrations and SQLite as the test DB. UPDATE 05/05/2016: As Sebastian points out below (thanks!) there is a much more appropriate…