\n"; echo '

\n"; $prevalue = esc_textarea($prevalue); echo ' '; if (strlen(trim($howtotext))) { echo '

'; echo $howtotext; echo "

\n"; } } else { echo _('Invalid call to pirate_rogue_form_textarea() - name or label is missing.', 'pirate-rogue'); } } endif; if ( ! function_exists( 'pirate_rogue_form_wpeditor' ) ) : function pirate_rogue_form_wpeditor($name= '', $prevalue = '', $labeltext = '', $howtotext = '', $small = true) { $name = pirate_rogue_san( $name ); $labeltext = pirate_rogue_san( $labeltext ); if (isset($name) && isset($labeltext)) { echo "

\n"; echo '

\n"; if ($small==true) { wp_editor( $prevalue, $name, array('teeny' => true, 'textarea_rows' => 5, 'media_buttons' => false) ); } else { wp_editor( $prevalue, $name ); } if (strlen(trim($howtotext))) { echo '

'; echo $howtotext; echo "

\n"; } } else { echo _('Invalid call to pirate_rogue_form_wpeditor() - name or label is missing.', 'pirate-rogue'); } } endif; if ( ! function_exists( 'pirate_rogue_form_text' ) ) : function pirate_rogue_form_text($name= '', $prevalue = '', $labeltext = '', $howtotext = '', $placeholder='', $size = 0) { $name = pirate_rogue_san( $name ); $labeltext = pirate_rogue_san( $labeltext ); if (isset($name) && isset($labeltext)) { echo "

\n"; echo '
\n"; echo ' 0) { echo ' size="'.$size.'"'; } else { echo ' class="large-text"'; } echo ' name="'.$name.'" id="'.$name.'" value="'.$prevalue.'"'; if (strlen(trim($placeholder))) { echo ' placeholder="'.$placeholder.'"'; } echo " />\n"; echo "

\n"; if (strlen(trim($howtotext))) { echo '

'; echo $howtotext; echo "

\n"; } } else { echo _('Invalid call to pirate_rogue_form_text() - name or label is missing.', 'pirate-rogue'); } } endif; if ( ! function_exists( 'pirate_rogue_form_email' ) ) : function pirate_rogue_form_email($name= '', $prevalue = '', $labeltext = '', $howtotext = '', $placeholder='', $size = 0) { $name = pirate_rogue_san( $name ); $labeltext = pirate_rogue_san( $labeltext ); if (isset($name) && isset($labeltext)) { echo "

\n"; echo '
\n"; echo ' 0) { echo ' size="'.$size.'"'; } else { echo ' class="large-text"'; } echo ' name="'.$name.'" id="'.$name.'" value="'.$prevalue.'"'; if (strlen(trim($placeholder))) { echo ' placeholder="'.$placeholder.'"'; } echo " />\n"; echo "

\n"; if (strlen(trim($howtotext))) { echo '

'; echo $howtotext; echo "

\n"; } } else { echo _('Invalid call to pirate_rogue_form_email() - name or label is missing.', 'pirate-rogue'); } } endif; if ( ! function_exists( 'pirate_rogue_form_number' ) ) : function pirate_rogue_form_number($name= '', $prevalue = '', $labeltext = '', $howtotext = '', $min = 0, $max = 0, $step=1) { $name = pirate_rogue_san( $name ); $labeltext = pirate_rogue_san( $labeltext ); if (isset($name) && isset($labeltext)) { echo "

\n"; echo '
\n"; echo ' 0) { echo ' min="'.$min.'"'; } if ($max>0) { echo ' max="'.$max.'"'; } if ($step>1) { echo ' step="'.$step.'"'; } echo " />\n"; echo "

\n"; if (strlen(trim($howtotext))) { echo '

'; echo $howtotext; echo "

\n"; } } else { echo _('Invalid call to pirate_rogue_form_number() - name or label is missing.', 'pirate-rogue'); } } endif; if ( ! function_exists( 'pirate_rogue_form_url' ) ) : function pirate_rogue_form_url($name= '', $prevalue = '', $labeltext = '', $howtotext = '', $placeholder='http://', $size = 0) { $name = pirate_rogue_san( $name ); $labeltext = pirate_rogue_san( $labeltext ); if (isset($name) && isset($labeltext)) { echo "

\n"; echo '
\n"; echo ' 0) { echo ' length="'.$size.'"'; } echo " />\n"; echo "

\n"; if (strlen(trim($howtotext))) { echo '

'; echo $howtotext; echo "

