CMS
Version 3.9
blog_subscriber.inc
Go to the documentation of this file.
1
<?php
7
/**************************************************************
8
9
Copyright (c) 2010 Sonjara, Inc
10
11
Permission is hereby granted, free of charge, to any person
12
obtaining a copy of this software and associated documentation
13
files (the "Software"), to deal in the Software without
14
restriction, including without limitation the rights to use,
15
copy, modify, merge, publish, distribute, sublicense, and/or sell
16
copies of the Software, and to permit persons to whom the
17
Software is furnished to do so, subject to the following
18
conditions:
19
20
The above copyright notice and this permission notice shall be
21
included in all copies or substantial portions of the Software.
22
23
Except as contained in this notice, the name(s) of the above
24
copyright holders shall not be used in advertising or otherwise
25
to promote the sale, use or other dealings in this Software
26
without prior written authorization.
27
28
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
30
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
32
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
33
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
34
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
35
OTHER DEALINGS IN THE SOFTWARE.
36
37
*****************************************************************/
38
39
class
BlogSubscriber
extends
DataItem
40
{
41
var
$table
=
"blog_subscriber"
;
42
var
$primary_key
=
"blog_subscriber_id"
;
43
44
// Fields
45
var
$fields
= array(
"blog_subscriber_id"
=> Number,
46
"blog_id"
=> Number,
47
"subscriber_email"
=> String,
48
"first_name"
=> String,
49
"last_name"
=> String,
50
"organization"
=> String,
51
"subscription_type"
=> String,
52
"subscription_token"
=> String
53
);
54
55
// Hidden Fields
56
var
$hiddenFields
= array(
"subscription_token"
);
57
58
// Relations
59
60
var
$relations
= array(
"Blog"
=>
"Blog"
61
);
62
63
// Subscription type options are only available to web sites that set up a cron job
64
// and verify this using CMS Application Settings.
65
static
$subscriptionTypes
= array(
66
"instant"
=>
"Instant Notification"
,
67
"daily"
=>
"Daily Digest"
,
68
"weekly"
=>
"Weekly Digest"
,
69
);
70
75
static
function
fromToken
(
$token
)
76
{
77
$subscriber
= Query::create(
BlogSubscriber
,
"WHERE subscription_token=:s"
)
78
->bind(
":s"
,
$token
)
79
->executeSingle();
80
return
$subscriber
;
81
}
82
83
function
Blog
()
84
{
85
return
$this->getRelated(
Blog
);
86
}
87
93
function
getUnsubscribeUrl
()
94
{
95
global
$config
;
96
$url
= ($_SERVER[
'HTTPS'
]) ?
"https://"
:
"http://"
;
97
98
return
$url
.
$config
[
"http_host"
] .
"/action/blog/unsubscribe?subscription_token={$this->subscription_token}"
;
99
}
100
108
function
getBlogUrl
()
109
{
110
return
$this->
Blog
()->getURL();
111
}
112
}
113
?>
$token
$token
Definition:
authentication_token_form.inc:41
$subscriber
if(! $token) $subscriber
Definition:
blog_subscription_preferences.inc:51
Blog
Definition:
blog.inc:41
BlogSubscriber
Definition:
blog_subscriber.inc:40
BlogSubscriber\$primary_key
$primary_key
Definition:
blog_subscriber.inc:42
BlogSubscriber\getUnsubscribeUrl
getUnsubscribeUrl()
Merge Code 'unsubscribe_url'.
Definition:
blog_subscriber.inc:93
BlogSubscriber\$subscriptionTypes
static $subscriptionTypes
Definition:
blog_subscriber.inc:65
BlogSubscriber\$hiddenFields
$hiddenFields
Definition:
blog_subscriber.inc:56
BlogSubscriber\Blog
Blog()
Definition:
blog_subscriber.inc:83
BlogSubscriber\getBlogUrl
getBlogUrl()
Merge code 'blog_url'.
Definition:
blog_subscriber.inc:108
BlogSubscriber\$fields
$fields
Definition:
blog_subscriber.inc:45
BlogSubscriber\fromToken
static fromToken($token)
Retreive the blog subscriber record from the token.
Definition:
blog_subscriber.inc:75
BlogSubscriber\$relations
$relations
Definition:
blog_subscriber.inc:60
BlogSubscriber\$table
$table
Definition:
blog_subscriber.inc:41
$config
global $config
Definition:
import.inc:4
$url
if(! $blog->published||! $blog->enable_rss_feed||!checkRole($blog->allow_read)) $url
Definition:
rss.inc:58
code
cms.sonjara.com
cms
components
blog
datamodel
blog_subscriber.inc
Generated on Tue Mar 23 2021 15:36:12 for CMS by
1.9.1