function createSiteConfig() { $destination = $this->setDestinationPath(); Helper::make_dir($destination); file_put_contents($destination . 'config.php', '<?php' . PHP_EOL . '$cfg = ' . var_export($this->config, true) . ';'); $this->printResult($destination); }
function runClone($source, $destination, $specificFiles, $mode) { $this->mode = $mode; $this->specificFiles = $specificFiles; Helper::make_dir($destination); $this->cloneFiles($source, $destination); }
function writeTextFile($data, $project, $site_dir, $catDir) { $path = $this->setTextFilePath($project, $site_dir, $catDir); Helper::make_dir($path); $filename = $path . $catDir . '.txt'; $data = serialize($data); file_put_contents($filename, $data); $this->printReport($filename); }
function createRobots() { Helper::make_dir($this->robotDestination()); $fh = fopen($this->robotDestination() . '/robots.txt', 'w'); $robot = 'User-agent: *' . PHP_EOL; $robot .= 'Disallow: /shop/' . PHP_EOL; $robot .= 'Sitemap: ' . $this->getDomain() . '/sitemap_index.xml'; fwrite($fh, $robot); fclose($fh); $this->printRobotsResult(); }
function createSitemap() { Helper::make_dir($this->sitemapDestination()); date_default_timezone_set('America/Los_Angeles'); $this->initialCountVariables(); $this->openXmlTagHeaderUrlSet(); foreach ($this->readProductTextFileFromDir() as $file) { $this->productFile = $this->getProductFile($file); $productItems = $this->readContentFromProductTextFile($file); $this->loopThroughProductItems($productItems); $this->countXmlFile++; } $this->closeXmlTageUrlSet(); $this->printCreateXmlResult(); }
function createLogoImage() { //กำหนดตัวแปร $dest = $this->logoDestination(); $logo_text = $this->logoText(); $font_logo_path = $this->logoFontPath(); $logo_bg_color = $this->logoBgColor(); Helper::make_dir($dest); $img_size = explode(',', '350,30'); $text_color = explode(',', '255, 255, 255'); //$bg_color = explode( ',', '231, 76, 60' ); $bg_color = explode(',', $logo_bg_color); $font_size = '20'; $pos = explode(',', '0, 0, 20'); //creates a image handle //$img = imagecreate( 500, 200 ); $img = imagecreate($img_size[0], $img_size[1]); //choose a bg color, u can play with the rgb values //$background = imagecolorallocate( $img, 232, 0, 135 ); $background = imagecolorallocate($img, $bg_color[0], $bg_color[1], $bg_color[2]); //chooses the text colors //$text_colour = imagecolorallocate( $img, 255, 255, 255 ); $text_colour = imagecolorallocate($img, $text_color[0], $text_color[1], $text_color[2]); //sets the thickness/bolness of the line imagesetthickness($img, 3); //draws a line params are (imgres,x1,y1,x2,y2,color) //imageline( $img, 20, 130, 165, 130, $text_colour ); // place the font file in the same dir level as the php file $font = $font_logo_path . 'arialuni.ttf'; //this function sets the font size, places to the co-ords //imagettftext($img, 100, 0, 11, 120, $text_colour, $font, $text); imagettftext($img, $font_size, $pos[0], $pos[1], $pos[2], $text_colour, $font, $logo_text); //places another text with smaller size //imagettftext($img, 20, 0, 10, 160, $text_colour, $font, 'Small Text'); //alerts the browser abt the type of content i.e. png image //header( 'Content-type: image/png' ); //now creates the image //imagepng( $img ); //create and save imagepng($img, $dest . 'logo.png'); //destroys used resources //imagecolordeallocate( $text_color ); //imagecolordeallocate( $background ); imagedestroy($img); }
function createHtaccess() { $projectName = $this->config['project']; $siteDirName = $this->config['site_dir']; // $webType = $this->config['web_type']; // $webUser = $this->config['web_user']; $webType = ''; $webUser = ''; $hta = 'RewriteEngine On' . PHP_EOL; $hta .= $this->rewriteBase($webType, $webUser) . PHP_EOL; $hta .= 'RewriteCond %{REQUEST_FILENAME} !-f' . PHP_EOL; $hta .= 'RewriteCond %{REQUEST_FILENAME} !-d' . PHP_EOL; $hta .= 'RewriteRule (.*) index.php/$1' . PHP_EOL; $destination = $this->setHtaccessDestination($projectName, $siteDirName); Helper::make_dir($destination); $this->writeHtaccessFile($destination, $hta); $this->printHtaccessResult($destination); }
function getCategorySlug($row) { return Helper::clean_string($row['category']); }
function writeTextDatabase($products) { $this->countTotalGroupByProjectName($products); $path = $this->getTextDbPath(); Helper::make_dir($path); $file = $path . $this->filename; $this->printWriteTotalProduct($products, $file); //PrintTextDbProductResult Trait $products = serialize($products); file_put_contents($file, $products); }
function convertMerchantToDatatbase($merchant) { $dbName = Helper::clean_string($merchant); return 'prosp_' . str_replace('-', '_', $dbName); }
function convertMerchantToDbName($merchant) { $dbName = Helper::clean_string($merchant); $dbName = $this->setDatabaseNameForEachNetwork($this->getNetwork(), $dbName); return $dbName; }