当前位置: 首页>>代码示例>>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;未经允许,请勿转载。