/** * Sends a notification via Slack * @param string $message */ public function sendNotification($message) { // Only send a notification if we are running in production mode if (Director::isLive()) { $config = SiteConfig::current_site_config(); $message = $config->Title . ' (' . Director::absoluteBaseURL() . ') - ' . $message; $this->client->send($message); } }
/** * Force SSL on live site. */ public function init() { if (Director::isLive()) { Director::forceSSL(); } parent::init(); }
public function GerritStatisticsReport() { Requirements::block(SAPPHIRE_DIR . "/javascript/jquery_improvements.js"); Requirements::block(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js'); Requirements::block(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.min.js'); Requirements::block(THIRDPARTY_DIR . '/jquery-cookie/jquery.cookie.js'); if (Director::isLive()) { Requirements::javascript('themes/openstack/javascript/jquery.min.js'); } else { Requirements::javascript('themes/openstack/javascript/jquery.js'); } Requirements::javascript('themes/openstack/javascript/jquery-migrate-1.2.1.min.js'); Requirements::javascript("themes/openstack/javascript/jquery.cookie.js"); Requirements::javascript("themes/openstack/javascript/bootstrap.min.js"); Requirements::css('themes/openstack/css/bootstrap.min.css'); Requirements::javascript(Director::protocol() . "maps.googleapis.com/maps/api/js?sensor=false"); Requirements::javascript("marketplace/code/ui/admin/js/utils.js"); Requirements::javascript("marketplace/code/ui/frontend/js/markerclusterer.js"); Requirements::javascript("marketplace/code/ui/frontend/js/oms.min.js"); Requirements::javascript("marketplace/code/ui/frontend/js/infobubble-compiled.js"); Requirements::javascript("marketplace/code/ui/frontend/js/google.maps.jquery.js"); Requirements::javascript('themes/openstack/javascript/Chart.js'); Requirements::javascript("gerrit_ingest/js/sangria.page.gerrit.statistics.report.js"); Requirements::css('gerrit_ingest/css/sangria.page.gerrit.statistics.report.css'); return $this->owner->getViewer('GerritStatisticsReport')->process($this->owner); }
/** * It's preferable to use this as an access point in case we * add support for multiple property id's in the future (subsites for example) * @return string */ public static function get_property_id() { if (self::config()->disable_on_dev && !Director::isLive()) { return ''; } return self::config()->web_property_id; }
public function XrequireDefaultRecords() { foreach ($this->config()->get('records') as $code => $record) { if ($record['IsDev'] && Director::isDev() || $record['IsTest'] && Director::isTest() || $record['IsLive'] && Director::isLive()) { if (!($discountType = StreakDiscountType::get_by_code($code))) { $discountType = StreakDiscountType::create(); DB::alteration_message("Added discount type '{$code}'", "changed"); } // if the record is using default code then update from config. if ($code == self::DefaultCode) { $record['Code'] = $this->config()->get('default_code'); } else { $record['Code'] = $code; } $title = $record['Title']; // if the record is using default title then update from config as hasn't changed, if different // then leave alone if ($title == self::DefaultTitle) { $record['Title'] = $this->config()->get('default_title'); } $data = array_diff_key($record, array_flip(array('IsDev', 'IsTest', 'IsLive'))); $discountType->update($data); $discountType->write(); } } }
public function preRequest(SS_HTTPRequest $request, Session $session, DataModel $model) { if (!$this->testSessionEnvironment->isRunningTests()) { return; } $testState = $this->testSessionEnvironment->getState(); // Date and time if (isset($testState->datetime)) { SS_Datetime::set_mock_now($testState->datetime); } // Register mailer if (isset($testState->mailer)) { $mailer = $testState->mailer; Email::set_mailer(new $mailer()); Config::inst()->update("Email", "send_all_emails_to", null); } // Allows inclusion of a PHP file, usually with procedural commands // to set up required test state. The file can be generated // through {@link TestSessionStubCodeWriter}, and the session state // set through {@link TestSessionController->set()} and the // 'testsession.stubfile' state parameter. if (isset($testState->stubfile)) { $file = $testState->stubfile; if (!Director::isLive() && $file && file_exists($file)) { // Connect to the database so the included code can interact with it global $databaseConfig; if ($databaseConfig) { DB::connect($databaseConfig); } include_once $file; } } }
/** * Log something into our log file * @param $environment = string (minimum environment state for logging this message) * @param $message = string (the message body) **/ static function Log($message = '', $environment = 'dev') { // only proceed if LogJam is enabled if (static::$enabled) { // make sure our log level matches our environment level, otherwise break out if (Director::isLive() && $environment != 'live') { return false; } else { if (Director::isTest() && ($environment != 'live' || $environment != 'test')) { return false; } } // trace the origin call $trace = SS_Backtrace::filtered_backtrace(); $trace = $trace[0]; $file = isset($trace['file']) ? $trace['file'] : ''; $line = isset($trace['line']) ? $trace['line'] : ''; // construct the line in our file $output = 'LogJam: '; $output .= $message; $output .= ' (line ' . $line . ' in ' . $file . ')'; // piggy-back PHP error_log return error_log($output); } return false; }
function ShowGoogleAnalytics() { $config = SiteConfig::current_site_config(); if (Director::isLive() && $config->GoogleAnalyticsID && strpos($_SERVER['REQUEST_URI'], '/admin') === false && strpos($_SERVER['REQUEST_URI'], '/Security') === false && strpos($_SERVER['REQUEST_URI'], '/dev') === false) { return true; } return false; }
public function index() { if (Director::isLive() && !Permission::check('CMS_ACCESS_CMSMain')) { return Security::permissionFailure($this); } Requirements::css(STYLEGUIDE_DIR . '/css/styleguide.css'); return $this->renderWith(array(__CLASS__, 'Page')); }
static function get_spt_merchant_id() { if (!Director::isLive()) { return 'TESTDIGISPL1'; } else { return self::$spt_merchant_id; } }
public function SuppressWhitespace($html) { if ($this->config()->suppress == 'always' || $this->config()->suppress == 'live-only' && Director::isLive()) { $html = preg_replace("/\\s+/", ' ', trim($html)); $html = str_replace(array('<!-- -->', ' //<![CDATA[', '//]]> '), '', $html); // TODO: remove all comments? } return $html; }
public function IsEnabled() { if (Director::isLive()) { return true; } elseif (Director::isDev() && $this->IsEnabledInDev()) { return true; } return false; }
/** * Check that we do not run this in production */ public function init() { // only allowed to do this in DEV or TEST environments for obivious reasons if (Director::isLive()) { echo Debug::text("Sorry, can't do this in production/live environments"); exit; // maybe return? } parent::init(); }
public function init() { parent::init(); $this->extend('init'); $canAccess = !Director::isLive() && (Director::isDev() || Director::isTest() || Director::is_cli() || Permission::check("ADMIN")); if (!$canAccess) { return Security::permissionFailure($this); } Requirements::javascript('framework/thirdparty/jquery/jquery.js'); Requirements::javascript('testsession/javascript/testsession.js'); }
function css($file, $media = null) { /* Only initiate if webiste is in dev mode or a ?flush is called */ if (preg_match('/\\.less$/i', $file) || Director::isDev() || isset($_GET['flush'])) { /* If file is CSS, check if there is a LESS file */ if (preg_match('/\\.css$/i', $file)) { $less = preg_replace('/\\.css$/i', '.less', $file); if (is_file(Director::getAbsFile($less))) { $file = $less; } } /* If less file exists, then check/compile it */ if (preg_match('/\\.less$/i', $file)) { $out = preg_replace('/\\.less$/i', '.css', $file); $css_file = Director::getAbsFile($out); $options = array(); /* Automatically compress if in live mode */ if (Director::isLive()) { $options['compress'] = true; } try { /* Force recompile & only write to css if updated */ if (isset($_GET['flush']) || !Director::isLive()) { /* Force deleting of all cache files on flush */ if (file_exists(self::$cacheDir) && isset($_GET['flush']) && !self::$already_flushed) { $paths = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(self::$cacheDir, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST); foreach ($paths as $path) { $path->isDir() && !$path->isLink() ? rmdir($path->getPathname()) : unlink($path->getPathname()); } /* make sure we only flush once per request and not for each *.less */ self::$already_flushed = true; } /* Set cache directory */ $options['cache_dir'] = self::$cacheDir; /* Set cache method */ $options['cache_method'] = self::$cacheMethod; /* Calculate the LESS file's parent URL */ $css_dir = dirname(Director::baseURL() . $file) . '/'; /* Generate and return cached file path */ $cached_file = self::$cacheDir . '/' . Less_Cache::Get(array(Director::getAbsFile($file) => $css_dir), $options, self::$variables); /* check cache vs. css and overwrite if necessary */ if (!is_file($css_file) || md5_file($css_file) != md5_file($cached_file)) { copy($cached_file, $css_file); } } } catch (Exception $ex) { trigger_error('Less.php fatal error: ' . $ex->getMessage(), E_USER_ERROR); } $file = $out; } } /* Return css file path */ return parent::css($file, $media); }
public function EnvironmentType() { if (Director::isLive()) { return "live"; } else { if (Director::isTest()) { return "test"; } else { return "dev"; } } }
/** * Updates the database schema, creating tables & fields as necessary. */ function build() { if (Director::isLive() && Security::database_is_ready() && (!Member::currentUser() || !Member::currentUser()->isAdmin())) { Security::permissionFailure($this, "This page is secured and you need administrator rights to access it. " . "Enter your credentials below and we will send you right along."); return; } // The default time limit of 30 seconds is normally not enough if (ini_get("safe_mode") != "1") { set_time_limit(600); } $this->doBuild(isset($_REQUEST['quiet']) || isset($_REQUEST['from_installer'])); }
/** * Execute the console command. * * @return void */ public function fire() { $this->bootSilverstripe(); if (\Director::isLive()) { $env = App::environment(); $this->error("This command is not allowed on the '{$env}' environment."); return; } $defaultMember = \Security::findAnAdministrator(); if (!$defaultMember->Email) { // must be a new install, admin user has no username // ask the user for one $member = $defaultMember; $member->Email = $this->ask("What username/email do you want to give to the default CMS admin user? [admin]:", 'admin'); } else { for (;;) { $username = $this->ask("What username do you want to edit? [{$defaultMember->Email}]: ", $defaultMember->Email); if ($username == $defaultMember->Email) { $member = $defaultMember; break; } $member = \Member::get()->filter('Email', $username)->First(); if ($member && $member->Exists()) { break; } $this->error("Username '{$username}' not found."); } } for (;;) { for (;;) { $password = $this->secret("Enter a new password: "******"I can't let you set a blank password."); } $confirm = $this->secret("Enter again to confirm: "); if ($confirm == $password) { break; } $this->error("Those passwords don't match."); } $member->Password = $password; $member->PasswordEncryption = SilverstripeConfig::inst()->get('Security', 'password_encryption_algorithm'); try { $this->info("Saving CMS account '{$member->Email}'..."); $member->write(); $this->info('Password changed successfully.'); } catch (Exception $e) { $this->error('Error: ' . $e->getMessage()); } }
/** * generates piwik tracking code out of config vars and Piwik.ss template * @param $wrap wrap inside <script> tags, e.g. for templates */ public function getPiwik($wrap = true) { if (Director::isDev() && !Config::inst()->get('PiwikExtension', 'show_on_dev')) { return false; } if (Director::isTest() && !Config::inst()->get('PiwikExtension', 'show_on_test')) { return false; } if (Director::isLive() && !Config::inst()->get('PiwikExtension', 'show_on_live')) { return false; } $data = array('WrapInJsTags' => $wrap, 'URL' => Config::inst()->get('PiwikExtension', 'piwik_server'), 'SiteID' => Config::inst()->get('PiwikExtension', 'piwik_site_id')); return ArrayData::create($data)->renderWith(array('Piwik')); }
protected function parseAnalyticsConfigs() { $this->config = Config::inst(); /* Set trackers from yaml */ if ($trackers = $this->config->get('AnalyticsJS', 'tracker')) { foreach ($trackers as $tracker) { array_push(self::$tracker_config, $tracker); } } /* return false if no trackers are set */ if (count(self::$tracker_config) == 0) { return false; } /* set GA global name, typically "ga" */ self::$global_name = $this->config->get('AnalyticsJS', 'global_name'); $skip_tracking = !Director::isLive() || isset($_GET['flush']) ? true : false; foreach (self::$tracker_config as $conf) { $args = array(); if ($conf[0] == 'create') { $tname = false; foreach ($conf as $i) { if (is_array($i) && isset($i['name'])) { $tname = $i['name'] . '.'; break; } } $ufname = $tname === false ? 'Default' : $tname; /* check if config has already been set (or _config.php has been run a second time) */ if (isset(self::$ga_configs[$ufname])) { /* no unique name has been specified for additional tracker */ if (self::$ga_configs[$ufname] != $conf[1]) { trigger_error('Tracker ' . $ufname . ' already set, please use a unique name', E_USER_WARNING); } return false; } else { self::$ga_configs[$ufname] = $conf[1]; } /* Replace Tracker IDs with fake ones if not in LIVE mode */ if ($skip_tracking) { $conf[1] = preg_replace('/[0-9]{4,}-[0-9]+/', 'DEV-' . self::$tracker_counter++, $conf[1]); } array_push(self::$tracker_names, $tname); } foreach ($conf as $i) { array_push($args, json_encode($i)); } self::$ga_trackers .= self::$global_name . '(' . implode(',', $args) . ');' . "\n"; } }
function css($file, $media = null) { /** * Only initiate automatically if: * - webiste is in dev mode * - or a ?flush is called */ if (preg_match('/\\.less$/i', $file) || Director::isDev() || isset($_GET['flush'])) { /* If file is CSS, check if there is a LESS file */ if (preg_match('/\\.css$/i', $file)) { $less = preg_replace('/\\.css$/i', '.less', $file); if (is_file(Director::getAbsFile($less))) { $file = $less; } } /* If less file exists, then check/compile it */ if (preg_match('/\\.less$/i', $file)) { $out = preg_replace('/\\.less$/i', '.css', $file); $css_file = Director::getAbsFile($out); $options = array(); /* Automatically compress if in live mode */ if (Director::isLive()) { $options['compress'] = true; } try { /* Force recompile & only write to css if updated */ if (isset($_GET['flush']) || !Director::isLive()) { /* Create instance */ $parser = new Less_Parser($options); if (!empty(self::$variables)) { $parser->ModifyVars(self::$variables); } /* calculate the LESS file's parent URL */ $css_dir = rtrim(Director::baseURL(), '/') . Director::makeRelative(dirname(Director::getAbsFile($file)) . '/'); $parser->parseFile(Director::getAbsFile($file), $css_dir); $css = $parser->getCss(); if (!is_file($css_file) || md5_file($css_file) != md5($css)) { file_put_contents($css_file, $css); } } } catch (Exception $ex) { trigger_error("Less.php fatal error: " . $ex->getMessage(), E_USER_ERROR); } $file = $out; } } /* Return css path */ return parent::css($file, $media); }
public function EnvironmentIcon() { if (Director::isLive()) { $mode = 'live'; } else { if (Director::isTest()) { $mode = 'test'; } else { if (Director::isDev()) { $mode = 'dev'; } } } return '<span class="environment-icon ' . $mode . '"></span>'; }
/** * generates piwik tracking code out of config vars and Piwik.ss template * @param $wrap wrap inside <script> tags, e.g. for templates */ public function getPiwik($wrap = true) { if (Director::isDev() && !Config::inst()->get('PiwikExtension', 'show_on_dev')) { return false; } if (Director::isTest() && !Config::inst()->get('PiwikExtension', 'show_on_test')) { return false; } if (Director::isLive() && !Config::inst()->get('PiwikExtension', 'show_on_live')) { return false; } //used for overwriting defaults in SiteConfig, e.g. for different SiteIDs in a Subsite installation $currentSiteConfig = Controller::curr()->hasMethod('getSiteConfig') ? Controller::curr()->getSiteConfig() : SiteConfig::current_site_config(); $data = array('WrapInJsTags' => $wrap, 'URL' => Config::inst()->get('PiwikExtension', 'piwik_server'), 'SiteID' => Config::inst()->get('PiwikExtension', 'piwik_site_id'), 'SiteConfig' => $currentSiteConfig); return ArrayData::create($data)->renderWith(array('Piwik')); }
/** * When we initialize this controller * This happens during the birth of the universe **/ public function init() { parent::init(); // global compiled javascript if (Director::isLive()) { Requirements::javascript('site/production/index.min.js'); } else { Requirements::javascript('site/production/index.js'); } // global css (compiled scss) if (Director::isLive()) { Requirements::css('site/production/index.min.css'); } else { Requirements::css('site/production/index.css'); } }
/** * Creates a SiteMapPage at the top level when the database is built. * Config MUST have 'autobuildpage' set to true, and site MUST NOT be in live mode. */ public function requireDefaultRecords() { parent::requireDefaultRecords(); $smp = DataObject::get_one('SiteMapPage'); $autobuild = Config::inst()->get('SiteMapPage', 'autobuildpage'); //TODO: This does not check for whether this SiteMapPage is an orphan or not if (!$smp && !Director::isLive() && $autobuild === true) { $smp = new SiteMapPage(); $smp->Title = _t('SiteMapPage.DEFAULTTITLE', 'Site Map'); $smp->Content = "<div>[SiteMap]</div><p> </p>"; $smp->URLSegment = singleton('SiteTree')->generateURLSegment(_t('SiteMapPage.DEFAULTTITLE', 'Site Map')); $smp->Status = "Published"; $smp->write(); $smp->publish("Stage", "Live"); DB::alteration_message("Default site map page created ;)", "created"); } }
private function registerJS() { Requirements::block(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js'); Requirements::block(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js'); Requirements::block(SAPPHIRE_DIR . '/javascript/prototype_improvements.js'); Requirements::block(SAPPHIRE_DIR . "/javascript/jquery_improvements.js"); Requirements::block(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js'); Requirements::block(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.min.js'); Requirements::block(THIRDPARTY_DIR . '/jquery-cookie/jquery.cookie.js'); if (Director::isLive()) { Requirements::javascript('themes/openstack/javascript/jquery.min.js'); } else { Requirements::javascript('themes/openstack/javascript/jquery.js'); } Requirements::javascript('themes/openstack/javascript/jquery-migrate-1.2.1.min.js'); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/jquery.validate.js"); Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/additional-methods.js"); }
public function UserSwitcherForm() { if (Director::isLive()) { return false; } if (Permission::check('ADMIN') || Session::get('UserSwitched')) { $members = Member::get()->map()->toArray(); if (isset($_GET['userswitchercms']) && $_GET['userswitchercms'] == 1) { $field = DropdownField::create('MemberID', '', $members)->setEmptyString(_t('UserSwticherController.SwitchUser', 'Switch User')); } else { $field = DropdownField::create('MemberID', 'User:'******'switchuser', 'Switch User')); $validator = RequiredFields::create('MemberID'); return Form::create($this, 'UserSwitcherForm', $fields, $actions, $validator)->addExtraClass('userswitcher'); } }
/** *@return Integer - number of carts destroyed **/ public function run($request) { if (!Director::isDev() || Director::isLive()) { DB::alteration_message("you can only run this in dev mode!"); } else { if (!isset($_REQUEST["i-am-sure"])) { $_REQUEST["i-am-sure"] = ""; } if ("yes" != $_REQUEST["i-am-sure"]) { die("<h1>ARE YOU SURE?</h1><br /><br /><br /> please add the 'i-am-sure' get variable to your request and set it to 'yes' ... e.g. <br />http://www.mysite.com/dev/ecommerce/ecommercetaskdeleteallorders/?i-am-sure=yes"); } $oldCarts = Order::get(); $count = 0; if ($oldCarts->count()) { if ($this->verbose) { $totalToDeleteSQLObject = DB::query("SELECT COUNT(*) FROM \"Order\""); $totalToDelete = $totalToDeleteSQLObject->value(); DB::alteration_message("<h2>Total number of orders: " . $totalToDelete . " .... now deleting: </h2>", "deleted"); } foreach ($oldCarts as $oldCart) { $count++; if ($this->verbose) { DB::alteration_message("{$count} ... deleting abandonned order #" . $oldCart->ID, "deleted"); } $oldCart->delete(); $oldCart->destroy(); } } else { if ($this->verbose) { $count = DB::query("SELECT COUNT(\"ID\") FROM \"Order\"")->value(); DB::alteration_message("There are no abandonned orders. There are {$count} 'live' Orders.", "created"); } } $countCheck = DB::query("Select COUNT(ID) FROM \"Order\"")->value(); if ($countCheck) { DB::alteration_message("ERROR: in testing <i>Orders</i> it appears there are " . $countCheck . " records left.", "deleted"); } else { DB::alteration_message("PASS: in testing <i>Orders</i> there seem to be no records left.", "created"); } $this->cleanupUnlinkedOrderObjects(); $this->doubleCheckModifiersAndItems(); return $count; } }
/** * Updates the database schema, creating tables & fields as necessary. */ function build() { if(Director::isLive() && Security::database_is_ready() && !Director::is_cli() && !Permission::check("ADMIN")) { Security::permissionFailure($this, "This page is secured and you need administrator rights to access it. " . "Enter your credentials below and we will send you right along."); return; } // The default time limit of 30 seconds is normally not enough if(ini_get("safe_mode") != "1") { set_time_limit(600); } // Get all our classes ManifestBuilder::create_manifest_file(); require(MANIFEST_FILE); $this->doBuild(isset($_REQUEST['quiet']) || isset($_REQUEST['from_installer']), !isset($_REQUEST['dont_populate'])); }
public function init() { parent::init(); if (!Member::currentUser()) { return OpenStackIdCommon::doLogin(); } if (!Permission::check("ADMIN_SUMMIT_APP_FRONTEND_ADMIN")) { Security::permissionFailure($this); } Requirements::css("themes/openstack/bower_assets/bootstrap/dist/css/bootstrap.min.css"); Requirements::css("themes/openstack/bower_assets/fontawesome/css/font-awesome.min.css"); Requirements::css('//fonts.googleapis.com/css?family=Open+Sans:300,400,700'); Requirements::css("themes/openstack/css/combined.css"); Requirements::css("themes/openstack/css/navigation_menu.css"); Requirements::css("themes/openstack/css/dropdown.css"); Requirements::css('themes/openstack/css/chosen.css'); Requirements::css('summit/bower_components/bootstrap-tagsinput/dist/bootstrap-tagsinput.css'); Requirements::css("themes/openstack/javascript/datetimepicker/jquery.datetimepicker.css"); Requirements::css('summit/css/summit-admin.css'); Requirements::javascript("themes/openstack/bower_assets/jquery/dist/jquery.min.js"); Requirements::javascript("themes/openstack/bower_assets/jquery-migrate/jquery-migrate.min.js"); Requirements::javascript("themes/openstack/bower_assets/bootstrap/dist/js/bootstrap.min.js"); Requirements::javascript('themes/openstack/javascript/chosen.jquery.min.js'); Requirements::javascript('themes/openstack/bower_assets/moment/min/moment.min.js'); Requirements::javascript("themes/openstack/javascript/datetimepicker/jquery.datetimepicker.js"); Requirements::javascript('themes/openstack/javascript/urlfragment.jquery.js'); Requirements::javascript("themes/openstack/bower_assets/jquery-ui/jquery-ui.min.js"); Requirements::javascript("themes/openstack/javascript/jquery-ui-bridge.js"); if (Director::isLive()) { Requirements::javascript("themes/openstack/bower_assets/jquery-validate/dist/jquery.validate.min.js"); Requirements::javascript("themes/openstack/bower_assets/jquery-validate/dist/additional-methods.min.js"); } else { Requirements::javascript("themes/openstack/bower_assets/jquery-validate/dist/jquery.validate.js"); Requirements::javascript("themes/openstack/bower_assets/jquery-validate/dist/additional-methods.js"); } Requirements::javascript('summit/javascript/bootstrap-dropdown.js'); Requirements::javascript('summit/bower_components/bootstrap-tagsinput/dist/bootstrap-tagsinput.min.js'); Requirements::javascript('themes/openstack/javascript/jquery.serialize.js'); $this->event_repository = new SapphireSummitEventRepository(); $this->promocode_repository = new SapphireSummitRegistrationPromoCodeRepository(); $this->eventbrite_attendee_repository = new SapphireEventbriteAttendeeRepository(); }