A toUnicode section, needed for unicode fonts

@param $id
@param $action
@return null|string
182827
protected function o_toUnicode($id, $action)
    {
        switch ($action) {
            case 'new':
                $this->objects[$id] = array(
                    't'    => 'toUnicode'
                );
                break;
            case 'add':
                break;
            case 'out':
                $ordering = '(UCS)';
                $registry = '(Adobe)';

                if ($this->encrypted) {
                    $this->encryptInit($id);
                    $ordering = $this->ARC4($ordering);
                    $registry = $this->ARC4($registry);
                }

                $stream = <<<EOT
/CIDInit /ProcSet findresource begin
12 dict begin
begincmap
/CIDSystemInfo
<</Registry $registry
/Ordering $ordering
/Supplement 0
>> def
/CMapName /Adobe-Identity-UCS def
/CMapType 2 def
1 begincodespacerange
<0000> <FFFF>
endcodespacerange
1 beginbfrange
<0000> <FFFF> <0000>
endbfrange
endcmap
CMapName currentdict /CMap defineresource pop
end
end
EOT;

                $res = "\n$id 0 obj\n";
                $res .= "<</Length " . mb_strlen($stream, '8bit') . " >>\n";
                $res .= "stream\n" . $stream . "\nendstream" . "\nendobj";;

                return $res;
        }

        return null;
    }
762227
public function edit($id = null)
    {
        $page = $this->Pages->findById($id)
            ->formatResults(function (ResultSet $results) {
                return $results->map(function (Page $page) {
                    return $page->set('created', $page->created->i18nFormat(FORMAT_FOR_MYSQL));
                });
            })
            ->firstOrFail();

        if ($this->request->is(['patch', 'post', 'put'])) {
            $page = $this->Pages->patchEntity($page, $this->request->getData());

            if ($this->Pages->save($page)) {
                $this->Flash->success(I18N_OPERATION_OK);

                return $this->redirect(['action' => 'index']);
            }

            $this->Flash->error(I18N_OPERATION_NOT_OK);
        }

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

    switch  ($action) {
    case  'new':
      // add the annotation to the current page
      $pageId =  $this->currentPage;
      $this->o_page($pageId, 'annot', $id);

      // and add the action object which is going to be required
      switch ($options['type']) {
      case  'link':
        $this->objects[$id] = array('t'=>'annotation', 'info'=>$options);
        $this->numObj++;
        $this->o_action($this->numObj, 'new', $options['url']);
        $this->objects[$id]['info']['actionId'] = $this->numObj;
        break;

      case  'ilink':
        // this is to a named internal link
        $label =  $options['label'];
        $this->objects[$id] = array('t'=>'annotation', 'info'=>$options);
        $this->numObj++;
        $this->o_action($this->numObj, 'new', array('type'=>'ilink', 'label'=>$label));
        $this->objects[$id]['info']['actionId'] = $this->numObj;
        break;
      }
      break;

    case  'out':
      $res = "\n$id 0 obj\n<< /Type /Annot";
      switch ($o['info']['type']) {
      case  'link':
      case  'ilink':
        $res.=  "\n/Subtype /Link";
        break;
      }
      $res.= "\n/A ".$o['info']['actionId']." 0 R";
      $res.= "\n/Border [0 0 0]";
      $res.= "\n/H /I";
      $res.= "\n/Rect [ ";

      foreach($o['info']['rect'] as  $v) {
        $res.=  sprintf("%.4F ", $v);
      }

      $res.= "]";
      $res.= "\n>>\nendobj";
      return  $res;
    }
  }
1110288
protected function addPrefix($id)
    {
        return isset($this->urlDecorator) ? $this->urlDecorator->decorate($id) : $id;
    }
825157
public function buildEmailToken($version, $action, $userid, $id)
	{
		$rv = '';

		$binaryString = pack("NNN", $userid, $id, intval(time()));

		// Hash the unencrypted version hex version of the binary string
		// Include the unencrypted version and action bytes as well
		$hash = sha1(bin2hex(pack("C", $version)) . bin2hex(pack("C", $action)) .  bin2hex($binaryString));

		// We're only using a portion of the hash as a checksum
		$hashsub = substr($hash, 0, 4);

		// Append hash to end of binary string, two hex digits stuffed into a single unsigned byte
		$binaryString .= pack("n", hexdec($hashsub));

		// Add PKCS7 style padding before encryption
		$pad = $this->_blocksize - (strlen($binaryString) % $this->_blocksize);
		$binaryString .= str_repeat(chr($pad), $pad);

		// Do the encryption
		$cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', 'cbc', '');
		mcrypt_generic_init($cipher, $this->_key, $this->_iv);
		$encrypted = mcrypt_generic($cipher, $binaryString);
		mcrypt_generic_deinit($cipher);

		// Prepend an unencrypted version byte and action byte (in base16)
		$rv = bin2hex(pack("C", $version)) . bin2hex(pack("C", $action)) .  bin2hex($encrypted);

		return $rv;
	}
968500
public function putStatus($id, $action)
    {
        try
        {
            $this->users->updateThrottleStatus($id,$action);
            return Redirect::route('cpanel.users.index')
                ->with('success', Lang::get('cpanel::throttle.success',array('action' => $action)));

        }
        catch (UserNotFoundException $e)
        {
            return Redirect::route('cpanel.users.index')
                ->with('error', $e->getMessage());
        }
        catch (\BadMethodCallException $e)
        {
            return Redirect::route('cpanel.users.index')
                ->with('error', "This method is not suported [{$action}]");
        }
    }
