php

Whitelist element with class of, using htmlpurifier

I want to only allow the span element only when it has a certain class in htmlpurifier does anyone know how to do this, right now I have $config->set('HTML.Allowed','a[href],p,ol,li,ul,img[src],blockquote,em,span[class]'); $config->set('Attr.AllowedClasses',"allowed"); but that allows all spans and only allows class allowed I l...

Are there any control sets for PHP?

Hi all, Are there any good control sets that can be used with PHP, like how there are Telerik controls for ASP.Net? ...

PHP array help getting a value from the key

I have a variable that looks likes this, $rslt['expected_salary_level'] This returns a string similar to LEVEL_3, in another array that looks like this I have a set of salaries, Array ( [LEVEL_1] => Array ( [nice_name] => under £10,000 [low] => 1 [high] => 10000 ) ...

Real Time Twitter Streaming without constant Polling

I was looking at Twitter Streaming API for getting a real-time feed. But I dont want it stored on my server. I just want it pulled from the server and the browser page will retrieve the data from my server's twitter pull URL. But I want to avoid polling my server every few mill-seconds. Is there a way for my server script to keep pushing...

Running job in the background from Perl WITHOUT waiting for return

The Disclaimer First of all, I know this question (or close variations) have been asked a thousand times. I really spent a few hours looking in the obvious and the not-so-obvious places, but there may be something small I'm missing. The Context Let me define the problem more clearly: I'm writing a newsletter app in which I want the ac...

Shopping Portal based on XML Data - XSLT or PHP?

For my bachelor thesis I want to implement a shopping (price comparison) portal prototype based on XML Data. The main requirement is to get a very clear and customizable HTML template, which should be hosted by the customer on his own webserver. I'm not very sure if XSLT meets this requirements, as it generates a lot of xsl-related cod...

Wordpress display featured posts outside of loop

Im new to WP and Im not real sure how to work with the loop. I am trying to display featured posts in the sidebar with this code: <?php query_posts('cat=5'); $url = get_permalink(); while(have_posts()){ the_post(); $image_tag = wp_get_post_image('return_html=true'); $resized_img = getphpthumburl($image_tag,'h=168&w=168&zc=1'); $title ...

TCPDF Specific border for different sides

Hey Everyone, I just started using TCPDF (output with HTML), and I do not understand why I can not have an inline CSS style for border like the following, style="border-right: 1px" After looking at some of the examples, the only place I see borders being used is on a table using the border="1" property. This is very frustrating, and ...

Best way to implement keywords for image upload gallery

I'm starting to spec out an image gallery type system similar to Facebook's. Members of the site will be able to create image galleries and upload images for others to view. Images will have keywords the the uploader can specify. Here's the question, what's the best way to model this? With image and keyword tables linked vi a HABTM r...

order keywords by frequency in PHP mySql

Hello, I've got a database with video ids and N keywords for each video. I made a table with 1 video ID and 1 keyword ID in each row. What's the easiest way to order keywords by frequency? I mean to extract the number of times a keyword is used and order them. Is it possible to do that with sql or do I need to use php arrays? Thank...

PHP nuSoap issue when connecting to a .NET server: "Object reference not set to an instance of an object."

I am currently working on a SOAP project using PHP. The script is connecting to a remote .NET service server. I get a nice response using the HelloWorld action the provide, but when the script goes to get any other data using other actions, I get "Object reference not set to an instance of an object." in a diffgram sub array of ...

PHP - CURL vs fopen vs fsocketopen ?

I would write a WordPress plugin to parse all image source and check it's broken link or not. My idea is : Select all post&page's images by regex from MySQL Navigate the image url and get the response header (404 ,403 error etc) print a report Since i don't need actual to download the binary file, so in performance ,compare in CURL ,...

Some mail clients see empty CSV attachment from PHP mail() after switch from sendmail to qmail

Hi folks, The code below has been sending CSVs to our print fulfillment folks for years. Beginning of the week the sysadmin switched from sendmail to qmail for reasons having to do with procmail recipes we want to run. Probably not coincidentally we starting started hearing that the fulfillment folks were seeing empty CSVs even when o...

How can I break an email address into different parts in php?

Basically what I want to do is display an email using javascript to bring the parts together and form a complete email address that cannot be visible by email harvesters. I would like to take an email address eg [email protected] and break it to: $variable1 = "info"; $variable2 = "thiscompany.com"; All this done in PHP. Regards, JB...

Can a WordPress blog pull content from Django pages?

Say you have a WordPress theme you like, but want to make use of a bunch of Django code that's already written. Is there a good and easy, and performant way, of sucking in HTML that is output from Django and displaying it inline in a WordPress posting, or page without using browser frames? Any good examples of this? ...

Static creator with variable number of arguments

I am looking for the best way to have a static creation method at the abstract level in a class family that can have a variable number of arguments in the constructor. For example, if I know that all extended versions of Foo will have two constructor arguments, I could do this: abstract class Foo { abstract public function __constr...

How to scale a PHP application (servers, mysql, memcache)

Hi, I'm currently creating a website for a social project in switzerland. And before there is an overflow of user, I want to prepare the application to scale. I answered by myself many questions but some are left. I explain what I want to do. First at the beginnning, the Application will have only one server (short time) with DNS...

Building XML with PHP - Performance in mind..

When building XML in PHP, is it quicker to build a string, then echo out the string or to use the XML functions that php gives you? Currently I'm doing the following: UPDATED to better code snippet: $searchParam = mysql_real_escape_string($_POST['s']); $search = new Search($searchParam); if($search->retResult()>0){ $xmlRes = $sea...

using preg_match to strip specified underscore in php

There has always been a confusion with preg_match in php. I have a string like this: apsd_01_03s_somedescription apsd_02_04_somedescription Can I use preg_match to strip off anything from 3rd underscore including the 3rd underscore. thanks. ...

high tweet status IDs causing failed to open stream errors?

Erg. Starting in the past few days high tweet IDs (at least, it appears it's ID related, but I suppose it could be some recent change in the api returns) are breaking my code. At first I tried passing the ID as a string instead of an integer to this function, and I thought this worked, but in reality it was just the process of uploading ...