encode() public static method

Encode the text into a string which all white spaces will be replaced by $rplChar
public static encode ( string $text, Char $rplChar = '', $upWords = true )
$text string text to be encoded
$rplChar Char character to replace all the white spaces
Example #1
0
 public function prepare()
 {
     //$this->encodedLayoutName = $this->encode($this->layoutName);
     $this->encodedLayoutName = GxcHelpers::encode($this->layoutName, '_', false);
     //The directory where the new code will be generated to
     $layoutPath = COMMON_FOLDER . DIRECTORY_SEPARATOR . 'front_layouts' . DIRECTORY_SEPARATOR . $this->encodedLayoutName;
     //Get all the paths of template files
     $files = CFileHelper::findFiles($this->templatePath);
     foreach ($files as $file) {
         //Get the path of new code to be generated
         $generatedFilePath = $layoutPath . str_replace($this->templatePath, '', $file);
         //Get the path of template files (in the folder templates)
         $templateFile = $this->render($file);
         //code to be generated
         $this->files[] = new CCodeFile($generatedFilePath, $templateFile);
     }
 }
Example #2
0
 public function prepare()
 {
     //get the block ID based on the block name. Ex: 'New Example' -> 'new_example'
     $this->blockID = GxcHelpers::encode($this->blockName, '_', false);
     $blockPath = COMMON_FOLDER . DIRECTORY_SEPARATOR . 'front_blocks' . DIRECTORY_SEPARATOR . $this->blockID;
     //Get the block class based on the block name. Ex: 'New Example' -> 'NewExampleBlock'
     $this->blockClass = GxcHelpers::encode($this->blockName) . 'Block';
     //Get the path of new code to be generated
     $iniPath = $blockPath . DIRECTORY_SEPARATOR . 'info.ini';
     $blockInputPath = $blockPath . DIRECTORY_SEPARATOR . $this->blockID . '_block_input.php';
     $blockOutputPath = $blockPath . DIRECTORY_SEPARATOR . $this->blockID . '_block_output.php';
     $blockClassPath = $blockPath . DIRECTORY_SEPARATOR . $this->blockClass . '.php';
     //Get the path of template files (in the folder templates)
     $iniFile = $this->render($this->templatepath . DIRECTORY_SEPARATOR . 'info.ini');
     $blockInputFile = $this->render($this->templatepath . DIRECTORY_SEPARATOR . 'block_input.php');
     $blockOutputFile = $this->render($this->templatePath . DIRECTORY_SEPARATOR . 'block_output.php');
     $blockClassFile = $this->render($this->templatePath . DIRECTORY_SEPARATOR . 'Block.php');
     //generate code
     $this->files[] = new CCodeFile($iniPath, $iniFile);
     $this->files[] = new CCodeFile($blockInputPath, $blockInputFile);
     $this->files[] = new CCodeFile($blockOutputPath, $blockOutputFile);
     $this->files[] = new CCodeFile($blockClassPath, $blockClassFile);
 }