Advertisement
Guest User

unzend.com_289

a guest
Jan 24th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 22.41 KB | None | 0 0
  1. <?php
  2. // ionCube version 9 Decoder unzend.com - Email: unzend@gmail.com
  3. // http://www.unzend.com
  4. /**
  5.  * This file contains core interfaces for Yii framework.
  6.  *
  7.  * @author Qiang Xue <qiang.xue@gmail.com>
  8.  * @link http://www.yiiframework.com/
  9.  * @copyright 2008-2013 Yii Software LLC
  10.  * @license http://www.yiiframework.com/license/
  11.  */
  12.  
  13. /**
  14.  * IApplicationComponent is the interface that all application components must implement.
  15.  *
  16.  * After the application completes configuration, it will invoke the {@link init()}
  17.  * method of every loaded application component.
  18.  *
  19.  * @author Qiang Xue <qiang.xue@gmail.com>
  20.  * @package system.base
  21.  * @since 1.0
  22.  */
  23. interface IApplicationComponent
  24. {
  25.     /**
  26.      * Initializes the application component.
  27.      * This method is invoked after the application completes configuration.
  28.      */
  29.     public function init();
  30.     /**
  31.      * @return boolean whether the {@link init()} method has been invoked.
  32.      */
  33.     public function getIsInitialized();
  34. }
  35.  
  36. /**
  37.  * ICache is the interface that must be implemented by cache components.
  38.  *
  39.  * This interface must be implemented by classes supporting caching feature.
  40.  *
  41.  * @author Qiang Xue <qiang.xue@gmail.com>
  42.  * @package system.caching
  43.  * @since 1.0
  44.  */
  45. interface ICache
  46. {
  47.     /**
  48.      * Retrieves a value from cache with a specified key.
  49.      * @param string $id a key identifying the cached value
  50.      * @return mixed the value stored in cache, false if the value is not in the cache or expired.
  51.      */
  52.     public function get($id);
  53.     /**
  54.      * Retrieves multiple values from cache with the specified keys.
  55.      * Some caches (such as memcache, apc) allow retrieving multiple cached values at one time,
  56.      * which may improve the performance since it reduces the communication cost.
  57.      * In case a cache doesn't support this feature natively, it will be simulated by this method.
  58.      * @param array $ids list of keys identifying the cached values
  59.      * @return array list of cached values corresponding to the specified keys. The array
  60.      * is returned in terms of (key,value) pairs.
  61.      * If a value is not cached or expired, the corresponding array value will be false.
  62.      */
  63.     public function mget($ids);
  64.     /**
  65.      * Stores a value identified by a key into cache.
  66.      * If the cache already contains such a key, the existing value and
  67.      * expiration time will be replaced with the new ones.
  68.      *
  69.      * @param string $id the key identifying the value to be cached
  70.      * @param mixed $value the value to be cached
  71.      * @param integer $expire the number of seconds in which the cached value will expire. 0 means never expire.
  72.      * @param ICacheDependency $dependency dependency of the cached item. If the dependency changes, the item is labelled invalid.
  73.      * @return boolean true if the value is successfully stored into cache, false otherwise
  74.      */
  75.     public function set($id,$value,$expire=0,$dependency=null);
  76.     /**
  77.      * Stores a value identified by a key into cache if the cache does not contain this key.
  78.      * Nothing will be done if the cache already contains the key.
  79.      * @param string $id the key identifying the value to be cached
  80.      * @param mixed $value the value to be cached
  81.      * @param integer $expire the number of seconds in which the cached value will expire. 0 means never expire.
  82.      * @param ICacheDependency $dependency dependency of the cached item. If the dependency changes, the item is labelled invalid.
  83.      * @return boolean true if the value is successfully stored into cache, false otherwise
  84.      */
  85.     public function add($id,$value,$expire=0,$dependency=null);
  86.     /**
  87.      * Deletes a value with the specified key from cache
  88.      * @param string $id the key of the value to be deleted
  89.      * @return boolean whether the deletion is successful
  90.      */
  91.     public function delete($id);
  92.     /**
  93.      * Deletes all values from cache.
  94.      * Be careful of performing this operation if the cache is shared by multiple applications.
  95.      * @return boolean whether the flush operation was successful.
  96.      */
  97.     public function flush();
  98. }
  99.  
  100. /**
  101.  * ICacheDependency is the interface that must be implemented by cache dependency classes.
  102.  *
  103.  * This interface must be implemented by classes meant to be used as
  104.  * cache dependencies.
  105.  *
  106.  * Objects implementing this interface must be able to be serialized and unserialized.
  107.  *
  108.  * @author Qiang Xue <qiang.xue@gmail.com>
  109.  * @package system.caching
  110.  * @since 1.0
  111.  */
  112. interface ICacheDependency
  113. {
  114.     /**
  115.      * Evaluates the dependency by generating and saving the data related with dependency.
  116.      * This method is invoked by cache before writing data into it.
  117.      */
  118.     public function evaluateDependency();
  119.     /**
  120.      * @return boolean whether the dependency has changed.
  121.      */
  122.     public function getHasChanged();
  123. }
  124.  
  125.  
  126. /**
  127.  * IStatePersister is the interface that must be implemented by state persister classes.
  128.  *
  129.  * This interface must be implemented by all state persister classes (such as
  130.  * {@link CStatePersister}.
  131.  *
  132.  * @package system.base
  133.  * @since 1.0
  134.  */
  135. interface IStatePersister
  136. {
  137.     /**
  138.      * Loads state data from a persistent storage.
  139.      * @return mixed the state
  140.      */
  141.     public function load();
  142.     /**
  143.      * Saves state data into a persistent storage.
  144.      * @param mixed $state the state to be saved
  145.      */
  146.     public function save($state);
  147. }
  148.  
  149.  
  150. /**
  151.  * IFilter is the interface that must be implemented by action filters.
  152.  *
  153.  * @package system.base
  154.  * @since 1.0
  155.  */
  156. interface IFilter
  157. {
  158.     /**
  159.      * Performs the filtering.
  160.      * This method should be implemented to perform actual filtering.
  161.      * If the filter wants to continue the action execution, it should call
  162.      * <code>$filterChain->run()</code>.
  163.      * @param CFilterChain $filterChain the filter chain that the filter is on.
  164.      */
  165.     public function filter($filterChain);
  166. }
  167.  
  168.  
  169. /**
  170.  * IAction is the interface that must be implemented by controller actions.
  171.  *
  172.  * @package system.base
  173.  * @since 1.0
  174.  */
  175. interface IAction
  176. {
  177.     /**
  178.      * @return string id of the action
  179.      */
  180.     public function getId();
  181.     /**
  182.      * @return CController the controller instance
  183.      */
  184.     public function getController();
  185. }
  186.  
  187.  
  188. /**
  189.  * IWebServiceProvider interface may be implemented by Web service provider classes.
  190.  *
  191.  * If this interface is implemented, the provider instance will be able
  192.  * to intercept the remote method invocation (e.g. for logging or authentication purpose).
  193.  * @author Qiang Xue <qiang.xue@gmail.com>
  194.  * @package system.base
  195.  * @since 1.0
  196.  */
  197. interface IWebServiceProvider
  198. {
  199.     /**
  200.      * This method is invoked before the requested remote method is invoked.
  201.      * @param CWebService $service the currently requested Web service.
  202.      * @return boolean whether the remote method should be executed.
  203.      */
  204.     public function beforeWebMethod($service);
  205.     /**
  206.      * This method is invoked after the requested remote method is invoked.
  207.      * @param CWebService $service the currently requested Web service.
  208.      */
  209.     public function afterWebMethod($service);
  210. }
  211.  
  212.  
  213. /**
  214.  * IViewRenderer interface is implemented by a view renderer class.
  215.  *
  216.  * A view renderer is {@link CWebApplication::viewRenderer viewRenderer}
  217.  * application component whose wants to replace the default view rendering logic
  218.  * implemented in {@link CBaseController}.
  219.  *
  220.  * @author Qiang Xue <qiang.xue@gmail.com>
  221.  * @package system.base
  222.  * @since 1.0
  223.  */
  224. interface IViewRenderer
  225. {
  226.     /**
  227.      * Renders a view file.
  228.      * @param CBaseController $context the controller or widget who is rendering the view file.
  229.      * @param string $file the view file path
  230.      * @param mixed $data the data to be passed to the view
  231.      * @param boolean $return whether the rendering result should be returned
  232.      * @return mixed the rendering result, or null if the rendering result is not needed.
  233.      */
  234.     public function renderFile($context,$file,$data,$return);
  235. }
  236.  
  237.  
  238. /**
  239.  * IUserIdentity interface is implemented by a user identity class.
  240.  *
  241.  * An identity represents a way to authenticate a user and retrieve
  242.  * information needed to uniquely identity the user. It is normally
  243.  * used with the {@link CWebApplication::user user application component}.
  244.  *
  245.  * @author Qiang Xue <qiang.xue@gmail.com>
  246.  * @package system.base
  247.  * @since 1.0
  248.  */
  249. interface IUserIdentity
  250. {
  251.     /**
  252.      * Authenticates the user.
  253.      * The information needed to authenticate the user
  254.      * are usually provided in the constructor.
  255.      * @return boolean whether authentication succeeds.
  256.      */
  257.     public function authenticate();
  258.     /**
  259.      * Returns a value indicating whether the identity is authenticated.
  260.      * @return boolean whether the identity is valid.
  261.      */
  262.     public function getIsAuthenticated();
  263.     /**
  264.      * Returns a value that uniquely represents the identity.
  265.      * @return mixed a value that uniquely represents the identity (e.g. primary key value).
  266.      */
  267.     public function getId();
  268.     /**
  269.      * Returns the display name for the identity (e.g. username).
  270.      * @return string the display name for the identity.
  271.      */
  272.     public function getName();
  273.     /**
  274.      * Returns the additional identity information that needs to be persistent during the user session.
  275.      * @return array additional identity information that needs to be persistent during the user session (excluding {@link id}).
  276.      */
  277.     public function getPersistentStates();
  278. }
  279.  
  280.  
  281. /**
  282.  * IWebUser interface is implemented by a {@link CWebApplication::user user application component}.
  283.  *
  284.  * A user application component represents the identity information
  285.  * for the current user.
  286.  *
  287.  * @author Qiang Xue <qiang.xue@gmail.com>
  288.  * @package system.base
  289.  * @since 1.0
  290.  */
  291. interface IWebUser
  292. {
  293.     /**
  294.      * Returns a value that uniquely represents the identity.
  295.      * @return mixed a value that uniquely represents the identity (e.g. primary key value).
  296.      */
  297.     public function getId();
  298.     /**
  299.      * Returns the display name for the identity (e.g. username).
  300.      * @return string the display name for the identity.
  301.      */
  302.     public function getName();
  303.     /**
  304.      * Returns a value indicating whether the user is a guest (not authenticated).
  305.      * @return boolean whether the user is a guest (not authenticated)
  306.      */
  307.     public function getIsGuest();
  308.     /**
  309.      * Performs access check for this user.
  310.      * @param string $operation the name of the operation that need access check.
  311.      * @param array $params name-value pairs that would be passed to business rules associated
  312.      * with the tasks and roles assigned to the user.
  313.      * @return boolean whether the operations can be performed by this user.
  314.      */
  315.     public function checkAccess($operation,$params=array());
  316.     /**
  317.      * Redirects the user browser to the login page.
  318.      * Before the redirection, the current URL (if it's not an AJAX url) will be
  319.      * kept in {@link returnUrl} so that the user browser may be redirected back
  320.      * to the current page after successful login. Make sure you set {@link loginUrl}
  321.      * so that the user browser can be redirected to the specified login URL after
  322.      * calling this method.
  323.      * After calling this method, the current request processing will be terminated.
  324.      */
  325.     public function loginRequired();
  326. }
  327.  
  328.  
  329. /**
  330.  * IAuthManager interface is implemented by an auth manager application component.
  331.  *
  332.  * An auth manager is mainly responsible for providing role-based access control (RBAC) service.
  333.  *
  334.  * @author Qiang Xue <qiang.xue@gmail.com>
  335.  * @package system.base
  336.  * @since 1.0
  337.  */
  338. interface IAuthManager
  339. {
  340.     /**
  341.      * Performs access check for the specified user.
  342.      * @param string $itemName the name of the operation that we are checking access to
  343.      * @param mixed $userId the user ID. This should be either an integer or a string representing
  344.      * the unique identifier of a user. See {@link IWebUser::getId}.
  345.      * @param array $params name-value pairs that would be passed to biz rules associated
  346.      * with the tasks and roles assigned to the user.
  347.      * @return boolean whether the operations can be performed by the user.
  348.      */
  349.     public function checkAccess($itemName,$userId,$params=array());
  350.  
  351.     /**
  352.      * Creates an authorization item.
  353.      * An authorization item represents an action permission (e.g. creating a post).
  354.      * It has three types: operation, task and role.
  355.      * Authorization items form a hierarchy. Higher level items inheirt permissions representing
  356.      * by lower level items.
  357.      * @param string $name the item name. This must be a unique identifier.
  358.      * @param integer $type the item type (0: operation, 1: task, 2: role).
  359.      * @param string $description description of the item
  360.      * @param string $bizRule business rule associated with the item. This is a piece of
  361.      * PHP code that will be executed when {@link checkAccess} is called for the item.
  362.      * @param mixed $data additional data associated with the item.
  363.      * @return CAuthItem the authorization item
  364.      * @throws CException if an item with the same name already exists
  365.      */
  366.     public function createAuthItem($name,$type,$description='',$bizRule=null,$data=null);
  367.     /**
  368.      * Removes the specified authorization item.
  369.      * @param string $name the name of the item to be removed
  370.      * @return boolean whether the item exists in the storage and has been removed
  371.      */
  372.     public function removeAuthItem($name);
  373.     /**
  374.      * Returns the authorization items of the specific type and user.
  375.      * @param integer $type the item type (0: operation, 1: task, 2: role). Defaults to null,
  376.      * meaning returning all items regardless of their type.
  377.      * @param mixed $userId the user ID. Defaults to null, meaning returning all items even if
  378.      * they are not assigned to a user.
  379.      * @return array the authorization items of the specific type.
  380.      */
  381.     public function getAuthItems($type=null,$userId=null);
  382.     /**
  383.      * Returns the authorization item with the specified name.
  384.      * @param string $name the name of the item
  385.      * @return CAuthItem the authorization item. Null if the item cannot be found.
  386.      */
  387.     public function getAuthItem($name);
  388.     /**
  389.      * Saves an authorization item to persistent storage.
  390.      * @param CAuthItem $item the item to be saved.
  391.      * @param string $oldName the old item name. If null, it means the item name is not changed.
  392.      */
  393.     public function saveAuthItem($item,$oldName=null);
  394.  
  395.     /**
  396.      * Adds an item as a child of another item.
  397.      * @param string $itemName the parent item name
  398.      * @param string $childName the child item name
  399.      * @throws CException if either parent or child doesn't exist or if a loop has been detected.
  400.      */
  401.     public function addItemChild($itemName,$childName);
  402.     /**
  403.      * Removes a child from its parent.
  404.      * Note, the child item is not deleted. Only the parent-child relationship is removed.
  405.      * @param string $itemName the parent item name
  406.      * @param string $childName the child item name
  407.      * @return boolean whether the removal is successful
  408.      */
  409.     public function removeItemChild($itemName,$childName);
  410.     /**
  411.      * Returns a value indicating whether a child exists within a parent.
  412.      * @param string $itemName the parent item name
  413.      * @param string $childName the child item name
  414.      * @return boolean whether the child exists
  415.      */
  416.     public function hasItemChild($itemName,$childName);
  417.     /**
  418.      * Returns the children of the specified item.
  419.      * @param mixed $itemName the parent item name. This can be either a string or an array.
  420.      * The latter represents a list of item names.
  421.      * @return array all child items of the parent
  422.      */
  423.     public function getItemChildren($itemName);
  424.  
  425.     /**
  426.      * Assigns an authorization item to a user.
  427.      * @param string $itemName the item name
  428.      * @param mixed $userId the user ID (see {@link IWebUser::getId})
  429.      * @param string $bizRule the business rule to be executed when {@link checkAccess} is called
  430.      * for this particular authorization item.
  431.      * @param mixed $data additional data associated with this assignment
  432.      * @return CAuthAssignment the authorization assignment information.
  433.      * @throws CException if the item does not exist or if the item has already been assigned to the user
  434.      */
  435.     public function assign($itemName,$userId,$bizRule=null,$data=null);
  436.     /**
  437.      * Revokes an authorization assignment from a user.
  438.      * @param string $itemName the item name
  439.      * @param mixed $userId the user ID (see {@link IWebUser::getId})
  440.      * @return boolean whether removal is successful
  441.      */
  442.     public function revoke($itemName,$userId);
  443.     /**
  444.      * Returns a value indicating whether the item has been assigned to the user.
  445.      * @param string $itemName the item name
  446.      * @param mixed $userId the user ID (see {@link IWebUser::getId})
  447.      * @return boolean whether the item has been assigned to the user.
  448.      */
  449.     public function isAssigned($itemName,$userId);
  450.     /**
  451.      * Returns the item assignment information.
  452.      * @param string $itemName the item name
  453.      * @param mixed $userId the user ID (see {@link IWebUser::getId})
  454.      * @return CAuthAssignment the item assignment information. Null is returned if
  455.      * the item is not assigned to the user.
  456.      */
  457.     public function getAuthAssignment($itemName,$userId);
  458.     /**
  459.      * Returns the item assignments for the specified user.
  460.      * @param mixed $userId the user ID (see {@link IWebUser::getId})
  461.      * @return array the item assignment information for the user. An empty array will be
  462.      * returned if there is no item assigned to the user.
  463.      */
  464.     public function getAuthAssignments($userId);
  465.     /**
  466.      * Saves the changes to an authorization assignment.
  467.      * @param CAuthAssignment $assignment the assignment that has been changed.
  468.      */
  469.     public function saveAuthAssignment($assignment);
  470.  
  471.     /**
  472.      * Removes all authorization data.
  473.      */
  474.     public function clearAll();
  475.     /**
  476.      * Removes all authorization assignments.
  477.      */
  478.     public function clearAuthAssignments();
  479.  
  480.     /**
  481.      * Saves authorization data into persistent storage.
  482.      * If any change is made to the authorization data, please make
  483.      * sure you call this method to save the changed data into persistent storage.
  484.      */
  485.     public function save();
  486.  
  487.     /**
  488.      * Executes a business rule.
  489.      * A business rule is a piece of PHP code that will be executed when {@link checkAccess} is called.
  490.      * @param string $bizRule the business rule to be executed.
  491.      * @param array $params additional parameters to be passed to the business rule when being executed.
  492.      * @param mixed $data additional data that is associated with the corresponding authorization item or assignment
  493.      * @return boolean whether the execution returns a true value.
  494.      * If the business rule is empty, it will also return true.
  495.      */
  496.     public function executeBizRule($bizRule,$params,$data);
  497. }
  498.  
  499.  
  500. /**
  501.  * IBehavior interfaces is implemented by all behavior classes.
  502.  *
  503.  * A behavior is a way to enhance a component with additional methods that
  504.  * are defined in the behavior class and not available in the component class.
  505.  *
  506.  * @author Qiang Xue <qiang.xue@gmail.com>
  507.  * @package system.base
  508.  */
  509. interface IBehavior
  510. {
  511.     /**
  512.      * Attaches the behavior object to the component.
  513.      * @param CComponent $component the component that this behavior is to be attached to.
  514.      */
  515.     public function attach($component);
  516.     /**
  517.      * Detaches the behavior object from the component.
  518.      * @param CComponent $component the component that this behavior is to be detached from.
  519.      */
  520.     public function detach($component);
  521.     /**
  522.      * @return boolean whether this behavior is enabled
  523.      */
  524.     public function getEnabled();
  525.     /**
  526.      * @param boolean $value whether this behavior is enabled
  527.      */
  528.     public function setEnabled($value);
  529. }
  530.  
  531. /**
  532.  * IWidgetFactory is the interface that must be implemented by a widget factory class.
  533.  *
  534.  * When calling {@link CBaseController::createWidget}, if a widget factory is available,
  535.  * it will be used for creating the requested widget.
  536.  *
  537.  * @author Qiang Xue <qiang.xue@gmail.com>
  538.  * @package system.web
  539.  * @since 1.1
  540.  */
  541. interface IWidgetFactory
  542. {
  543.     /**
  544.      * Creates a new widget based on the given class name and initial properties.
  545.      * @param CBaseController $owner the owner of the new widget
  546.      * @param string $className the class name of the widget. This can also be a path alias (e.g. system.web.widgets.COutputCache)
  547.      * @param array $properties the initial property values (name=>value) of the widget.
  548.      * @return CWidget the newly created widget whose properties have been initialized with the given values.
  549.      */
  550.     public function createWidget($owner,$className,$properties=array());
  551. }
  552.  
  553. /**
  554.  * IDataProvider is the interface that must be implemented by data provider classes.
  555.  *
  556.  * Data providers are components that can feed data for widgets such as data grid, data list.
  557.  * Besides providing data, they also support pagination and sorting.
  558.  *
  559.  * @author Qiang Xue <qiang.xue@gmail.com>
  560.  * @package system.web
  561.  * @since 1.1
  562.  */
  563. interface IDataProvider
  564. {
  565.     /**
  566.      * @return string the unique ID that identifies the data provider from other data providers.
  567.      */
  568.     public function getId();
  569.     /**
  570.      * Returns the number of data items in the current page.
  571.      * This is equivalent to <code>count($provider->getData())</code>.
  572.      * When {@link pagination} is set false, this returns the same value as {@link totalItemCount}.
  573.      * @param boolean $refresh whether the number of data items should be re-calculated.
  574.      * @return integer the number of data items in the current page.
  575.      */
  576.     public function getItemCount($refresh=false);
  577.     /**
  578.      * Returns the total number of data items.
  579.      * When {@link pagination} is set false, this returns the same value as {@link itemCount}.
  580.      * @param boolean $refresh whether the total number of data items should be re-calculated.
  581.      * @return integer total number of possible data items.
  582.      */
  583.     public function getTotalItemCount($refresh=false);
  584.     /**
  585.      * Returns the data items currently available.
  586.      * @param boolean $refresh whether the data should be re-fetched from persistent storage.
  587.      * @return array the list of data items currently available in this data provider.
  588.      */
  589.     public function getData($refresh=false);
  590.     /**
  591.      * Returns the key values associated with the data items.
  592.      * @param boolean $refresh whether the keys should be re-calculated.
  593.      * @return array the list of key values corresponding to {@link data}. Each data item in {@link data}
  594.      * is uniquely identified by the corresponding key value in this array.
  595.      */
  596.     public function getKeys($refresh=false);
  597.     /**
  598.      * @return CSort the sorting object. If this is false, it means the sorting is disabled.
  599.      */
  600.     public function getSort();
  601.     /**
  602.      * @return CPagination the pagination object. If this is false, it means the pagination is disabled.
  603.      */
  604.     public function getPagination();
  605. }
  606.  
  607.  
  608. /**
  609.  * ILogFilter is the interface that must be implemented by log filters.
  610.  *
  611.  * A log filter preprocesses the logged messages before they are handled by a log route.
  612.  * You can attach classes that implement ILogFilter to {@link CLogRoute::$filter}.
  613.  *
  614.  * @package system.logging
  615.  * @since 1.1.11
  616.  */
  617. interface ILogFilter
  618. {
  619.     /**
  620.      * This method should be implemented to perform actual filtering of log messages
  621.      * by working on the array given as the first parameter.
  622.      * Implementation might reformat, remove or add information to logged messages.
  623.      * @param array $logs list of messages. Each array element represents one message
  624.      * with the following structure:
  625.      * array(
  626.      *   [0] => message (string)
  627.      *   [1] => level (string)
  628.      *   [2] => category (string)
  629.      *   [3] => timestamp (float, obtained by microtime(true));
  630.      */
  631.     public function filter(&$logs);
  632. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement