Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8579287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:34:49+00:00 2026-06-11T20:34:49+00:00

I am reading some WordPress plugin code, pardon my french, and even though I

  • 0

I am reading some WordPress plugin code, pardon my french, and even though I have coded a lot of stuff in anything from C to JavaScript, including PHP, I am not sure what kind of logic is accomplished with following:

<?php

    function dcontact_options_page() {

        if($_GET['action'] == 'edit_group') {
            dcontact_action_edit_group();
            return;
        }
        elseif($_GET['action'] == 'edit_form') {
            dcontact_action_form_settings();
            return;
        }
        elseif(isset($_POST['set_order'])) {
            $result = dcontact_action_set_order();
        }
        else if(isset($_POST['new_group'])) {
            $result = dcontact_action_new_group();
        }
        else if($_GET['action'] == 'delete_group') {
            $result = dcontact_action_delete_group();
        }

        if(!isset($result['message']) && isset($_GET['message'])) $result['message'] = urldecode($_GET['message'])
    ?>

    <div class="wrap">
        <div class="icon32" id="icon-options-general"><br></div>

        <!-- More HTML AND PHP code blocks -->

    <!-- And then suddenly... -->

<?php
    } /// What's this? End of function definition? PHP chokes on this with syntax error.

    ///...

?>

I am no stranger to mixing PHP and verbatim output, and I also did my fair share of entering and exiting PHP blocks in the middle of say if statements, but this tops it. Can anyone explain what the guy was trying to accomplish? Does the code imply that if the if condition evaluates to true then whole lot of markup is written out (and more PHP is executed), but then the function definition ends, suddenly? Maybe it’s what the function does? I mean, I would have used a HEREDOC syntax for readability.

And to sum it up, my command line PHP 5.4.7 preprocessor chokes on the last }. And I can’t say I blame it. Haven’t seen spaghetti code like this in some time now.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T20:34:50+00:00Added an answer on June 11, 2026 at 8:34 pm

    This part:

    if(!isset($result['message']) && isset($_GET['message'])) $result['message'] = urldecode($_GET['message'])
    

    Is missing a semi-colon at the end. It would be much clearer if the original author had used proper bracing for single-statement conditionals, e.g.:

    if(!isset($result['message']) && isset($_GET['message'])) {
        $result['message'] = urldecode($_GET['message'])
    }
    

    That would have put the error location just one line below the offending line 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been reading some WordPress PHP code on GitHub and I found that
I am reading some book and I have encountered a piece of code that
I'm having some trouble reading files with Indy from a site that has WordPress
Reading some source code, I have found next traits definition: namespace dds { template
Reading some posts from Jimmy Boggard and wondering - how exactly is it possible
Reading some Verilog code, there seem to be two ways of defining arguments in
When reading some FreeBSD source code (See: radix.h lines 158-173), I found variable declarations
After reading some articles about XSS I have incorporated HTMLPurifier into my zend framework
thanks for reading! Here's what I'm up to. I'm writing a WordPress plugin that
I'm trying to put some simple jQuery code into the Wordpress header (usually just

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.