Changeset 1326501
- Timestamp:
- 01/12/2016 10:57:03 AM (10 years ago)
- Location:
- i-am-human/trunk
- Files:
-
- 3 edited
-
iamhuman.php (modified) (8 diffs)
-
iamhuman_options.php (modified) (7 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
i-am-human/trunk/iamhuman.php
r1244419 r1326501 3 3 Plugin Name: I am human 4 4 Plugin URI: http://programminglinuxblog.blogspot.com/2014/06/i-am-human.html 5 Description: Human vs machine. Who will pass the test? Customisable machine 6 filtering (otherwise known as captcha), that can be imbeded into forms. 5 Description: Human vs machine. Who will pass the test? Customisable machine filtering (otherwise known as captcha), that can be imbeded into forms. 7 6 Author: Benjamin Leov 8 7 Version: 1.1 … … 46 45 47 46 <div id=\"iamhuman_grid\" class='iamhuman_grid'></div> 48 <div class='iamhuman_message'>" . get_option(IamHumanConstants::IAMHUMAN_OPTION_INCORRECT_ATTEMPT_MESSAGE) ."</div>47 <div class='iamhuman_message'>" . iamhuman_get_incorrect_attempt_message() ."</div> 49 48 </div> 50 49 </div> … … 53 52 jQuery(document).ready(function($) { 54 53 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>'));54 $('html > head').append($('<style> .colour_bg { background: " . iamhuman_get_background_colour() . "; }</style>')); 55 $('html > head').append($('<style> .colour_one { background: " . iamhuman_get_colour_one() . "; }</style>')); 56 $('html > head').append($('<style> .colour_two { background: " . iamhuman_get_colour_two() . "; }</style>')); 58 57 $('html > head').append($('<style> .cell_mouse_over { background: " . get_option(IamHumanConstants::IAMHUMAN_OPTION_COLOUR_HOVER) . "; }</style>')); 59 58 … … 70 69 //var form = jQuery(this).parents('form:first'); 71 70 var form = $(\"#commentform\"); 72 71 var answer_passed = false; 72 73 73 form.append($('<div style=\"display:none\"><input id=\"alt_submit\" type=\"submit\" /></div>')); 74 74 … … 107 107 108 108 result = $(response).find('success').first().text(); 109 109 110 110 if(result == 'true') { 111 111 jQuery('.iamhuman_message').hide(); 112 112 answer_field.val(selection_string); 113 answer_passed = true; 113 114 jQuery('#alt_submit').click(); 114 115 } else { 115 116 // display error message 117 answer_passed = false; 116 118 jQuery('.iamhuman_message').show(); 117 119 } … … 137 139 form.submit(function (event) { 138 140 139 answer_field = form.children('input[name=\"iamhuman_answer\"]:first').val();141 //answer_field = form.children('input[name=\"iamhuman_answer\"]:first').val(); 140 142 141 if(!answer_ field) {143 if(!answer_passed) { 142 144 event.preventDefault(); 143 145 handle_submit(); … … 214 216 215 217 if(empty($_POST['iamhuman_answer'])) { 216 wp_die( get_option(IamHumanConstants::IAMHUMAN_OPTION_INCORRECT_ATTEMPT_MESSAGE));218 wp_die(iamhuman_get_incorrect_attempt_message()); 217 219 } else { 218 220 … … 220 222 221 223 if($test_answer !== $answer_string) { 222 wp_die( get_option(IamHumanConstants::IAMHUMAN_OPTION_INCORRECT_ATTEMPT_MESSAGE));224 wp_die(iamhuman_get_incorrect_attempt_message()); 223 225 } 224 226 } -
i-am-human/trunk/iamhuman_options.php
r1243970 r1326501 1 1 <?php 2 include_once 'iamhuman_options.php';3 2 4 3 function iamhuman_register_settings() { … … 26 25 27 26 register_setting(IamHumanConstants::$IAMHUMAN_SETTINGS_ID, IamHumanConstants::IAMHUMAN_OPTION_ENABLE_POST_COMMENTS); 27 } 28 29 function iamhuman_get_colour_one() { 30 return get_option(IamHumanConstants::IAMHUMAN_OPTION_COLOUR_ONE, '#006495'); 31 } 32 33 function iamhuman_get_colour_two() { 34 return get_option(IamHumanConstants::IAMHUMAN_OPTION_COLOUR_TWO, '#E0A026'); 35 } 36 37 function iamhuman_get_background_colour() { 38 return get_option(IamHumanConstants::IAMHUMAN_OPTION_BACKGROUND_COLOUR, 'white'); 39 } 40 41 function iamhuman_get_incorrect_attempt_message() { 42 return get_option(IamHumanConstants::IAMHUMAN_OPTION_INCORRECT_ATTEMPT_MESSAGE, 'Incorrect Attempt'); 43 } 44 45 /** 46 * Gets the grid size, with the default option set. 47 * 48 * @return int 49 */ 50 function iamhuman_get_grid_size_setting() { 51 return get_option(IamHumanConstants::IAMHUMAN_OPTION_GRID_SIZE, 22); 28 52 } 29 53 … … 165 189 <tr valign="top"> 166 190 <th scope="row"><?php echo __('Incorrect Attempt Message', IamHumanConstants::$IAMHUMAN_TEXT_DOMAIN) ?></th> 167 <td><textarea name="incorrect_attempt_message"><?php echo get_option(IamHumanConstants::IAMHUMAN_OPTION_INCORRECT_ATTEMPT_MESSAGE); ?></textarea></td>191 <td><textarea name="incorrect_attempt_message"><?php echo iamhuman_get_incorrect_attempt_message(); ?></textarea></td> 168 192 </tr> 169 193 170 194 <tr valign="top"> 171 195 <td colspan="2"> 172 173 196 <p> 174 197 <strong> … … 193 216 ?> 194 217 </p> 195 218 196 219 <table class="form-table"> 197 220 <tr valign="top"> 198 221 <th scope="row"><?php echo __('Colour one', IamHumanConstants::$IAMHUMAN_TEXT_DOMAIN) ?></th> 199 <td><input type="text" class='colour_field' id="colour_one" name="colour_one" value="<?php echo get_option(IamHumanConstants::IAMHUMAN_OPTION_COLOUR_ONE); ?>" /></td>222 <td><input type="text" class='colour_field' id="colour_one" name="colour_one" value="<?php echo iamhuman_get_colour_one(); ?>" /></td> 200 223 </tr> 201 224 <tr valign="top"> 202 225 <th scope="row"><?php echo __('Colour two', IamHumanConstants::$IAMHUMAN_TEXT_DOMAIN) ?></th> 203 <td><input type="text" class='colour_field' id="colour_two" name="colour_two" value="<?php echo get_option(IamHumanConstants::IAMHUMAN_OPTION_COLOUR_TWO); ?>" /></td>226 <td><input type="text" class='colour_field' id="colour_two" name="colour_two" value="<?php echo iamhuman_get_colour_two(); ?>" /></td> 204 227 </tr> 205 228 <tr valign="top"> 206 229 <th scope="row"><?php echo __('Hover colour', IamHumanConstants::$IAMHUMAN_TEXT_DOMAIN) ?></th> 207 <td><input type="text" class='colour_field' id="colour_hover" name="colour_hover" value="<?php echo get_option(IamHumanConstants::IAMHUMAN_OPTION_COLOUR_HOVER ); ?>" /></td>230 <td><input type="text" class='colour_field' id="colour_hover" name="colour_hover" value="<?php echo get_option(IamHumanConstants::IAMHUMAN_OPTION_COLOUR_HOVER, '#F4D00C'); ?>" /></td> 208 231 </tr> 209 232 <tr valign="top"> 210 233 <th scope="row"><?php echo __('Background colour', IamHumanConstants::$IAMHUMAN_TEXT_DOMAIN) ?></th> 211 <td><input type="text" class='colour_field' id="background_colour" name="background_colour" value="<?php echo get_option(IamHumanConstants::IAMHUMAN_OPTION_BACKGROUND_COLOUR); ?>" /></td>234 <td><input type="text" class='colour_field' id="background_colour" name="background_colour" value="<?php echo iamhuman_get_background_colour(); ?>" /></td> 212 235 </tr> 213 236 </table> … … 238 261 239 262 // setup the custom styles 240 $('html > head').append($('<style> .colour_bg { background: <?php echo get_option(IamHumanConstants::IAMHUMAN_OPTION_BACKGROUND_COLOUR); ?>; }</style>'));241 $('html > head').append($('<style> .colour_one { background: <?php echo get_option(IamHumanConstants::IAMHUMAN_OPTION_COLOUR_ONE); ?>; }</style>'));242 $('html > head').append($('<style> .colour_two { background: <?php echo get_option(IamHumanConstants::IAMHUMAN_OPTION_COLOUR_TWO); ?>; }</style>'));243 $(".grid_cell").css('background-color', '<?php echo get_option(IamHumanConstants::IAMHUMAN_OPTION_BACKGROUND_COLOUR)?>');263 $('html > head').append($('<style> .colour_bg { background: <?php echo iamhuman_get_background_colour(); ?>; }</style>')); 264 $('html > head').append($('<style> .colour_one { background: <?php echo iamhuman_get_colour_one(); ?>; }</style>')); 265 $('html > head').append($('<style> .colour_two { background: <?php echo iamhuman_get_colour_two(); ?>; }</style>')); 266 $(".grid_cell").css('background-color', '<?php echo iamhuman_get_background_colour(); ?>'); 244 267 245 268 create_grid("#iamhuman_grid_question", <?php echo iamhuman_get_grid_size_setting(); ?>); … … 357 380 } 358 381 359 /**360 * Gets the grid size, with the default option set.361 *362 * @return int363 */364 function iamhuman_get_grid_size_setting() {365 return get_option(IamHumanConstants::IAMHUMAN_OPTION_GRID_SIZE, 22);366 }367 382 368 383 /** … … 392 407 } else { 393 408 $response->success = false; 394 $response->messsage = __("No template matched was specifie .", IamHumanConstants::$IAMHUMAN_TEXT_DOMAIN);409 $response->messsage = __("No template matched was specified.", IamHumanConstants::$IAMHUMAN_TEXT_DOMAIN); 395 410 } 396 411 -
i-am-human/trunk/readme.txt
r1244246 r1326501 72 72 Initial release of I Am Human! 73 73 74 = 1.1 = 75 76 Bug fixes. 77 78 = 1.2 = 79 80 Bug fixes. 81 74 82 == Upgrade Notice == 75 83
Note: See TracChangeset
for help on using the changeset viewer.