21 set_include_path(get_include_path().PATH_SEPARATOR.dirname(realpath(__FILE__)));
22 require_once
'OPiQuotations/log.inc';
27 ini_set(
'display_errors',
'stdout');
28 ini_set(
'display_startup_errors', 1);
29 ini_set(
'html_errors', 1);
33 assert_options(ASSERT_ACTIVE,
true);
34 assert_options(ASSERT_WARNING,
true);
35 assert_options(ASSERT_BAIL,
true);
40 ini_set(
'display_errors',
'stderr');
41 ini_set(
'display_startup_errors', 0);
42 ini_set(
'html_errors', 0);
46 assert_options(ASSERT_ACTIVE,
false);
47 assert_options(ASSERT_WARNING,
false);
48 assert_options(ASSERT_BAIL,
false);
50 set_error_handler(
'\OPiQuotations\error_handler');
55 mb_internal_encoding(
'UTF-8');
56 mb_regex_encoding(
'UTF-8');
57 mb_http_output(
'UTF-8');
58 mb_detect_order(
'UTF-8');
60 require_once
'OPiQuotations/OPiQuotations.inc';
63 $LABEL =
'Twitter - OPiCitationJour';
70 #$quot = $opiquotations->quotation_by_id(9); 71 #$quot = $opiquotations->quotation_by_id(110); 72 #$quot = $opiquotations->quotation_by_id(459); 73 #$quot = $opiquotations->quotation_by_id(961); 74 #$quot = $opiquotations->quotation_by_id(3062); 85 require_once(
'libs/twitteroauth/autoload.php');
88 require_once(
'.private/Twitter_login.inc');
90 $connection =
new TwitterOAuth($consumer_key, $consumer_secret, $access_token, $access_token_secret);
98 echo
'<pre>help/configuration: ';
109 $text =
$quot->to_text_twitter(
'http://www.opimedia.be/OPiCitations/?id='.
$quot->id(),
114 preg_match(
'/(http:\/\/.*?)(\n|$)/',
$text, $long_url);
115 $long_url = $long_url[0];
117 .
'<pre>'.htmlspecialchars(
$text).
'</pre>';
128 'trim_user' =>
true));
137 echo
'<pre>$result->errors: 143 $a = array(basename(__FILE__).
' error(s):');
144 foreach (
$result->errors as $error) {
145 $a[] =
' - Error '.$error->code.
': '.$error->message;
147 $a[] =
'Quotation '.$quot->id().
': '.
$text;
159 $url =
'https://twitter.com/OPiCitationJour/status/'.$result->id;
165 echo
'</pre><a href="',
$url,
'">',
$url,
'</a>';
to_log($message)
Append $message in LOG_FILE.
Class to get OPiQuotation and informations from the databse.