\n"; } } else { echo _('Invalid call to pirate_rogue_form_url() - name or label is missing.', 'pirate-rogue'); } } endif; if ( ! function_exists( 'pirate_rogue_form_onoff' ) ) : function pirate_rogue_form_onoff($name= '', $prevalue = 0, $labeltext = '', $howtotext = '' ) { $name = pirate_rogue_san( $name ); $labeltext = pirate_rogue_san( $labeltext ); if (isset($name) && isset($labeltext)) { ?>
'; echo $howtotext; echo "

\n"; } } else { echo _('Invalid call to pirate_rogue_form_onoff() - name or label is missing.', 'pirate-rogue'); } } endif; if ( ! function_exists( 'pirate_rogue_form_select' ) ) : function pirate_rogue_form_select($name= '', $liste = array(), $prevalue, $labeltext = '', $howtotext = '', $showempty=1, $emptytext = '' ) { $name = pirate_rogue_san( $name ); $labeltext = pirate_rogue_san( $labeltext ); $emptytext = pirate_rogue_san( $emptytext ); if (is_array($liste) && isset($name) && isset($labeltext)) { ?>

'; echo $howtotext; echo "

\n"; } } else { echo _('Invalid call to pirate_rogue_form_select() - array, name or label is missing.', 'pirate-rogue'); } } endif; if ( ! function_exists( 'pirate_rogue_form_multiselect' ) ) : function pirate_rogue_form_multiselect($name= '', $liste = array(), $prevalues = array(), $labeltext = '', $howtotext = '', $showempty=1, $emptytext = '' ) { $name = pirate_rogue_san( $name ); $labeltext = pirate_rogue_san( $labeltext ); $emptytext = pirate_rogue_san( $emptytext ); if (is_array($liste) && isset($name) && isset($labeltext)) { ?>

'; echo $howtotext; echo "

\n"; } } else { echo _('Invalid call to pirate_rogue_form_multiselect() - array, name or label is missing.', 'pirate-rogue'); } } endif; if ( ! function_exists( 'pirate_rogue_form_image' ) ) : function pirate_rogue_form_image($name= '', $preimageid = 0, $labeltext = '', $howtotext = '', $width=300, $height=200 ) { $name = pirate_rogue_san( $name ); $labeltext = pirate_rogue_san( $labeltext ); if (isset($name) && isset($labeltext)) { echo '

\n"; echo '
'; $image = ''; $imagehtml = ''; if (isset($preimageid) && ($preimageid>0)) { $image = wp_get_attachment_image_src($preimageid, 'full'); if (isset($image)) { $imagehtml = ''; } } echo '
'; if (!empty($imagehtml)) { echo $imagehtml; } echo "
\n"; ?>

'; $rand = rand(); echo '

'.$labeltext.'

'; if (strlen(trim($howtotext))) { echo '

'; echo $howtotext; echo "

\n"; } echo '
'; echo "

\n"; echo '
\n"; echo ''; echo "

\n"; echo "

\n"; echo '
\n"; echo ''; echo "

"; echo '

'; echo "
\n"; ?> \n"; } else { echo _('Invalid call to pirate_rogue_form_link() - name or label is missing.', 'pirate-rogue'); } } endif; if ( ! function_exists( 'pirate_rogue_save_standard' ) ) : function pirate_rogue_save_standard($name, $val, $post_id, $post_type, $type='text') { if (isset($name) && isset($post_id) && isset($post_type)) { if ($type == 'url') { $newval = ( isset( $val ) ? esc_url( $val ) : 0 ); } elseif ($type == 'email') { $newval = ( isset( $val ) ? sanitize_email( $val ) : 0 ); } elseif ($type == 'int') { $newval = ( isset( $val ) ? intval( $val ) : 0 ); } elseif ($type == 'text') { $newval = ( isset( $val ) ? sanitize_text_field( $val ) : 0 ); } elseif ($type == 'textnohtml') { $newval = ( isset( $val ) ? wp_strip_all_tags( $val ) : 0 ); } elseif ($type == 'textarea') { $newval = ( isset( $val ) ? esc_textarea( $val ) : 0 ); } elseif ($type == 'wpeditor') { $newval = wp_kses_post($val); } else { $newval = ( isset( $val ) ? sanitize_text_field( $val ) : 0 ); } $oldval = get_post_meta( $post_id, $name, true ); if (!empty($newval)) { update_post_meta( $post_id, $name, $newval ); } elseif ($oldval) { delete_post_meta( $post_id, $name, $oldval ); } } else { return false; } } endif; if ( ! function_exists( 'pirate_rogue_san' ) ) : function pirate_rogue_san($s){ return filter_var(trim($s), FILTER_SANITIZE_STRING); } endif;