本文整理汇总了PHP中project函数的典型用法代码示例。如果您正苦于以下问题:PHP project函数的具体用法?PHP project怎么用?PHP project使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了project函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generatePDF
function generatePDF()
{
// tempfolder
$tmpBaseFolder = TEMP_FOLDER . '/shopsystem';
$tmpFolder = project() ? "{$tmpBaseFolder}/" . project() : "{$tmpBaseFolder}/site";
if (is_dir($tmpFolder)) {
Filesystem::removeFolder($tmpFolder);
}
if (!file_exists($tmpFolder)) {
Filesystem::makeFolder($tmpFolder);
}
$baseFolderName = basename($tmpFolder);
//Get site
Requirements::clear();
$link = Director::absoluteURL($this->pdfLink() . "/?view=1");
$response = Director::test($link);
$content = $response->getBody();
$content = utf8_decode($content);
$contentfile = "{$tmpFolder}/" . $this->PublicURL . ".html";
if (!file_exists($contentfile)) {
// Write to file
if ($fh = fopen($contentfile, 'w')) {
fwrite($fh, $content);
fclose($fh);
}
}
return $contentfile;
}
示例2: get_data_dir
static function get_data_dir()
{
if (isset(self::$data_dir)) {
return self::$data_dir;
}
return project() . '/testdata/';
}
示例3: init
function init()
{
if (Director::fileExists(project() . "/css/VimeoGallery.css")) {
Requirements::css(project() . "/css/VimeoGallery.css");
} elseif (Director::fileExists('themes/' . project() . "/css/VimeoGallery.css")) {
Requirements::css('themes/' . project() . "/css/VimeoGallery.css");
} else {
Requirements::css("vimeoservice/css/VimeoGallery.css");
}
// only include if necessary
if ($this->ShowVideoInPopup) {
Requirements::javascript("vimeoservice/javascript/jquery-1.4.4.min.js");
Requirements::javascript("vimeoservice/javascript/jquery.prettyPhoto.js");
Requirements::css('vimeoservice/css/prettyPhoto.css');
$theme = $this->PopupTheme ? $this->PopupTheme : 'default';
$width = $this->PopupWidth < 1 ? 400 : $this->PopupWidth;
$height = $this->PopupHeight < 1 ? 225 : $this->PopupHeight;
Requirements::customScript(<<<JS
\$(document).ready(function(){
\$("a[rel^='prettyPhoto']").prettyPhoto({
theme:'{$theme}',
default_width: {$width},
default_height: {$height},
});
});
JS
);
}
parent::init();
}
示例4: __construct
/**
* Constructor
*
* @param Controller $controller The parent controller, necessary to
* create the appropriate form action tag.
* @param string $name The method on the controller that will return this
* form object.
* @param FieldSet|FormField $fields All of the fields in the form - a
* {@link FieldSet} of {@link FormField}
* objects.
* @param FieldSet|FormAction $actions All of the action buttons in the
* form - a {@link FieldSet} of
* {@link FormAction} objects
* @param bool $checkCurrentUser If set to TRUE, it will be checked if a
* the user is currently logged in, and if
* so, only a logout button will be rendered
* @param string $authenticatorClassName Name of the authenticator class that this form uses.
*/
function __construct($controller, $name, $fields = null, $actions = null,
$checkCurrentUser = true) {
// This is now set on the class directly to make it easier to create subclasses
// $this->authenticator_class = $authenticatorClassName;
$customCSS = project() . '/css/member_login.css';
if(Director::fileExists($customCSS)) {
Requirements::css($customCSS);
}
// Focus on the email input when the page is loaded
Requirements::customScript("
(function($){
$(document).ready(function() {
$('#Email input').focus();
});
})(jQuery);
");
if(isset($_REQUEST['BackURL'])) {
$backURL = $_REQUEST['BackURL'];
} else {
$backURL = Session::get('BackURL');
}
if($checkCurrentUser && Member::currentUserID()) {
$fields = new FieldSet();
$actions = new FieldSet(new FormAction("logout", _t('Member.BUTTONLOGINOTHER', "Log in as someone else")));
} else {
if(!$fields) {
$fields = new FieldSet(
new HiddenField("AuthenticationMethod", null, $this->authenticator_class, $this),
new TextField("Email", _t('Member.EMAIL', 'Email'), Session::get('SessionForms.MemberLoginForm.Email'), null, $this),
new PasswordField("Password", _t('Member.PASSWORD', 'Password'))
);
if(Security::$autologin_enabled) {
$fields->push(new CheckboxField(
"Remember",
_t('Member.REMEMBERME', "Remember me next time?")
));
}
}
if(!$actions) {
$actions = new FieldSet(
new FormAction('dologin', _t('Member.BUTTONLOGIN', "Log in")),
new LiteralField(
'forgotPassword',
'<p id="ForgotPassword"><a href="Security/lostpassword">' . _t('Member.BUTTONLOSTPASSWORD', "I've lost my password") . '</a></p>'
)
);
}
}
if(isset($backURL)) {
$fields->push(new HiddenField('BackURL', 'BackURL', $backURL));
}
parent::__construct($controller, $name, $fields, $actions);
}
示例5: generate_i18n_namespace
/**
* Gets a namespace for all _t() translation functions
*
* @return string
*/
public static function generate_i18n_namespace()
{
if ($namespace = SilverSmithDefaults::get('DefaultNamespace')) {
return $namespace;
}
return ucwords(project());
}
示例6: __construct
/**
* Taken from MemberLoginForm::__construct with minor changes
*/
public function __construct($controller, $name, $fields = null, $actions = null, $checkCurrentUser = true)
{
$customCSS = project() . '/css/member_login.css';
if (Director::fileExists($customCSS)) {
Requirements::css($customCSS);
}
if (isset($_REQUEST['BackURL'])) {
$backURL = $_REQUEST['BackURL'];
} else {
$backURL = Session::get('BackURL');
}
if ($checkCurrentUser && Member::currentUser() && Member::logged_in_session_exists()) {
$fields = new FieldList(new HiddenField("AuthenticationMethod", null, $this->authenticator_class, $this));
$actions = new FieldList(new FormAction("logout", _t('Member.BUTTONLOGINOTHER', "Log in as someone else")));
} else {
if (!$fields) {
$fields = new FieldList(new HiddenField("AuthenticationMethod", null, $this->authenticator_class, $this));
}
if (!$actions) {
$actions = new FieldList(new FormAction('dologin', _t('GoogleAuthenticator.BUTTONLOGIN', "Log in with Google")));
}
}
if (isset($backURL)) {
$fields->push(new HiddenField('BackURL', 'BackURL', $backURL));
}
// Allow GET method for callback
$this->setFormMethod('GET', true);
parent::__construct($controller, $name, $fields, $actions);
}
开发者ID:helpfulrobot,项目名称:xpointo-silverstripe-google-authenticator,代码行数:32,代码来源:GoogleAuthenticatorLoginForm.php
示例7: init
public function init()
{
parent::init();
Requirements::javascript(MCE_ROOT . "tiny_mce_src.js");
Requirements::javascript("jsparty/tiny_mce_improvements.js");
Requirements::javascript("jsparty/hover.js");
Requirements::javascript("jsparty/scriptaculous/controls.js");
Requirements::javascript("cms/javascript/SecurityAdmin.js");
Requirements::javascript("cms/javascript/LeftAndMain_left.js");
Requirements::javascript("cms/javascript/LeftAndMain_right.js");
Requirements::javascript("cms/javascript/CMSMain_left.js");
Requirements::javascript("cms/javascript/ReportAdmin_left.js");
Requirements::javascript("cms/javascript/ReportAdmin_right.js");
Requirements::css("cms/css/ReportAdmin.css");
// TODO Find a better solution to integrate optional Requirements in a specific order
if (Director::fileExists("ecommerce/css/DataReportCMSMain.css")) {
Requirements::css("ecommerce/css/DataReportCMSMain.css");
}
if (Director::fileExists("ecommerce/css/DataReportCMSMain.css")) {
Requirements::javascript("ecommerce/javascript/DataReport.js");
}
if (Director::fileExists(project() . "/css/DataReportCMSMain.css")) {
Requirements::css(project() . "/css/DataReportCMSMain.css");
}
if (Director::fileExists(project() . "/css/DataReportCMSMain.css")) {
Requirements::javascript(project() . "/javascript/DataReport.js");
}
// We don't want this showing up in every ajax-response, it should always be present in a CMS-environment
if (!Director::is_ajax()) {
Requirements::javascriptTemplate("cms/javascript/tinymce.template.js", array("ContentCSS" => project() . "/css/editor.css", "BaseURL" => Director::absoluteBaseURL(), "Lang" => i18n::get_tinymce_lang()));
}
}
示例8: template_paths
/**
* looked-up the email template_paths.
* if not set, will look up both theme folder and project folder
* in both cases, email folder exsits or Email folder exists
* return an array containing all folders pointing to the bunch of email templates
*
* @return array
*/
public static function template_paths()
{
if (!isset(self::$template_paths)) {
if (class_exists('SiteConfig') && ($config = SiteConfig::current_site_config()) && $config->Theme) {
$theme = $config->Theme;
} elseif (SSViewer::current_custom_theme()) {
$theme = SSViewer::current_custom_theme();
} elseif (SSViewer::current_theme()) {
$theme = SSViewer::current_theme();
} else {
$theme = false;
}
if ($theme) {
if (file_exists("../" . THEMES_DIR . "/" . $theme . "/templates/email")) {
self::$template_paths[] = THEMES_DIR . "/" . $theme . "/templates/email";
}
if (file_exists("../" . THEMES_DIR . "/" . $theme . "/templates/Email")) {
self::$template_paths[] = THEMES_DIR . "/" . $theme . "/templates/Email";
}
}
$project = project();
if (file_exists("../" . $project . '/templates/email')) {
self::$template_paths[] = $project . '/templates/email';
}
if (file_exists("../" . $project . '/templates/Email')) {
self::$template_paths[] = $project . '/templates/Email';
}
} else {
if (is_string(self::$template_paths)) {
self::$template_paths = array(self::$template_paths);
}
}
return self::$template_paths;
}
示例9: init
public function init()
{
parent::init();
// We don't want this showing up in every ajax-response, it should always be present in a CMS-environment
if (!Director::is_ajax()) {
Requirements::javascriptTemplate("cms/javascript/tinymce.template.js", array("ContentCSS" => (SSViewer::current_theme() ? "themes/" . SSViewer::current_theme() : project()) . "/css/editor.css", "BaseURL" => Director::absoluteBaseURL(), "Lang" => i18n::get_tinymce_lang()));
}
Requirements::javascript('cms/javascript/CMSMain.js');
Requirements::javascript('cms/javascript/CMSMain_left.js');
Requirements::javascript('cms/javascript/CMSMain_right.js');
Requirements::javascript('sapphire/javascript/UpdateURL.js');
/**
* HACK ALERT: Project-specific requirements
*
* We need a better way of including all of the CSS that *might* be used by this application.
* Perhaps the ajax responses can include some instructions to go get more CSS / JavaScript?
*/
Requirements::css("survey/css/SurveyFilter.css");
Requirements::javascript("survey/javascript/SurveyResponses.js");
Requirements::javascript("survey/javascript/FormResponses.js");
Requirements::javascript("parents/javascript/NotifyMembers.js");
Requirements::css("tourism/css/SurveyCMSMain.css");
Requirements::javascript("tourism/javascript/QuotasReport.js");
Requirements::javascript("sapphire/javascript/ReportField.js");
Requirements::javascript("ptraining/javascript/BookingList.js");
Requirements::javascript("forum/javascript/ForumAccess.js");
Requirements::javascript('gallery/javascript/GalleryPage_CMS.js');
}
示例10: listener_data_entity
/**
* Entity data listener
*
* @param array $data
*
* @return void
*/
function listener_data_entity(array &$data) : void
{
foreach ($data as $id => $item) {
$item['id'] = $id;
$item = data_entity($item);
$item['attr'] = data_order($item['attr'], ['sort' => 'asc']);
$data[$id] = $item;
}
if (!($entities = all('entity', ['project_id' => project('ids')]))) {
return;
}
$attrs = all('attr', ['project_id' => project('ids')], ['index' => ['entity_id', 'uid']]);
foreach ($entities as $id => $item) {
if (!empty($data[$id])) {
message(_('Can not use reserved Id %s for Entity %s', $id, $item['name']));
continue;
}
$item = array_replace($data['content'], $item);
$item['model'] = 'eav';
if (!empty($attrs[$id])) {
foreach ($attrs[$id] as $uid => $attr) {
if (empty($item['attr'][$uid])) {
$attr['col'] = 'value';
$attr['eav_id'] = $attr['id'];
unset($attr['id'], $attr['uid'], $attr['project_id']);
$item['attr'][$uid] = $attr;
}
}
}
unset($item['project_id']);
$item = data_entity($item);
$item['attr'] = data_order($item['attr'], ['sort' => 'asc']);
$data[$id] = $item;
}
}
示例11: __construct
/**
* Constructor
*
* @param Controller $controller The parent controller, necessary to
* create the appropriate form action tag.
* @param string $name The method on the controller that will return this
* form object.
* @param FieldSet|FormField $fields All of the fields in the form - a
* {@link FieldSet} of {@link FormField}
* objects.
* @param FieldSet|FormAction $actions All of the action buttons in the
* form - a {@link FieldSet} of
* {@link FormAction} objects
* @param bool $checkCurrentUser If set to TRUE, it will be checked if a
* the user is currently logged in, and if
* so, only a logout button will be rendered
*/
function __construct($controller, $name, $fields = null, $actions = null, $checkCurrentUser = true)
{
$this->authenticator_class = 'MemberAuthenticator';
$customCSS = project() . '/css/member_login.css';
if (Director::fileExists($customCSS)) {
Requirements::css($customCSS);
}
if (isset($_REQUEST['BackURL'])) {
$backURL = $_REQUEST['BackURL'];
} else {
$backURL = Session::get('BackURL');
}
if ($checkCurrentUser && Member::currentUserID()) {
$fields = new FieldSet();
$actions = new FieldSet(new FormAction("logout", _t('Member.BUTTONLOGINOTHER', "Log in as someone else")));
} else {
if (!$fields) {
$fields = new FieldSet(new HiddenField("AuthenticationMethod", null, $this->authenticator_class, $this), new TextField("Email", _t('Member.EMAIL'), Session::get('SessionForms.MemberLoginForm.Email'), null, $this), new EncryptField("Password", _t('Member.PASSWORD'), null, $this), new CheckboxField("Remember", _t('Member.REMEMBERME', "Remember me next time?"), Session::get('SessionForms.MemberLoginForm.Remember'), $this));
}
if (!$actions) {
$actions = new FieldSet(new FormAction("dologin", _t('Member.BUTTONLOGIN', "Log in")), new FormAction("forgotPassword", _t('Member.BUTTONLOSTPASSWORD', "I've lost my password")));
}
}
if (isset($backURL)) {
$fields->push(new HiddenField('BackURL', 'BackURL', $backURL));
}
parent::__construct($controller, $name, $fields, $actions);
}
示例12: getCompiledPath
/**
* Returns the path for the compiled JS file. Falls back on
* the project dir if {@link self::$compiled_path} is undefined.
*
* @return string
*/
public function getCompiledPath()
{
$new_file = basename($this->uncompiledFile, ".coffee") . ".js";
if (!$this->config()->compiled_path) {
return project() . "/javascript/" . $new_file;
}
return $this->config()->compiled_path . "/" . $new_file;
}
示例13: url_media
/**
* Project media URL
*
* @param string $path
*
* @return string
*/
function url_media(string $path = '') : string
{
static $base;
if ($base === null) {
$base = '/asset/' . project('id') . '/media';
}
return $base . ($path ? '/' . $path : '');
}
示例14: setupMailer
/**
* this is mainly a test harness
* @return [type] [description]
*/
public function setupMailer()
{
Requirements::clear();
$this->parseVariables(true);
if (empty($this->from)) {
$this->from = Email::config()->admin_email;
}
$headers = $this->customHeaders;
if (project()) {
$headers['X-SilverStripeSite'] = project();
}
$to = $this->to;
$from = $this->from;
$subject = $this->subject;
if ($sendAllTo = $this->config()->send_all_emails_to) {
$subject .= " [addressed to {$to}";
$to = $sendAllTo;
if ($this->cc) {
$subject .= ", cc to {$this->cc}";
}
if ($this->bcc) {
$subject .= ", bcc to {$this->bcc}";
}
$subject .= ']';
unset($headers['Cc']);
unset($headers['Bcc']);
} else {
if ($this->cc) {
$headers['Cc'] = $this->cc;
}
if ($this->bcc) {
$headers['Bcc'] = $this->bcc;
}
}
if ($ccAllTo = $this->config()->cc_all_emails_to) {
if (!empty($headers['Cc']) && trim($headers['Cc'])) {
$headers['Cc'] .= ', ' . $ccAllTo;
} else {
$headers['Cc'] = $ccAllTo;
}
}
if ($bccAllTo = $this->config()->bcc_all_emails_to) {
if (!empty($headers['Bcc']) && trim($headers['Bcc'])) {
$headers['Bcc'] .= ', ' . $bccAllTo;
} else {
$headers['Bcc'] = $bccAllTo;
}
}
if ($sendAllfrom = $this->config()->send_all_emails_from) {
if ($from) {
$subject .= " [from {$from}]";
}
$from = $sendAllfrom;
}
Requirements::restore();
return self::mailer()->setupMailer($to, $from, $subject, $this->attachments, $headers);
}
示例15: init
public function init()
{
if (Director::fileExists(project() . "/css/files.css")) {
Requirements::css(project() . "/css/files.css");
} else {
Requirements::css("file-listing/css/files.css");
}
parent::init();
}