當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Installer::getComposerEvent方法代碼示例

本文整理匯總了PHP中Installer::getComposerEvent方法的典型用法代碼示例。如果您正苦於以下問題:PHP Installer::getComposerEvent方法的具體用法?PHP Installer::getComposerEvent怎麽用?PHP Installer::getComposerEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Installer的用法示例。


在下文中一共展示了Installer::getComposerEvent方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: add

 public static function add()
 {
     parent::add();
     self::$facebook_app_id = Installer::getComposerEvent()->getIO()->ask(":: enter your facebook app id: ", "[app_id]");
     self::$facebook_api_secret = Installer::getComposerEvent()->getIO()->ask(":: enter your facebook app secret: ", "[app_secret]");
     File::replaceContent(Installer::getRootDirConfig() . self::getConfigfile(), "[app_id]", self::getFacebookAppId());
     File::replaceContent(Installer::getRootDirConfig() . self::getConfigfile(), "[api_secret]", self::getFacebookApiSecret());
     File::addContent(Installer::getRootDirTheme() . "Includes/Footer.ss", "<% include FacebookLoginLink %>", "SilverStripe</a></small>");
     Installer::getComposerEvent()->getIO()->write(":: added facebookconnect extension");
 }
開發者ID:helpfulrobot,項目名稱:hpmewes-silverstripe-install,代碼行數:10,代碼來源:FacebookConnectExtension.php

示例2: add

 /**
  * copy customized extension.yml, classes and templates to silverstripe project which should be availible as skelet
  */
 public static function add()
 {
     File::copy(Installer::getRootDirVendor() . static::getExtension(), Installer::getRootDirConfig());
     Installer::getComposerEvent()->getIO()->write(":: copied " . self::getConfigfile());
     foreach (static::getClasses() as $folder => $class) {
         File::copy(Installer::getRootDirVendor() . $class, Installer::getRootDirCode() . $folder . "/");
         Installer::getComposerEvent()->getIO()->write(":: added class {$class}");
     }
     foreach (static::getTemplates() as $folder => $template) {
         File::copy(Installer::getRootDirVendor() . $template, Installer::getRootDirTheme() . $folder . "/");
         Installer::getComposerEvent()->getIO()->write(":: added template {$template}");
     }
 }
開發者ID:helpfulrobot,項目名稱:hpmewes-silverstripe-install,代碼行數:16,代碼來源:Extension.php

示例3: editContent

 /**
  * file editing
  * 
  * @param string $filename
  * @param string $content
  * @param string $search
  * @param boolean $replace true if the given content should replace the $search string
  */
 public static function editContent($filename, $content, $search, $replace = false)
 {
     $lines = array();
     $linesTmp = array();
     $changed = false;
     // flag to set true when $search found in content
     // open file to read
     if (($fileHandle = fopen($filename, "r")) !== false) {
         // buffer every line
         while (($buffer = fgets($fileHandle)) !== false) {
             $lines[] = $buffer;
         }
         // close file
         fclose($fileHandle);
     } else {
         Installer::getComposerEvent()->getIO()->write(":: failure reading {$filename} perhaps not exists");
     }
     foreach ($lines as $line) {
         // if searched string found
         if (strpos($line, $search) !== false) {
             // when search string should be replaced
             if ($replace) {
                 $linesTmp[] = str_replace($search, $content, $line);
                 Installer::getComposerEvent()->getIO()->write(":: replaced {$search} with {$content} in {$filename}");
             } else {
                 $linesTmp[] = $line;
                 $linesTmp[] = $content . PHP_EOL;
                 Installer::getComposerEvent()->getIO()->write(":: added {$content} after {$search} to {$filename}");
             }
             $changed = true;
         } else {
             $linesTmp[] = $line;
         }
     }
     // has file changed
     if ($changed) {
         // overwrite file with new content
         file_put_contents($filename, implode('', $linesTmp));
     } else {
         Installer::getComposerEvent()->getIO()->write(":: not added {$content} to {$filename} because {$search} not found");
     }
 }
開發者ID:helpfulrobot,項目名稱:hpmewes-silverstripe-install,代碼行數:50,代碼來源:File.php

示例4: add

 public static function add()
 {
     parent::add();
     Installer::getComposerEvent()->getIO()->write(":: added bootstrap-forms extension");
 }
開發者ID:helpfulrobot,項目名稱:hpmewes-silverstripe-install,代碼行數:5,代碼來源:BootstrapFormsExtension.php


注:本文中的Installer::getComposerEvent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。