本文整理汇总了PHP中Loader::addSpecialClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Loader::addSpecialClass方法的具体用法?PHP Loader::addSpecialClass怎么用?PHP Loader::addSpecialClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loader
的用法示例。
在下文中一共展示了Loader::addSpecialClass方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: extractMentions
/**
* Extracts mentions from a Tweet.
*
* @param str $post_text The post text to search.
* @return array $matches All mentions in this tweet.
*/
public static function extractMentions($post_text)
{
if (!class_exists('Twitter_Extractor')) {
Loader::addSpecialClass('Twitter_Extractor', 'plugins/twitter/extlib/twitter-text-php/lib/Twitter/Extractor.php');
}
$tweet = new Twitter_Extractor($post_text);
$mentions = $tweet->extractMentionedUsernames();
foreach ($mentions as $k => $v) {
$mentions[$k] = '@' . $v;
}
return $mentions;
}
示例2:
* Copyright (c) 2009-2012 Gina Trapani
*
* LICENSE:
*
* This file is part of ThinkUp (http://thinkupapp.com).
*
* ThinkUp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any
* later version.
*
* ThinkUp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with ThinkUp. If not, see
* <http://www.gnu.org/licenses/>.
*/
/**
* @author Gina Trapani <ginatrapani[at]gmail[dot]com>
* @license http://www.gnu.org/licenses/gpl.html
* @copyright 2009-2012 Gina Trapani
*/
$config = Config::getInstance();
//For testing, check if mock class has already been loaded
if (!class_exists('TwitterOAuth')) {
Loader::addSpecialClass('TwitterOAuth', 'plugins/twitter/extlib/twitteroauth/twitteroauth.php');
}
$webapp = Webapp::getInstance();
$webapp->registerPlugin('twitter', 'TwitterPlugin');
$crawler = Crawler::getInstance();
$crawler->registerCrawlerPlugin('TwitterPlugin');
示例3: testAddSpecialClass
public function testAddSpecialClass()
{
// SimpleTest can't catch fatal errors so this assertion doesn't work
// $this->expectError();
// $lookup_test = new ConsumerUserStream();
Loader::addSpecialClass('ConsumerUserStream', 'plugins/twitterrealtime/model/class.ConsumerUserStream.php');
$special_classes = Loader::getSpecialClasses();
$this->assertEqual(Loader::getSpecialClasses(), array('Smarty' => THINKUP_WEBAPP_PATH . '_lib/extlib/Smarty-2.6.26/libs/Smarty.class.php', 'ConsumerUserStream' => THINKUP_WEBAPP_PATH . 'plugins/twitterrealtime/model/class.ConsumerUserStream.php'));
//shouldn't throw a not found error
$lookup_test = new ConsumerUserStream('username', 'password');
}
示例4:
*
* Copyright (c) 2009-2013 Gina Trapani
*
* LICENSE:
*
* This file is part of ThinkUp (http://thinkup.com).
*
* ThinkUp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any
* later version.
*
* ThinkUp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with ThinkUp. If not, see
* <http://www.gnu.org/licenses/>.
*
* @author Gina Trapani <ginatrapani[at]gmail[dot]com>
* @license http://www.gnu.org/licenses/gpl.html
* @copyright 2009-2013 Gina Trapani
*/
//For testing purposes, only include Facebook library if mock class hasn't already been loaded
if (!class_exists('Facebook')) {
Loader::addSpecialClass('Facebook', 'plugins/facebook/extlib/facebook/facebook.php');
}
$webapp_plugin_registrar = PluginRegistrarWebapp::getInstance();
$webapp_plugin_registrar->registerPlugin('facebook', 'FacebookPlugin');
$webapp_plugin_registrar->registerPlugin('facebook page', 'FacebookPlugin');
$crawler_plugin_registrar = PluginRegistrarCrawler::getInstance();
$crawler_plugin_registrar->registerCrawlerPlugin('FacebookPlugin');
示例5: SplClassLoader
*
* Copyright (c) 2013 Dimosthenis Nikoudis
*
* LICENSE:
*
* This file is part of ThinkUp (http://thinkup.com).
*
* ThinkUp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any
* later version.
*
* ThinkUp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with ThinkUp. If not, see
* <http://www.gnu.org/licenses/>.
*
* @author Dimosthenis Nikoudis <dnna[at]dnna[dot]gr>
* @license http://www.gnu.org/licenses/gpl.html
* @copyright 2013 Dimosthenis Nikoudis
*/
if (!class_exists('Instagram\\Instagram')) {
Loader::addSpecialClass('SplClassLoader', 'plugins/instagram/extlib/SplClassLoader.php');
$loader = new SplClassLoader('Instagram', 'plugins/instagram/extlib');
$loader->register();
}
$webapp_plugin_registrar = PluginRegistrarWebapp::getInstance();
$webapp_plugin_registrar->registerPlugin('instagram', 'InstagramPlugin');
$crawler_plugin_registrar = PluginRegistrarCrawler::getInstance();
$crawler_plugin_registrar->registerCrawlerPlugin('InstagramPlugin');