Make your own code sample box [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
Is there a simple way to make your own, or is there a plugin to have your own PHP code sample box for presenting your code of an open-source project? I would like to have something like here on Stackoverflow, with colors, to present your code, like:
<?php echo 'test'; ?>
If there is no simple way to do is, i'll just make it a download, but It would be handy to have something like this :)
Thanks

highlight_string("<?php echo 'test'; ?>");
Or there are some libaries that do a better job and other languages. I've also used GeSHi in the past.
Also, highlight_file().
Using HTML:
echo "<pre>" . highlight_string("<?php echo 'test'; ?>", true) . "</pre>";

Most of these are actually javascript based. SO and many other sites use the js library called Pettify to make code blocks look nice. You can find the project at https://code.google.com/p/google-code-prettify/

Related

An Algorithm/PHP code for word finding game [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
Well, I recently have been trying to come with code to create matrix in which word hunting can be done. I want the user to initialise rows, columns and of course give the words, it is too difficult to create such code/algorithm as the words can be placed vertically, horizontally or diagonally. I also tried google for such algorithms but without any luck. So, if anyone has an algorthm in mind or has written such PHP code, itll be really great if I can see that.
Thanks in Advance,
Nalin Bhardwaj
I am so sorry , I posted this question here, as suggested by one of the users, I googled a few different things online an dhave found a ruby file which has been built for the same purpose. And , if anybody would like to access it, they may check it out online at http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/298382 . And, now I have decided to use this algorithm itself to create such a PHP file. Thank you everybody, for suggestions

Link crawler (for download or development) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I have a question regarding webcrawling..
What I need is a webcrawler that can save all external links from a website and print them to a file (csv).
I am in the middle of developing it myself (with php), but was wondering if there were some downloadable solutions already (doesn't have to be php solution)..
Of course I have looked for myself, but couldn't find anything. So if anyone can help me out here, I would really appreciate it.
Also, what would be the best way to developing it be?
You can Simple HTML Dom Parser (http://simplehtmldom.sourceforge.net/)
Eg.
<?php
include 'simple_html_dom.php';
$html = file_get_html('http://google.com/');
foreach($html->find('a') as $element) {
$link[]=$element->href;
}
//Write into your CSV file
?>

How to obfuscate JavaScript using PHP? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
For example, how could I obfuscate this sample code from:
/*
The code below will write
to a heading and to a paragraph,
and will represent the start of
my homepage:
*/
document.getElementById("myH1").innerHTML="Welcome to my Homepage";
document.getElementById("myP").innerHTML="This is my first paragraph.";
into the form:
var _0xcc34=["\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C","\x6D\x79\x48\x31","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64","\x57\x65\x6C\x63\x6F\x6D\x65\x20\x74\x6F\x20\x6D\x79\x20\x48\x6F\x6D\x65\x70\x61\x67\x65","\x6D\x79\x50","\x54\x68\x69\x73\x20\x69\x73\x20\x6D\x79\x20\x66\x69\x72\x73\x74\x20\x70\x61\x72\x61\x67\x72\x61\x70\x68\x2E"];document[_0xcc34[2]](_0xcc34[1])[_0xcc34[0]]=_0xcc34[3];document[_0xcc34[2]](_0xcc34[4])[_0xcc34[0]]=_0xcc34[5];
using PHP?
I know that I can do this using http://javascriptobfuscator.com/ but I need to do that inside my PHP file, because it dynamically changes.
OK. On theory about how to obsfucate.
you need to know the language, as you will need a parser for good results.
when you know what is what, then you can start replacing things.
for a very stupid example replace all instances of
document.getElementById('string'); with ab(cd('fgevat'); like
function cd(s) { /* ROT13 implemented here*/ } function ab(s) { return document.getElementById(s); } ab(cd('fgevat');
you can use eval to avoid unpacking to clear text. and then you can go
like this
function h(s) { /*implement hexdecode in an ugly way, and run eval() on the resulting string */} h('2020202066756e6374696f6e206364287329207b202f2a20524f54313320696d706c656d656e74656420686572652a2f207d2066756e6374696f6e206162287329207b2072657475726e20646f63756d656e742e676574456c656d656e74427949642873293b207d206162286364282766676576617427293b'); // which is the above code.
this is all r=1 stuff. And can be done waay better with a deeper understanding of the language, also these are absolutely trivial to reverse

Microsoft Word to HTML in PHP script [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I want to know the PHP code for Word to HTML conversion. When we retrive the Word document from the database and display in the frontend, the Word document should display as HTML page.
wvware
I don't completly understand your request but I think you can try TinyMCE for PHP, it's a Web based Wysiwyg editor, where all you type and format will be saved as HTML code, you can even paste and convert Word documents.
So like symcbean said, the best way to do is wvWare, otherwise,you could hardcode a class yourself, but it will be a difficult path.

Batch code indenters and beautifiers [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
Does anyone here know of good batch file code indenters or beautifiers?
Specifically for PHP, JS and SGML-languages.
Preferably with options as to style.
The following page has code on it to tidy Javascript (written in javascript as well):
http://www.howtocreate.co.uk/tutorials/jsexamples/JSTidy.html
There are various ways to tidy SGML based files (i.e. XML) - HTMLTidy will often do the trick, and there are various 'pretty print' implementations in various languages out there.
And finally a link to a web site with PHP code for pretty printing PHP: http://tobyinkster.co.uk/blog/2007/07/17/php-pretty-printer/
For HTML/XML HTML Tidy is the best option:
http://tidy.sourceforge.net/

Categories