當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WYSIJA::setInfo方法代碼示例

本文整理匯總了PHP中WYSIJA::setInfo方法的典型用法代碼示例。如果您正苦於以下問題:PHP WYSIJA::setInfo方法的具體用法?PHP WYSIJA::setInfo怎麽用?PHP WYSIJA::setInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WYSIJA的用法示例。


在下文中一共展示了WYSIJA::setInfo方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get


//.........這裏部分代碼省略.........
 {
     static $array_of_objects;
     if ($load_lang) {
         WYSIJA::load_lang($extended_plugin);
     }
     // store all the objects made so that we can reuse them accross the application if the object is already set we return it immediately
     if (isset($array_of_objects[$extended_plugin][$type . $name])) {
         return $array_of_objects[$extended_plugin][$type . $name];
     }
     // which folder do we pick for controllersand views ? back or front ?
     if ($force_side) {
         $side = $force_side;
     } else {
         $side = WYSIJA_SIDE;
     }
     // for each plugin we will define the $extended_constant variable if it's not defined already
     // also we will defined the $extended_plugin_name which corresponds to the folder name and also will be used to build the class to be called
     switch ($extended_plugin) {
         case 'wysija-newsletters-premium':
             $extended_constant = 'WYSIJANLP';
             if (!defined($extended_constant)) {
                 define($extended_constant, $extended_constant);
             }
             $extended_plugin_name = 'wysijanlp';
             break;
         case 'wysija-newsletters':
             $extended_constant = 'WYSIJA';
             if (!defined($extended_constant)) {
                 define($extended_constant, $extended_constant);
             }
             $extended_plugin_name = 'wysija';
             break;
         default:
             $extended_constant = strtoupper($extended_plugin);
             if (!defined($extended_constant)) {
                 define($extended_constant, $extended_constant);
             }
             $extended_plugin_name = $extended_plugin;
     }
     // security to protect against dangerous ./../ includes
     $name = preg_replace('#[^a-z0-9_]#i', '', $name);
     // this switch will require_once the file needed and build a the class name depending on the parameters passed to the function
     switch ($type) {
         case 'controller':
             // require the parent class necessary
             require_once WYSIJA_CORE . 'controller.php';
             $ctrdir = WYSIJA_PLG_DIR . $extended_plugin . DS . 'controllers' . DS;
             // if we are doing ajax we don't go to one side, ajax is for frontend or backend in the same folder
             if (defined('DOING_AJAX')) {
                 $class_path = $ctrdir . 'ajax' . DS . $name . '.php';
             } else {
                 // the other controllers are called in a side folder back or front
                 $class_path = $ctrdir . $side . DS . $name . '.php';
                 // require the side specific controller file
                 require_once WYSIJA_CTRL . $side . '.php';
             }
             $class_name = strtoupper($extended_plugin_name) . '_control_' . $side . '_' . $name;
             break;
         case 'view':
             $viewdir = WYSIJA_PLG_DIR . $extended_plugin . DS . 'views' . DS;
             // let's get the right path for the view front or back and the right class_name
             $class_path = $viewdir . $side . DS . $name . '.php';
             $class_name = strtoupper($extended_plugin_name) . '_view_' . $side . '_' . $name;
             // require the common view file and the side view file
             require_once WYSIJA_CORE . 'view.php';
             require_once WYSIJA_VIEWS . $side . '.php';
             break;
         case 'helper':
             $helpdir = WYSIJA_PLG_DIR . $extended_plugin . DS . 'helpers' . DS;
             $class_path = $helpdir . $name . '.php';
             $class_name = strtoupper($extended_plugin_name) . '_help_' . $name;
             break;
         case 'model':
             $modeldir = WYSIJA_PLG_DIR . $extended_plugin . DS . 'models' . DS;
             $class_path = $modeldir . $name . '.php';
             $class_name = strtoupper($extended_plugin_name) . '_model_' . $name;
             // require the parent class necessary
             require_once WYSIJA_CORE . 'model.php';
             break;
         case 'widget':
             $modeldir = WYSIJA_PLG_DIR . $extended_plugin . DS . 'widgets' . DS;
             $class_path = $modeldir . $name . '.php';
             if ($name == 'wysija_nl') {
                 $class_name = 'WYSIJA_NL_Widget';
             } else {
                 $class_name = strtoupper($extended_plugin_name) . '_widget_' . $name;
             }
             break;
         default:
             WYSIJA::setInfo('error', 'WYSIJA::get does not accept this type of file "' . $type . '" .');
             return false;
     }
     if (!file_exists($class_path)) {
         WYSIJA::setInfo('error', 'file has not been recognised ' . $class_path);
         return;
     }
     // require the file needed once and store & return the object needed
     require_once $class_path;
     return $array_of_objects[$extended_plugin][$type . $name] = new $class_name($extended_plugin_name);
 }
