/var/www/html_nl/wp-content/plugins/loco-translate/src/mvc/HiddenFields.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/**
 * 
 */
class Loco_mvc_HiddenFields extends Loco_mvc_ViewParams {
    
    
    
    
/**
     * @internal
     * Echo all hidden fields to output buffer
     */
    
public function _e(){
        foreach( 
$this as $name => $value ){
            echo 
'<input type="hidden" name="',$this->escape($name),'" value="',$this->escape($value),'" />';
        }
    }


    
/**
     * Add a nonce field 
     * @param string action passed to wp_create_nonce
     * @return Loco_mvc_HiddenFields
     */
    
public function setNonce$action ){
        
$this['loco-nonce'] = wp_create_nonce$action );
        return 
$this;
    }


    
/**
     * @return string
     */
    
public function getNonce() {
        return 
$this['loco-nonce'];
    }
    

    
/**
     * Load postdata fields
     * @param Loco_mvc_PostParams post data
     * @return Loco_mvc_HiddenFields
     */
    
public function addPostLoco_mvc_PostParams $post ){
        foreach( 
$post->getSerial() as $pair ){
            
$this$pair[0] ] = isset($pair[1]) ? $pair[1] : '';
        }
        return 
$this;
    }


    
/**
     * Append arguments to a URL
     * @param string optional base url
     * @return string full URL with query string
     */
    
public function getHref$base '' ){
        
$query http_build_query($this->getArrayCopy());
        
$sep false === strpos($base,'?') ? '?' '&';
        return 
$base.$sep.$query;
    }