MyBB Community Forums

Full Version: PHP CODE
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I was able to find a wonderful php plugin that allowed me to change the colours of the PHP
 However I now noticed that at the top of every codebox there is this  
[code]<?php 
  
[Image: 234234234234.png]
 So my first question is, how do i remove the ?php from the top. and Also, is there a way to change the name of it, from PHP to Colored code, or whatever.. Cause I like to use it as my main codebox.
First of all, we need to know the plugin to have a look at the code.
Can you provide the plugin (.php) file?

[ETS]
(2022-08-23, 08:46 AM)[ExiTuS] Wrote: [ -> ]First of all, we need to know the plugin to have a look at the code.
Can you provide the plugin (.php) file?

[ETS]

OOOOH, It has to do with the plugin I installed.. I didnt relize that, I assumed it was just like that by default.
Umm the plugin is called phpcolors.php

and heres the code to it.
<?php

// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

$plugins->add_hook("global_start", "phpcolors");

function phpcolors_info()
{
	return array(
		"name"			=> "PHP Colors",
		"description"	=> "Sets the highlight colors used in [php] tags.",
		"website"		=> "http://mybbsecurity.net/",
		"author"		=> "Nathan Malcolm",
		"authorsite"	=> "http://mybbsecurity.net/",
		"version"		=> "1.0",
		"guid" 			=> "",
		"compatibility" => "*"
	);
}

function phpcolors()
{
    ini_set('highlight.string', 'orange;'); // Color for highlighting a string in PHP syntax (e.g. echo 'this will be purple')
    ini_set('highlight.comment', 'lime;'); // Color for highlighting PHP comments (e.g. this is a comment)
    ini_set('highlight.keyword', 'crimson;'); // Color for syntax highlighting PHP keywords (e.g. parenthesis and semicolon) 
    ini_set('highlight.default', 'aqua;'); // Default color for PHP syntax (e.g. <?php)
}

?>

THIS HAS GOT ME RIPPING MY HAIR OUT..

I spent 4 hours trying to figure this out..........

If anyone has a solution? or a better plugin. Im all ears.