-3

I'm not too much familiar with PHP and i'm trying to set up a wordpress page..

I have a function like;

public static function autoload() {
        $path_ = GMEDIA_ABSPATH . '/admin/class.processor.';
        $page = !isset($_GET['page'])?: $_GET['page'];
        switch($page) {
            case 'GrandMedia':
                include_once($path_ . 'library.php');
            break;
            case 'GrandMedia_AddMedia':
                include_once($path_ . 'addmedia.php');
            break;
            case 'GrandMedia_Terms':
                include_once($path_ . 'terms.php');
            break;
            case 'GrandMedia_Galleries':
                include_once($path_ . 'galleries.php');
            break;
            case 'GrandMedia_Modules':
                include_once($path_ . 'modules.php');
            break;
            case 'GrandMedia_Settings':
                include_once($path_ . 'settings.php');
            break;
            case 'GrandMedia_WordpressLibrary':
                include_once($path_ . 'wpmedia.php');
            break;
            default:
                global $gmProcessor;
                $gmProcessor = new GmediaProcessor();
            break;
        }
    }

and in the line 3 (is the line 144 in entire code) i get this;

Parse error: syntax error, unexpected ':' in /vhosts/karasinek.biz/http/wp-content/plugins/grand-media/admin/class.processor.php on line 144

Can you please help me to solve it?

Bora Ç
  • 1
  • 2
  • Which version of php are you using? Shorthand ternary operator is only available in php 5.3 and newer. – datasage Dec 29 '15 at 00:13
  • as i said i'm not much into php. I just added a plugin to my wordpress page and after activating, I cannot reach the /wp-admin or any page.. so, i don't know the version.. just looking if i can solve it without deleting the plugin files.. – Bora Ç Dec 29 '15 at 00:17

2 Answers2

2

Your ternary operator is badly written

try isset($_GET['page'])? $_GET['page'] : false

skank
  • 91
  • 10
1

The following line is I believe at fault.

$page = !isset($_GET['page']) ? : $_GET['page'];

There is nothing set if this condition proves to be true (ie: if get[page]==false )

rewrite to:

$page = !isset($_GET['page'])? false : $_GET['page'];
if( !$page ) return;
Professor Abronsius
  • 33,063
  • 5
  • 32
  • 46