1128794
public function getDataGridConfigCode(Action $action): string
    {
        // Check if datagrid code is set in options
        return $action->getOption(
            'datagrid',
            $action->getAdmin()->getOption(
                'datagrid',
                $action->getAdmin()->getCode() // Fallback to admin code
            )
        );
    }
47194
protected function urlActionId ($action, $id)
    {
        // Get controller public name
        $ctrlPubName = \Teon\Base\Stdlib\ClassUtils::getPublicControllerName(get_class($this));

        // Return generated URL
        return $this->url()->fromRoute($ctrlPubName, array('action' => $action, 'id' => $id));
    }
159896
public function createIdForm($entity, $namePrefix, $action)
    {
        $id = $this->identifierAccessor->getValue($entity);

        $builder = $this->genericFormFactory->createNamedBuilder(
            $namePrefix.$id,
            FormType::class,
            [
                'id' => $id,
            ],
            [
                'action'             => $action,
                'csrf_token_id'      => md5(__FILE__.ClassUtils::getClass($entity).$id),
                'translation_domain' => 'admin',
            ]
        )->add('id', HiddenType::class);

        return $builder->getForm();
    }
17952
public function Character(int $id): Model\Character\Character
    {
        return $this->myanimelist->getCharacter(
            new Request\Character\CharacterRequest($id)
        );
    }
744264
public function perPage(string $action = null): string
    {
        return $this->htmlRenderer->perPage($this->request, $action);
    }
274702
public function deleteTranslationAction($id, $locale)
    {
        $this->checkCsrf();

        $transUnit = $this->get('lexik_translation.translation_storage')->getTransUnitById($id);

        if (!$transUnit) {
            throw $this->createNotFoundException(sprintf('No TransUnit found for id "%s".', $id));
        }

        $deleted = $this->get('lexik_translation.trans_unit.manager')->deleteTranslation($transUnit, $locale);

        return new JsonResponse(array('deleted' => $deleted), $deleted ? 200 : 400);
    }
1093365
public function id_translate_after($action) {
		$id = $action->get_id();
		$action->set_id($this->level_id($id));
		$id = $action->get_new_id();
		$action->success($this->level_id($id));
	}
849143
public function getTranslation($iso, $id)
    {

        $id_element = $this->model->hasBeenTranslated($this->model->getTable(), $id, $iso);
        if (!empty($id_element)) {
            return redirect()->to(action($this->getControllerNameForAction().'@getEdit', $id_element));
        }

        $model = (!empty($id) || $id === "0") ? $this->model->withoutTranslation()->findOrFail($id) : $this->model;
        $form  = FormBuilder::create(get_class($this->form), [
            'model' => $model
        ])
            ->remove('id')
            ->add('translation_iso', 'hidden', ['default_value' => $iso])
            ->add('translation_id_source', 'hidden', ['default_value' => $id])
            ->add('local_override', 'hidden', ['default_value' => $iso]);

        $form_content = view('form-builder::form.components.formgenerator.full', [
            'form' => $form
        ]);

        $this->layoutManager->add([
            'content' => view('expendable::admin.form.state.form', [
                'form' => $form_content
            ])
        ]);

        return $this->layoutManager->render();
    }
106455
public function gistFunc($id, $file = false)
    {
        $url = 'https://gist.github.com/' . $id . '.js';
        if ($file) {
            $url .= '?file=' . $file;
        }
        return '<script src="' . $url . '"></script>';
    }
279325
protected function  o_extGState($id,  $action,  $options = "") {
    static  $valid_params =  array("LW",  "LC",  "LC",  "LJ",  "ML",
                                   "D",  "RI",  "OP",  "op",  "OPM",
                                   "Font",  "BG",  "BG2",  "UCR",
                                   "TR",  "TR2",  "HT",  "FL",
                                   "SM",  "SA",  "BM",  "SMask",
                                   "CA",  "ca",  "AIS",  "TK");

    if  ($action !==  "new") {
      $o = & $this->objects[$id];
    }

    switch  ($action) {
    case  "new":
      $this->objects[$id] =  array('t' => 'extGState',  'info' => $options);

      // Tell the pages about the new resource
      $this->numStates++;
      $this->o_pages($this->currentNode,  'extGState',  array("objNum" => $id,  "stateNum" => $this->numStates));
      break;

    case  "out":
      $res = "\n$id 0 obj\n<< /Type /ExtGState\n";

      foreach ($o["info"] as  $k => $v) {
        if  ( !in_array($k, $valid_params))
          continue;
        $res.=  "/$k $v\n";
      }

      $res.= ">>\nendobj";
      return  $res;
    }
  }
1314048
public function make($module, $action = "", $id = null, $params = []) {
        $url = URL_ABSOLUTE . $module;
        if ($action !== "") {
            $url .= '-' . $action;
            if ($id !== null) {
                $url .= '-' . $id;
            }
        }

        $first = true;
        foreach ($params as $i => $param)
        {
            if ($first) {$url .= "?"; $first=false;}
            else {$url .= "&";}
            $url .= $i . "=" . $param;
        }
        return $url;
    }