Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/contact-.../modules
File: really-simple-captcha.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
** A base module for [captchac] and [captchar]
[2] Fix | Delete
**/
[3] Fix | Delete
[4] Fix | Delete
/* form_tag handler */
[5] Fix | Delete
[6] Fix | Delete
add_action( 'wpcf7_init', 'wpcf7_add_form_tag_captcha', 10, 0 );
[7] Fix | Delete
[8] Fix | Delete
function wpcf7_add_form_tag_captcha() {
[9] Fix | Delete
// CAPTCHA-Challenge (image)
[10] Fix | Delete
wpcf7_add_form_tag( 'captchac',
[11] Fix | Delete
'wpcf7_captchac_form_tag_handler',
[12] Fix | Delete
array(
[13] Fix | Delete
'name-attr' => true,
[14] Fix | Delete
'zero-controls-container' => true,
[15] Fix | Delete
'not-for-mail' => true,
[16] Fix | Delete
)
[17] Fix | Delete
);
[18] Fix | Delete
[19] Fix | Delete
// CAPTCHA-Response (input)
[20] Fix | Delete
wpcf7_add_form_tag( 'captchar',
[21] Fix | Delete
'wpcf7_captchar_form_tag_handler',
[22] Fix | Delete
array(
[23] Fix | Delete
'name-attr' => true,
[24] Fix | Delete
'do-not-store' => true,
[25] Fix | Delete
'not-for-mail' => true,
[26] Fix | Delete
)
[27] Fix | Delete
);
[28] Fix | Delete
}
[29] Fix | Delete
[30] Fix | Delete
function wpcf7_captchac_form_tag_handler( $tag ) {
[31] Fix | Delete
if ( ! class_exists( 'ReallySimpleCaptcha' ) ) {
[32] Fix | Delete
$error = sprintf(
[33] Fix | Delete
/* translators: %s: link labeled 'Really Simple CAPTCHA' */
[34] Fix | Delete
esc_html( __( "To use CAPTCHA, you need %s plugin installed.", 'contact-form-7' ) ),
[35] Fix | Delete
wpcf7_link( 'https://wordpress.org/plugins/really-simple-captcha/', 'Really Simple CAPTCHA' )
[36] Fix | Delete
);
[37] Fix | Delete
[38] Fix | Delete
return sprintf( '<em>%s</em>', $error );
[39] Fix | Delete
}
[40] Fix | Delete
[41] Fix | Delete
if ( empty( $tag->name ) ) {
[42] Fix | Delete
return '';
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
$class = wpcf7_form_controls_class( $tag->type );
[46] Fix | Delete
$class .= ' wpcf7-captcha-' . str_replace( ':', '', $tag->name );
[47] Fix | Delete
[48] Fix | Delete
$atts = array();
[49] Fix | Delete
$atts['class'] = $tag->get_class_option( $class );
[50] Fix | Delete
$atts['id'] = $tag->get_id_option();
[51] Fix | Delete
[52] Fix | Delete
$op = array( // Default
[53] Fix | Delete
'img_size' => array( 72, 24 ),
[54] Fix | Delete
'base' => array( 6, 18 ),
[55] Fix | Delete
'font_size' => 14,
[56] Fix | Delete
'font_char_width' => 15,
[57] Fix | Delete
);
[58] Fix | Delete
[59] Fix | Delete
$op = array_merge( $op, wpcf7_captchac_options( $tag->options ) );
[60] Fix | Delete
[61] Fix | Delete
if ( ! $filename = wpcf7_generate_captcha( $op ) ) {
[62] Fix | Delete
return '';
[63] Fix | Delete
}
[64] Fix | Delete
[65] Fix | Delete
if ( ! empty( $op['img_size'] ) ) {
[66] Fix | Delete
if ( isset( $op['img_size'][0] ) ) {
[67] Fix | Delete
$atts['width'] = $op['img_size'][0];
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
if ( isset( $op['img_size'][1] ) ) {
[71] Fix | Delete
$atts['height'] = $op['img_size'][1];
[72] Fix | Delete
}
[73] Fix | Delete
}
[74] Fix | Delete
[75] Fix | Delete
$atts['alt'] = 'captcha';
[76] Fix | Delete
$atts['src'] = wpcf7_captcha_url( $filename );
[77] Fix | Delete
[78] Fix | Delete
$atts = wpcf7_format_atts( $atts );
[79] Fix | Delete
[80] Fix | Delete
$prefix = substr( $filename, 0, strrpos( $filename, '.' ) );
[81] Fix | Delete
[82] Fix | Delete
$html = sprintf(
[83] Fix | Delete
'<input type="hidden" name="%1$s" value="%2$s" /><img %3$s />',
[84] Fix | Delete
esc_attr( sprintf( '_wpcf7_captcha_challenge_%s', $tag->name ) ),
[85] Fix | Delete
esc_attr( $prefix ),
[86] Fix | Delete
$atts
[87] Fix | Delete
);
[88] Fix | Delete
[89] Fix | Delete
return $html;
[90] Fix | Delete
}
[91] Fix | Delete
[92] Fix | Delete
function wpcf7_captchar_form_tag_handler( $tag ) {
[93] Fix | Delete
if ( empty( $tag->name ) ) {
[94] Fix | Delete
return '';
[95] Fix | Delete
}
[96] Fix | Delete
[97] Fix | Delete
$validation_error = wpcf7_get_validation_error( $tag->name );
[98] Fix | Delete
[99] Fix | Delete
$class = wpcf7_form_controls_class( $tag->type );
[100] Fix | Delete
[101] Fix | Delete
if ( $validation_error ) {
[102] Fix | Delete
$class .= ' wpcf7-not-valid';
[103] Fix | Delete
}
[104] Fix | Delete
[105] Fix | Delete
$atts = array();
[106] Fix | Delete
[107] Fix | Delete
$atts['size'] = $tag->get_size_option( '40' );
[108] Fix | Delete
$atts['maxlength'] = $tag->get_maxlength_option();
[109] Fix | Delete
$atts['minlength'] = $tag->get_minlength_option();
[110] Fix | Delete
[111] Fix | Delete
if ( $atts['maxlength'] and $atts['minlength']
[112] Fix | Delete
and $atts['maxlength'] < $atts['minlength'] ) {
[113] Fix | Delete
unset( $atts['maxlength'], $atts['minlength'] );
[114] Fix | Delete
}
[115] Fix | Delete
[116] Fix | Delete
$atts['class'] = $tag->get_class_option( $class );
[117] Fix | Delete
$atts['id'] = $tag->get_id_option();
[118] Fix | Delete
$atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true );
[119] Fix | Delete
$atts['autocomplete'] = 'off';
[120] Fix | Delete
[121] Fix | Delete
if ( $validation_error ) {
[122] Fix | Delete
$atts['aria-invalid'] = 'true';
[123] Fix | Delete
$atts['aria-describedby'] = wpcf7_get_validation_error_reference(
[124] Fix | Delete
$tag->name
[125] Fix | Delete
);
[126] Fix | Delete
} else {
[127] Fix | Delete
$atts['aria-invalid'] = 'false';
[128] Fix | Delete
}
[129] Fix | Delete
[130] Fix | Delete
$value = (string) reset( $tag->values );
[131] Fix | Delete
[132] Fix | Delete
if ( wpcf7_is_posted() ) {
[133] Fix | Delete
$value = '';
[134] Fix | Delete
}
[135] Fix | Delete
[136] Fix | Delete
if ( $tag->has_option( 'placeholder' )
[137] Fix | Delete
or $tag->has_option( 'watermark' ) ) {
[138] Fix | Delete
$atts['placeholder'] = $value;
[139] Fix | Delete
$value = '';
[140] Fix | Delete
}
[141] Fix | Delete
[142] Fix | Delete
$atts['value'] = $value;
[143] Fix | Delete
$atts['type'] = 'text';
[144] Fix | Delete
$atts['name'] = $tag->name;
[145] Fix | Delete
[146] Fix | Delete
$html = sprintf(
[147] Fix | Delete
'<span class="wpcf7-form-control-wrap" data-name="%1$s"><input %2$s />%3$s</span>',
[148] Fix | Delete
esc_attr( $tag->name ),
[149] Fix | Delete
wpcf7_format_atts( $atts ),
[150] Fix | Delete
$validation_error
[151] Fix | Delete
);
[152] Fix | Delete
[153] Fix | Delete
return $html;
[154] Fix | Delete
}
[155] Fix | Delete
[156] Fix | Delete
[157] Fix | Delete
/* Validation filter */
[158] Fix | Delete
[159] Fix | Delete
add_filter( 'wpcf7_validate_captchar',
[160] Fix | Delete
'wpcf7_captcha_validation_filter', 10, 2 );
[161] Fix | Delete
[162] Fix | Delete
function wpcf7_captcha_validation_filter( $result, $tag ) {
[163] Fix | Delete
$type = $tag->type;
[164] Fix | Delete
$name = $tag->name;
[165] Fix | Delete
[166] Fix | Delete
$captchac = '_wpcf7_captcha_challenge_' . $name;
[167] Fix | Delete
[168] Fix | Delete
$prefix = (string) ( $_POST[$captchac] ?? '' );
[169] Fix | Delete
$response = (string) ( $_POST[$name] ?? '' );
[170] Fix | Delete
$response = wpcf7_canonicalize( $response );
[171] Fix | Delete
[172] Fix | Delete
if ( 0 === strlen( $prefix )
[173] Fix | Delete
or ! wpcf7_check_captcha( $prefix, $response ) ) {
[174] Fix | Delete
$result->invalidate( $tag, wpcf7_get_message( 'captcha_not_match' ) );
[175] Fix | Delete
}
[176] Fix | Delete
[177] Fix | Delete
if ( 0 !== strlen( $prefix ) ) {
[178] Fix | Delete
wpcf7_remove_captcha( $prefix );
[179] Fix | Delete
}
[180] Fix | Delete
[181] Fix | Delete
return $result;
[182] Fix | Delete
}
[183] Fix | Delete
[184] Fix | Delete
[185] Fix | Delete
/* Ajax echo filter */
[186] Fix | Delete
[187] Fix | Delete
add_filter( 'wpcf7_refill_response', 'wpcf7_captcha_ajax_refill', 10, 1 );
[188] Fix | Delete
add_filter( 'wpcf7_feedback_response', 'wpcf7_captcha_ajax_refill', 10, 1 );
[189] Fix | Delete
[190] Fix | Delete
function wpcf7_captcha_ajax_refill( $items ) {
[191] Fix | Delete
if ( ! is_array( $items ) ) {
[192] Fix | Delete
return $items;
[193] Fix | Delete
}
[194] Fix | Delete
[195] Fix | Delete
$tags = wpcf7_scan_form_tags( array( 'type' => 'captchac' ) );
[196] Fix | Delete
[197] Fix | Delete
if ( empty( $tags ) ) {
[198] Fix | Delete
return $items;
[199] Fix | Delete
}
[200] Fix | Delete
[201] Fix | Delete
$refill = array();
[202] Fix | Delete
[203] Fix | Delete
foreach ( $tags as $tag ) {
[204] Fix | Delete
$name = $tag->name;
[205] Fix | Delete
$options = $tag->options;
[206] Fix | Delete
[207] Fix | Delete
if ( empty( $name ) ) {
[208] Fix | Delete
continue;
[209] Fix | Delete
}
[210] Fix | Delete
[211] Fix | Delete
$op = wpcf7_captchac_options( $options );
[212] Fix | Delete
[213] Fix | Delete
if ( $filename = wpcf7_generate_captcha( $op ) ) {
[214] Fix | Delete
$captcha_url = wpcf7_captcha_url( $filename );
[215] Fix | Delete
$refill[$name] = $captcha_url;
[216] Fix | Delete
}
[217] Fix | Delete
}
[218] Fix | Delete
[219] Fix | Delete
if ( ! empty( $refill ) ) {
[220] Fix | Delete
$items['captcha'] = $refill;
[221] Fix | Delete
}
[222] Fix | Delete
[223] Fix | Delete
return $items;
[224] Fix | Delete
}
[225] Fix | Delete
[226] Fix | Delete
[227] Fix | Delete
/* Messages */
[228] Fix | Delete
[229] Fix | Delete
add_filter( 'wpcf7_messages', 'wpcf7_captcha_messages', 10, 1 );
[230] Fix | Delete
[231] Fix | Delete
function wpcf7_captcha_messages( $messages ) {
[232] Fix | Delete
$messages = array_merge( $messages, array(
[233] Fix | Delete
'captcha_not_match' => array(
[234] Fix | Delete
'description' =>
[235] Fix | Delete
__( "The code that sender entered does not match the CAPTCHA", 'contact-form-7' ),
[236] Fix | Delete
'default' =>
[237] Fix | Delete
__( 'Your entered code is incorrect.', 'contact-form-7' ),
[238] Fix | Delete
),
[239] Fix | Delete
) );
[240] Fix | Delete
[241] Fix | Delete
return $messages;
[242] Fix | Delete
}
[243] Fix | Delete
[244] Fix | Delete
[245] Fix | Delete
/* Tag generator */
[246] Fix | Delete
[247] Fix | Delete
add_action( 'wpcf7_admin_init', 'wpcf7_add_tag_generator_captcha', 46, 0 );
[248] Fix | Delete
[249] Fix | Delete
function wpcf7_add_tag_generator_captcha() {
[250] Fix | Delete
if ( ! wpcf7_use_really_simple_captcha() ) {
[251] Fix | Delete
return;
[252] Fix | Delete
}
[253] Fix | Delete
[254] Fix | Delete
$tag_generator = WPCF7_TagGenerator::get_instance();
[255] Fix | Delete
$tag_generator->add( 'captcha',
[256] Fix | Delete
__( 'CAPTCHA (Really Simple CAPTCHA)', 'contact-form-7' ),
[257] Fix | Delete
'wpcf7_tag_generator_captcha' );
[258] Fix | Delete
}
[259] Fix | Delete
[260] Fix | Delete
function wpcf7_tag_generator_captcha( $contact_form, $args = '' ) {
[261] Fix | Delete
$args = wp_parse_args( $args, array() );
[262] Fix | Delete
[263] Fix | Delete
if ( ! class_exists( 'ReallySimpleCaptcha' ) ) {
[264] Fix | Delete
?>
[265] Fix | Delete
<div class="control-box">
[266] Fix | Delete
<fieldset>
[267] Fix | Delete
<legend><?php
[268] Fix | Delete
echo sprintf(
[269] Fix | Delete
/* translators: %s: link labeled 'Really Simple CAPTCHA' */
[270] Fix | Delete
esc_html( __( "To use CAPTCHA, you first need to install and activate %s plugin.", 'contact-form-7' ) ),
[271] Fix | Delete
wpcf7_link( 'https://wordpress.org/plugins/really-simple-captcha/', 'Really Simple CAPTCHA' )
[272] Fix | Delete
);
[273] Fix | Delete
?></legend>
[274] Fix | Delete
</fieldset>
[275] Fix | Delete
</div>
[276] Fix | Delete
<?php
[277] Fix | Delete
[278] Fix | Delete
return;
[279] Fix | Delete
}
[280] Fix | Delete
[281] Fix | Delete
$description = __( "Generate form-tags for a CAPTCHA image and corresponding response input field. For more details, see %s.", 'contact-form-7' );
[282] Fix | Delete
[283] Fix | Delete
$desc_link = wpcf7_link( __( 'https://contactform7.com/captcha/', 'contact-form-7' ), __( 'CAPTCHA', 'contact-form-7' ) );
[284] Fix | Delete
[285] Fix | Delete
?>
[286] Fix | Delete
<div class="control-box">
[287] Fix | Delete
<fieldset>
[288] Fix | Delete
<legend><?php echo sprintf( esc_html( $description ), $desc_link ); ?></legend>
[289] Fix | Delete
[290] Fix | Delete
<table class="form-table">
[291] Fix | Delete
<tbody>
[292] Fix | Delete
<tr>
[293] Fix | Delete
<th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-name' ); ?>"><?php echo esc_html( __( 'Name', 'contact-form-7' ) ); ?></label></th>
[294] Fix | Delete
<td><input type="text" name="name" class="tg-name oneline" id="<?php echo esc_attr( $args['content'] . '-name' ); ?>" /></td>
[295] Fix | Delete
</tr>
[296] Fix | Delete
</tbody>
[297] Fix | Delete
</table>
[298] Fix | Delete
[299] Fix | Delete
<table class="form-table scope captchac">
[300] Fix | Delete
<caption><?php echo esc_html( __( "Image settings", 'contact-form-7' ) ); ?></caption>
[301] Fix | Delete
<tbody>
[302] Fix | Delete
<tr>
[303] Fix | Delete
<th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-captchac-id' ); ?>"><?php echo esc_html( __( 'Id attribute', 'contact-form-7' ) ); ?></label></th>
[304] Fix | Delete
<td><input type="text" name="id" class="idvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-captchac-id' ); ?>" /></td>
[305] Fix | Delete
</tr>
[306] Fix | Delete
[307] Fix | Delete
<tr>
[308] Fix | Delete
<th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-captchac-class' ); ?>"><?php echo esc_html( __( 'Class attribute', 'contact-form-7' ) ); ?></label></th>
[309] Fix | Delete
<td><input type="text" name="class" class="classvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-captchac-class' ); ?>" /></td>
[310] Fix | Delete
</tr>
[311] Fix | Delete
</tbody>
[312] Fix | Delete
</table>
[313] Fix | Delete
[314] Fix | Delete
<table class="form-table scope captchar">
[315] Fix | Delete
<caption><?php echo esc_html( __( "Input field settings", 'contact-form-7' ) ); ?></caption>
[316] Fix | Delete
<tbody>
[317] Fix | Delete
<tr>
[318] Fix | Delete
<th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-captchar-id' ); ?>"><?php echo esc_html( __( 'Id attribute', 'contact-form-7' ) ); ?></label></th>
[319] Fix | Delete
<td><input type="text" name="id" class="idvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-captchar-id' ); ?>" /></td>
[320] Fix | Delete
</tr>
[321] Fix | Delete
[322] Fix | Delete
<tr>
[323] Fix | Delete
<th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-captchar-class' ); ?>"><?php echo esc_html( __( 'Class attribute', 'contact-form-7' ) ); ?></label></th>
[324] Fix | Delete
<td><input type="text" name="class" class="classvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-captchar-class' ); ?>" /></td>
[325] Fix | Delete
</tr>
[326] Fix | Delete
</tbody>
[327] Fix | Delete
</table>
[328] Fix | Delete
</fieldset>
[329] Fix | Delete
</div>
[330] Fix | Delete
[331] Fix | Delete
<div class="insert-box">
[332] Fix | Delete
<input type="text" name="captcha" class="tag code" readonly="readonly" onfocus="this.select()" />
[333] Fix | Delete
[334] Fix | Delete
<div class="submitbox">
[335] Fix | Delete
<input type="button" class="button button-primary insert-tag" value="<?php echo esc_attr( __( 'Insert Tag', 'contact-form-7' ) ); ?>" />
[336] Fix | Delete
</div>
[337] Fix | Delete
</div>
[338] Fix | Delete
<?php
[339] Fix | Delete
}
[340] Fix | Delete
[341] Fix | Delete
[342] Fix | Delete
/* Warning message */
[343] Fix | Delete
[344] Fix | Delete
add_action( 'wpcf7_admin_warnings',
[345] Fix | Delete
'wpcf7_captcha_display_warning_message', 10, 3 );
[346] Fix | Delete
[347] Fix | Delete
function wpcf7_captcha_display_warning_message( $page, $action, $object ) {
[348] Fix | Delete
if ( $object instanceof WPCF7_ContactForm ) {
[349] Fix | Delete
$contact_form = $object;
[350] Fix | Delete
} else {
[351] Fix | Delete
return;
[352] Fix | Delete
}
[353] Fix | Delete
[354] Fix | Delete
$has_tags = (bool) $contact_form->scan_form_tags(
[355] Fix | Delete
array( 'type' => array( 'captchac' ) ) );
[356] Fix | Delete
[357] Fix | Delete
if ( ! $has_tags ) {
[358] Fix | Delete
return;
[359] Fix | Delete
}
[360] Fix | Delete
[361] Fix | Delete
if ( ! class_exists( 'ReallySimpleCaptcha' ) ) {
[362] Fix | Delete
return;
[363] Fix | Delete
}
[364] Fix | Delete
[365] Fix | Delete
$uploads_dir = wpcf7_captcha_tmp_dir();
[366] Fix | Delete
wpcf7_init_captcha();
[367] Fix | Delete
[368] Fix | Delete
if ( ! is_dir( $uploads_dir )
[369] Fix | Delete
or ! wp_is_writable( $uploads_dir ) ) {
[370] Fix | Delete
$message = sprintf( __( 'This contact form contains CAPTCHA fields, but the temporary folder for the files (%s) does not exist or is not writable. You can create the folder or change its permission manually.', 'contact-form-7' ), $uploads_dir );
[371] Fix | Delete
[372] Fix | Delete
echo '<div class="notice notice-warning"><p>' . esc_html( $message ) . '</p></div>';
[373] Fix | Delete
}
[374] Fix | Delete
[375] Fix | Delete
if ( ! function_exists( 'imagecreatetruecolor' )
[376] Fix | Delete
or ! function_exists( 'imagettftext' ) ) {
[377] Fix | Delete
$message = __( "This contact form contains CAPTCHA fields, but the necessary libraries (GD and FreeType) are not available on your server.", 'contact-form-7' );
[378] Fix | Delete
[379] Fix | Delete
echo '<div class="notice notice-warning"><p>' . esc_html( $message ) . '</p></div>';
[380] Fix | Delete
}
[381] Fix | Delete
}
[382] Fix | Delete
[383] Fix | Delete
[384] Fix | Delete
/* CAPTCHA functions */
[385] Fix | Delete
[386] Fix | Delete
function wpcf7_init_captcha() {
[387] Fix | Delete
static $captcha = null;
[388] Fix | Delete
[389] Fix | Delete
if ( $captcha ) {
[390] Fix | Delete
return $captcha;
[391] Fix | Delete
}
[392] Fix | Delete
[393] Fix | Delete
if ( class_exists( 'ReallySimpleCaptcha' ) ) {
[394] Fix | Delete
$captcha = new ReallySimpleCaptcha();
[395] Fix | Delete
} else {
[396] Fix | Delete
return false;
[397] Fix | Delete
}
[398] Fix | Delete
[399] Fix | Delete
$dir = trailingslashit( wpcf7_captcha_tmp_dir() );
[400] Fix | Delete
[401] Fix | Delete
$captcha->tmp_dir = $dir;
[402] Fix | Delete
[403] Fix | Delete
if ( is_callable( array( $captcha, 'make_tmp_dir' ) ) ) {
[404] Fix | Delete
$result = $captcha->make_tmp_dir();
[405] Fix | Delete
[406] Fix | Delete
if ( ! $result ) {
[407] Fix | Delete
return false;
[408] Fix | Delete
}
[409] Fix | Delete
[410] Fix | Delete
return $captcha;
[411] Fix | Delete
}
[412] Fix | Delete
[413] Fix | Delete
$result = wp_mkdir_p( $dir );
[414] Fix | Delete
[415] Fix | Delete
if ( ! $result ) {
[416] Fix | Delete
return false;
[417] Fix | Delete
}
[418] Fix | Delete
[419] Fix | Delete
$htaccess_file = path_join( $dir, '.htaccess' );
[420] Fix | Delete
[421] Fix | Delete
if ( file_exists( $htaccess_file ) ) {
[422] Fix | Delete
list( $first_line_comment ) = (array) file(
[423] Fix | Delete
$htaccess_file,
[424] Fix | Delete
FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES
[425] Fix | Delete
);
[426] Fix | Delete
[427] Fix | Delete
if ( '# Apache 2.4+' === $first_line_comment ) {
[428] Fix | Delete
return $captcha;
[429] Fix | Delete
}
[430] Fix | Delete
}
[431] Fix | Delete
[432] Fix | Delete
if ( $handle = @fopen( $htaccess_file, 'w' ) ) {
[433] Fix | Delete
fwrite( $handle, "# Apache 2.4+\n" );
[434] Fix | Delete
fwrite( $handle, "<IfModule authz_core_module>\n" );
[435] Fix | Delete
fwrite( $handle, " Require all denied\n" );
[436] Fix | Delete
fwrite( $handle, ' <FilesMatch "^\w+\.(jpe?g|gif|png)$">' . "\n" );
[437] Fix | Delete
fwrite( $handle, " Require all granted\n" );
[438] Fix | Delete
fwrite( $handle, " </FilesMatch>\n" );
[439] Fix | Delete
fwrite( $handle, "</IfModule>\n" );
[440] Fix | Delete
fwrite( $handle, "\n" );
[441] Fix | Delete
fwrite( $handle, "# Apache 2.2\n" );
[442] Fix | Delete
fwrite( $handle, "<IfModule !authz_core_module>\n" );
[443] Fix | Delete
fwrite( $handle, " Order deny,allow\n" );
[444] Fix | Delete
fwrite( $handle, " Deny from all\n" );
[445] Fix | Delete
fwrite( $handle, ' <FilesMatch "^\w+\.(jpe?g|gif|png)$">' . "\n" );
[446] Fix | Delete
fwrite( $handle, " Allow from all\n" );
[447] Fix | Delete
fwrite( $handle, " </FilesMatch>\n" );
[448] Fix | Delete
fwrite( $handle, "</IfModule>\n" );
[449] Fix | Delete
[450] Fix | Delete
fclose( $handle );
[451] Fix | Delete
}
[452] Fix | Delete
[453] Fix | Delete
return $captcha;
[454] Fix | Delete
}
[455] Fix | Delete
[456] Fix | Delete
[457] Fix | Delete
/**
[458] Fix | Delete
* Returns the directory path for Really Simple CAPTCHA files.
[459] Fix | Delete
*
[460] Fix | Delete
* @return string Directory path.
[461] Fix | Delete
*/
[462] Fix | Delete
function wpcf7_captcha_tmp_dir() {
[463] Fix | Delete
if ( defined( 'WPCF7_CAPTCHA_TMP_DIR' ) ) {
[464] Fix | Delete
$dir = path_join( WP_CONTENT_DIR, WPCF7_CAPTCHA_TMP_DIR );
[465] Fix | Delete
wp_mkdir_p( $dir );
[466] Fix | Delete
[467] Fix | Delete
if ( wpcf7_is_file_path_in_content_dir( $dir ) ) {
[468] Fix | Delete
return $dir;
[469] Fix | Delete
}
[470] Fix | Delete
}
[471] Fix | Delete
[472] Fix | Delete
$dir = path_join( wpcf7_upload_dir( 'dir' ), 'wpcf7_captcha' );
[473] Fix | Delete
wp_mkdir_p( $dir );
[474] Fix | Delete
return $dir;
[475] Fix | Delete
}
[476] Fix | Delete
[477] Fix | Delete
[478] Fix | Delete
function wpcf7_captcha_tmp_url() {
[479] Fix | Delete
if ( defined( 'WPCF7_CAPTCHA_TMP_URL' ) ) {
[480] Fix | Delete
return WPCF7_CAPTCHA_TMP_URL;
[481] Fix | Delete
} else {
[482] Fix | Delete
return path_join( wpcf7_upload_dir( 'url' ), 'wpcf7_captcha' );
[483] Fix | Delete
}
[484] Fix | Delete
}
[485] Fix | Delete
[486] Fix | Delete
function wpcf7_captcha_url( $filename ) {
[487] Fix | Delete
$url = path_join( wpcf7_captcha_tmp_url(), $filename );
[488] Fix | Delete
[489] Fix | Delete
if ( is_ssl()
[490] Fix | Delete
and 'http:' == substr( $url, 0, 5 ) ) {
[491] Fix | Delete
$url = 'https:' . substr( $url, 5 );
[492] Fix | Delete
}
[493] Fix | Delete
[494] Fix | Delete
return apply_filters( 'wpcf7_captcha_url', sanitize_url( $url ) );
[495] Fix | Delete
}
[496] Fix | Delete
[497] Fix | Delete
function wpcf7_generate_captcha( $options = null ) {
[498] Fix | Delete
if ( ! $captcha = wpcf7_init_captcha() ) {
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function