Encerrado

PHP function to clean up duplicate and redundant HTML tags.

We require a PHP function that will receive a string of HTML which then needs to be cleaned of redundant(useless) and duplicate tags. The function must work in PHP 4 and PHP 5.

Please see the example cases provided for more information.

## Deliverables

**Example Cases** The following "messy" code...

<div align="center">

<span style="FONT-FAMILY: Tahoma; FONT-SIZE: 18pt">

<span style="FONT-FAMILY: Tahoma; FONT-SIZE: 18pt">

Content text...

</span>

</span>

</div>

**Would need to be cleaned up to this:**

<div align="center">

<span style="font-family: Tahoma; font-size: 18pt">

Content text...

</span>

</div>

Note that it removed the duplicate span tag which is redundant. It is not limited to 'one' duplicate, it will need to be able to remove any number of duplicate tags that are redundant.

Another example:

<div align="justify"><span style="FONT-SIZE: 10pt"><strong></strong></span></div>

**Would need to be cleaned to:**

<div align="justify"></div>

This is removing the empty strong tag (all empty strong / em e.t.c. tags should be removed. It's keeping the div, as this might be used for the space it takes up. Because there's nothing in the span, the font size property is pointless, so the span is redundant, it is also being removed.

It is important that the cleaning does not have an effect on the way that the site looks. If tags have a character within them they mustn't be removed as it will change the spacing of the site. See the following example for more...

<div align="left"><strong></strong></div>

**Should be changed to:**

<div align="left"></div>

However

<div align="justify"> </div>

Should remain the same as the space affects the layout.

It should also be able to combine style tags if possible for instance:

<span style="font-weight: bold;">

<span style="font-size: 18pt; color: red;">

<span style="font-size: 18pt;">

Some text...

</span>

</span>

</span>

**Would change to:**

<span style="font-size: 18pt; font-weight: bold; color: red;">

Some text...

</span>

We have attached a file as an example of a page that has a lot of useless tags, for you to use as a test.

We will test the function you provide on the example we've uploaded and the test cases.. We will need to be able to process files potentially over 300kb.d

## Platform

PHP

Habilidades: Amazon Web Services, Engenharia, PHP, Gestão de projetos, Arquitetura de software, Teste de Software

Ver mais: up string, text em, site em html 5, php string to html, php function for, php color code, number function, html 5 font color, html 5 color, html 5 align, function number, php function , html tags, Duplicate content, color red, clean files, size function, html project tags, php remove text, php font color, remove redundant code, php change color, php remove file, remove text php, bold html

Acerca do Empregador:
( 6 comentários ) Brighton, United Kingdom

ID do Projeto: #3002124

11 freelancers estão ofertando em média $131 para este trabalho

webnexus

See private message.

$85 USD in 7 dias
(37 Comentários)
5.3
billyhandiii

See private message.

$59.5 USD in 7 dias
(24 Comentários)
4.2
webdeveloperro

See private message.

$850 USD in 7 dias
(16 Comentários)
4.0
homi12345

See private message.

$17 USD in 7 dias
(9 Comentários)
2.7
alienwebsl

See private message.

$72.25 USD in 7 dias
(6 Comentários)
2.7
mzabbasi

See private message.

$50.15 USD in 7 dias
(2 Comentários)
1.9
tmrvw

See private message.

$51 USD in 7 dias
(0 Comentários)
0.0
WaXas059

See private message.

$55.25 USD in 7 dias
(0 Comentários)
0.0
chinthanapannila

See private message.

$29.33 USD in 7 dias
(2 Comentários)
0.0
tospat

See private message.

$42.5 USD in 7 dias
(0 Comentários)
0.0
acmabpo

See private message.

$127.5 USD in 7 dias
(1 Comentário)
0.0