Plugin Directory

Changeset 1244416


Ignore:
Timestamp:
09/13/2015 09:23:53 AM (10 years ago)
Author:
rclick
Message:

refactored constants

File:
1 edited

Legend:

Unmodified
Added
Removed
  • i-am-human/trunk/iamhuman.php

    r1244410 r1244416  
    3737
    3838    $html = "
    39     <div id='iamhuman_container' style='display: none' title='" . get_option('description_title') . "'>
     39    <div id='iamhuman_container' style='display: none' title='" . get_option(IamHumanConstants::IAMHUMAN_OPTION_DESCRIPTION_TITLE) . "'>
    4040       
    4141        <div id=\"iamhuman_dialog_contents\">
     
    4646       
    4747            <div id=\"iamhuman_grid\" class='iamhuman_grid'></div>
    48             <div class='iamhuman_message'>" . get_option("incorrect_attempt_message") ."</div>
     48            <div class='iamhuman_message'>" . get_option(IamHumanConstants::IAMHUMAN_OPTION_INCORRECT_ATTEMPT_MESSAGE) ."</div>
    4949        </div>
    5050    </div>
     
    5353        jQuery(document).ready(function($) {
    5454       
    55             $('html > head').append($('<style> .colour_bg { background: " . get_option('background_colour') . "; }</style>'));
    56             $('html > head').append($('<style> .colour_one { background: " . get_option('colour_one') . "; }</style>'));
    57             $('html > head').append($('<style> .colour_two { background: " . get_option('colour_two') . "; }</style>'));
    58             $('html > head').append($('<style> .cell_mouse_over { background: " . get_option('colour_hover') . "; }</style>'));
    59                
    60             foreground = '" . get_option('question_colour_one_string') . "';" .
    61             "guide = '" . get_option('question_colour_two_string') . "';" .
    62            
    63             "create_grid(\"#iamhuman_grid\", " . get_option('grid_size') .");
     55            $('html > head').append($('<style> .colour_bg { background: " . get_option(IamHumanConstants::IAMHUMAN_OPTION_BACKGROUND_COLOUR) . "; }</style>'));
     56            $('html > head').append($('<style> .colour_one { background: " . get_option(IamHumanConstants::IAMHUMAN_OPTION_COLOUR_ONE) . "; }</style>'));
     57            $('html > head').append($('<style> .colour_two { background: " . get_option(IamHumanConstants::IAMHUMAN_OPTION_COLOUR_TWO) . "; }</style>'));
     58            $('html > head').append($('<style> .cell_mouse_over { background: " . get_option(IamHumanConstants::IAMHUMAN_OPTION_COLOUR_HOVER) . "; }</style>'));
     59               
     60            foreground = '" . get_option(IamHumanConstants::IAMHUMAN_OPTION_QUESTION_COLOUR_ONE_STRING) . "';" .
     61            "guide = '" . get_option(IamHumanConstants::IAMHUMAN_OPTION_COLOUR_TWO) . "';" .
     62           
     63            "create_grid(\"#iamhuman_grid\", " . get_option(IamHumanConstants::IAMHUMAN_OPTION_GRID_SIZE) .");
    6464               
    6565            highlight_list(\"#iamhuman_grid\", \"colour_one\", foreground);
     
    181181function iamhuman_answer_check_ajax_callback() {
    182182        $results = "<result>";
    183         $answer_string = get_option('answer_colour_one_string');
     183        $answer_string = get_option(IamHumanConstants::IAMHUMAN_OPTION_ANSWER_COLOUR_ONE_STRING);
    184184    $test_string = $_POST['answer_string'];
    185185        $results .= "<success>" . (($answer_string === $test_string) ? "true" : "false")  . "</success>";
     
    214214       
    215215            if(empty($_POST['iamhuman_answer'])) {
    216                wp_die( get_option("incorrect_attempt_message")); 
     216               wp_die( get_option(IamHumanConstants::IAMHUMAN_OPTION_INCORRECT_ATTEMPT_MESSAGE)); 
    217217            } else {
    218218
     
    220220
    221221                if($test_answer !== $answer_string) {
    222                     wp_die( get_option("incorrect_attempt_message"));
     222                    wp_die( get_option(IamHumanConstants::IAMHUMAN_OPTION_INCORRECT_ATTEMPT_MESSAGE));
    223223                }
    224224            }
     
    240240function iamhuman_is_enabled() {
    241241
    242     return !is_user_logged_in() && get_option('colour_one') !== false &&  get_option('grid_size') !== false &&
     242    return !is_user_logged_in() && get_option('colour_one') !== false &&  get_option(IamHumanConstants::IAMHUMAN_OPTION_GRID_SIZE) !== false &&
    243243            filter_var(get_option('enable_post_comments'), FILTER_VALIDATE_BOOLEAN);
    244244}
Note: See TracChangeset for help on using the changeset viewer.