開發者ID:sontv1003,項目名稱:fashionbeans,代碼行數:101,代碼來源:base.php

示例2: get

 /**
  * function to generate objects of different types, managing file requiring in order to be the most efficient
  * @staticvar array $arrayOfObjects
  * @param type $name
  * @param type $type
  * @return type
  */
 public static function get($name, $type, $forceside = false, $extendedplugin = 'wysija-newsletters')
 {
     static $arrayOfObjects;
     WYSIJA::load_lang($extendedplugin);
     /*store all the objects made so that we can reuse them accross the application*/
     if (isset($arrayOfObjects[$extendedplugin][$type . $name])) {
         return $arrayOfObjects[$extendedplugin][$type . $name];
     }
     if ($forceside) {
         $side = $forceside;
     } else {
         $side = WYSIJA_SIDE;
     }
     if ($extendedplugin == 'wysija-newsletters') {
         $extendeconstant = strtoupper("wysija");
         if (!defined($extendeconstant)) {
             define($extendeconstant, $extendeconstant);
         }
         $extendedpluginname = 'wysija';
     } else {
         $extendeconstant = strtoupper($extendedplugin);
         if (!defined($extendeconstant)) {
             define($extendeconstant, $extendeconstant);
         }
         $extendedpluginname = $extendedplugin;
     }
     //security to protect against ./../ includes
     $name = preg_replace('#[^a-z0-9_]#i', '', $name);
     switch ($type) {
         case 'controller':
             $ctrdir = WYSIJA_PLG_DIR . $extendedplugin . DS . 'controllers' . DS;
             /*require the parent class necessary*/
             require_once WYSIJA_CORE . 'controller.php';
             /*require the common controller file*/
             if (defined('DOING_AJAX')) {
                 $classpath = $ctrdir . 'ajax' . DS . $name . '.php';
             } else {
                 $classpath = $ctrdir . $side . DS . $name . '.php';
                 require_once WYSIJA_CTRL . $side . '.php';
                 /*require the side specific controller file*/
             }
             $classname = strtoupper($extendedpluginname) . '_control_' . $side . '_' . $name;
             break;
         case 'view':
             $viewdir = WYSIJA_PLG_DIR . $extendedplugin . DS . 'views' . DS;
             $classpath = $viewdir . $side . DS . $name . ".php";
             $classname = strtoupper($extendedpluginname) . '_view_' . $side . '_' . $name;
             require_once WYSIJA_CORE . 'view.php';
             /*require the common view file*/
             require_once WYSIJA_VIEWS . $side . '.php';
             /*require the side specific view file*/
             break;
         case 'helper':
             $helpdir = WYSIJA_PLG_DIR . $extendedplugin . DS . 'helpers' . DS;
             $classpath = $helpdir . $name . '.php';
             $classname = strtoupper($extendedpluginname) . '_help_' . $name;
             break;
         case 'model':
             $modeldir = WYSIJA_PLG_DIR . $extendedplugin . DS . 'models' . DS;
             $classpath = $modeldir . $name . '.php';
             $classname = strtoupper($extendedpluginname) . '_model_' . $name;
             /*require the parent class necessary*/
             require_once WYSIJA_CORE . 'model.php';
             break;
         default:
             WYSIJA::setInfo('error', 'WYSIJA::get does not accept this type of file "' . $type . '" .');
             return false;
     }
     if (!file_exists($classpath)) {
         WYSIJA::setInfo('error', 'file has not been recognised ' . $classpath);
         return;
     }
     require_once $classpath;
     return $arrayOfObjects[$extendedplugin][$type . $name] = new $classname($extendedpluginname);
 }
開發者ID:rotoballer,項目名稱:emily,代碼行數:82,代碼來源:base.php


注:本文中的WYSIJA::setInfo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。