Best Atoum code snippet using html
class-gf-field-address.php
Source:class-gf-field-address.php
...44 || ( empty( $state ) && ! ( $this->hideState || $this->get_input_property( $this->id . '.4', 'isHidden' ) ) )45 || ( empty( $country ) && ! ( $this->hideCountry || $this->get_input_property( $this->id . '.6', 'isHidden' ) ) )46 ) {47 $this->failed_validation = true;48 $this->validation_message = empty( $this->errorMessage ) ? esc_html__( 'This field is required. Please enter a complete address.', 'gravityforms' ) : $this->errorMessage;49 }50 }51 }52 public function get_value_submission( $field_values, $get_from_post_global_var = true ) {53 $value = parent::get_value_submission( $field_values, $get_from_post_global_var );54 $value[ $this->id . '_copy_values_activated' ] = (bool) rgpost( 'input_' . $this->id . '_copy_values_activated' );55 return $value;56 }57 public function get_field_input( $form, $value = '', $entry = null ) {58 $is_entry_detail = $this->is_entry_detail();59 $is_form_editor = $this->is_form_editor();60 $is_admin = $is_entry_detail || $is_form_editor;61 $form_id = absint( $form['id'] );62 $id = intval( $this->id );63 $field_id = $is_entry_detail || $is_form_editor || $form_id == 0 ? "input_$id" : 'input_' . $form_id . "_$id";64 $form_id = ( $is_entry_detail || $is_form_editor ) && empty( $form_id ) ? rgget( 'id' ) : $form_id;65 $disabled_text = $is_form_editor ? "disabled='disabled'" : '';66 $class_suffix = $is_entry_detail ? '_admin' : '';67 $form_sub_label_placement = rgar( $form, 'subLabelPlacement' );68 $field_sub_label_placement = $this->subLabelPlacement;69 $is_sub_label_above = $field_sub_label_placement == 'above' || ( empty( $field_sub_label_placement ) && $form_sub_label_placement == 'above' );70 $sub_label_class_attribute = $field_sub_label_placement == 'hidden_label' ? "class='hidden_sub_label screen-reader-text'" : '';71 $street_value = '';72 $street2_value = '';73 $city_value = '';74 $state_value = '';75 $zip_value = '';76 $country_value = '';77 if ( is_array( $value ) ) {78 $street_value = esc_attr( rgget( $this->id . '.1', $value ) );79 $street2_value = esc_attr( rgget( $this->id . '.2', $value ) );80 $city_value = esc_attr( rgget( $this->id . '.3', $value ) );81 $state_value = esc_attr( rgget( $this->id . '.4', $value ) );82 $zip_value = esc_attr( rgget( $this->id . '.5', $value ) );83 $country_value = esc_attr( rgget( $this->id . '.6', $value ) );84 }85 //Inputs86 $address_street_field_input = GFFormsModel::get_input( $this, $this->id . '.1' );87 $address_street2_field_input = GFFormsModel::get_input( $this, $this->id . '.2' );88 $address_city_field_input = GFFormsModel::get_input( $this, $this->id . '.3' );89 $address_state_field_input = GFFormsModel::get_input( $this, $this->id . '.4' );90 $address_zip_field_input = GFFormsModel::get_input( $this, $this->id . '.5' );91 $address_country_field_input = GFFormsModel::get_input( $this, $this->id . '.6' );92 //Placeholders93 $street_placeholder_attribute = GFCommon::get_input_placeholder_attribute( $address_street_field_input );94 $street2_placeholder_attribute = GFCommon::get_input_placeholder_attribute( $address_street2_field_input );95 $city_placeholder_attribute = GFCommon::get_input_placeholder_attribute( $address_city_field_input );96 $zip_placeholder_attribute = GFCommon::get_input_placeholder_attribute( $address_zip_field_input );97 $address_types = $this->get_address_types( $form_id );98 $addr_type = empty( $this->addressType ) ? 'international' : $this->addressType;99 $address_type = $address_types[ $addr_type ];100 $state_label = empty( $address_type['state_label'] ) ? esc_html__( 'State', 'gravityforms' ) : $address_type['state_label'];101 $zip_label = empty( $address_type['zip_label'] ) ? esc_html__( 'Zip Code', 'gravityforms' ) : $address_type['zip_label'];102 $hide_country = ! empty( $address_type['country'] ) || $this->hideCountry || rgar( $address_country_field_input, 'isHidden' );103 if ( empty( $country_value ) ) {104 $country_value = $this->defaultCountry;105 }106 if ( empty( $state_value ) ) {107 $state_value = $this->defaultState;108 }109 $country_placeholder = GFCommon::get_input_placeholder_value( $address_country_field_input );110 $country_list = $this->get_country_dropdown( $country_value, $country_placeholder );111 //changing css classes based on field format to ensure proper display112 $address_display_format = apply_filters( 'gform_address_display_format', 'default', $this );113 $city_location = $address_display_format == 'zip_before_city' ? 'right' : 'left';114 $zip_location = $address_display_format != 'zip_before_city' && ( $this->hideState || rgar( $address_state_field_input, 'isHidden' ) ) ? 'right' : 'left'; // support for $this->hideState legacy property115 $state_location = $address_display_format == 'zip_before_city' ? 'left' : 'right';116 $country_location = $this->hideState || rgar( $address_state_field_input, 'isHidden' ) ? 'left' : 'right'; // support for $this->hideState legacy property117 //labels118 $address_street_sub_label = rgar( $address_street_field_input, 'customLabel' ) != '' ? $address_street_field_input['customLabel'] : esc_html__( 'Street Address', 'gravityforms' );119 $address_street_sub_label = gf_apply_filters( array( 'gform_address_street', $form_id, $this->id ), $address_street_sub_label, $form_id );120 $address_street_sub_label = esc_html( $address_street_sub_label );121 $address_street2_sub_label = rgar( $address_street2_field_input, 'customLabel' ) != '' ? $address_street2_field_input['customLabel'] : esc_html__( 'Address Line 2', 'gravityforms' );122 $address_street2_sub_label = gf_apply_filters( array( 'gform_address_street2', $form_id, $this->id ), $address_street2_sub_label, $form_id );123 $address_street2_sub_label = esc_html( $address_street2_sub_label );124 $address_zip_sub_label = rgar( $address_zip_field_input, 'customLabel' ) != '' ? $address_zip_field_input['customLabel'] : $zip_label;125 $address_zip_sub_label = gf_apply_filters( array( 'gform_address_zip', $form_id, $this->id ), $address_zip_sub_label, $form_id );126 $address_zip_sub_label = esc_html( $address_zip_sub_label );127 $address_city_sub_label = rgar( $address_city_field_input, 'customLabel' ) != '' ? $address_city_field_input['customLabel'] : esc_html__( 'City', 'gravityforms' );128 $address_city_sub_label = gf_apply_filters( array( 'gform_address_city', $form_id, $this->id ), $address_city_sub_label, $form_id );129 $address_city_sub_label = esc_html( $address_city_sub_label );130 $address_state_sub_label = rgar( $address_state_field_input, 'customLabel' ) != '' ? $address_state_field_input['customLabel'] : $state_label;131 $address_state_sub_label = gf_apply_filters( array( 'gform_address_state', $form_id, $this->id ), $address_state_sub_label, $form_id );132 $address_state_sub_label = esc_html( $address_state_sub_label );133 $address_country_sub_label = rgar( $address_country_field_input, 'customLabel' ) != '' ? $address_country_field_input['customLabel'] : esc_html__( 'Country', 'gravityforms' );134 $address_country_sub_label = gf_apply_filters( array( 'gform_address_country', $form_id, $this->id ), $address_country_sub_label, $form_id );135 $address_country_sub_label = esc_html( $address_country_sub_label );136 //address field137 $street_address = '';138 $tabindex = $this->get_tabindex();139 $style = ( $is_admin && rgar( $address_street_field_input, 'isHidden' ) ) ? "style='display:none;'" : '';140 if ( $is_admin || ! rgar( $address_street_field_input, 'isHidden' ) ) {141 if ( $is_sub_label_above ) {142 $street_address = " <span class='ginput_full{$class_suffix} address_line_1' id='{$field_id}_1_container' {$style}>143 <label for='{$field_id}_1' id='{$field_id}_1_label' {$sub_label_class_attribute}>{$address_street_sub_label}</label>144 <input type='text' name='input_{$id}.1' id='{$field_id}_1' value='{$street_value}' {$tabindex} {$disabled_text} {$street_placeholder_attribute}/>145 </span>";146 } else {147 $street_address = " <span class='ginput_full{$class_suffix} address_line_1' id='{$field_id}_1_container' {$style}>148 <input type='text' name='input_{$id}.1' id='{$field_id}_1' value='{$street_value}' {$tabindex} {$disabled_text} {$street_placeholder_attribute}/>149 <label for='{$field_id}_1' id='{$field_id}_1_label' {$sub_label_class_attribute}>{$address_street_sub_label}</label>150 </span>";151 }152 }153 //address line 2 field154 $street_address2 = '';155 $style = ( $is_admin && ( $this->hideAddress2 || rgar( $address_street2_field_input, 'isHidden' ) ) ) ? "style='display:none;'" : ''; // support for $this->hideAddress2 legacy property156 if ( $is_admin || ( ! $this->hideAddress2 && ! rgar( $address_street2_field_input, 'isHidden' ) ) ) {157 $tabindex = $this->get_tabindex();158 if ( $is_sub_label_above ) {159 $street_address2 = "<span class='ginput_full{$class_suffix} address_line_2' id='{$field_id}_2_container' {$style}>160 <label for='{$field_id}_2' id='{$field_id}_2_label' {$sub_label_class_attribute}>{$address_street2_sub_label}</label>161 <input type='text' name='input_{$id}.2' id='{$field_id}_2' value='{$street2_value}' {$tabindex} {$disabled_text} {$street2_placeholder_attribute}/>162 </span>";163 } else {164 $street_address2 = "<span class='ginput_full{$class_suffix} address_line_2' id='{$field_id}_2_container' {$style}>165 <input type='text' name='input_{$id}.2' id='{$field_id}_2' value='{$street2_value}' {$tabindex} {$disabled_text} {$street2_placeholder_attribute}/>166 <label for='{$field_id}_2' id='{$field_id}_2_label' {$sub_label_class_attribute}>{$address_street2_sub_label}</label>167 </span>";168 }169 }170 if ( $address_display_format == 'zip_before_city' ) {171 //zip field172 $zip = '';173 $tabindex = $this->get_tabindex();174 $style = ( $is_admin && rgar( $address_zip_field_input, 'isHidden' ) ) ? "style='display:none;'" : '';175 if ( $is_admin || ! rgar( $address_zip_field_input, 'isHidden' ) ) {176 if ( $is_sub_label_above ) {177 $zip = "<span class='ginput_{$zip_location}{$class_suffix} address_zip' id='{$field_id}_5_container' {$style}>178 <label for='{$field_id}_5' id='{$field_id}_5_label' {$sub_label_class_attribute}>{$address_zip_sub_label}</label>179 <input type='text' name='input_{$id}.5' id='{$field_id}_5' value='{$zip_value}' {$tabindex} {$disabled_text} {$zip_placeholder_attribute}/>180 </span>";181 } else {182 $zip = "<span class='ginput_{$zip_location}{$class_suffix} address_zip' id='{$field_id}_5_container' {$style}>183 <input type='text' name='input_{$id}.5' id='{$field_id}_5' value='{$zip_value}' {$tabindex} {$disabled_text} {$zip_placeholder_attribute}/>184 <label for='{$field_id}_5' id='{$field_id}_5_label' {$sub_label_class_attribute}>{$address_zip_sub_label}</label>185 </span>";186 }187 }188 //city field189 $city = '';190 $tabindex = $this->get_tabindex();191 $style = ( $is_admin && rgar( $address_city_field_input, 'isHidden' ) ) ? "style='display:none;'" : '';192 if ( $is_admin || ! rgar( $address_city_field_input, 'isHidden' ) ) {193 if ( $is_sub_label_above ) {194 $city = "<span class='ginput_{$city_location}{$class_suffix} address_city' id='{$field_id}_3_container' {$style}>195 <label for='{$field_id}_3' id='{$field_id}_3_label' {$sub_label_class_attribute}>{$address_city_sub_label}</label>196 <input type='text' name='input_{$id}.3' id='{$field_id}_3' value='{$city_value}' {$tabindex} {$disabled_text} {$city_placeholder_attribute}/>197 </span>";198 } else {199 $city = "<span class='ginput_{$city_location}{$class_suffix} address_city' id='{$field_id}_3_container' {$style}>200 <input type='text' name='input_{$id}.3' id='{$field_id}_3' value='{$city_value}' {$tabindex} {$disabled_text} {$city_placeholder_attribute}/>201 <label for='{$field_id}_3' id='{$field_id}_3_label' {$sub_label_class_attribute}>{$address_city_sub_label}</label>202 </span>";203 }204 }205 //state field206 $style = ( $is_admin && ( $this->hideState || rgar( $address_state_field_input, 'isHidden' ) ) ) ? "style='display:none;'" : ''; // support for $this->hideState legacy property207 if ( $is_admin || ( ! $this->hideState && ! rgar( $address_state_field_input, 'isHidden' ) ) ) {208 $state_field = $this->get_state_field( $id, $field_id, $state_value, $disabled_text, $form_id );209 if ( $is_sub_label_above ) {210 $state = "<span class='ginput_{$state_location}{$class_suffix} address_state' id='{$field_id}_4_container' {$style}>211 <label for='{$field_id}_4' id='{$field_id}_4_label' {$sub_label_class_attribute}>{$address_state_sub_label}</label>212 $state_field213 </span>";214 } else {215 $state = "<span class='ginput_{$state_location}{$class_suffix} address_state' id='{$field_id}_4_container' {$style}>216 $state_field217 <label for='{$field_id}_4' id='{$field_id}_4_label' {$sub_label_class_attribute}>{$address_state_sub_label}</label>218 </span>";219 }220 } else {221 $state = sprintf( "<input type='hidden' class='gform_hidden' name='input_%d.4' id='%s_4' value='%s'/>", $id, $field_id, $state_value );222 }223 } else {224 //city field225 $city = '';226 $tabindex = $this->get_tabindex();227 $style = ( $is_admin && rgar( $address_city_field_input, 'isHidden' ) ) ? "style='display:none;'" : '';228 if ( $is_admin || ! rgar( $address_city_field_input, 'isHidden' ) ) {229 if ( $is_sub_label_above ) {230 $city = "<span class='ginput_{$city_location}{$class_suffix} address_city' id='{$field_id}_3_container' {$style}>231 <label for='{$field_id}_3' id='{$field_id}_3_label' {$sub_label_class_attribute}>{$address_city_sub_label}</label>232 <input type='text' name='input_{$id}.3' id='{$field_id}_3' value='{$city_value}' {$tabindex} {$disabled_text} {$city_placeholder_attribute}/>233 </span>";234 } else {235 $city = "<span class='ginput_{$city_location}{$class_suffix} address_city' id='{$field_id}_3_container' {$style}>236 <input type='text' name='input_{$id}.3' id='{$field_id}_3' value='{$city_value}' {$tabindex} {$disabled_text} {$city_placeholder_attribute}/>237 <label for='{$field_id}_3' id='{$field_id}_3_label' {$sub_label_class_attribute}>{$address_city_sub_label}</label>238 </span>";239 }240 }241 //state field242 $style = ( $is_admin && ( $this->hideState || rgar( $address_state_field_input, 'isHidden' ) ) ) ? "style='display:none;'" : ''; // support for $this->hideState legacy property243 if ( $is_admin || ( ! $this->hideState && ! rgar( $address_state_field_input, 'isHidden' ) ) ) {244 $state_field = $this->get_state_field( $id, $field_id, $state_value, $disabled_text, $form_id );245 if ( $is_sub_label_above ) {246 $state = "<span class='ginput_{$state_location}{$class_suffix} address_state' id='{$field_id}_4_container' {$style}>247 <label for='{$field_id}_4' id='{$field_id}_4_label' {$sub_label_class_attribute}>$address_state_sub_label</label>248 $state_field249 </span>";250 } else {251 $state = "<span class='ginput_{$state_location}{$class_suffix} address_state' id='{$field_id}_4_container' {$style}>252 $state_field253 <label for='{$field_id}_4' id='{$field_id}_4_label' {$sub_label_class_attribute}>$address_state_sub_label</label>254 </span>";255 }256 } else {257 $state = sprintf( "<input type='hidden' class='gform_hidden' name='input_%d.4' id='%s_4' value='%s'/>", $id, $field_id, $state_value );258 }259 //zip field260 $zip = '';261 $tabindex = GFCommon::get_tabindex();262 $style = ( $is_admin && rgar( $address_zip_field_input, 'isHidden' ) ) ? "style='display:none;'" : '';263 if ( $is_admin || ! rgar( $address_zip_field_input, 'isHidden' ) ) {264 if ( $is_sub_label_above ) {265 $zip = "<span class='ginput_{$zip_location}{$class_suffix} address_zip' id='{$field_id}_5_container' {$style}>266 <label for='{$field_id}_5' id='{$field_id}_5_label' {$sub_label_class_attribute}>{$address_zip_sub_label}</label>267 <input type='text' name='input_{$id}.5' id='{$field_id}_5' value='{$zip_value}' {$tabindex} {$disabled_text} {$zip_placeholder_attribute}/>268 </span>";269 } else {270 $zip = "<span class='ginput_{$zip_location}{$class_suffix} address_zip' id='{$field_id}_5_container' {$style}>271 <input type='text' name='input_{$id}.5' id='{$field_id}_5' value='{$zip_value}' {$tabindex} {$disabled_text} {$zip_placeholder_attribute}/>272 <label for='{$field_id}_5' id='{$field_id}_5_label' {$sub_label_class_attribute}>{$address_zip_sub_label}</label>273 </span>";274 }275 }276 }277 if ( $is_admin || ! $hide_country ) {278 $style = $hide_country ? "style='display:none;'" : '';279 $tabindex = $this->get_tabindex();280 if ( $is_sub_label_above ) {281 $country = "<span class='ginput_{$country_location}{$class_suffix} address_country' id='{$field_id}_6_container' {$style}>282 <label for='{$field_id}_6' id='{$field_id}_6_label' {$sub_label_class_attribute}>{$address_country_sub_label}</label>283 <select name='input_{$id}.6' id='{$field_id}_6' {$tabindex} {$disabled_text}>{$country_list}</select>284 </span>";285 } else {286 $country = "<span class='ginput_{$country_location}{$class_suffix} address_country' id='{$field_id}_6_container' {$style}>287 <select name='input_{$id}.6' id='{$field_id}_6' {$tabindex} {$disabled_text}>{$country_list}</select>288 <label for='{$field_id}_6' id='{$field_id}_6_label' {$sub_label_class_attribute}>{$address_country_sub_label}</label>289 </span>";290 }291 } else {292 $country = sprintf( "<input type='hidden' class='gform_hidden' name='input_%d.6' id='%s_6' value='%s'/>", $id, $field_id, $country_value );293 }294 $inputs = $address_display_format == 'zip_before_city' ? $street_address . $street_address2 . $zip . $city . $state . $country : $street_address . $street_address2 . $city . $state . $zip . $country;295 $copy_values_option = '';296 $input_style = '';297 if ( ( $this->enableCopyValuesOption || $is_form_editor ) && ! $is_entry_detail ) {298 $copy_values_style = $is_form_editor && ! $this->enableCopyValuesOption ? "style='display:none;'" : '';299 $copy_values_is_checked = isset( $value[$this->id . '_copy_values_activated'] ) ? $value[$this->id . '_copy_values_activated'] == true : $this->copyValuesOptionDefault == true;300 $copy_values_checked = checked( true, $copy_values_is_checked, false );301 $copy_values_option = "<div id='{$field_id}_copy_values_option_container' class='copy_values_option_container' {$copy_values_style}>302 <input type='checkbox' id='{$field_id}_copy_values_activated' class='copy_values_activated' value='1' name='input_{$id}_copy_values_activated' {$disabled_text} {$copy_values_checked}/>303 <label for='{$field_id}_copy_values_activated' id='{$field_id}_copy_values_option_label' class='copy_values_option_label inline'>{$this->copyValuesOptionLabel}</label>304 </div>";305 if ( $copy_values_is_checked ) {306 $input_style = "style='display:none;'";307 }308 }309 $css_class = $this->get_css_class();310 return " {$copy_values_option}311 <div class='ginput_complex{$class_suffix} ginput_container {$css_class}' id='$field_id' {$input_style}>312 {$inputs}313 <div class='gf_clear gf_clear_complex'></div>314 </div>";315 }316 public function get_css_class() {317 $address_street_field_input = GFFormsModel::get_input( $this, $this->id . '.1' );318 $address_street2_field_input = GFFormsModel::get_input( $this, $this->id . '.2' );319 $address_city_field_input = GFFormsModel::get_input( $this, $this->id . '.3' );320 $address_state_field_input = GFFormsModel::get_input( $this, $this->id . '.4' );321 $address_zip_field_input = GFFormsModel::get_input( $this, $this->id . '.5' );322 $address_country_field_input = GFFormsModel::get_input( $this, $this->id . '.6' );323 $css_class = '';324 if ( ! rgar( $address_street_field_input, 'isHidden' ) ) {325 $css_class .= 'has_street ';326 }327 if ( ! rgar( $address_street2_field_input, 'isHidden' ) ) {328 $css_class .= 'has_street2 ';329 }330 if ( ! rgar( $address_city_field_input, 'isHidden' ) ) {331 $css_class .= 'has_city ';332 }333 if ( ! rgar( $address_state_field_input, 'isHidden' ) ) {334 $css_class .= 'has_state ';335 }336 if ( ! rgar( $address_zip_field_input, 'isHidden' ) ) {337 $css_class .= 'has_zip ';338 }339 if ( ! rgar( $address_country_field_input, 'isHidden' ) ) {340 $css_class .= 'has_country ';341 }342 $css_class .= 'ginput_container_address';343 return trim( $css_class );344 }345 public function get_address_types( $form_id ) {346 $addressTypes = array(347 'international' => array( 'label' => esc_html__( 'International', 'gravityforms' ),348 'zip_label' => gf_apply_filters( array( 'gform_address_zip', $form_id ), esc_html__( 'ZIP / Postal Code', 'gravityforms' ), $form_id ),349 'state_label' => gf_apply_filters( array( 'gform_address_state', $form_id ), esc_html__( 'State / Province / Region', 'gravityforms' ), $form_id )350 ),351 'us' => array(352 'label' => esc_html__( 'United States', 'gravityforms' ),353 'zip_label' => gf_apply_filters( array( 'gform_address_zip', $form_id ), esc_html__( 'ZIP Code', 'gravityforms' ), $form_id ),354 'state_label' => gf_apply_filters( array( 'gform_address_state', $form_id ), esc_html__( 'State', 'gravityforms' ), $form_id ),355 'country' => 'United States',356 'states' => array_merge( array( '' ), $this->get_us_states() )357 ),358 'canadian' => array(359 'label' => esc_html__( 'Canadian', 'gravityforms' ),360 'zip_label' => gf_apply_filters( array( 'gform_address_zip', $form_id ), esc_html__( 'Postal Code', 'gravityforms' ), $form_id ),361 'state_label' => gf_apply_filters( array( 'gform_address_state', $form_id ), esc_html__( 'Province', 'gravityforms' ), $form_id ),362 'country' => 'Canada',363 'states' => array_merge( array( '' ), $this->get_canadian_provinces() )364 )365 );366 return gf_apply_filters( array( 'gform_address_types', $form_id ), $addressTypes, $form_id );367 }368 public function get_state_field( $id, $field_id, $state_value, $disabled_text, $form_id ) {369 $is_entry_detail = $this->is_entry_detail();370 $is_form_editor = $this->is_form_editor();371 $is_admin = $is_entry_detail || $is_form_editor;372 $state_dropdown_class = $state_text_class = $state_style = $text_style = $state_field_id = '';373 if ( empty( $state_value ) ) {374 $state_value = $this->defaultState;375 //for backwards compatibility (canadian address type used to store the default state into the defaultProvince property)376 if ( $this->addressType == 'canadian' && ! empty($this->defaultProvince) ) {377 $state_value = $this->defaultProvince;378 }379 }380 $address_type = empty($this->addressType) ? 'international' : $this->addressType;381 $address_types = $this->get_address_types( $form_id );382 $has_state_drop_down = isset( $address_types[ $address_type ]['states'] ) && is_array( $address_types[ $address_type ]['states'] );383 if ( $is_admin && RG_CURRENT_VIEW != 'entry' ) {384 $state_dropdown_class = "class='state_dropdown'";385 $state_text_class = "class='state_text'";386 $state_style = ! $has_state_drop_down ? "style='display:none;'" : '';387 $text_style = $has_state_drop_down ? "style='display:none;'" : '';388 $state_field_id = '';389 } else {390 //id only displayed on front end391 $state_field_id = "id='" . $field_id . "_4'";392 }393 $tabindex = $this->get_tabindex();394 $state_input = GFFormsModel::get_input( $this, $this->id . '.4' );395 $sate_placeholder = GFCommon::get_input_placeholder_value( $state_input );396 $states = empty( $address_types[ $address_type ]['states'] ) ? array() : $address_types[ $address_type ]['states'];397 $state_dropdown = sprintf( "<select name='input_%d.4' %s $tabindex %s $state_dropdown_class $state_style>%s</select>", $id, $state_field_id, $disabled_text, $this->get_state_dropdown( $states, $state_value, $sate_placeholder ) );398 $tabindex = $this->get_tabindex();399 $state_placeholder_attribute = GFCommon::get_input_placeholder_attribute( $state_input );400 $state_text = sprintf( "<input type='text' name='input_%d.4' %s value='%s' {$tabindex} %s {$state_text_class} {$text_style} {$state_placeholder_attribute}/>", $id, $state_field_id, $state_value, $disabled_text );401 if ( $is_admin && RG_CURRENT_VIEW != 'entry' ) {402 return $state_dropdown . $state_text;403 } elseif ( $has_state_drop_down ) {404 return $state_dropdown;405 } else {406 return $state_text;407 }408 }409 public function get_countries() {410 return apply_filters(411 'gform_countries', array(412 esc_html__( 'Afghanistan', 'gravityforms' ), esc_html__( 'Albania', 'gravityforms' ), esc_html__( 'Algeria', 'gravityforms' ), esc_html__( 'American Samoa', 'gravityforms' ), esc_html__( 'Andorra', 'gravityforms' ), esc_html__( 'Angola', 'gravityforms' ), esc_html__( 'Antigua and Barbuda', 'gravityforms' ), esc_html__( 'Argentina', 'gravityforms' ), esc_html__( 'Armenia', 'gravityforms' ), esc_html__( 'Australia', 'gravityforms' ), esc_html__( 'Austria', 'gravityforms' ), esc_html__( 'Azerbaijan', 'gravityforms' ), esc_html__( 'Bahamas', 'gravityforms' ), esc_html__( 'Bahrain', 'gravityforms' ), esc_html__( 'Bangladesh', 'gravityforms' ), esc_html__( 'Barbados', 'gravityforms' ), esc_html__( 'Belarus', 'gravityforms' ), esc_html__( 'Belgium', 'gravityforms' ), esc_html__( 'Belize', 'gravityforms' ), esc_html__( 'Benin', 'gravityforms' ), esc_html__( 'Bermuda', 'gravityforms' ), esc_html__( 'Bhutan', 'gravityforms' ), esc_html__( 'Bolivia', 'gravityforms' ), esc_html__( 'Bosnia and Herzegovina', 'gravityforms' ), esc_html__( 'Botswana', 'gravityforms' ), esc_html__( 'Brazil', 'gravityforms' ), esc_html__( 'Brunei', 'gravityforms' ), esc_html__( 'Bulgaria', 'gravityforms' ), esc_html__( 'Burkina Faso', 'gravityforms' ), esc_html__( 'Burundi', 'gravityforms' ), esc_html__( 'Cambodia', 'gravityforms' ), esc_html__( 'Cameroon', 'gravityforms' ), esc_html__( 'Canada', 'gravityforms' ), esc_html__( 'Cape Verde', 'gravityforms' ), esc_html__( 'Cayman Islands', 'gravityforms' ), esc_html__( 'Central African Republic', 'gravityforms' ), esc_html__( 'Chad', 'gravityforms' ), esc_html__( 'Chile', 'gravityforms' ), esc_html__( 'China', 'gravityforms' ), esc_html__( 'Colombia', 'gravityforms' ), esc_html__( 'Comoros', 'gravityforms' ), esc_html__( 'Congo, Democratic Republic of the', 'gravityforms' ), esc_html__( 'Congo, Republic of the', 'gravityforms' ), esc_html__( 'Costa Rica', 'gravityforms' ), esc_html__( "Côte d'Ivoire", 'gravityforms' ), esc_html__( 'Croatia', 'gravityforms' ), esc_html__( 'Cuba', 'gravityforms' ), esc_html__( 'Cyprus', 'gravityforms' ), esc_html__( 'Czech Republic', 'gravityforms' ), esc_html__( 'Denmark', 'gravityforms' ), esc_html__( 'Djibouti', 'gravityforms' ), esc_html__( 'Dominica', 'gravityforms' ), esc_html__( 'Dominican Republic', 'gravityforms' ), esc_html__( 'East Timor', 'gravityforms' ), esc_html__( 'Ecuador', 'gravityforms' ), esc_html__( 'Egypt', 'gravityforms' ), esc_html__( 'El Salvador', 'gravityforms' ), esc_html__( 'Equatorial Guinea', 'gravityforms' ), esc_html__( 'Eritrea', 'gravityforms' ), esc_html__( 'Estonia', 'gravityforms' ), esc_html__( 'Ethiopia', 'gravityforms' ), esc_html__( 'Faroe Islands', 'gravityforms' ), esc_html__( 'Fiji', 'gravityforms' ), esc_html__( 'Finland', 'gravityforms' ), esc_html__( 'France', 'gravityforms' ), esc_html__( 'French Polynesia', 'gravityforms' ), esc_html__( 'Gabon', 'gravityforms' ),413 esc_html__( 'Gambia', 'gravityforms' ), _x( 'Georgia', 'Country', 'gravityforms' ), esc_html__( 'Germany', 'gravityforms' ), esc_html__( 'Ghana', 'gravityforms' ), esc_html__( 'Greece', 'gravityforms' ), esc_html__( 'Greenland', 'gravityforms' ), esc_html__( 'Grenada', 'gravityforms' ), esc_html__( 'Guam', 'gravityforms' ), esc_html__( 'Guatemala', 'gravityforms' ), esc_html__( 'Guinea', 'gravityforms' ), esc_html__( 'Guinea-Bissau', 'gravityforms' ), esc_html__( 'Guyana', 'gravityforms' ), esc_html__( 'Haiti', 'gravityforms' ), esc_html__( 'Honduras', 'gravityforms' ), esc_html__( 'Hong Kong', 'gravityforms' ), esc_html__( 'Hungary', 'gravityforms' ), esc_html__( 'Iceland', 'gravityforms' ), esc_html__( 'India', 'gravityforms' ), esc_html__( 'Indonesia', 'gravityforms' ), esc_html__( 'Iran', 'gravityforms' ), esc_html__( 'Iraq', 'gravityforms' ), esc_html__( 'Ireland', 'gravityforms' ), esc_html__( 'Israel', 'gravityforms' ), esc_html__( 'Italy', 'gravityforms' ), esc_html__( 'Jamaica', 'gravityforms' ), esc_html__( 'Japan', 'gravityforms' ), esc_html__( 'Jordan', 'gravityforms' ), esc_html__( 'Kazakhstan', 'gravityforms' ), esc_html__( 'Kenya', 'gravityforms' ), esc_html__( 'Kiribati', 'gravityforms' ), esc_html__( 'North Korea', 'gravityforms' ), esc_html__( 'South Korea', 'gravityforms' ), esc_html__( 'Kosovo', 'gravityforms' ), esc_html__( 'Kuwait', 'gravityforms' ), esc_html__( 'Kyrgyzstan', 'gravityforms' ), esc_html__( 'Laos', 'gravityforms' ), esc_html__( 'Latvia', 'gravityforms' ), esc_html__( 'Lebanon', 'gravityforms' ), esc_html__( 'Lesotho', 'gravityforms' ), esc_html__( 'Liberia', 'gravityforms' ), esc_html__( 'Libya', 'gravityforms' ), esc_html__( 'Liechtenstein', 'gravityforms' ), esc_html__( 'Lithuania', 'gravityforms' ), esc_html__( 'Luxembourg', 'gravityforms' ), esc_html__( 'Macedonia', 'gravityforms' ), esc_html__( 'Madagascar', 'gravityforms' ), esc_html__( 'Malawi', 'gravityforms' ), esc_html__( 'Malaysia', 'gravityforms' ), esc_html__( 'Maldives', 'gravityforms' ), esc_html__( 'Mali', 'gravityforms' ), esc_html__( 'Malta', 'gravityforms' ), esc_html__( 'Marshall Islands', 'gravityforms' ), esc_html__( 'Mauritania', 'gravityforms' ), esc_html__( 'Mauritius', 'gravityforms' ), esc_html__( 'Mexico', 'gravityforms' ), esc_html__( 'Micronesia', 'gravityforms' ), esc_html__( 'Moldova', 'gravityforms' ), esc_html__( 'Monaco', 'gravityforms' ), esc_html__( 'Mongolia', 'gravityforms' ), esc_html__( 'Montenegro', 'gravityforms' ), esc_html__( 'Morocco', 'gravityforms' ), esc_html__( 'Mozambique', 'gravityforms' ), esc_html__( 'Myanmar', 'gravityforms' ), esc_html__( 'Namibia', 'gravityforms' ), esc_html__( 'Nauru', 'gravityforms' ), esc_html__( 'Nepal', 'gravityforms' ), esc_html__( 'Netherlands', 'gravityforms' ), esc_html__( 'New Zealand', 'gravityforms' ),414 esc_html__( 'Nicaragua', 'gravityforms' ), esc_html__( 'Niger', 'gravityforms' ), esc_html__( 'Nigeria', 'gravityforms' ), esc_html__( 'Northern Mariana Islands', 'gravityforms' ), esc_html__( 'Norway', 'gravityforms' ), esc_html__( 'Oman', 'gravityforms' ), esc_html__( 'Pakistan', 'gravityforms' ), esc_html__( 'Palau', 'gravityforms' ), esc_html__( 'Palestine, State of', 'gravityforms' ), esc_html__( 'Panama', 'gravityforms' ), esc_html__( 'Papua New Guinea', 'gravityforms' ), esc_html__( 'Paraguay', 'gravityforms' ), esc_html__( 'Peru', 'gravityforms' ), esc_html__( 'Philippines', 'gravityforms' ), esc_html__( 'Poland', 'gravityforms' ), esc_html__( 'Portugal', 'gravityforms' ), esc_html__( 'Puerto Rico', 'gravityforms' ), esc_html__( 'Qatar', 'gravityforms' ), esc_html__( 'Romania', 'gravityforms' ), esc_html__( 'Russia', 'gravityforms' ), esc_html__( 'Rwanda', 'gravityforms' ), esc_html__( 'Saint Kitts and Nevis', 'gravityforms' ), esc_html__( 'Saint Lucia', 'gravityforms' ), esc_html__( 'Saint Vincent and the Grenadines', 'gravityforms' ), esc_html__( 'Samoa', 'gravityforms' ), esc_html__( 'San Marino', 'gravityforms' ), esc_html__( 'Sao Tome and Principe', 'gravityforms' ), esc_html__( 'Saudi Arabia', 'gravityforms' ), esc_html__( 'Senegal', 'gravityforms' ), esc_html__( 'Serbia', 'gravityforms' ), esc_html__( 'Seychelles', 'gravityforms' ), esc_html__( 'Sierra Leone', 'gravityforms' ), esc_html__( 'Singapore', 'gravityforms' ), esc_html__( 'Sint Maarten', 'gravityforms' ), esc_html__( 'Slovakia', 'gravityforms' ), esc_html__( 'Slovenia', 'gravityforms' ), esc_html__( 'Solomon Islands', 'gravityforms' ), esc_html__( 'Somalia', 'gravityforms' ), esc_html__( 'South Africa', 'gravityforms' ), esc_html__( 'Spain', 'gravityforms' ), esc_html__( 'Sri Lanka', 'gravityforms' ), esc_html__( 'Sudan', 'gravityforms' ), esc_html__( 'Sudan, South', 'gravityforms' ), esc_html__( 'Suriname', 'gravityforms' ), esc_html__( 'Swaziland', 'gravityforms' ), esc_html__( 'Sweden', 'gravityforms' ), esc_html__( 'Switzerland', 'gravityforms' ), esc_html__( 'Syria', 'gravityforms' ), esc_html__( 'Taiwan', 'gravityforms' ), esc_html__( 'Tajikistan', 'gravityforms' ), esc_html__( 'Tanzania', 'gravityforms' ), esc_html__( 'Thailand', 'gravityforms' ), esc_html__( 'Togo', 'gravityforms' ), esc_html__( 'Tonga', 'gravityforms' ), esc_html__( 'Trinidad and Tobago', 'gravityforms' ), esc_html__( 'Tunisia', 'gravityforms' ), esc_html__( 'Turkey', 'gravityforms' ), esc_html__( 'Turkmenistan', 'gravityforms' ), esc_html__( 'Tuvalu', 'gravityforms' ), esc_html__( 'Uganda', 'gravityforms' ), esc_html__( 'Ukraine', 'gravityforms' ), esc_html__( 'United Arab Emirates', 'gravityforms' ), esc_html__( 'United Kingdom', 'gravityforms' ),415 esc_html__( 'United States', 'gravityforms' ), esc_html__( 'Uruguay', 'gravityforms' ), esc_html__( 'Uzbekistan', 'gravityforms' ), esc_html__( 'Vanuatu', 'gravityforms' ), esc_html__( 'Vatican City', 'gravityforms' ), esc_html__( 'Venezuela', 'gravityforms' ), esc_html__( 'Vietnam', 'gravityforms' ), esc_html__( 'Virgin Islands, British', 'gravityforms' ), esc_html__( 'Virgin Islands, U.S.', 'gravityforms' ), esc_html__( 'Yemen', 'gravityforms' ), esc_html__( 'Zambia', 'gravityforms' ), esc_html__( 'Zimbabwe', 'gravityforms' ),416 )417 );418 }419 public function get_country_code( $country_name ) {420 $codes = $this->get_country_codes();421 return rgar( $codes, GFCommon::safe_strtoupper( $country_name ) );422 }423 public function get_country_codes() {424 $codes = array(425 esc_html__( 'AFGHANISTAN', 'gravityforms' ) => 'AF',426 esc_html__( 'ALBANIA', 'gravityforms' ) => 'AL',427 esc_html__( 'ALGERIA', 'gravityforms' ) => 'DZ',428 esc_html__( 'AMERICAN SAMOA', 'gravityforms' ) => 'AS',429 esc_html__( 'ANDORRA', 'gravityforms' ) => 'AD',430 esc_html__( 'ANGOLA', 'gravityforms' ) => 'AO',431 esc_html__( 'ANTIGUA AND BARBUDA', 'gravityforms' ) => 'AG',432 esc_html__( 'ARGENTINA', 'gravityforms' ) => 'AR',433 esc_html__( 'ARMENIA', 'gravityforms' ) => 'AM',434 esc_html__( 'AUSTRALIA', 'gravityforms' ) => 'AU',435 esc_html__( 'AUSTRIA', 'gravityforms' ) => 'AT',436 esc_html__( 'AZERBAIJAN', 'gravityforms' ) => 'AZ',437 esc_html__( 'BAHAMAS', 'gravityforms' ) => 'BS',438 esc_html__( 'BAHRAIN', 'gravityforms' ) => 'BH',439 esc_html__( 'BANGLADESH', 'gravityforms' ) => 'BD',440 esc_html__( 'BARBADOS', 'gravityforms' ) => 'BB',441 esc_html__( 'BELARUS', 'gravityforms' ) => 'BY',442 esc_html__( 'BELGIUM', 'gravityforms' ) => 'BE',443 esc_html__( 'BELIZE', 'gravityforms' ) => 'BZ',444 esc_html__( 'BENIN', 'gravityforms' ) => 'BJ',445 esc_html__( 'BERMUDA', 'gravityforms' ) => 'BM',446 esc_html__( 'BHUTAN', 'gravityforms' ) => 'BT',447 esc_html__( 'BOLIVIA', 'gravityforms' ) => 'BO',448 esc_html__( 'BOSNIA AND HERZEGOVINA', 'gravityforms' ) => 'BA',449 esc_html__( 'BOTSWANA', 'gravityforms' ) => 'BW',450 esc_html__( 'BRAZIL', 'gravityforms' ) => 'BR',451 esc_html__( 'BRUNEI', 'gravityforms' ) => 'BN',452 esc_html__( 'BULGARIA', 'gravityforms' ) => 'BG',453 esc_html__( 'BURKINA FASO', 'gravityforms' ) => 'BF',454 esc_html__( 'BURUNDI', 'gravityforms' ) => 'BI',455 esc_html__( 'CAMBODIA', 'gravityforms' ) => 'KH',456 esc_html__( 'CAMEROON', 'gravityforms' ) => 'CM',457 esc_html__( 'CANADA', 'gravityforms' ) => 'CA',458 esc_html__( 'CAPE VERDE', 'gravityforms' ) => 'CV',459 esc_html__( 'CAYMAN ISLANDS', 'gravityforms' ) => 'KY',460 esc_html__( 'CENTRAL AFRICAN REPUBLIC', 'gravityforms' ) => 'CF',461 esc_html__( 'CHAD', 'gravityforms' ) => 'TD',462 esc_html__( 'CHILE', 'gravityforms' ) => 'CL',463 esc_html__( 'CHINA', 'gravityforms' ) => 'CN',464 esc_html__( 'COLOMBIA', 'gravityforms' ) => 'CO',465 esc_html__( 'COMOROS', 'gravityforms' ) => 'KM',466 esc_html__( 'CONGO, DEMOCRATIC REPUBLIC OF THE', 'gravityforms' ) => 'CD',467 esc_html__( 'CONGO, REPUBLIC OF THE', 'gravityforms' ) => 'CG',468 esc_html__( 'COSTA RICA', 'gravityforms' ) => 'CR',469 esc_html__( "CÃTE D'IVOIRE", 'gravityforms' ) => 'CI',470 esc_html__( 'CROATIA', 'gravityforms' ) => 'HR',471 esc_html__( 'CUBA', 'gravityforms' ) => 'CU',472 esc_html__( 'CYPRUS', 'gravityforms' ) => 'CY',473 esc_html__( 'CZECH REPUBLIC', 'gravityforms' ) => 'CZ',474 esc_html__( 'DENMARK', 'gravityforms' ) => 'DK',475 esc_html__( 'DJIBOUTI', 'gravityforms' ) => 'DJ',476 esc_html__( 'DOMINICA', 'gravityforms' ) => 'DM',477 esc_html__( 'DOMINICAN REPUBLIC', 'gravityforms' ) => 'DO',478 esc_html__( 'EAST TIMOR', 'gravityforms' ) => 'TL',479 esc_html__( 'ECUADOR', 'gravityforms' ) => 'EC',480 esc_html__( 'EGYPT', 'gravityforms' ) => 'EG',481 esc_html__( 'EL SALVADOR', 'gravityforms' ) => 'SV',482 esc_html__( 'EQUATORIAL GUINEA', 'gravityforms' ) => 'GQ',483 esc_html__( 'ERITREA', 'gravityforms' ) => 'ER',484 esc_html__( 'ESTONIA', 'gravityforms' ) => 'EE',485 esc_html__( 'ETHIOPIA', 'gravityforms' ) => 'ET',486 esc_html__( 'FAROE ISLANDS', 'gravityforms' ) => 'FO',487 esc_html__( 'FIJI', 'gravityforms' ) => 'FJ',488 esc_html__( 'FINLAND', 'gravityforms' ) => 'FI',489 esc_html__( 'FRANCE', 'gravityforms' ) => 'FR',490 esc_html__( 'GABON', 'gravityforms' ) => 'GA',491 esc_html__( 'GAMBIA', 'gravityforms' ) => 'GM',492 esc_html( _x( 'GEORGIA', 'Country', 'gravityforms' ) ) => 'GE',493 esc_html__( 'GERMANY', 'gravityforms' ) => 'DE',494 esc_html__( 'GHANA', 'gravityforms' ) => 'GH',495 esc_html__( 'GREECE', 'gravityforms' ) => 'GR',496 esc_html__( 'GREENLAND', 'gravityforms' ) => 'GL',497 esc_html__( 'GRENADA', 'gravityforms' ) => 'GD',498 esc_html__( 'GUAM', 'gravityforms' ) => 'GU',499 esc_html__( 'GUATEMALA', 'gravityforms' ) => 'GT',500 esc_html__( 'GUINEA', 'gravityforms' ) => 'GN',501 esc_html__( 'GUINEA-BISSAU', 'gravityforms' ) => 'GW',502 esc_html__( 'GUYANA', 'gravityforms' ) => 'GY',503 esc_html__( 'HAITI', 'gravityforms' ) => 'HT',504 esc_html__( 'HONDURAS', 'gravityforms' ) => 'HN',505 esc_html__( 'HONG KONG', 'gravityforms' ) => 'HK',506 esc_html__( 'HUNGARY', 'gravityforms' ) => 'HU',507 esc_html__( 'ICELAND', 'gravityforms' ) => 'IS',508 esc_html__( 'INDIA', 'gravityforms' ) => 'IN',509 esc_html__( 'INDONESIA', 'gravityforms' ) => 'ID',510 esc_html__( 'IRAN', 'gravityforms' ) => 'IR',511 esc_html__( 'IRAQ', 'gravityforms' ) => 'IQ',512 esc_html__( 'IRELAND', 'gravityforms' ) => 'IE',513 esc_html__( 'ISRAEL', 'gravityforms' ) => 'IL',514 esc_html__( 'ITALY', 'gravityforms' ) => 'IT',515 esc_html__( 'JAMAICA', 'gravityforms' ) => 'JM',516 esc_html__( 'JAPAN', 'gravityforms' ) => 'JP',517 esc_html__( 'JORDAN', 'gravityforms' ) => 'JO',518 esc_html__( 'KAZAKHSTAN', 'gravityforms' ) => 'KZ',519 esc_html__( 'KENYA', 'gravityforms' ) => 'KE',520 esc_html__( 'KIRIBATI', 'gravityforms' ) => 'KI',521 esc_html__( 'NORTH KOREA', 'gravityforms' ) => 'KP',522 esc_html__( 'SOUTH KOREA', 'gravityforms' ) => 'KR',523 esc_html__( 'KOSOVO', 'gravityforms' ) => 'KV',524 esc_html__( 'KUWAIT', 'gravityforms' ) => 'KW',525 esc_html__( 'KYRGYZSTAN', 'gravityforms' ) => 'KG',526 esc_html__( 'LAOS', 'gravityforms' ) => 'LA',527 esc_html__( 'LATVIA', 'gravityforms' ) => 'LV',528 esc_html__( 'LEBANON', 'gravityforms' ) => 'LB',529 esc_html__( 'LESOTHO', 'gravityforms' ) => 'LS',530 esc_html__( 'LIBERIA', 'gravityforms' ) => 'LR',531 esc_html__( 'LIBYA', 'gravityforms' ) => 'LY',532 esc_html__( 'LIECHTENSTEIN', 'gravityforms' ) => 'LI',533 esc_html__( 'LITHUANIA', 'gravityforms' ) => 'LT',534 esc_html__( 'LUXEMBOURG', 'gravityforms' ) => 'LU',535 esc_html__( 'MACEDONIA', 'gravityforms' ) => 'MK',536 esc_html__( 'MADAGASCAR', 'gravityforms' ) => 'MG',537 esc_html__( 'MALAWI', 'gravityforms' ) => 'MW',538 esc_html__( 'MALAYSIA', 'gravityforms' ) => 'MY',539 esc_html__( 'MALDIVES', 'gravityforms' ) => 'MV',540 esc_html__( 'MALI', 'gravityforms' ) => 'ML',541 esc_html__( 'MALTA', 'gravityforms' ) => 'MT',542 esc_html__( 'MARSHALL ISLANDS', 'gravityforms' ) => 'MH',543 esc_html__( 'MAURITANIA', 'gravityforms' ) => 'MR',544 esc_html__( 'MAURITIUS', 'gravityforms' ) => 'MU',545 esc_html__( 'MEXICO', 'gravityforms' ) => 'MX',546 esc_html__( 'MICRONESIA', 'gravityforms' ) => 'FM',547 esc_html__( 'MOLDOVA', 'gravityforms' ) => 'MD',548 esc_html__( 'MONACO', 'gravityforms' ) => 'MC',549 esc_html__( 'MONGOLIA', 'gravityforms' ) => 'MN',550 esc_html__( 'MONTENEGRO', 'gravityforms' ) => 'ME',551 esc_html__( 'MOROCCO', 'gravityforms' ) => 'MA',552 esc_html__( 'MOZAMBIQUE', 'gravityforms' ) => 'MZ',553 esc_html__( 'MYANMAR', 'gravityforms' ) => 'MM',554 esc_html__( 'NAMIBIA', 'gravityforms' ) => 'NA',555 esc_html__( 'NAURU', 'gravityforms' ) => 'NR',556 esc_html__( 'NEPAL', 'gravityforms' ) => 'NP',557 esc_html__( 'NETHERLANDS', 'gravityforms' ) => 'NL',558 esc_html__( 'NEW ZEALAND', 'gravityforms' ) => 'NZ',559 esc_html__( 'NICARAGUA', 'gravityforms' ) => 'NI',560 esc_html__( 'NIGER', 'gravityforms' ) => 'NE',561 esc_html__( 'NIGERIA', 'gravityforms' ) => 'NG',562 esc_html__( 'NORTHERN MARIANA ISLANDS', 'gravityforms' ) => 'MP',563 esc_html__( 'NORWAY', 'gravityforms' ) => 'NO',564 esc_html__( 'OMAN', 'gravityforms' ) => 'OM',565 esc_html__( 'PAKISTAN', 'gravityforms' ) => 'PK',566 esc_html__( 'PALAU', 'gravityforms' ) => 'PW',567 esc_html__( 'PALESTINE, STATE OF', 'gravityforms' ) => 'PS',568 esc_html__( 'PANAMA', 'gravityforms' ) => 'PA',569 esc_html__( 'PAPUA NEW GUINEA', 'gravityforms' ) => 'PG',570 esc_html__( 'PARAGUAY', 'gravityforms' ) => 'PY',571 esc_html__( 'PERU', 'gravityforms' ) => 'PE',572 esc_html__( 'PHILIPPINES', 'gravityforms' ) => 'PH',573 esc_html__( 'POLAND', 'gravityforms' ) => 'PL',574 esc_html__( 'PORTUGAL', 'gravityforms' ) => 'PT',575 esc_html__( 'PUERTO RICO', 'gravityforms' ) => 'PR',576 esc_html__( 'QATAR', 'gravityforms' ) => 'QA',577 esc_html__( 'ROMANIA', 'gravityforms' ) => 'RO',578 esc_html__( 'RUSSIA', 'gravityforms' ) => 'RU',579 esc_html__( 'RWANDA', 'gravityforms' ) => 'RW',580 esc_html__( 'SAINT KITTS AND NEVIS', 'gravityforms' ) => 'KN',581 esc_html__( 'SAINT LUCIA', 'gravityforms' ) => 'LC',582 esc_html__( 'SAINT VINCENT AND THE GRENADINES', 'gravityforms' ) => 'VC',583 esc_html__( 'SAMOA', 'gravityforms' ) => 'WS',584 esc_html__( 'SAN MARINO', 'gravityforms' ) => 'SM',585 esc_html__( 'SAO TOME AND PRINCIPE', 'gravityforms' ) => 'ST',586 esc_html__( 'SAUDI ARABIA', 'gravityforms' ) => 'SA',587 esc_html__( 'SENEGAL', 'gravityforms' ) => 'SN',588 esc_html__( 'SERBIA', 'gravityforms' ) => 'RS',589 esc_html__( 'SEYCHELLES', 'gravityforms' ) => 'SC',590 esc_html__( 'SIERRA LEONE', 'gravityforms' ) => 'SL',591 esc_html__( 'SINGAPORE', 'gravityforms' ) => 'SG',592 esc_html__( 'SINT MAARTEN', 'gravityforms' ) => 'SX',593 esc_html__( 'SLOVAKIA', 'gravityforms' ) => 'SK',594 esc_html__( 'SLOVENIA', 'gravityforms' ) => 'SI',595 esc_html__( 'SOLOMON ISLANDS', 'gravityforms' ) => 'SB',596 esc_html__( 'SOMALIA', 'gravityforms' ) => 'SO',597 esc_html__( 'SOUTH AFRICA', 'gravityforms' ) => 'ZA',598 esc_html__( 'SPAIN', 'gravityforms' ) => 'ES',599 esc_html__( 'SRI LANKA', 'gravityforms' ) => 'LK',600 esc_html__( 'SUDAN', 'gravityforms' ) => 'SD',601 esc_html__( 'SUDAN, SOUTH', 'gravityforms' ) => 'SS',602 esc_html__( 'SURINAME', 'gravityforms' ) => 'SR',603 esc_html__( 'SWAZILAND', 'gravityforms' ) => 'SZ',604 esc_html__( 'SWEDEN', 'gravityforms' ) => 'SE',605 esc_html__( 'SWITZERLAND', 'gravityforms' ) => 'CH',606 esc_html__( 'SYRIA', 'gravityforms' ) => 'SY',607 esc_html__( 'TAIWAN', 'gravityforms' ) => 'TW',608 esc_html__( 'TAJIKISTAN', 'gravityforms' ) => 'TJ',609 esc_html__( 'TANZANIA', 'gravityforms' ) => 'TZ',610 esc_html__( 'THAILAND', 'gravityforms' ) => 'TH',611 esc_html__( 'TOGO', 'gravityforms' ) => 'TG',612 esc_html__( 'TONGA', 'gravityforms' ) => 'TO',613 esc_html__( 'TRINIDAD AND TOBAGO', 'gravityforms' ) => 'TT',614 esc_html__( 'TUNISIA', 'gravityforms' ) => 'TN',615 esc_html__( 'TURKEY', 'gravityforms' ) => 'TR',616 esc_html__( 'TURKMENISTAN', 'gravityforms' ) => 'TM',617 esc_html__( 'TUVALU', 'gravityforms' ) => 'TV',618 esc_html__( 'UGANDA', 'gravityforms' ) => 'UG',619 esc_html__( 'UKRAINE', 'gravityforms' ) => 'UA',620 esc_html__( 'UNITED ARAB EMIRATES', 'gravityforms' ) => 'AE',621 esc_html__( 'UNITED KINGDOM', 'gravityforms' ) => 'GB',622 esc_html__( 'UNITED STATES', 'gravityforms' ) => 'US',623 esc_html__( 'URUGUAY', 'gravityforms' ) => 'UY',624 esc_html__( 'UZBEKISTAN', 'gravityforms' ) => 'UZ',625 esc_html__( 'VANUATU', 'gravityforms' ) => 'VU',626 esc_html__( 'VATICAN CITY', 'gravityforms' ) => 'VA',627 esc_html__( 'VENEZUELA', 'gravityforms' ) => 'VE',628 esc_html__( 'VIRGIN ISLANDS, BRITISH', 'gravityforms' ) => 'VG',629 esc_html__( 'VIRGIN ISLANDS, U.S.', 'gravityforms' ) => 'VI',630 esc_html__( 'VIETNAM', 'gravityforms' ) => 'VN',631 esc_html__( 'YEMEN', 'gravityforms' ) => 'YE',632 esc_html__( 'ZAMBIA', 'gravityforms' ) => 'ZM',633 esc_html__( 'ZIMBABWE', 'gravityforms' ) => 'ZW',634 );635 return $codes;636 }637 public function get_us_states() {638 return apply_filters(639 'gform_us_states', array(640 esc_html__( 'Alabama', 'gravityforms' ), esc_html__( 'Alaska', 'gravityforms' ), esc_html__( 'Arizona', 'gravityforms' ), esc_html__( 'Arkansas', 'gravityforms' ),641 esc_html__( 'California', 'gravityforms' ), esc_html__( 'Colorado', 'gravityforms' ), esc_html__( 'Connecticut', 'gravityforms' ), esc_html__( 'Delaware', 'gravityforms' ),642 esc_html__( 'District of Columbia', 'gravityforms' ), esc_html__( 'Florida', 'gravityforms' ), _x( 'Georgia', 'US State', 'gravityforms' ),643 esc_html__( 'Hawaii', 'gravityforms' ), esc_html__( 'Idaho', 'gravityforms' ), esc_html__( 'Illinois', 'gravityforms' ), esc_html__( 'Indiana', 'gravityforms' ),644 esc_html__( 'Iowa', 'gravityforms' ), esc_html__( 'Kansas', 'gravityforms' ), esc_html__( 'Kentucky', 'gravityforms' ), esc_html__( 'Louisiana', 'gravityforms' ),645 esc_html__( 'Maine', 'gravityforms' ), esc_html__( 'Maryland', 'gravityforms' ), esc_html__( 'Massachusetts', 'gravityforms' ), esc_html__( 'Michigan', 'gravityforms' ),646 esc_html__( 'Minnesota', 'gravityforms' ), esc_html__( 'Mississippi', 'gravityforms' ), esc_html__( 'Missouri', 'gravityforms' ), esc_html__( 'Montana', 'gravityforms' ),647 esc_html__( 'Nebraska', 'gravityforms' ), esc_html__( 'Nevada', 'gravityforms' ), esc_html__( 'New Hampshire', 'gravityforms' ), esc_html__( 'New Jersey', 'gravityforms' ),648 esc_html__( 'New Mexico', 'gravityforms' ), esc_html__( 'New York', 'gravityforms' ), esc_html__( 'North Carolina', 'gravityforms' ),649 esc_html__( 'North Dakota', 'gravityforms' ), esc_html__( 'Ohio', 'gravityforms' ), esc_html__( 'Oklahoma', 'gravityforms' ), esc_html__( 'Oregon', 'gravityforms' ),650 esc_html__( 'Pennsylvania', 'gravityforms' ), esc_html__( 'Rhode Island', 'gravityforms' ), esc_html__( 'South Carolina', 'gravityforms' ),651 esc_html__( 'South Dakota', 'gravityforms' ), esc_html__( 'Tennessee', 'gravityforms' ), esc_html__( 'Texas', 'gravityforms' ), esc_html__( 'Utah', 'gravityforms' ),652 esc_html__( 'Vermont', 'gravityforms' ), esc_html__( 'Virginia', 'gravityforms' ), esc_html__( 'Washington', 'gravityforms' ), esc_html__( 'West Virginia', 'gravityforms' ),653 esc_html__( 'Wisconsin', 'gravityforms' ), esc_html__( 'Wyoming', 'gravityforms' ), esc_html__( 'Armed Forces Americas', 'gravityforms' ),654 esc_html__( 'Armed Forces Europe', 'gravityforms' ), esc_html__( 'Armed Forces Pacific', 'gravityforms' ),655 )656 );657 }658 public function get_us_state_code( $state_name ) {659 $states = array(660 GFCommon::safe_strtoupper( esc_html__( 'Alabama', 'gravityforms' ) ) => 'AL',661 GFCommon::safe_strtoupper( esc_html__( 'Alaska', 'gravityforms' ) ) => 'AK',662 GFCommon::safe_strtoupper( esc_html__( 'Arizona', 'gravityforms' ) ) => 'AZ',663 GFCommon::safe_strtoupper( esc_html__( 'Arkansas', 'gravityforms' ) ) => 'AR',664 GFCommon::safe_strtoupper( esc_html__( 'California', 'gravityforms' ) ) => 'CA',665 GFCommon::safe_strtoupper( esc_html__( 'Colorado', 'gravityforms' ) ) => 'CO',666 GFCommon::safe_strtoupper( esc_html__( 'Connecticut', 'gravityforms' ) ) => 'CT',667 GFCommon::safe_strtoupper( esc_html__( 'Delaware', 'gravityforms' ) ) => 'DE',668 GFCommon::safe_strtoupper( esc_html__( 'District of Columbia', 'gravityforms' ) ) => 'DC',669 GFCommon::safe_strtoupper( esc_html__( 'Florida', 'gravityforms' ) ) => 'FL',670 GFCommon::safe_strtoupper( _x( 'Georgia', 'US State', 'gravityforms' ) ) => 'GA',671 GFCommon::safe_strtoupper( esc_html__( 'Hawaii', 'gravityforms' ) ) => 'HI',672 GFCommon::safe_strtoupper( esc_html__( 'Idaho', 'gravityforms' ) ) => 'ID',673 GFCommon::safe_strtoupper( esc_html__( 'Illinois', 'gravityforms' ) ) => 'IL',674 GFCommon::safe_strtoupper( esc_html__( 'Indiana', 'gravityforms' ) ) => 'IN',675 GFCommon::safe_strtoupper( esc_html__( 'Iowa', 'gravityforms' ) ) => 'IA',676 GFCommon::safe_strtoupper( esc_html__( 'Kansas', 'gravityforms' ) ) => 'KS',677 GFCommon::safe_strtoupper( esc_html__( 'Kentucky', 'gravityforms' ) ) => 'KY',678 GFCommon::safe_strtoupper( esc_html__( 'Louisiana', 'gravityforms' ) ) => 'LA',679 GFCommon::safe_strtoupper( esc_html__( 'Maine', 'gravityforms' ) ) => 'ME',680 GFCommon::safe_strtoupper( esc_html__( 'Maryland', 'gravityforms' ) ) => 'MD',681 GFCommon::safe_strtoupper( esc_html__( 'Massachusetts', 'gravityforms' ) ) => 'MA',682 GFCommon::safe_strtoupper( esc_html__( 'Michigan', 'gravityforms' ) ) => 'MI',683 GFCommon::safe_strtoupper( esc_html__( 'Minnesota', 'gravityforms' ) ) => 'MN',684 GFCommon::safe_strtoupper( esc_html__( 'Mississippi', 'gravityforms' ) ) => 'MS',685 GFCommon::safe_strtoupper( esc_html__( 'Missouri', 'gravityforms' ) ) => 'MO',686 GFCommon::safe_strtoupper( esc_html__( 'Montana', 'gravityforms' ) ) => 'MT',687 GFCommon::safe_strtoupper( esc_html__( 'Nebraska', 'gravityforms' ) ) => 'NE',688 GFCommon::safe_strtoupper( esc_html__( 'Nevada', 'gravityforms' ) ) => 'NV',689 GFCommon::safe_strtoupper( esc_html__( 'New Hampshire', 'gravityforms' ) ) => 'NH',690 GFCommon::safe_strtoupper( esc_html__( 'New Jersey', 'gravityforms' ) ) => 'NJ',691 GFCommon::safe_strtoupper( esc_html__( 'New Mexico', 'gravityforms' ) ) => 'NM',692 GFCommon::safe_strtoupper( esc_html__( 'New York', 'gravityforms' ) ) => 'NY',693 GFCommon::safe_strtoupper( esc_html__( 'North Carolina', 'gravityforms' ) ) => 'NC',694 GFCommon::safe_strtoupper( esc_html__( 'North Dakota', 'gravityforms' ) ) => 'ND',695 GFCommon::safe_strtoupper( esc_html__( 'Ohio', 'gravityforms' ) ) => 'OH',696 GFCommon::safe_strtoupper( esc_html__( 'Oklahoma', 'gravityforms' ) ) => 'OK',697 GFCommon::safe_strtoupper( esc_html__( 'Oregon', 'gravityforms' ) ) => 'OR',698 GFCommon::safe_strtoupper( esc_html__( 'Pennsylvania', 'gravityforms' ) ) => 'PA',699 GFCommon::safe_strtoupper( esc_html__( 'Rhode Island', 'gravityforms' ) ) => 'RI',700 GFCommon::safe_strtoupper( esc_html__( 'South Carolina', 'gravityforms' ) ) => 'SC',701 GFCommon::safe_strtoupper( esc_html__( 'South Dakota', 'gravityforms' ) ) => 'SD',702 GFCommon::safe_strtoupper( esc_html__( 'Tennessee', 'gravityforms' ) ) => 'TN',703 GFCommon::safe_strtoupper( esc_html__( 'Texas', 'gravityforms' ) ) => 'TX',704 GFCommon::safe_strtoupper( esc_html__( 'Utah', 'gravityforms' ) ) => 'UT',705 GFCommon::safe_strtoupper( esc_html__( 'Vermont', 'gravityforms' ) ) => 'VT',706 GFCommon::safe_strtoupper( esc_html__( 'Virginia', 'gravityforms' ) ) => 'VA',707 GFCommon::safe_strtoupper( esc_html__( 'Washington', 'gravityforms' ) ) => 'WA',708 GFCommon::safe_strtoupper( esc_html__( 'West Virginia', 'gravityforms' ) ) => 'WV',709 GFCommon::safe_strtoupper( esc_html__( 'Wisconsin', 'gravityforms' ) ) => 'WI',710 GFCommon::safe_strtoupper( esc_html__( 'Wyoming', 'gravityforms' ) ) => 'WY',711 GFCommon::safe_strtoupper( esc_html__( 'Armed Forces Americas', 'gravityforms' ) ) => 'AA',712 GFCommon::safe_strtoupper( esc_html__( 'Armed Forces Europe', 'gravityforms' ) ) => 'AE',713 GFCommon::safe_strtoupper( esc_html__( 'Armed Forces Pacific', 'gravityforms' ) ) => 'AP',714 );715 $state_name = GFCommon::safe_strtoupper( $state_name );716 $code = isset( $states[ $state_name ] ) ? $states[ $state_name ] : $state_name;717 return $code;718 }719 public function get_canadian_provinces() {720 return array( esc_html__( 'Alberta', 'gravityforms' ), esc_html__( 'British Columbia', 'gravityforms' ), esc_html__( 'Manitoba', 'gravityforms' ), esc_html__( 'New Brunswick', 'gravityforms' ), esc_html__( 'Newfoundland & Labrador', 'gravityforms' ), esc_html__( 'Northwest Territories', 'gravityforms' ), esc_html__( 'Nova Scotia', 'gravityforms' ), esc_html__( 'Nunavut', 'gravityforms' ), esc_html__( 'Ontario', 'gravityforms' ), esc_html__( 'Prince Edward Island', 'gravityforms' ), esc_html__( 'Quebec', 'gravityforms' ), esc_html__( 'Saskatchewan', 'gravityforms' ), esc_html__( 'Yukon', 'gravityforms' ) );721 }722 public function get_state_dropdown( $states, $selected_state = '', $placeholder = '' ) {723 $str = '';724 foreach ( $states as $code => $state ) {725 if ( is_numeric( $code ) ) {726 $code = $state;727 }728 if ( empty( $state ) ) {729 $state = $placeholder;730 }731 $selected = $code == $selected_state ? "selected='selected'" : '';732 $str .= "<option value='" . esc_attr( $code ) . "' $selected>" . esc_html( $state ) . '</option>';733 }734 return $str;735 }736 public function get_us_state_dropdown( $selected_state = '' ) {737 $states = array_merge( array( '' ), $this->get_us_states() );738 $str = '';739 foreach ( $states as $code => $state ) {740 if ( is_numeric( $code ) ) {741 $code = $state;742 }743 $selected = $code == $selected_state ? "selected='selected'" : '';744 $str .= "<option value='" . esc_attr( $code ) . "' $selected>" . esc_html( $state ) . '</option>';745 }746 return $str;747 }748 public function get_canadian_provinces_dropdown( $selected_province = '' ) {749 $states = array_merge( array( '' ), $this->get_canadian_provinces() );750 $str = '';751 foreach ( $states as $state ) {752 $selected = $state == $selected_province ? "selected='selected'" : '';753 $str .= "<option value='" . esc_attr( $state ) . "' $selected>" . esc_html( $state ) . '</option>';754 }755 return $str;756 }757 public function get_country_dropdown( $selected_country = '', $placeholder = '' ) {758 $str = '';759 $selected_country = strtolower( $selected_country );760 $countries = array_merge( array( '' ), $this->get_countries() );761 foreach ( $countries as $code => $country ) {762 if ( is_numeric( $code ) ) {763 $code = $country;764 }765 if ( empty( $country ) ) {766 $country = $placeholder;767 }768 $selected = strtolower( $code ) == $selected_country ? "selected='selected'" : '';769 $str .= "<option value='" . esc_attr( $code ) . "' $selected>" . esc_html( $country ) . '</option>';770 }771 return $str;772 }773 public function get_value_entry_detail( $value, $currency = '', $use_text = false, $format = 'html', $media = 'screen' ) {774 if ( is_array( $value ) ) {775 $street_value = trim( rgget( $this->id . '.1', $value ) );776 $street2_value = trim( rgget( $this->id . '.2', $value ) );777 $city_value = trim( rgget( $this->id . '.3', $value ) );778 $state_value = trim( rgget( $this->id . '.4', $value ) );779 $zip_value = trim( rgget( $this->id . '.5', $value ) );780 $country_value = trim( rgget( $this->id . '.6', $value ) );781 $line_break = $format == 'html' ? '<br />' : "\n";782 $address_display_format = apply_filters( 'gform_address_display_format', 'default', $this );783 if ( $address_display_format == 'zip_before_city' ) {784 /*785 Sample:786 3333 Some Street787 suite 16788 2344 City, State789 Country790 */791 $addr_ary = array();792 $addr_ary[] = $street_value;793 if ( ! empty( $street2_value ) ) {794 $addr_ary[] = $street2_value;795 }796 $zip_line = trim( $zip_value . ' ' . $city_value );797 $zip_line .= ! empty( $zip_line ) && ! empty( $state_value ) ? ", {$state_value}" : $state_value;798 $zip_line = trim( $zip_line );799 if ( ! empty( $zip_line ) ) {800 $addr_ary[] = $zip_line;801 }802 if ( ! empty( $country_value ) ) {803 $addr_ary[] = $country_value;804 }805 $address = implode( '<br />', $addr_ary );806 } else {807 $address = $street_value;808 $address .= ! empty( $address ) && ! empty( $street2_value ) ? $line_break . $street2_value : $street2_value;809 $address .= ! empty( $address ) && ( ! empty( $city_value ) || ! empty( $state_value ) ) ? $line_break . $city_value : $city_value;810 $address .= ! empty( $address ) && ! empty( $city_value ) && ! empty( $state_value ) ? ", $state_value" : $state_value;811 $address .= ! empty( $address ) && ! empty( $zip_value ) ? " $zip_value" : $zip_value;812 $address .= ! empty( $address ) && ! empty( $country_value ) ? $line_break . $country_value : $country_value;813 }814 //adding map link815 $map_link_disabled = apply_filters( 'gform_disable_address_map_link', false );816 if ( ! empty( $address ) && $format == 'html' && ! $map_link_disabled ) {817 $address_qs = str_replace( $line_break, ' ', $address ); //replacing <br/> and \n with spaces818 $address_qs = urlencode( $address_qs );819 $address .= "<br/><a href='http://maps.google.com/maps?q={$address_qs}' target='_blank' class='map-it-link'>Map It</a>";820 }821 return $address;822 } else {823 return '';824 }825 }826 public function get_input_property( $input_id, $property_name ) {827 $input = GFFormsModel::get_input( $this, $input_id );828 return rgar( $input, $property_name );829 }830 public function sanitize_settings() {...
v_quartier.php
Source:v_quartier.php
...23 $this->nonDroit();24 }25 else26 {27 $html='<h2>Gestion quartier</h2>';28 $html.='<h3>Choisissez une action à effectuer</h3>';29 $html.='<ul>';30 $html.='<li>Gestion <a href="#" onclick=moreAntennes();>antennes</a> de quartier</li>';31 $html.='<div id=moreAntennes></div><br />';32 $html.='<li>Gestion <a href="#" onclick=moreQuartiers();>quartier</a></li>';33 $html.='<div id=moreQuartiers></div><br />';34 $html.='<li>Gestion <a href="#" onclick=moreAgents();>agents</a> de quartier</li>';35 $html.='<div id=moreAgents></div><br />';36 $html.='<li>Faire une <a href="#" onclick=moreRecherches();>recherche</a></li>';37 $html.='<div id=moreRecherches></div><br />'; 38 $html.='</ul>';39 40 // $html.='Actions à développer : <br />41 // - Gestion antennes de quartier (afficher - ajouter - modifier - supprimer)<br />42 // - Gestion des quartiers (attachement aux rues - "decoupables" par portions - et à l\'antenne) <br />43 // - Gestion des agents de quartier (attachement d\'un AQ à un quartier) <br />';44 45 // $html.='<img src="/zoom5317/templates/mytpl/images/under-construction.png">';46 $this->afficheHtml($html);47 }48 }49//------------------------------------------------------------//50// GENERATION DES FORMULAIRES D'AJOUT DES DIFFERENTES ENTITES //51//------------------------------------------------------------//52 53public function ajouter($type,$rues='',$agent='',$quartier=''){54 $html='<h2>Gestion quartier</h2><h3>Ajout d\'un';55 switch($type)56 {57 case 'antennes':58 $html.='e antenne de quartier</h3>';59 $html.=$this->formAjoutAntenne($rues,$agent);60 break;61 62 case 'quartier':63 $html.=' quartier</h3>';64 $html.=$this->formAjoutQuartier();65 break;66 67 case 'agent':68 $html.='e liaison agent de quartier / quartier</h3>';69 $html.=$this->formAjoutAgent($agent,$quartier);70 break;71 }72 $html.='<div id=rep></div>';73 $this->afficheHtml($html); 74 }75 76private function formAjoutAntenne($rues,$agent){77 $html='<table>';78 $html.='<tr><th>Dénomination :</th><td><input type=text id=denom autofocus></td><th>Adresse :</th><td><select id=adresse><option value=""></option>';79 while ($row=$rues->fetch())80 {81 $html.='<option value="'.$row['IdRue'].'" title="('.$row['StraatNaam'].')">'.$row['NomRue'].'</option>';82 }83 $html.='</select> n° <input type=text size=5 id=num></td></tr>';84 $html.='<tr><th>Téléphone :</th><td><input type=text id=phone value="056 / 863 "></td><th>Fax :</th><td><input type=text id=fax value="056 / 863 "></td></tr>';85 $html.='<tr><th>Responsable antenne :</th><td><select name=resp id=resp><option value=""></option>';86 while ($rowb=$agent->fetch()){87 $html.='<option value="'.$rowb['id_user'].'">'.$rowb['nom'].' '.$rowb['prenom'].'</option>';88 }89 $html.='</td></tr>';90 91 $html.='<tr><td colspan="4" class=noborder><input type=button onclick=addAntenne(); value=Enregistrer></td></tr>';92 $html.='</table>';93 return $html;94 }95 96private function formAjoutQuartier(){97 $html='<table>';98 $html.='<tr><th>Dénomination :</th><td><input type=text id=denom name=denom autofocus></td><th>GSM associé :</th><td><input type=text name=gsm id=gsm value="04xx / xxx xxx"</td></tr>';99 $html.='<tr><td colspan="4" class=noborder><input type=button value="Enregistrer" onclick=addQuartier();></td></tr>';100 $html.='</table>';101 $html.='<div id="rep"></div>';102 return $html;103 }104 105private function formAjoutAgent($agent,$quartier){106 $html='<table>';107 $html.='<tr><th>Agent concerné :</th><td><select id=agent><option value=""></option>';108 while ($row=$agent->fetch())109 {110 $html.='<option value="'.$row['id_user'].'">'.$row['nom'].' '.$row['prenom'].'</option>';111 }112 $html.='</select></td></tr>';113 $html.='<tr><th>Quartier associé :</th><td><select id=quartier onchange=checkAqQuart();><option value=""></option>';114 while ($row=$quartier->fetch())115 {116 $html.='<option value="'.$row['id_quartier'].'">'.$row['denomination'].'</option>';117 }118 $html.='</select></td></tr>'; 119 $html.='<tr><td colspan="2" class=noborder><input type=button onclick=addLiaisonAqQuart(); value=Enregistrer></td></tr>';120 $html.='</table>';121 $html.='<div id="rep"></div>';122 return $html;123 }124//-----//125// END //126//-----//127 128//--------------------------------------------------------------------//129// GENERATION DES FORMULAIRES DE MODIFICATION DES DIFFERENTES ENTITES //130//--------------------------------------------------------------------//131public function modifier($type,$data,$rues){132 $html='<h3>Modification d\'un';133 switch($type){134 case 'antennes':135 $html.='e antenne de quartier</h3>';136 $html.='<h4>Sélectionnez l\'antenne à modifier</h4>';137 $html.=$this->ShowAntennes($data,$rues);138 break;139 140 case 'quartier':141 $html.=' quartier</h3>';142 $html.='<h4>Sélectionnez le quartier à modifier</h4>';143 $html.=$this->ShowQuartiers($data,$rues); 144 break;145 146 case 'agent':147 $html.=' agent de quartier</h3>';148 $html.=$this->formModifAgent($data);149 break;150 }151 $this->afficheHtml($html);152 }153 154private function ShowAntennes($data,$rues){155 $html='';156 while ($row=$data->fetch()){157 $html.='<a href="#" onclick=modifAntenne("'.$row['id_antenne'].'");>'.$row['denomination'].'</a><br />';158 $html.='Adresse : '.$row['NomRue'].', '.$row['numero'].'. <br />';159 $html.='Téléphone : '.$row['telephone'].'.<br />';160 $html.='Fax : '.$row['fax'].'.<br />';161 $html.='<br /><div id='.$row['id_antenne'].'></div>';162 $html.='<hr>';163 }164 $html.='<div id="rep"></div><br />';165 return $html;166 }167 168private function ShowQuartiers($data,$rues){169 $html='';170 while ($row=$data->fetch()){171 $html.='<a href="#" onclick=modifQuartier("'.$row['id_quartier'].'");>'.$row['denomination'].'</a><br />';172 $html.='GSM associé : '.$row['gsm'].'<br />';173 $html.='<br /><div id='.$row['id_quartier'].'></div>';174 $html.='<hr>';175 }176 $html.='<div id="rep"></div><br />'; 177 return $html;178 }179 180private function formModifAgent($data){181 $html='<table>';182 $html.='<tr><th width=48%>Agent à modifier :</th><td><select name=agent id=agent onChange=infosAgent();><option value=""></option>';183 while ($row=$data->fetch()){184 $html.='<option value='.$row['id_user'].'>'.$row['nom'].' '.$row['prenom'].'</option>';185 }186 $html.='</td></tr>';187 $html.='</table>';188 $html.='<div id="rep"></div><br />';189 return $html;190 }191 192//-----//193// END //194//-----// 195 196public function afficheInfos($type,$data){197 $html='<h2>Antennes de quartier</h2>';198 switch ($type){199 case 'antennes' :200 while ($row=$data->fetch()){201 $html.='<b>'.$row['denomination'].'</b><br />';202 $html.='Adresse : '.$row['NomRue'].', '.$row['numero'].'. <br />';203 $html.='Téléphone : '.$row['telephone'].'.<br />';204 $html.='Fax : '.$row['fax'].'.<br />';205 $html.='<hr>';206 }207 break;208 case 'quartier':209 while ($row=$data->fetch()){210 $html.=$row['denomination'].'<br />';211 $html.='GSM associé : '.$row['gsm'].'<br />';212 $html.='<hr>';213 }214 break;215 case 'agent':216 $html.='<h4>Agents de quartier</h4>';217 while ($row=$data->fetch()){218 $html.=$row['nom'].' '.$row['prenom'];219 if (isset($row['gsm'])){220 $html.=' (Quartier : '.$row['denomination'].'. GSM de quartier : '.$row['gsm'].').<br />';221 } 222 $html.='<hr>';223 }224 break; 225 }226 $this->afficheHtml($html); 227 }228 229//------------------------//230//ASSOCIATION QUARTIER RUE//231//------------------------//232public function assocrq($rues,$quartiers){233 $html='<h3>Associer une (portion de) rue à un quartier</h3>';234 $html.='<h4>Choix de la rue</h4>';235 $html.='<table>';236 $html.='<tr><th>Rue :</th><td colspan="3"><select id=rue><option value=""></option>';237 while ($row=$rues->fetch())238 {239 $html.='<option value="'.$row['IdRue'].'" title="('.$row['StraatNaam'].')">'.$row['NomRue'].'</option>';240 }241 $html.='</select></td></tr>'; 242 $html.='<tr>';243 $html.='<th>Limite paire basse :</th><td><input type=text id=lpb value="0"></td><th>Limite paire haute :</th><td><input type=text id=lph value="998"></td>';244 $html.='</tr>';245 $html.='<tr>';246 $html.='<th>Limite impaire basse :</th><td><input type=text id=lib value="1"></td><th>Limite impaire haute :</th><td><input type=text id=lih value="999"></td>';247 $html.='</tr>';248 $html.='<tr><th>Quartier :</th><td colspan="3"><select id=quartier><option value=""></option>';249 while ($row=$quartiers->fetch())250 {251 $html.='<option value="'.$row['id_quartier'].'">'.$row['denomination'].'</option>';252 }253 $html.='</select></td></tr>'; 254 $html.='<tr><td colspan="4" class=noborder><input type=button onclick="assocrq();" value="Enregistrer"></td></tr>';255 $html.='</table>';256 $html.='<div id="rep"></div>';257 $this->afficheHtml($html);258 }259 260 261//----------------------------//262//ASSOCIATION QUARTIER ANTENNE//263//----------------------------//264 265public function assocqa($antennes,$quartiers){266 $html='<h3>Associer un quartier à une antenne de quartier</h3>';267 $html.='<h4>Choix de l\'antenne</h4>';268 $html.='<table>';269 $html.='<tr><th width=48%>Quartier à associer :</th><td><select id=quartier onChange=infosAntenne();><option value=""></option>';270 while ($row=$quartiers->fetch()){271 $html.='<option value='.$row['id_quartier'].'>'.$row['denomination'].'</option>';272 }273 $html.='</td></tr>';274 $html.='<tr><th width=48%>Antenne :</th><td><select id=antenne><option value=""></option>';275 while ($row=$antennes->fetch()){276 $html.='<option value='.$row['id_antenne'].'>'.$row['denomination'].'</option>';277 }278 $html.='</td></tr>';279 $html.='<tr><td colspan="2" class=noborder><input type=button onclick=assocqa(); value="Enregistrer"></td></tr>';280 $html.='</table>';281 $html.='<div id="rep"></div>';282 $this->afficheHtml($html);283 }284 285//------------------------------------------//286// GENERATION DES FORMULAIRES DE RECHERCHES //287//------------------------------------------// 288 289public function formSearch($type,$rues,$agents,$antennes,$quartiers){290 $html='<h3>Rechercher</h3>';291 switch ($type){292 case 'rue':293 $html.=$this->formSearchRue($rues);294 break;295 296 case 'agent':297 $html=$this->formSearchAgent($agents);298 break;299 300 case 'antenne':301 $html=$this->formSearchAntenne($antennes);302 break;303 }304 $html.='<div id=rep></div>';305 $this->afficheHtml($html);306 }307 308private function formSearchRue($rues){309 $html='<h4>Sur base de la rue</h4>';310 $html.='<table>';311 $html.='<tr><th>Rue concernée :</th><td><select name=info id=info onChange=showInfosBy("rue");><option value=""></option>';312 while ($row=$rues->fetch()){313 $html.='<option value='.$row['IdRue'].'>'.$row['NomRue'].'</option>';314 }315 $html.='</td></tr>';316 $html.='</table>';317 return $html;318 }319 320private function formSearchAgent($agents){321 $html='<h4>Sur base de l\'agent de quartier</h4>';322 $html.='<table>';323 $html.='<tr><th>Agent concerné :</th><td><select name=info id=info onChange=showInfosBy("agent");><option value=""></option>';324 while ($row=$agents->fetch()){325 $html.='<option value='.$row['id_user'].'>'.$row['nom'].' '.$row['prenom'].'</option>';326 }327 $html.='</td></tr>';328 $html.='</table>';329 return $html; 330 }331 332private function formSearchAntenne($antennes){333 $html='<h4>Sur base de l\'antenne</h4>';334 $html.='<table>';335 $html.='<tr><th>Antenne concernée :</th><td><select name=info id=info onChange=showInfosBy("antenne");><option value=""></option>';336 while ($row=$antennes->fetch()){337 $html.='<option value='.$row['id_antenne'].'>'.$row['denomination'].'</option>';338 }339 $html.='</td></tr>';340 $html.='</table>';341 return $html; 342 }343//--------------//344//FIN RECHERCHES//345//--------------//346}347?>...
mediatype_test.go
Source:mediatype_test.go
...124 "application/x-stuff",125 m("title", "This is even more ***fun*** isn't it!")},126 // Tests from http://greenbytes.de/tech/tc2231/127 // TODO(bradfitz): add the rest of the tests from that site.128 {`attachment; filename="f\oo.html"`,129 "attachment",130 m("filename", "foo.html")},131 {`attachment; filename="\"quoting\" tested.html"`,132 "attachment",133 m("filename", `"quoting" tested.html`)},134 {`attachment; filename="Here's a semicolon;.html"`,135 "attachment",136 m("filename", "Here's a semicolon;.html")},137 {`attachment; foo="\"\\";filename="foo.html"`,138 "attachment",139 m("foo", "\"\\", "filename", "foo.html")},140 {`attachment; filename=foo.html`,141 "attachment",142 m("filename", "foo.html")},143 {`attachment; filename=foo.html ;`,144 "attachment",145 m("filename", "foo.html")},146 {`attachment; filename='foo.html'`,147 "attachment",148 m("filename", "'foo.html'")},149 {`attachment; filename="foo-%41.html"`,150 "attachment",151 m("filename", "foo-%41.html")},152 {`attachment; filename="foo-%\41.html"`,153 "attachment",154 m("filename", "foo-%41.html")},155 {`filename=foo.html`,156 "", m()},157 {`x=y; filename=foo.html`,158 "", m()},159 {`"foo; filename=bar;baz"; filename=qux`,160 "", m()},161 {`inline; attachment; filename=foo.html`,162 "", m()},163 {`attachment; filename="foo.html".txt`,164 "", m()},165 {`attachment; filename="bar`,166 "", m()},167 {`attachment; creation-date="Wed, 12 Feb 1997 16:29:51 -0500"`,168 "attachment",169 m("creation-date", "Wed, 12 Feb 1997 16:29:51 -0500")},170 {`foobar`, "foobar", m()},171 {`attachment; filename* =UTF-8''foo-%c3%a4.html`,172 "attachment",173 m("filename", "foo-ä.html")},174 {`attachment; filename*=UTF-8''A-%2541.html`,175 "attachment",176 m("filename", "A-%41.html")},177 {`attachment; filename*0="foo."; filename*1="html"`,178 "attachment",179 m("filename", "foo.html")},180 {`attachment; filename*0*=UTF-8''foo-%c3%a4; filename*1=".html"`,181 "attachment",182 m("filename", "foo-ä.html")},183 {`attachment; filename*0="foo"; filename*01="bar"`,184 "attachment",185 m("filename", "foo")},186 {`attachment; filename*0="foo"; filename*2="bar"`,187 "attachment",188 m("filename", "foo")},189 {`attachment; filename*1="foo"; filename*2="bar"`,190 "attachment", m()},191 {`attachment; filename*1="bar"; filename*0="foo"`,192 "attachment",193 m("filename", "foobar")},194 {`attachment; filename="foo-ae.html"; filename*=UTF-8''foo-%c3%a4.html`,195 "attachment",196 m("filename", "foo-ä.html")},197 {`attachment; filename*=UTF-8''foo-%c3%a4.html; filename="foo-ae.html"`,198 "attachment",199 m("filename", "foo-ä.html")},200 // Browsers also just send UTF-8 directly without RFC 2231,201 // at least when the source page is served with UTF-8.202 {`form-data; firstname="ÐÑÑд"; lastname="ФиÑпаÑÑик"`,203 "form-data",204 m("firstname", "ÐÑÑд", "lastname", "ФиÑпаÑÑик")},205 // Empty string used to be mishandled.206 {`foo; bar=""`, "foo", m("bar", "")},207 }208 for _, test := range tests {209 mt, params, err := ParseMediaType(test.in)210 if err != nil {211 if test.t != "" {212 t.Errorf("for input %q, unexpected error: %v", test.in, err)213 continue...
mkd-loading-spinners.php
Source:mkd-loading-spinners.php
2if(!function_exists('depot_mikado_loading_spinners')) {3 function depot_mikado_loading_spinners() {4 $id = depot_mikado_get_page_id();5 $spinner_type = depot_mikado_get_meta_field_intersect('smooth_pt_spinner_type',$id);6 $spinner_html = '';7 if(!empty($spinner_type)){8 switch ($spinner_type) {9 case 'rotate_circles':10 $spinner_html = depot_mikado_loading_spinner_rotate_circles();11 break;12 case 'pulse':13 $spinner_html = depot_mikado_loading_spinner_pulse();14 break;15 case 'double_pulse':16 $spinner_html = depot_mikado_loading_spinner_double_pulse();17 break;18 case 'cube':19 $spinner_html = depot_mikado_loading_spinner_cube();20 break;21 case 'rotating_cubes':22 $spinner_html = depot_mikado_loading_spinner_rotating_cubes();23 break;24 case 'stripes':25 $spinner_html = depot_mikado_loading_spinner_stripes();26 break;27 case 'wave':28 $spinner_html = depot_mikado_loading_spinner_wave();29 break;30 case 'two_rotating_circles':31 $spinner_html = depot_mikado_loading_spinner_two_rotating_circles();32 break;33 case 'five_rotating_circles':34 $spinner_html = depot_mikado_loading_spinner_five_rotating_circles();35 break;36 case 'atom':37 $spinner_html = depot_mikado_loading_spinner_atom();38 break;39 case 'clock':40 $spinner_html = depot_mikado_loading_spinner_clock();41 break;42 case 'mitosis':43 $spinner_html = depot_mikado_loading_spinner_mitosis();44 break;45 case 'lines':46 $spinner_html = depot_mikado_loading_spinner_lines();47 break;48 case 'fussion':49 $spinner_html = depot_mikado_loading_spinner_fussion();50 break;51 case 'wave_circles':52 $spinner_html = depot_mikado_loading_spinner_wave_circles();53 break;54 case 'pulse_circles':55 $spinner_html = depot_mikado_loading_spinner_pulse_circles();56 break;57 default:58 $spinner_html = depot_mikado_loading_spinner_pulse();59 }60 }61 echo wp_kses($spinner_html, array(62 'div' => array(63 'class' => true,64 'style' => true,65 'id' => true66 )67 ));68 }69}70if(!function_exists('depot_mikado_loading_spinner_rotate_circles')) {71 function depot_mikado_loading_spinner_rotate_circles() {72 $html = '';73 $html .= '<div class="mkd-rotate-circles">';74 $html .= '<div></div>';75 $html .= '<div></div>';76 $html .= '<div></div>';77 $html .= '</div>';78 return $html;79 }80}81if(!function_exists('depot_mikado_loading_spinner_pulse')) {82 function depot_mikado_loading_spinner_pulse() {83 $html = '<div class="pulse"></div>';84 return $html;85 }86}87if(!function_exists('depot_mikado_loading_spinner_double_pulse')) {88 function depot_mikado_loading_spinner_double_pulse() {89 $html = '';90 $html .= '<div class="double_pulse">';91 $html .= '<div class="double-bounce1"></div>';92 $html .= '<div class="double-bounce2"></div>';93 $html .= '</div>';94 return $html;95 }96}97if(!function_exists('depot_mikado_loading_spinner_cube')) {98 function depot_mikado_loading_spinner_cube() {99 $html = '<div class="cube"></div>';100 return $html;101 }102}103if(!function_exists('depot_mikado_loading_spinner_rotating_cubes')) {104 function depot_mikado_loading_spinner_rotating_cubes() {105 $html = '';106 $html .= '<div class="rotating_cubes">';107 $html .= '<div class="cube1"></div>';108 $html .= '<div class="cube2"></div>';109 $html .= '</div>';110 return $html;111 }112}113if(!function_exists('depot_mikado_loading_spinner_stripes')) {114 function depot_mikado_loading_spinner_stripes() {115 $html = '';116 $html .= '<div class="stripes">';117 $html .= '<div class="rect1"></div>';118 $html .= '<div class="rect2"></div>';119 $html .= '<div class="rect3"></div>';120 $html .= '<div class="rect4"></div>';121 $html .= '<div class="rect5"></div>';122 $html .= '</div>';123 return $html;124 }125}126if(!function_exists('depot_mikado_loading_spinner_wave')) {127 function depot_mikado_loading_spinner_wave() {128 $html = '';129 $html .= '<div class="wave">';130 $html .= '<div class="bounce1"></div>';131 $html .= '<div class="bounce2"></div>';132 $html .= '<div class="bounce3"></div>';133 $html .= '</div>';134 return $html;135 }136}137if(!function_exists('depot_mikado_loading_spinner_two_rotating_circles')) {138 function depot_mikado_loading_spinner_two_rotating_circles() {139 $html = '';140 $html .= '<div class="two_rotating_circles">';141 $html .= '<div class="dot1"></div>';142 $html .= '<div class="dot2"></div>';143 $html .= '</div>';144 return $html;145 }146}147if(!function_exists('depot_mikado_loading_spinner_five_rotating_circles')) {148 function depot_mikado_loading_spinner_five_rotating_circles() {149 $html = '';150 $html .= '<div class="five_rotating_circles">';151 $html .= '<div class="spinner-container container1">';152 $html .= '<div class="circle1"></div>';153 $html .= '<div class="circle2"></div>';154 $html .= '<div class="circle3"></div>';155 $html .= '<div class="circle4"></div>';156 $html .= '</div>';157 $html .= '<div class="spinner-container container2">';158 $html .= '<div class="circle1"></div>';159 $html .= '<div class="circle2"></div>';160 $html .= '<div class="circle3"></div>';161 $html .= '<div class="circle4"></div>';162 $html .= '</div>';163 $html .= '<div class="spinner-container container3">';164 $html .= '<div class="circle1"></div>';165 $html .= '<div class="circle2"></div>';166 $html .= '<div class="circle3"></div>';167 $html .= '<div class="circle4"></div>';168 $html .= '</div>';169 $html .= '</div>';170 return $html;171 }172}173if(!function_exists('depot_mikado_loading_spinner_atom')) {174 function depot_mikado_loading_spinner_atom(){175 $html = '';176 $html .= '<div class="atom">';177 $html .= '<div class="ball ball-1"></div>';178 $html .= '<div class="ball ball-2"></div>';179 $html .= '<div class="ball ball-3"></div>';180 $html .= '<div class="ball ball-4"></div>';181 $html .= '</div>';182 return $html;183 }184}185if(!function_exists('depot_mikado_loading_spinner_clock')) {186 function depot_mikado_loading_spinner_clock(){187 $html = '';188 $html .= '<div class="clock">';189 $html .= '<div class="ball ball-1"></div>';190 $html .= '<div class="ball ball-2"></div>';191 $html .= '<div class="ball ball-3"></div>';192 $html .= '<div class="ball ball-4"></div>';193 $html .= '</div>';194 return $html;195 }196}197if(!function_exists('depot_mikado_loading_spinner_mitosis')) {198 function depot_mikado_loading_spinner_mitosis(){199 $html = '';200 $html .= '<div class="mitosis">';201 $html .= '<div class="ball ball-1"></div>';202 $html .= '<div class="ball ball-2"></div>';203 $html .= '<div class="ball ball-3"></div>';204 $html .= '<div class="ball ball-4"></div>';205 $html .= '</div>';206 return $html;207 }208}209if(!function_exists('depot_mikado_loading_spinner_lines')) {210 function depot_mikado_loading_spinner_lines(){211 $html = '';212 $html .= '<div class="lines">';213 $html .= '<div class="line1"></div>';214 $html .= '<div class="line2"></div>';215 $html .= '<div class="line3"></div>';216 $html .= '<div class="line4"></div>';217 $html .= '</div>';218 return $html;219 }220}221if(!function_exists('depot_mikado_loading_spinner_fussion')) {222 function depot_mikado_loading_spinner_fussion(){223 $html = '';224 $html .= '<div class="fussion">';225 $html .= '<div class="ball ball-1"></div>';226 $html .= '<div class="ball ball-2"></div>';227 $html .= '<div class="ball ball-3"></div>';228 $html .= '<div class="ball ball-4"></div>';229 $html .= '</div>';230 return $html;231 }232}233if(!function_exists('depot_mikado_loading_spinner_wave_circles')) {234 function depot_mikado_loading_spinner_wave_circles(){235 $html = '';236 $html .= '<div class="wave_circles">';237 $html .= '<div class="ball ball-1"></div>';238 $html .= '<div class="ball ball-2"></div>';239 $html .= '<div class="ball ball-3"></div>';240 $html .= '<div class="ball ball-4"></div>';241 $html .= '</div>';242 return $html;243 }244}245if(!function_exists('depot_mikado_loading_spinner_pulse_circles')) {246 function depot_mikado_loading_spinner_pulse_circles(){247 $html = '';248 $html .= '<div class="pulse_circles">';249 $html .= '<div class="ball ball-1"></div>';250 $html .= '<div class="ball ball-2"></div>';251 $html .= '<div class="ball ball-3"></div>';252 $html .= '<div class="ball ball-4"></div>';253 $html .= '</div>';254 return $html;255 }256}...
html.go
Source:html.go
...7 "fmt"8 "strings"9 "unicode/utf8"10)11// htmlNospaceEscaper escapes for inclusion in unquoted attribute values.12func htmlNospaceEscaper(args ...interface{}) string {13 s, t := stringify(args...)14 if t == contentTypeHTML {15 return htmlReplacer(stripTags(s), htmlNospaceNormReplacementTable, false)16 }17 return htmlReplacer(s, htmlNospaceReplacementTable, false)18}19// attrEscaper escapes for inclusion in quoted attribute values.20func attrEscaper(args ...interface{}) string {21 s, t := stringify(args...)22 if t == contentTypeHTML {23 return htmlReplacer(stripTags(s), htmlNormReplacementTable, true)24 }25 return htmlReplacer(s, htmlReplacementTable, true)26}27// rcdataEscaper escapes for inclusion in an RCDATA element body.28func rcdataEscaper(args ...interface{}) string {29 s, t := stringify(args...)30 if t == contentTypeHTML {31 return htmlReplacer(s, htmlNormReplacementTable, true)32 }33 return htmlReplacer(s, htmlReplacementTable, true)34}35// htmlEscaper escapes for inclusion in HTML text.36func htmlEscaper(args ...interface{}) string {37 s, t := stringify(args...)38 if t == contentTypeHTML {39 return s40 }41 return htmlReplacer(s, htmlReplacementTable, true)42}43// htmlReplacementTable contains the runes that need to be escaped44// inside a quoted attribute value or in a text node.45var htmlReplacementTable = []string{46 // http://www.w3.org/TR/html5/syntax.html#attribute-value-(unquoted)-state47 // U+0000 NULL Parse error. Append a U+FFFD REPLACEMENT48 // CHARACTER character to the current attribute's value.49 // "50 // and similarly51 // http://www.w3.org/TR/html5/syntax.html#before-attribute-value-state52 0: "\uFFFD",53 '"': """,54 '&': "&",55 '\'': "'",56 '+': "+",57 '<': "<",58 '>': ">",59}60// htmlNormReplacementTable is like htmlReplacementTable but without '&' to61// avoid over-encoding existing entities.62var htmlNormReplacementTable = []string{63 0: "\uFFFD",64 '"': """,65 '\'': "'",66 '+': "+",67 '<': "<",68 '>': ">",69}70// htmlNospaceReplacementTable contains the runes that need to be escaped71// inside an unquoted attribute value.72// The set of runes escaped is the union of the HTML specials and73// those determined by running the JS below in browsers:74// <div id=d></div>75// <script>(function () {76// var a = [], d = document.getElementById("d"), i, c, s;77// for (i = 0; i < 0x10000; ++i) {78// c = String.fromCharCode(i);79// d.innerHTML = "<span title=" + c + "lt" + c + "></span>"80// s = d.getElementsByTagName("SPAN")[0];81// if (!s || s.title !== c + "lt" + c) { a.push(i.toString(16)); }82// }83// document.write(a.join(", "));84// })()</script>85var htmlNospaceReplacementTable = []string{86 0: "�",87 '\t': "	",88 '\n': " ",89 '\v': "",90 '\f': "",91 '\r': " ",92 ' ': " ",93 '"': """,94 '&': "&",95 '\'': "'",96 '+': "+",97 '<': "<",98 '=': "=",99 '>': ">",100 // A parse error in the attribute value (unquoted) and101 // before attribute value states.102 // Treated as a quoting character by IE.103 '`': "`",104}105// htmlNospaceNormReplacementTable is like htmlNospaceReplacementTable but106// without '&' to avoid over-encoding existing entities.107var htmlNospaceNormReplacementTable = []string{108 0: "�",109 '\t': "	",110 '\n': " ",111 '\v': "",112 '\f': "",113 '\r': " ",114 ' ': " ",115 '"': """,116 '\'': "'",117 '+': "+",118 '<': "<",119 '=': "=",120 '>': ">",121 // A parse error in the attribute value (unquoted) and122 // before attribute value states.123 // Treated as a quoting character by IE.124 '`': "`",125}126// htmlReplacer returns s with runes replaced according to replacementTable127// and when badRunes is true, certain bad runes are allowed through unescaped.128func htmlReplacer(s string, replacementTable []string, badRunes bool) string {129 written, b := 0, new(bytes.Buffer)130 r, w := rune(0), 0131 for i := 0; i < len(s); i += w {132 // Cannot use 'for range s' because we need to preserve the width133 // of the runes in the input. If we see a decoding error, the input134 // width will not be utf8.Runelen(r) and we will overrun the buffer.135 r, w = utf8.DecodeRuneInString(s[i:])136 if int(r) < len(replacementTable) {137 if repl := replacementTable[r]; len(repl) != 0 {138 b.WriteString(s[written:i])139 b.WriteString(repl)140 written = i + w141 }142 } else if badRunes {143 // No-op.144 // IE does not allow these ranges in unquoted attrs.145 } else if 0xfdd0 <= r && r <= 0xfdef || 0xfff0 <= r && r <= 0xffff {146 fmt.Fprintf(b, "%s&#x%x;", s[written:i], r)147 written = i + w148 }149 }150 if written == 0 {151 return s152 }153 b.WriteString(s[written:])154 return b.String()155}156// stripTags takes a snippet of HTML and returns only the text content.157// For example, `<b>¡Hi!</b> <script>...</script>` -> `¡Hi! `.158func stripTags(html string) string {159 var b bytes.Buffer160 s, c, i, allText := []byte(html), context{}, 0, true161 // Using the transition funcs helps us avoid mangling162 // `<div title="1>2">` or `I <3 Ponies!`.163 for i != len(s) {164 if c.delim == delimNone {165 st := c.state166 // Use RCDATA instead of parsing into JS or CSS styles.167 if c.element != elementNone && !isInTag(st) {168 st = stateRCDATA169 }170 d, nread := transitionFunc[st](c, s[i:])171 i1 := i + nread172 if c.state == stateText || c.state == stateRCDATA {173 // Emit text up to the start of the tag or comment.174 j := i1175 if d.state != c.state {176 for j1 := j - 1; j1 >= i; j1-- {177 if s[j1] == '<' {178 j = j1179 break180 }181 }182 }183 b.Write(s[i:j])184 } else {185 allText = false186 }187 c, i = d, i1188 continue189 }190 i1 := i + bytes.IndexAny(s[i:], delimEnds[c.delim])191 if i1 < i {192 break193 }194 if c.delim != delimSpaceOrTagEnd {195 // Consume any quote.196 i1++197 }198 c, i = context{state: stateTag, element: c.element}, i1199 }200 if allText {201 return html202 } else if c.state == stateText || c.state == stateRCDATA {203 b.Write(s[i:])204 }205 return b.String()206}207// htmlNameFilter accepts valid parts of an HTML attribute or tag name or208// a known-safe HTML attribute.209func htmlNameFilter(args ...interface{}) string {210 s, t := stringify(args...)211 if t == contentTypeHTMLAttr {212 return s213 }214 if len(s) == 0 {215 // Avoid violation of structure preservation.216 // <input checked {{.K}}={{.V}}>.217 // Without this, if .K is empty then .V is the value of218 // checked, but otherwise .V is the value of the attribute219 // named .K.220 return filterFailsafe221 }222 s = strings.ToLower(s)223 if t := attrType(s); t != contentTypePlain {...
doctype.go
Source:doctype.go
1// Copyright 2011 The Go Authors. All rights reserved.2// Use of this source code is governed by a BSD-style3// license that can be found in the LICENSE file.4package html5import (6 "strings"7)8// parseDoctype parses the data from a DoctypeToken into a name,9// public identifier, and system identifier. It returns a Node whose Type10// is DoctypeNode, whose Data is the name, and which has attributes11// named "system" and "public" for the two identifiers if they were present.12// quirks is whether the document should be parsed in "quirks mode".13func parseDoctype(s string) (n *Node, quirks bool) {14 n = &Node{Type: DoctypeNode}15 // Find the name.16 space := strings.IndexAny(s, whitespace)17 if space == -1 {18 space = len(s)19 }20 n.Data = s[:space]21 // The comparison to "html" is case-sensitive.22 if n.Data != "html" {23 quirks = true24 }25 n.Data = strings.ToLower(n.Data)26 s = strings.TrimLeft(s[space:], whitespace)27 if len(s) < 6 {28 // It can't start with "PUBLIC" or "SYSTEM".29 // Ignore the rest of the string.30 return n, quirks || s != ""31 }32 key := strings.ToLower(s[:6])33 s = s[6:]34 for key == "public" || key == "system" {35 s = strings.TrimLeft(s, whitespace)36 if s == "" {37 break38 }39 quote := s[0]40 if quote != '"' && quote != '\'' {41 break42 }43 s = s[1:]44 q := strings.IndexRune(s, rune(quote))45 var id string46 if q == -1 {47 id = s48 s = ""49 } else {50 id = s[:q]51 s = s[q+1:]52 }53 n.Attr = append(n.Attr, Attribute{Key: key, Val: id})54 if key == "public" {55 key = "system"56 } else {57 key = ""58 }59 }60 if key != "" || s != "" {61 quirks = true62 } else if len(n.Attr) > 0 {63 if n.Attr[0].Key == "public" {64 public := strings.ToLower(n.Attr[0].Val)65 switch public {66 case "-//w3o//dtd w3 html strict 3.0//en//", "-/w3d/dtd html 4.0 transitional/en", "html":67 quirks = true68 default:69 for _, q := range quirkyIDs {70 if strings.HasPrefix(public, q) {71 quirks = true72 break73 }74 }75 }76 // The following two public IDs only cause quirks mode if there is no system ID.77 if len(n.Attr) == 1 && (strings.HasPrefix(public, "-//w3c//dtd html 4.01 frameset//") ||78 strings.HasPrefix(public, "-//w3c//dtd html 4.01 transitional//")) {79 quirks = true80 }81 }82 if lastAttr := n.Attr[len(n.Attr)-1]; lastAttr.Key == "system" &&83 strings.ToLower(lastAttr.Val) == "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd" {84 quirks = true85 }86 }87 return n, quirks88}89// quirkyIDs is a list of public doctype identifiers that cause a document90// to be interpreted in quirks mode. The identifiers should be in lower case.91var quirkyIDs = []string{92 "+//silmaril//dtd html pro v0r11 19970101//",93 "-//advasoft ltd//dtd html 3.0 aswedit + extensions//",94 "-//as//dtd html 3.0 aswedit + extensions//",95 "-//ietf//dtd html 2.0 level 1//",96 "-//ietf//dtd html 2.0 level 2//",97 "-//ietf//dtd html 2.0 strict level 1//",98 "-//ietf//dtd html 2.0 strict level 2//",99 "-//ietf//dtd html 2.0 strict//",100 "-//ietf//dtd html 2.0//",101 "-//ietf//dtd html 2.1e//",102 "-//ietf//dtd html 3.0//",103 "-//ietf//dtd html 3.2 final//",104 "-//ietf//dtd html 3.2//",105 "-//ietf//dtd html 3//",106 "-//ietf//dtd html level 0//",107 "-//ietf//dtd html level 1//",108 "-//ietf//dtd html level 2//",109 "-//ietf//dtd html level 3//",110 "-//ietf//dtd html strict level 0//",111 "-//ietf//dtd html strict level 1//",112 "-//ietf//dtd html strict level 2//",113 "-//ietf//dtd html strict level 3//",114 "-//ietf//dtd html strict//",115 "-//ietf//dtd html//",116 "-//metrius//dtd metrius presentational//",117 "-//microsoft//dtd internet explorer 2.0 html strict//",118 "-//microsoft//dtd internet explorer 2.0 html//",119 "-//microsoft//dtd internet explorer 2.0 tables//",120 "-//microsoft//dtd internet explorer 3.0 html strict//",121 "-//microsoft//dtd internet explorer 3.0 html//",122 "-//microsoft//dtd internet explorer 3.0 tables//",123 "-//netscape comm. corp.//dtd html//",124 "-//netscape comm. corp.//dtd strict html//",125 "-//o'reilly and associates//dtd html 2.0//",126 "-//o'reilly and associates//dtd html extended 1.0//",127 "-//o'reilly and associates//dtd html extended relaxed 1.0//",128 "-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//",129 "-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//",130 "-//spyglass//dtd html 2.0 extended//",131 "-//sq//dtd html 2.0 hotmetal + extensions//",132 "-//sun microsystems corp.//dtd hotjava html//",133 "-//sun microsystems corp.//dtd hotjava strict html//",134 "-//w3c//dtd html 3 1995-03-24//",135 "-//w3c//dtd html 3.2 draft//",136 "-//w3c//dtd html 3.2 final//",137 "-//w3c//dtd html 3.2//",138 "-//w3c//dtd html 3.2s draft//",139 "-//w3c//dtd html 4.0 frameset//",140 "-//w3c//dtd html 4.0 transitional//",141 "-//w3c//dtd html experimental 19960712//",142 "-//w3c//dtd html experimental 970421//",143 "-//w3c//dtd w3 html//",144 "-//w3o//dtd w3 html 3.0//",145 "-//webtechs//dtd mozilla html 2.0//",146 "-//webtechs//dtd mozilla html//",147}...
html
Using AI Code Generation
1use \mageekguy\atoum\reports\realtime\html;2use \mageekguy\atoum\reports\coverage;3use \mageekguy\atoum\reports\coverage\html;4use \mageekguy\atoum\reports\coverage\clover;5use \mageekguy\atoum\reports\coverage\php;6use \mageekguy\atoum\reports\coverage\xml;7use \mageekguy\atoum\reports\coverage\text;8use \mageekguy\atoum\reports\coverage\html;9use \mageekguy\atoum\reports\coverage\clover;10use \mageekguy\atoum\reports\coverage\php;11use \mageekguy\atoum\reports\coverage\xml;12use \mageekguy\atoum\reports\coverage\text;13use \mageekguy\atoum\reports\coverage\html;14use \mageekguy\atoum\reports\coverage\clover;15use \mageekguy\atoum\reports\coverage\php;16use \mageekguy\atoum\reports\coverage\xml;17use \mageekguy\atoum\reports\coverage\text;
html
Using AI Code Generation
1require 'vendor/autoload.php';2use \mageekguy\atoum;3use \mageekguy\atoum\reports;4use \mageekguy\atoum\writers\std;5use \mageekguy\atoum\reports\asynchronous;6use \mageekguy\atoum\reports\realtime;7use \mageekguy\atoum\reports\coverage;8use \mageekguy\atoum\reports\coverage\html;9use \mageekguy\atoum\reports\coverage\clover;10$script->addDefaultReport();11$coverageField = new \mageekguy\atoum\report\fields\runner\coverage\html('MyProject', '/path/to/coverage');12$runner->addReport(new \mageekguy\atoum\reports\asynchronous\html());13$runner->addReport(new \mageekguy\atoum\reports\realtime\html());14$runner->addReport(new \mageekguy\atoum\reports\coverage\html());15$runner->addReport(new \mageekguy\atoum\reports\coverage\clover());16$runner->addReport($coverageField);17require 'vendor/autoload.php';18use \mageekguy\atoum;19use \mageekguy\atoum\reports;20use \mageekguy\atoum\writers\std;21use \mageekguy\atoum\reports\asynchronous;22use \mageekguy\atoum\reports\realtime;23use \mageekguy\atoum\reports\coverage;24use \mageekguy\atoum\reports\coverage\html;25use \mageekguy\atoum\reports\coverage\clover;26$script->addDefaultReport();27$coverageField = new \mageekguy\atoum\report\fields\runner\coverage\html('MyProject', '/path/to/coverage');
html
Using AI Code Generation
1require_once __DIR__ . '/vendor/autoload.php';2{3 public function __construct()4 {5 parent::__construct();6 }7}8$runner->addReport(new Html());9$runner->addTestsFromDirectory(__DIR__ . '/tests/units');10$script->run();
html
Using AI Code Generation
1use \mageekguy\atoum\html\report;2$report = new report();3$report->addWriter(new report\writer\std\out());4$runner->addReport($report);5$report = new report();6$report->addWriter(new report\writer\std\out());7$runner->addReport($report);8$report = new report();9$report->addWriter(new report\writer\std\out());10$runner->addReport($report);11$report = new report();12$report->addWriter(new report\writer\std\out());13$runner->addReport($report);14$report = new report();15$report->addWriter(new report\writer\std\out());16$runner->addReport($report);17$report = new report();18$report->addWriter(new report\writer\std\out());19$runner->addReport($report);20$report = new report();21$report->addWriter(new report\writer\std\out());22$runner->addReport($report);23$report = new report();24$report->addWriter(new report\writer\std\out());25$runner->addReport($report);26$report = new report();27$report->addWriter(new report\writer\std\out());28$runner->addReport($report
html
Using AI Code Generation
1require_once 'vendor/autoload.php';2use mageekguy\atoum\reports\realtime\html;3$cli = new \mageekguy\atoum\scripts\runner();4$cli->addReport(new html());5$cli->run();6require_once 'vendor/autoload.php';7use mageekguy\atoum\reports\realtime\html;8$cli = new \mageekguy\atoum\scripts\runner();9$cli->addReport(new html());10$cli->run();11require_once 'vendor/autoload.php';12use mageekguy\atoum\reports\realtime\html;13$cli = new \mageekguy\atoum\scripts\runner();14$cli->addReport(new html());15$cli->run();16require_once 'vendor/autoload.php';17use mageekguy\atoum\reports\realtime\html;18$cli = new \mageekguy\atoum\scripts\runner();19$cli->addReport(new html());20$cli->run();21require_once 'vendor/autoload.php';22use mageekguy\atoum\reports\realtime\html;23$cli = new \mageekguy\atoum\scripts\runner();24$cli->addReport(new html());25$cli->run();26require_once 'vendor/autoload.php';27use mageekguy\atoum\reports\realtime\html;28$cli = new \mageekguy\atoum\scripts\runner();29$cli->addReport(new html());30$cli->run();
html
Using AI Code Generation
1require_once 'vendor/autoload.php';2{3 public function testHtml()4 {5 ->setRootDir('./')6 ->setRewriteUrl(false)7 ->setDumpDirectory('./')8 ->setDumpFileName('dump.html')9 ->setDumpFileExtension('.html')10 ->setDumpFileContent('dump.html')11 ->setDumpFileContentExtension('.html')12 ->setDumpFile(true)13 ->setDumpFileContent(true)14 ->setDumpFileContentExtension('.html')15 ->setDumpFileExtension('.html')16 ->setDumpFileName('dump.html')17 ->setDumpDirectory('./')18 ->setRewriteUrl(false)19 ->setRootDir('./')20 ->setDumpFile(true)21 ->setDumpFileContent(true)22 ->setDumpFileContentExtension('.html')23 ->setDumpFileExtension('.html')24 ->setDumpFileName('dump.html')25 ->setDumpDirectory('./')26 ->setRewriteUrl(false)27 ->setRootDir('./')28 ->setDumpFile(true)29 ->setDumpFileContent(true)30 ->setDumpFileContentExtension('.html')31 ->setDumpFileExtension('.html')32 ->setDumpFileName('dump.html')33 ->setDumpDirectory('./')34 ->setRewriteUrl(false)35 ->setRootDir('./')36 ->setDumpFile(true)37 ->setDumpFileContent(true)38 ->setDumpFileContentExtension('.html')39 ->setDumpFileExtension('.html')40 ->setDumpFileName('dump.html')41 ->setDumpDirectory('./')42 ->setRewriteUrl(false)43 ->setRootDir('./')44 ->setDumpFile(true)45 ->setDumpFileContent(true)46 ->setDumpFileContentExtension('.html')47 ->setDumpFileExtension('.html')48 ->setDumpFileName('dump.html')49 ->setDumpDirectory('./')50 ->setRewriteUrl(false)51 ->setRootDir('./')52 ->setDumpFile(true)
html
Using AI Code Generation
1require_once 'atoum/classes/html.php';2$html = new html();3$html->add('html');4$html->add('head');5$html->add('title');6$html->add('title', 'My Title');7$html->add('body');8$html->add('h1');9$html->add('h1', 'My Heading');10$html->add('p');11$html->add('p', 'My paragraph.');12echo $html;13require_once 'atoum/classes/html.php';14$html = new html();15$html->add('html');16$html->add('head');17$html->add('title');18$html->add('title', 'My Title');19$html->add('body');20$html->add('h1');21$html->add('h1', 'My Heading');22$html->add('p');23$html->add('p', 'My paragraph.');24$html->add('p');25$html->add('p', 'My paragraph 2.');26echo $html;27require_once 'atoum/classes/html.php';
html
Using AI Code Generation
1use Atoum\Atoum;2$atoum = new Atoum();3$html = $atoum->html;4$title = $html->getTitle();5$h1 = $html->getH1();6$h2 = $html->getH2();7$h3 = $html->getH3();8$h4 = $html->getH4();9$h5 = $html->getH5();10$h6 = $html->getH6();11$text = $html->getText();12$links = $html->getLinks();13$images = $html->getImages();14$forms = $html->getForms();
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.
Test now for FreeGet 100 minutes of automation test minutes FREE!!