本文整理汇总了PHP中Zend_Loader::loadClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Loader::loadClass方法的具体用法?PHP Zend_Loader::loadClass怎么用?PHP Zend_Loader::loadClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Loader
的用法示例。
在下文中一共展示了Zend_Loader::loadClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: photosAction
public function photosAction()
{
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Http_Client');
$CLIENT_ID = 'fa2641332bca4ce6bd8f71bd4345cc0f';
$CLIENT_SECRET = 'c44e29e7449444e3bc1f58ff499f5e8e';
$user = '332756956';
$tag = 'coreprojectua';
try {
$client = new Zend_Http_Client('https://api.instagram.com/v1/users/' . $user . '/media/recent');
$client->setParameterGet('client_id', $CLIENT_ID);
$response = $client->request();
$result = json_decode($response->getBody());
$data = $result->data;
if (count($data) > 0) {
$this->view->user = $data;
}
} catch (Exception $e) {
echo 'ERROR: ' . $e->getMessage() . print_r($client);
exit;
}
try {
$client = new Zend_Http_Client('https://api.instagram.com/v1/tags/' . $tag . '/media/recent');
$client->setParameterGet('client_id', $CLIENT_ID);
$response = $client->request();
$result = json_decode($response->getBody());
$data = $result->data;
if (count($data) > 0) {
$this->view->tag = $data;
}
} catch (Exception $e) {
echo 'ERROR: ' . $e->getMessage() . print_r($client);
exit;
}
}
示例2: connectToGoogleViaZend
private function connectToGoogleViaZend()
{
set_include_path($this->root_directory . "modules/Calendar4You/");
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
if ($this->user_login != "" && $this->user_password != "") {
try {
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$this->gClient = Zend_Gdata_ClientLogin::getHttpClient($this->user_login, $this->user_password, $service);
$this->status = $this->mod_strings["LBL_OK"];
$this->is_logged = true;
} catch (Zend_Gdata_App_CaptchaRequiredException $cre) {
$this->status = $this->mod_strings["LBL_URL_CAPTCHA_IMAGE"] . ': ' . $cre->getCaptchaUrl() . ', ' . $this->mod_strings["LBL_TOKEN_ID"] . ': ' . $cre->getCaptchaToken();
} catch (Zend_Gdata_App_AuthException $ae) {
$this->status = $this->mod_strings["LBL_AUTH_PROBLEM"] . ': ' . $ae->exception() . "\n";
}
} else {
$this->status = $this->mod_strings["LBL_MISSING_AUTH_DATA"];
}
if ($this->is_logged) {
$this->gService = new Zend_Gdata_Calendar($this->gClient);
try {
$this->gListFeed = $this->gService->getCalendarListFeed();
} catch (Zend_Gdata_App_Exception $e) {
$this->gListFeed = array();
}
}
set_include_path($this->root_directory);
}
示例3: fetchTable
public function fetchTable($table_name, $where = false, $parameters = array())
{
$range = isset($parameters['range']) && !empty($parameters['range']) ? $parameters['range'] : " * ";
$sortColumn = isset($parameters['sortColumn']) && !empty($parameters['sortColumn']) ? $parameters['sortColumn'] : false;
$sortType = isset($parameters['sortType']) && !empty($parameters['sortType']) ? $parameters['sortType'] : "ASC";
$limitOffset = isset($parameters['limitOffset']) && !empty($parameters['limitOffset']) ? $parameters['limitOffset'] : false;
$rowCount = isset($parameters['rowCount']) && !empty($parameters['rowCount']) ? $parameters['rowCount'] : false;
$queryString = "SELECT {$range} FROM {$table_name} ";
if ($where !== false) {
$queryString .= " WHERE " . $where;
}
if ($sortColumn !== false) {
$queryString .= " ORDER BY {$sortColumn} {$sortType} ";
}
if ($rowCount !== false) {
$queryString .= " LIMIT ";
if ($limitOffset !== false) {
$queryString .= " {$limitOffset}, ";
}
$queryString .= " {$rowCount} ";
}
$db = $this->_db->query($queryString);
$dataFetch = $db->fetchAll(Zend_Db::FETCH_ASSOC);
$data = array('table' => $this, 'data' => $dataFetch, 'rowClass' => $this->_rowClass, 'stored' => true);
Zend_Loader::loadClass($this->_rowsetClass);
if (count($dataFetch) < 1) {
return false;
} else {
return new $this->_rowsetClass($data);
}
}
示例4: setAdapter
/**
* Sets new encryption options
*
* @param string|array $options (Optional) Encryption options
* @return Zend_Filter_Encrypt
*/
public function setAdapter($options = null)
{
if (is_string($options)) {
$adapter = $options;
} else {
if (isset($options['adapter'])) {
$adapter = $options['adapter'];
unset($options['adapter']);
} else {
$adapter = 'Mcrypt';
}
}
if (!is_array($options)) {
$options = array();
}
if (Zend_Loader::isReadable('Zend/Filter/Encrypt/' . ucfirst($adapter) . '.php')) {
$adapter = 'Zend_Filter_Encrypt_' . ucfirst($adapter);
}
Zend_Loader::loadClass($adapter);
$this->_adapter = new $adapter($options);
if (!$this->_adapter instanceof Zend_Filter_Encrypt_Interface) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception("Encoding adapter '" . $adapter . "' does not implement Zend_Filter_Encrypt_Interface");
}
return $this;
}
示例5: getView
/**
* Get view instance
*
* @access public
* @return Zend_View
*/
public function getView()
{
if (!isset($this->_config)) {
throw new Gene_View_Exception('Configs does not set.');
}
if (!isset($this->_config['className'])) {
throw new Gene_View_Exception('Invaild class name.');
}
$encode = 'UTF-8';
if (isset($this->_config['encoding'])) {
$encode = $this->_config['encoding'];
}
if (!class_exists($this->_config['className'])) {
Zend_Loader::loadClass($this->_config['className']);
}
$streamWrapperFlag = false;
if (isset($this->_config['streamWrapperFlag'])) {
if (strtolower($this->_config['streamWrapperFlag']) === 'on') {
$streamWrapperFlag = $this->_config['streamWrapperFlag'];
}
}
$class = $this->_config['className'];
$view = new $class();
$view->setEncoding($encode)->setUseStreamWrapper($streamWrapperFlag);
return $view;
}
示例6: unserialize
public static function unserialize($cached)
{
if (isset($cached['_class']) && !class_exists($cached['_class'])) {
\Zend_Loader::loadClass($cached['_class']);
}
return unserialize(gzuncompress($cached['content']));
}
示例7: loginAction
function loginAction()
{
$this->view->message = '';
if ($this->_request->isPost()) {
Zend_Loader::loadClass('Zend_Filter_StripTags');
$f = new Zend_Filter_StripTags();
$username = $f->filter($this->_request->getPost('username'));
$password = md5($f->filter($this->_request->getPost('password')));
if (!empty($username)) {
Zend_Loader::loadClass('Zend_Auth_Adapter_DbTable');
$dbAdapter = Zend_Registry::get('dbAdapter');
$authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
$authAdapter->setTableName('utilisateur');
$authAdapter->setIdentityColumn('login_utilisateur');
$authAdapter->setCredentialColumn('pass_utilisateur');
$authAdapter->setIdentity($username);
$authAdapter->setCredential($password);
$auth = Zend_Auth::getInstance();
$result = $auth->authenticate($authAdapter);
if ($result->isValid()) {
$data = $authAdapter->getResultRowObject(null, 'password');
$auth->getStorage()->write($data);
$this->_redirect('/');
}
}
$this->_redirect('auth/loginfail');
}
}
示例8: init
/**
* Método Construtor
*
* @see Contribuinte_Lib_Controller_AbstractController::init()
*/
public function init()
{
parent::init();
// Carrega as classes para geração do PDF
Zend_Loader::loadClass('fpdf', APPLICATION_PATH . '/../library/FPDF/');
Zend_Loader::loadClass('Fpdf2File', APPLICATION_PATH . '/../library/FPDF/');
}
示例9: init
function init()
{
$this->view->baseUrl = $this->_request->getBaseUrl();
Zend_Loader::loadClass('Utilisateur');
Zend_Loader::loadClass('Avatar');
Zend_Loader::loadClass('Classe');
Zend_Loader::loadClass('Case_');
Zend_Loader::loadClass('Competence');
Zend_Loader::loadClass('Zone');
Zend_Loader::loadClass('Equipement');
Zend_Loader::loadClass('EquipementArme');
Zend_Loader::loadClass('EquipementArmure');
Zend_Loader::loadClass('Objet');
Zend_Loader::loadClass('ObjetMonstre');
Zend_Loader::loadClass('ZoneMonstre');
Zend_Loader::loadClass('Monstre');
Zend_Loader::loadClass('LigneInventaire');
Zend_Loader::loadClass('ObjetSoin');
Zend_Loader::loadClass('Niveau');
Zend_Loader::loadClass('Pnj');
Zend_Loader::loadClass('Instructeur');
Zend_Loader::loadClass('Marchand');
Zend_Loader::loadClass('Ville');
$this->view->user = Zend_Auth::getInstance()->getIdentity();
}
示例10: getView
/**
* Get view
*
* @param Zend_Config $config
* @return Zend_View_Interface
*/
public function getView(Zend_Config $config)
{
if (!($view = $this->getCache('view'))) {
$isUseViewRenderer = !Zend_Controller_Front::getInstance()->getParam('noViewRenderer');
$viewRenderer = $isUseViewRenderer ? Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer') : null;
// Use view from view renderer if possible
if ($isUseViewRenderer && $viewRenderer->view instanceof Zend_View_Interface) {
$view = $viewRenderer->view;
} else {
$viewClass = $config->get('class');
Zend_Loader::loadClass($viewClass);
$view = new $viewClass();
// Validate object
if (!$view instanceof Zend_View_Interface) {
/**
* @see Zym_App_Resource_View_Exception
*/
require_once 'Zym/App/Resource/View/Exception.php';
throw new Zym_App_Resource_View_Exception(sprintf('View object must be an instance of Zend_View_Interface an object of %s', get_class($view)));
}
}
// Setup
$this->_setupView($view, $config);
// Save
$this->saveCache($view, 'view');
}
return $view;
}
示例11: resetAction
function resetAction()
{
Zend_Loader::loadClass("UserModel");
$userm = new UserModel();
$user = $this->_request->get("user");
$key = $this->_request->get("key");
$obj = $userm->getRow($user);
if (empty($obj) or empty($key)) {
$this->_redirect("/");
}
$savedkey = $this->cache->load($user);
if ($savedkey != $key) {
$this->_redirect("/");
}
$this->cache->remove($user);
$pass = "";
for ($i = 0; $i < 8; $i++) {
$pass = $pass . mt_rand(0, 9);
}
/* send email */
$mail = Mailer::get_mailer();
$baseurl = Zend_Controller_Front::getInstance()->getBaseUrl();
if ($baseurl == "/") {
$baseurl = "";
}
$mail->setBodyText("\n\nYou are receiving this email because you wished to reset your password\non http://{$_SERVER['SERVER_NAME']}{$baseurl}.\n\nWe have changed your password to: {$pass}\n\nPlease try logging in using this password and change it as soon as\npossible.\n\n");
$mail->addTo($userm->getMember($obj, 0)->email, $userm->getMember($obj, 0)->name);
$mail->setSubject("Password Reset");
$mail->send();
$obj->setPassword($pass);
}
示例12: addEvent
function addEvent($title = 'Новый заказ', $desc = 'Описание заказа', $where = 'интернет-магазин', $startDate, $endDate, $sms_reminder)
{
try {
set_include_path('.' . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] . '/modules/gcalendar/' . PATH_SEPARATOR . get_include_path());
include_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_HttpClient');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
$client = Zend_Gdata_ClientLogin::getHttpClient($this->_user, $this->_pass, "cl");
$gdataCal = new Zend_Gdata_Calendar($client);
$newEvent = $gdataCal->newEventEntry();
$newEvent->title = $gdataCal->newTitle($title);
$newEvent->where = array($gdataCal->newWhere($where));
$newEvent->content = $gdataCal->newContent($desc);
$when = $gdataCal->newWhen();
$when->startTime = $startDate;
$when->endTime = $endDate;
if (intval($sms_reminder)) {
$reminder = $gdataCal->newReminder();
$reminder->method = "sms";
$reminder->minutes = "0";
$when->reminders = array($reminder);
}
$newEvent->when = array($when);
$createdEvent = $gdataCal->insertEvent($newEvent);
return $createdEvent->id->text;
} catch (Exception $ex) {
// Report the exception to the user
}
}
示例13: testRoleCascadeDelete
/**
* Cascade delete Role
* @group admin
* @group admin-role-cascade-delete
*/
public function testRoleCascadeDelete()
{
print "\n" . __METHOD__ . ' ';
$role_id = 6;
$this->_rootLogin();
$this->request->setPost(array('role_id' => $role_id));
$this->request->setMethod('POST');
$this->dispatch('admin/role-delete');
$this->logBody($this->response->outputBody());
// debug log
$this->assertController('admin');
$this->assertAction('role-index');
$this->assertNotQueryContentRegex('table', self::ZF_pattern);
// Zend Framework
// check role
Zend_Loader::loadClass('Wbroles');
$table = new Wbroles();
$row = $table->fetchRow("id = {$role_id}");
if ($row != null) {
$this->assertTrue(FALSE, "\nRole delete fail!\n");
}
unset($table);
// check ACLs tables
$arr_table = array('WbCommandACL', 'Wbresources', 'WbStorageACL', 'WbPoolACL', 'WbClientACL', 'WbFilesetACL', 'WbJobACL', 'WbWhereACL');
foreach ($arr_table as $tbl) {
Zend_Loader::loadClass($tbl);
$table = new $tbl();
$row = $table->fetchRow("role_id = {$role_id}");
if ($row != null) {
$this->assertTrue(FALSE, "\nRole cascade delete fail!\n");
}
echo "0";
unset($table);
}
}
示例14: convertToObject
/**
* Converts a DOMElement object into the specific class
*
* @throws Zend_InfoCard_Xml_Exception
* @param DOMElement $e The DOMElement object to convert
* @param string $classname The name of the class to convert it to (must inhert from Zend_InfoCard_Xml_Element)
* @return Zend_InfoCard_Xml_Element a Xml Element object from the DOM element
*/
static public function convertToObject(DOMElement $e, $classname)
{
if (!class_exists($classname)) {
require_once 'Zend/Loader.php';
Zend_Loader::loadClass($classname);
}
$reflection = new ReflectionClass($classname);
if(!$reflection->isSubclassOf('Zend_InfoCard_Xml_Element')) {
require_once 'Zend/InfoCard/Xml/Exception.php';
throw new Zend_InfoCard_Xml_Exception("DOM element must be converted to an instance of Zend_InfoCard_Xml_Element");
}
$sxe = simplexml_import_dom($e, $classname);
if(!($sxe instanceof Zend_InfoCard_Xml_Element)) {
// Since we just checked to see if this was a subclass of Zend_infoCard_Xml_Element this shoudl never fail
// @codeCoverageIgnoreStart
require_once 'Zend/InfoCard/Xml/Exception.php';
throw new Zend_InfoCard_Xml_Exception("Failed to convert between DOM and SimpleXML");
// @codeCoverageIgnoreEnd
}
return $sxe;
}
示例15: getById
function getById($jobid)
{
// do Bacula ACLs
Zend_Loader::loadClass('Job');
$table = new Job();
if (!$table->isJobIdExists($jobid)) {
return FALSE;
}
$select = new Zend_Db_Select($this->db);
switch ($this->db_adapter) {
case 'PDO_SQLITE':
// bug http://framework.zend.com/issues/browse/ZF-884
$select->distinct();
$select->from(array('l' => 'Log'), array('logid' => 'LogId', 'jobid' => 'JobId', 'LogTime' => 'Time', 'logtext' => 'LogText'));
$select->where("JobId = ?", $jobid);
$select->order(array('LogId', 'LogTime'));
break;
default:
// mysql, postgresql
$select->distinct();
$select->from(array('l' => 'Log'), array('LogId', 'JobId', 'LogTime' => 'Time', 'LogText'));
$select->where("JobId = ?", $jobid);
$select->order(array('LogId', 'LogTime'));
}
//$sql = $select->__toString(); echo "<pre>$sql</pre>"; exit; // for !!!debug!!!
$stmt = $select->query();
return $stmt->fetchAll();
}