protected function o_action($id, $action, $options = '')
    {
        if ($action !== 'new') {
            $o = &$this->objects[$id];
        }

        switch ($action) {
            case 'new':
                if (is_array($options)) {
                    $this->objects[$id] = array('t' => 'action', 'info' => $options, 'type' => $options['type']);
                } else {
                    // then assume a URI action
                    $this->objects[$id] = array('t' => 'action', 'info' => $options, 'type' => 'URI');
                }
                break;

            case 'out':
                if ($this->encrypted) {
                    $this->encryptInit($id);
                }

                $res = "\n$id 0 obj\n<< /Type /Action";
                switch ($o['type']) {
                    case 'ilink':
                        if (!isset($this->destinations[(string)$o['info']['label']])) {
                            break;
                        }

                        // there will be an 'label' setting, this is the name of the destination
                        $res .= "\n/S /GoTo\n/D " . $this->destinations[(string)$o['info']['label']] . " 0 R";
                        break;

                    case 'URI':
                        $res .= "\n/S /URI\n/URI (";
                        if ($this->encrypted) {
                            $res .= $this->filterText($this->ARC4($o['info']), false, false);
                        } else {
                            $res .= $this->filterText($o['info'], false, false);
                        }

                        $res .= ")";
                        break;
                }

                $res .= "\n>>\nendobj";

                return $res;
        }

        return null;
    }
protected function o_action($id, $action, $options = '')
    {
        if ($action !== 'new') {
            $o = &$this->objects[$id];
        }

        switch ($action) {
            case 'new':
                if (is_array($options)) {
                    $this->objects[$id] = array('t' => 'action', 'info' => $options, 'type' => $options['type']);
                } else {
                    // then assume a URI action
                    $this->objects[$id] = array('t' => 'action', 'info' => $options, 'type' => 'URI');
                }
                break;

            case 'out':
                if ($this->encrypted) {
                    $this->encryptInit($id);
                }

                $res = "\n$id 0 obj\n<< /Type /Action";
                switch ($o['type']) {
                    case 'ilink':
                        if (!isset($this->destinations[(string)$o['info']['label']])) {
                            break;
                        }

                        // there will be an 'label' setting, this is the name of the destination
                        $res .= "\n/S /GoTo\n/D " . $this->destinations[(string)$o['info']['label']] . " 0 R";
                        break;

                    case 'URI':
                        $res .= "\n/S /URI\n/URI (";
                        if ($this->encrypted) {
                            $res .= $this->filterText($this->ARC4($o['info']), false, false);
                        } else {
                            $res .= $this->filterText($o['info'], false, false);
                        }

                        $res .= ")";
                        break;
                }

                $res .= "\n>>\nendobj";

                return $res;
        }

        return null;
    }
protected function o_action ( $ id , $ action , $ options = '' ) { if ( $ action !== 'new' ) { $ o = & $ this -> objects [ $ id ] ; } switch ( $ action ) { case 'new' : if ( is_array ( $ options ) ) { $ this -> objects [ $ id ] = array ( 't' => 'action' , 'info' => $ options , 'type' => $ options [ 'type' ] ) ; } else { // then assume a URI action $ this -> objects [ $ id ] = array ( 't' => 'action' , 'info' => $ options , 'type' => 'URI' ) ; } break ; case 'out' : if ( $ this -> encrypted ) { $ this -> encryptInit ( $ id ) ; } $ res = "\n$id 0 obj\n<< /Type /Action" ; switch ( $ o [ 'type' ] ) { case 'ilink' : if ( ! isset ( $ this -> destinations [ ( string ) $ o [ 'info' ] [ 'label' ] ] ) ) { break ; } // there will be an 'label' setting, this is the name of the destination $ res .= "\n/S /GoTo\n/D " . $ this -> destinations [ ( string ) $ o [ 'info' ] [ 'label' ] ] . " 0 R" ; break ; case 'URI' : $ res .= "\n/S /URI\n/URI (" ; if ( $ this -> encrypted ) { $ res .= $ this -> filterText ( $ this -> ARC4 ( $ o [ 'info' ] ) , false , false ) ; } else { $ res .= $ this -> filterText ( $ o [ 'info' ] , false , false ) ; } $ res .= ")" ; break ; } $ res .= "\n>>\nendobj" ; return $ res ; } return null ; }
an action object, used to link to URLS initially

@param $id
@param $action
@param string $options
@return null|string
an action object used to link to URLS initially