idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
7,700
protected function getNewValues ( User $ user ) { $ newProps = new UserUpdater ( ) ; $ this -> logger -> section ( 'Editing user ' . $ user -> getEmail ( ) . ' (' . $ user -> getUsername ( ) . ')' ) ; $ this -> logger -> comment ( 'leave empty to keep unchanged' ) ; $ newProps -> setUsername ( $ this -> ask ( new Question ( 'Username' , $ user -> getUsername ( ) ) ) ) ; $ newProps -> setEmail ( $ this -> ask ( new Question ( 'E-mail address' , $ user -> getEmail ( ) ) ) ) ; $ password = $ this -> ask ( new Question ( 'Password' , '***' ) ) ; $ newProps -> setPassword ( $ password !== '***' ? $ password : '' ) ; return $ newProps ; }
Ask for new user properties
7,701
static function notify ( $ message , $ type , $ page = null ) { global $ pagenow ; if ( ( null != $ page && $ page == $ pagenow ) || null == $ page ) { add_action ( 'admin_notices' , create_function ( '' , "echo '<div class=\"" . $ type . "\"><p>" . $ message . "</p></div>';" ) ) ; } }
Register an admin notification .
7,702
public function set ( EntityInterface $ entity ) : string { $ hash = $ entity -> calculateHash ( ) ; $ content = $ this -> encodeContent ( $ entity -> writeData ( ) ) ; $ this -> saveContent ( $ hash , $ content ) ; return $ hash ; }
Sets the specified entity into the registry .
7,703
public function get ( string $ hash ) : ? EntityInterface { $ result = null ; $ content = $ this -> loadContent ( $ hash ) ; if ( $ content !== null ) { $ result = $ this -> createEntityFromContent ( $ content ) ; } return $ result ; }
Returns the entity with the specified hash .
7,704
protected function createEntityFromContent ( string $ content ) : EntityInterface { $ result = $ this -> createEntity ( ) ; $ result -> readData ( new DataContainer ( $ this -> decodeContent ( $ content ) ) ) ; return $ result ; }
Creates an entity from the specified content .
7,705
public function associateScope ( ScopeEntity $ scope ) { if ( ! isset ( $ this -> scopes [ $ scope -> getId ( ) ] ) ) { $ this -> scopes [ $ scope -> getId ( ) ] = $ scope ; } return $ this ; }
Associate a scope
7,706
public function hasScope ( $ scope ) { if ( $ this -> scopes === null ) { $ this -> getScopes ( ) ; } return isset ( $ this -> scopes [ $ scope ] ) ; }
Check if access token has an associated scope
7,707
public function getClient ( ) { if ( $ this -> client instanceof ClientEntity ) { return $ this -> client ; } $ this -> client = $ this -> server -> getClientStorage ( ) -> getBySession ( $ this ) ; return $ this -> client ; }
Return the session client
7,708
public function setOwner ( $ type , $ id ) { $ this -> ownerType = $ type ; $ this -> ownerId = $ id ; $ this -> server -> getEventEmitter ( ) -> emit ( new SessionOwnerEvent ( $ this ) ) ; return $ this ; }
Set the session owner
7,709
public function save ( ) { $ id = $ this -> server -> getSessionStorage ( ) -> create ( $ this -> getOwnerType ( ) , $ this -> getOwnerId ( ) , $ this -> getClient ( ) -> getId ( ) , $ this -> getClient ( ) -> getRedirectUri ( ) ) ; $ this -> setId ( $ id ) ; foreach ( $ this -> getScopes ( ) as $ scope ) { $ this -> server -> getSessionStorage ( ) -> associateScope ( $ this , $ scope ) ; } }
Save the session
7,710
protected function convertButtons ( ) { $ buttons = array ( ) ; $ snippets = array ( ) ; if ( isset ( $ this -> assignedValues ) ) { foreach ( $ this -> assignedValues as $ item ) { if ( $ item instanceof \ Psc \ UI \ ButtonInterface ) { $ button = $ item ; } elseif ( $ item instanceof \ Psc \ CMS \ Entity ) { $ button = $ this -> entityMeta -> getAdapter ( $ item ) -> setButtonMode ( Buttonable :: CLICK | Buttonable :: DRAG ) -> getDropBoxButton ( ) ; } else { throw new \ InvalidArgumentException ( Code :: varInfo ( $ item ) . ' kann nicht in einen Button umgewandelt werden' ) ; } if ( $ button instanceof \ Psc \ JS \ JooseSnippetWidget ) { $ button -> disableAutoLoad ( ) ; $ button -> html ( ) -> addClass ( 'assigned-item' ) ; $ snippets [ ] = $ button -> getJooseSnippet ( ) ; } else { $ button -> html ( ) -> addClass ( 'assigned-item' ) ; } $ buttons [ ] = $ button ; } } return array ( $ buttons , $ snippets ) ; }
Wandelt die assignedValues in Buttons um
7,711
protected function prepareColumnsConfig ( ) { $ columns = [ ] ; foreach ( $ this -> table -> getColumns ( ) as $ column ) { $ columns [ ] = $ column -> getProperties ( ) ; } $ this -> table -> setColumns ( $ columns ) ; }
Prepare columns config
7,712
protected function prepareExtensionsConfig ( ) { foreach ( $ this -> table -> getExtensions ( ) as $ extension ) { $ properties = $ extension -> getProperties ( ) ; if ( isset ( $ properties ) ) { $ this -> table -> setProperty ( $ extension -> getPropertyName ( ) , $ properties ) ; } } }
Prepare extensions config
7,713
public function dirs ( $ resource , $ recursive = false , $ filter = null ) { return $ this -> ls ( $ resource , self :: LS_MODE_DIR , $ recursive , $ filter ) ; }
Get a list of directories from a resource .
7,714
public function ls ( $ resource , $ mode = self :: LS_MODE_FILE , $ recursive = false , $ filter = null ) { $ files = [ ] ; list ( , $ paths , $ path ) = $ this -> _parse ( $ resource ) ; foreach ( ( array ) $ paths as $ _path ) { if ( file_exists ( $ _path . '/' . $ path ) ) { foreach ( $ this -> _list ( FS :: clean ( $ _path . '/' . $ path ) , '' , $ mode , $ recursive , $ filter ) as $ file ) { if ( ! Arr :: in ( $ file , $ files ) ) { $ files [ ] = $ file ; } } } } return $ files ; }
Get a list of files or diretories from a resource .
7,715
protected function _list ( $ path , $ prefix = '' , $ mode = 'file' , $ recursive = false , $ filter = null ) { $ files = [ ] ; $ ignore = [ '.' , '..' , '.DS_Store' , '.svn' , '.git' , '.gitignore' , '.gitmodules' , 'cgi-bin' ] ; if ( $ scan = @ scandir ( $ path ) ) { foreach ( $ scan as $ file ) { if ( Arr :: in ( $ file , $ ignore ) ) { continue ; } if ( is_dir ( $ path . '/' . $ file ) ) { if ( $ mode === 'dir' ) { if ( $ filter && ! preg_match ( $ filter , $ file ) ) { continue ; } $ files [ ] = $ prefix . $ file ; } if ( ! $ recursive ) { continue ; } $ files = array_merge ( $ files , $ this -> _list ( $ path . '/' . $ file , $ prefix . $ file . '/' , $ mode , $ recursive , $ filter ) ) ; } else { if ( $ mode === 'file' ) { if ( $ filter && ! preg_match ( $ filter , $ file ) ) { continue ; } $ files [ ] = $ prefix . $ file ; } } } } return $ files ; }
Get the list of files or directories in a given path .
7,716
public function putBaiDu ( array $ urls ) { return $ this -> getBaiDu ( ) -> setHeader ( [ 'Content-Type' => 'text/plain' ] ) -> parameters ( $ this -> merge ( [ 'urls' => $ urls ] ) ) -> encode ( function ( $ data ) { return implode ( "\n" , $ data [ 'urls' ] ) ; } ) -> json ( ) ; }
INITIATIVE PUT URLS TO BAIDU
7,717
private function createCreateForm ( PermissionsGroup $ permissionsGroup ) { $ form = $ this -> createForm ( new PermissionsGroupType ( ) , $ permissionsGroup , array ( 'action' => $ this -> generateUrl ( 'admin_permissionsgroup_create' ) , 'method' => 'POST' , ) ) ; $ form -> add ( 'submit' , 'submit' , array ( 'label' => 'Create' ) ) ; return $ form ; }
Creates a form to create a PermissionsGroup entity .
7,718
public function newAction ( ) { $ permissionsGroup = new PermissionsGroup ( ) ; $ form = $ this -> createCreateForm ( $ permissionsGroup ) ; return $ this -> render ( 'ChillMainBundle:PermissionsGroup:new.html.twig' , array ( 'entity' => $ permissionsGroup , 'form' => $ form -> createView ( ) , ) ) ; }
Displays a form to create a new PermissionsGroup entity .
7,719
public function showAction ( $ id ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ permissionsGroup = $ em -> getRepository ( 'ChillMainBundle:PermissionsGroup' ) -> find ( $ id ) ; if ( ! $ permissionsGroup ) { throw $ this -> createNotFoundException ( 'Unable to find PermissionsGroup entity.' ) ; } $ translatableStringHelper = $ this -> get ( 'chill.main.helper.translatable_string' ) ; $ roleScopes = $ permissionsGroup -> getRoleScopes ( ) -> toArray ( ) ; usort ( $ roleScopes , function ( RoleScope $ a , RoleScope $ b ) use ( $ translatableStringHelper ) { if ( $ a -> getScope ( ) === NULL ) { return 1 ; } if ( $ b -> getScope ( ) === NULL ) { return + 1 ; } return strcmp ( $ translatableStringHelper -> localize ( $ a -> getScope ( ) -> getName ( ) ) , $ translatableStringHelper -> localize ( $ b -> getScope ( ) -> getName ( ) ) ) ; } ) ; return $ this -> render ( 'ChillMainBundle:PermissionsGroup:show.html.twig' , array ( 'entity' => $ permissionsGroup , 'role_scopes' => $ roleScopes , 'expanded_roles' => $ this -> getExpandedRoles ( $ roleScopes ) ) ) ; }
Finds and displays a PermissionsGroup entity .
7,720
private function getExpandedRoles ( array $ roleScopes ) { $ expandedRoles = array ( ) ; foreach ( $ roleScopes as $ roleScope ) { if ( ! array_key_exists ( $ roleScope -> getRole ( ) , $ expandedRoles ) ) { $ expandedRoles [ $ roleScope -> getRole ( ) ] = array_map ( function ( RoleInterface $ role ) { return $ role -> getRole ( ) ; } , $ this -> get ( 'security.role_hierarchy' ) -> getReachableRoles ( array ( new Role ( $ roleScope -> getRole ( ) ) ) ) ) ; } } return $ expandedRoles ; }
expand roleScopes to be easily shown in template
7,721
public function editAction ( $ id ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ permissionsGroup = $ em -> getRepository ( 'ChillMainBundle:PermissionsGroup' ) -> find ( $ id ) ; if ( ! $ permissionsGroup ) { throw $ this -> createNotFoundException ( 'Unable to find PermissionsGroup entity.' ) ; } $ editForm = $ this -> createEditForm ( $ permissionsGroup ) ; $ deleteRoleScopesForm = array ( ) ; foreach ( $ permissionsGroup -> getRoleScopes ( ) as $ roleScope ) { $ deleteRoleScopesForm [ $ roleScope -> getId ( ) ] = $ this -> createDeleteRoleScopeForm ( $ permissionsGroup , $ roleScope ) ; } $ addRoleScopesForm = $ this -> createAddRoleScopeForm ( $ permissionsGroup ) ; return $ this -> render ( 'ChillMainBundle:PermissionsGroup:edit.html.twig' , array ( 'entity' => $ permissionsGroup , 'edit_form' => $ editForm -> createView ( ) , 'expanded_roles' => $ this -> getExpandedRoles ( $ permissionsGroup -> getRoleScopes ( ) -> toArray ( ) ) , 'delete_role_scopes_form' => array_map ( function ( $ form ) { return $ form -> createView ( ) ; } , $ deleteRoleScopesForm ) , 'add_role_scopes_form' => $ addRoleScopesForm -> createView ( ) ) ) ; }
Displays a form to edit an existing PermissionsGroup entity .
7,722
private function createEditForm ( PermissionsGroup $ permissionsGroup ) { $ form = $ this -> createForm ( new PermissionsGroupType ( ) , $ permissionsGroup , array ( 'action' => $ this -> generateUrl ( 'admin_permissionsgroup_update' , array ( 'id' => $ permissionsGroup -> getId ( ) ) ) , 'method' => 'PUT' , ) ) ; $ form -> add ( 'submit' , 'submit' , array ( 'label' => 'Update' ) ) ; return $ form ; }
Creates a form to edit a PermissionsGroup entity .
7,723
public function updateAction ( Request $ request , $ id ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ permissionsGroup = $ em -> getRepository ( 'ChillMainBundle:PermissionsGroup' ) -> find ( $ id ) ; if ( ! $ permissionsGroup ) { throw $ this -> createNotFoundException ( 'Unable to find PermissionsGroup entity.' ) ; } $ editForm = $ this -> createEditForm ( $ permissionsGroup ) ; $ editForm -> handleRequest ( $ request ) ; if ( $ editForm -> isValid ( ) ) { $ em -> flush ( ) ; return $ this -> redirect ( $ this -> generateUrl ( 'admin_permissionsgroup_edit' , array ( 'id' => $ id ) ) ) ; } $ deleteRoleScopesForm = array ( ) ; foreach ( $ permissionsGroup -> getRoleScopes ( ) as $ roleScope ) { $ deleteRoleScopesForm [ $ roleScope -> getId ( ) ] = $ this -> createDeleteRoleScopeForm ( $ permissionsGroup , $ roleScope ) ; } $ addRoleScopesForm = $ this -> createAddRoleScopeForm ( $ permissionsGroup ) ; return $ this -> render ( 'ChillMainBundle:PermissionsGroup:edit.html.twig' , array ( 'entity' => $ permissionsGroup , 'edit_form' => $ editForm -> createView ( ) , 'expanded_roles' => $ this -> getExpandedRoles ( $ permissionsGroup -> getRoleScopes ( ) -> toArray ( ) ) , 'delete_role_scopes_form' => array_map ( function ( $ form ) { return $ form -> createView ( ) ; } , $ deleteRoleScopesForm ) , 'add_role_scopes_form' => $ addRoleScopesForm -> createView ( ) ) ) ; }
Edits an existing PermissionsGroup entity .
7,724
protected function getPersistentRoleScopeBy ( $ role , Scope $ scope = null ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ roleScope = $ em -> getRepository ( 'ChillMainBundle:RoleScope' ) -> findOneBy ( array ( 'role' => $ role , 'scope' => $ scope ) ) ; if ( $ roleScope === NULL ) { $ roleScope = ( new RoleScope ( ) ) -> setRole ( $ role ) -> setScope ( $ scope ) ; $ em -> persist ( $ roleScope ) ; } return $ roleScope ; }
get a role scope by his parameters . The role scope is persisted if it doesn t exists in database .
7,725
public function deleteLinkRoleScopeAction ( $ pgid , $ rsid ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ permissionsGroup = $ em -> getRepository ( 'ChillMainBundle:PermissionsGroup' ) -> find ( $ pgid ) ; $ roleScope = $ em -> getRepository ( 'ChillMainBundle:RoleScope' ) -> find ( $ rsid ) ; if ( ! $ permissionsGroup ) { throw $ this -> createNotFoundException ( 'Unable to find PermissionsGroup entity.' ) ; } if ( ! $ roleScope ) { throw $ this -> createNotFoundException ( 'Unable to find RoleScope entity' ) ; } try { $ permissionsGroup -> removeRoleScope ( $ roleScope ) ; } catch ( \ RuntimeException $ ex ) { $ this -> addFlash ( 'notice' , $ this -> get ( 'translator' ) -> trans ( "The role '%role%' and circle " . "'%scope%' is not associated with this permission group" , array ( '%role%' => $ this -> get ( 'translator' ) -> trans ( $ roleScope -> getRole ( ) ) , '%scope%' => $ this -> get ( 'chill.main.helper.translatable_string' ) -> localize ( $ roleScope -> getScope ( ) -> getName ( ) ) ) ) ) ; return $ this -> redirect ( $ this -> generateUrl ( 'admin_permissionsgroup_edit' , array ( 'id' => $ pgid ) ) ) ; } $ em -> flush ( ) ; $ this -> addFlash ( 'notice' , $ this -> get ( 'translator' ) -> trans ( "The role '%role%' on circle " . "'%scope%' has been removed" , array ( '%role%' => $ this -> get ( 'translator' ) -> trans ( $ roleScope -> getRole ( ) ) , '%scope%' => $ this -> get ( 'chill.main.helper.translatable_string' ) -> localize ( $ roleScope -> getScope ( ) -> getName ( ) ) ) ) ) ; return $ this -> redirect ( $ this -> generateUrl ( 'admin_permissionsgroup_edit' , array ( 'id' => $ pgid ) ) ) ; }
remove an association between permissionsGroup and roleScope
7,726
private function createDeleteRoleScopeForm ( PermissionsGroup $ permissionsGroup , RoleScope $ roleScope ) { return $ this -> createFormBuilder ( ) -> setAction ( $ this -> generateUrl ( 'admin_permissionsgroup_delete_role_scope' , array ( 'pgid' => $ permissionsGroup -> getId ( ) , 'rsid' => $ roleScope -> getId ( ) ) ) ) -> setMethod ( 'DELETE' ) -> add ( 'submit' , 'submit' , array ( 'label' => 'Delete' ) ) -> getForm ( ) ; }
Creates a form to delete a link to roleScope .
7,727
private function createAddRoleScopeForm ( PermissionsGroup $ permissionsGroup ) { return $ this -> createFormBuilder ( ) -> setAction ( $ this -> generateUrl ( 'admin_permissionsgroup_add_role_scope' , array ( 'id' => $ permissionsGroup -> getId ( ) ) ) ) -> setMethod ( 'PUT' ) -> add ( 'composed_role_scope' , 'composed_role_scope' ) -> add ( 'submit' , 'submit' , array ( 'label' => 'Add permission' ) ) -> getForm ( ) ; }
creates a form to add a role scope to permissionsgroup
7,728
public function getDefaultQueue ( ) : ? Queue { $ manager = QueueFacade :: getFacadeRoot ( ) ; if ( isset ( $ manager ) ) { return $ manager -> connection ( ) ; } return $ manager ; }
Get a default queue value if any is available
7,729
public function insertMulti ( array $ hashes ) { $ valuesString = '' ; foreach ( $ hashes as $ id => $ hash ) { $ valuesString .= "('$id','$hash')," ; } $ this -> storage -> exec ( "INSERT INTO " . $ this -> tableName . "(id, hash) VALUES " . rtrim ( $ valuesString , ',' ) ) ; }
Inserts hashes in batch for better performance
7,730
public function updateMulti ( array $ hashes ) { $ startSql = "UPDATE " . $ this -> tableName ; $ this -> storage -> exec ( 'BEGIN TRANSACTION' ) ; foreach ( $ hashes as $ id => $ hash ) { $ this -> storage -> exec ( $ startSql . " SET hash='$hash' WHERE id='$id'" ) ; } $ this -> storage -> exec ( 'END TRANSACTION' ) ; }
Updating hashes in batch for better performance
7,731
public static function addParagraphStyle ( $ styleName , $ styles ) { if ( ! array_key_exists ( $ styleName , self :: $ _styleElements ) ) { $ style = new PHPWord_Style_Paragraph ( ) ; foreach ( $ styles as $ key => $ value ) { if ( substr ( $ key , 0 , 1 ) != '_' ) { $ key = '_' . $ key ; } $ style -> setStyleValue ( $ key , $ value ) ; } self :: $ _styleElements [ $ styleName ] = $ style ; } }
Add a paragraph style
7,732
public static function addFontStyle ( $ styleName , $ styleFont , $ styleParagraph = null ) { if ( ! array_key_exists ( $ styleName , self :: $ _styleElements ) ) { $ font = new PHPWord_Style_Font ( 'text' , $ styleParagraph ) ; foreach ( $ styleFont as $ key => $ value ) { if ( substr ( $ key , 0 , 1 ) != '_' ) { $ key = '_' . $ key ; } $ font -> setStyleValue ( $ key , $ value ) ; } self :: $ _styleElements [ $ styleName ] = $ font ; } }
Add a font style
7,733
public static function addLinkStyle ( $ styleName , $ styles ) { if ( ! array_key_exists ( $ styleName , self :: $ _styleElements ) ) { $ style = new PHPWord_Style_Font ( 'link' ) ; foreach ( $ styles as $ key => $ value ) { if ( substr ( $ key , 0 , 1 ) != '_' ) { $ key = '_' . $ key ; } $ style -> setStyleValue ( $ key , $ value ) ; } self :: $ _styleElements [ $ styleName ] = $ style ; } }
Add a link style
7,734
public static function addTableStyle ( $ styleName , $ styleTable , $ styleFirstRow = null , $ styleLastRow = null ) { if ( ! array_key_exists ( $ styleName , self :: $ _styleElements ) ) { $ style = new PHPWord_Style_TableFull ( $ styleTable , $ styleFirstRow , $ styleLastRow ) ; self :: $ _styleElements [ $ styleName ] = $ style ; } }
Add a table style
7,735
public function setProcessorsStack ( array $ stack ) { $ this -> processorsStack = [ ] ; foreach ( array_reverse ( $ stack ) as $ processor ) { $ this -> pushProcessor ( $ processor ) ; } return $ this ; }
Setting the processors stack as array .
7,736
public function getEntityMeta ( EntityMetaProvider $ entityMetaProvider = NULL ) { if ( ! isset ( $ this -> entityMeta ) && $ this -> type === self :: SPECIFIC ) { if ( ! isset ( $ entityMetaProvider ) ) throw new \ LogicException ( 'Missing Parameter 1 (EntityMetaProvider) for ' . __FUNCTION__ ) ; $ this -> entityMeta = $ entityMetaProvider -> getEntityMeta ( $ this -> entity -> getEntityName ( ) ) ; } return $ this -> entityMeta ; }
Returns the EntityMeta for specific or general type
7,737
public function getProperties ( $ public = true ) { JLog :: add ( 'JException::getProperties is deprecated.' , JLog :: WARNING , 'deprecated' ) ; $ vars = get_object_vars ( $ this ) ; if ( $ public ) { foreach ( $ vars as $ key => $ value ) { if ( '_' == substr ( $ key , 0 , 1 ) ) { unset ( $ vars [ $ key ] ) ; } } } return $ vars ; }
Returns an associative array of object properties
7,738
public static function isValidValue ( $ value , $ strict = false ) { static :: initialize ( ) ; return ( array_search ( $ value , static :: $ constants , $ strict ) !== false ) ; }
Check if a specific enum exists by value .
7,739
public static function getValueName ( $ value , $ strict = false ) { if ( ! static :: isValidValue ( $ value ) ) { throw new \ InvalidArgumentException ( 'No enum name was found for the value supplied.' ) ; } return array_search ( $ value , static :: $ constants , $ strict ) ; }
Get the enum name from its value .
7,740
public static function getNameValue ( $ name ) { static :: initialize ( ) ; if ( ! static :: isValidName ( $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The enum name "%s" is not valid. Expected one of: %s' , $ name , implode ( ', ' , static :: names ( ) ) ) ) ; } return static :: $ constants [ static :: $ lcKeyMap [ strtolower ( $ name ) ] ] ; }
Get the enum value from its name .
7,741
protected static function initialize ( ) { $ class = static :: class ; if ( static :: $ constants === null ) { static :: $ constants = ( new \ ReflectionClass ( $ class ) ) -> getConstants ( ) ; foreach ( static :: names ( ) as $ name ) { static :: $ lcKeyMap [ strtolower ( $ name ) ] = $ name ; } } }
Cache the enum array statically so we only have to do reflection a single time .
7,742
public static function instance ( ) { if ( null === self :: $ _instance ) { self :: $ _instance = new Blade ( APP_ROOT . 'views' , PROJECT_ROOT . 'tmp' . DS . 'cache' ) ; } return self :: $ _instance ; }
Instantiate Blade Renderer
7,743
public static function render ( $ template , $ data = [ ] ) { $ factory = self :: instance ( ) -> view ( ) ; $ view = $ factory -> make ( $ template , $ data ) ; return $ view -> render ( ) ; }
Render Blade template file with Data
7,744
public static function renderJSON ( $ data = [ ] , $ flags = null ) { if ( is_null ( $ flags ) ) { $ flags = JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_UNESCAPED_SLASHES ; } json_encode ( null ) ; $ result = json_encode ( $ data , $ flags ) ; if ( JSON_ERROR_NONE !== json_last_error ( ) ) { throw new InvalidArgumentException ( sprintf ( 'Unable to encode data to JSON in %s: %s' , __CLASS__ , json_last_error_msg ( ) ) ) ; } return $ result ; }
Json Encode String with given flags
7,745
public function setAll ( $ variables ) { $ vars = array ( ) ; foreach ( $ variables as $ k => $ v ) { $ vars [ ] = array ( 'key' => $ k , 'value' => $ v ) ; } return $ this -> setArgument ( "variables" , $ vars ) ; }
Sets all the given variables .
7,746
public function setStateChange ( $ stateChange ) { $ hash = sha1 ( $ stateChange ) ; $ this -> properties [ 'stateChange' ] = $ hash ; $ this -> callbacks [ $ hash ] = $ stateChange ; return $ this ; }
Set callback function to let you know when the state has changed .
7,747
public function belongsTo ( array $ tagList ) { if ( is_string ( $ this -> getName ( ) ) ) { return in_array ( strtolower ( $ this -> getName ( ) ) , $ tagList ) ; } return false ; }
Return true if the tag name is in the given list .
7,748
public function setRemoteApp ( RemoteApp $ v = null ) { if ( $ v === null ) { $ this -> setRemoteAppId ( NULL ) ; } else { $ this -> setRemoteAppId ( $ v -> getId ( ) ) ; } $ this -> aRemoteApp = $ v ; if ( $ v !== null ) { $ v -> addApiLog ( $ this ) ; } return $ this ; }
Declares an association between this object and a RemoteApp object .
7,749
public function getRemoteApp ( PropelPDO $ con = null , $ doQuery = true ) { if ( $ this -> aRemoteApp === null && ( $ this -> remote_app_id !== null ) && $ doQuery ) { $ this -> aRemoteApp = RemoteAppQuery :: create ( ) -> findPk ( $ this -> remote_app_id , $ con ) ; } return $ this -> aRemoteApp ; }
Get the associated RemoteApp object
7,750
public function parse ( $ code ) { $ parser = $ this -> parserFactory -> create ( $ this -> parserType ) ; try { $ ast = $ parser -> parse ( $ code ) ; } catch ( Error $ error ) { throw new ParseException ( $ error -> getMessage ( ) , 0 , $ error ) ; } $ printer = new Printer ( $ this -> securityManager ) ; return $ printer -> prettyPrintFile ( $ ast ) ; }
Parses untrusted PHP code and returns a secure version which only contains safe calls . Throws an exception in case the code contains untrusted calls
7,751
protected function positionAfterWhitespace ( $ start ) { $ position = $ start ; $ length = $ this -> source -> getLength ( ) ; while ( $ start < $ length ) { $ code = $ this -> charCodeAt ( $ position ) ; if ( $ code === 32 || $ code === 44 || $ code === 160 || $ code === 0x2028 || $ code === 0x2029 || $ code > 8 && $ code < 14 ) { ++ $ position ; } elseif ( $ code === 35 ) { ++ $ position ; while ( $ position < $ length && ( $ code = $ this -> charCodeAt ( $ position ) ) && $ code !== 10 && $ code !== 13 && $ code !== 0x2028 && $ code !== 0x2029 ) { ++ $ position ; } } else { break ; } } return $ position ; }
Reads from body starting at startPosition until it finds a non - whitespace or commented character then returns the position of that character for lexing .
7,752
protected function readNumber ( $ start , $ code ) { $ position = $ start ; $ type = Token :: INT_TYPE ; if ( $ code === 45 ) { $ code = $ this -> charCodeAt ( ++ $ position ) ; } if ( $ code === 48 ) { $ code = $ this -> charCodeAt ( ++ $ position ) ; } elseif ( $ code >= 49 && $ code <= 57 ) { do { $ code = $ this -> charCodeAt ( ++ $ position ) ; } while ( $ code >= 48 && $ code <= 57 ) ; } else { throw new \ Exception ( 'Invalid number.' ) ; } if ( $ code === 46 ) { $ type = Token :: FLOAT_TYPE ; $ code = $ this -> charCodeAt ( ++ $ position ) ; if ( $ code >= 48 && $ code <= 57 ) { do { $ code = $ this -> charCodeAt ( ++ $ position ) ; } while ( $ code >= 48 && $ code <= 57 ) ; } else { throw new \ Exception ( 'Invalid number.' ) ; } if ( $ code === 69 || $ code === 101 ) { $ code = $ this -> charCodeAt ( ++ $ position ) ; if ( $ code === 43 || $ code === 45 ) { $ code = $ this -> charCodeAt ( ++ $ position ) ; } if ( $ code >= 48 && $ code <= 57 ) { do { $ code = $ this -> charCodeAt ( ++ $ position ) ; } while ( $ code >= 48 && $ code <= 57 ) ; } else { throw new \ Exception ( 'Invalid number.' ) ; } } } $ body = $ this -> source -> getBody ( ) ; $ value = mb_substr ( $ body , $ start , $ position - $ start , 'UTF-8' ) ; return new Token ( $ type , $ start , $ position , $ value ) ; }
Reads a number token from the source file either a float or an int depending on whether a decimal point appears .
7,753
protected function readName ( $ position ) { $ end = $ position + 1 ; $ length = $ this -> source -> getLength ( ) ; $ body = $ this -> source -> getBody ( ) ; while ( $ end < $ length && ( $ code = $ this -> charCodeAt ( $ end ) ) && ( $ code === 95 || $ code >= 48 && $ code <= 57 || $ code >= 65 && $ code <= 90 || $ code >= 97 && $ code <= 122 ) ) { ++ $ end ; } $ value = mb_substr ( $ body , $ position , $ end - $ position , 'UTF-8' ) ; return new Token ( Token :: NAME_TYPE , $ position , $ end , $ value ) ; }
Reads an alphanumeric + underscore name from the source .
7,754
protected function charCodeAt ( $ index ) { $ body = $ this -> source -> getBody ( ) ; $ char = mb_substr ( $ body , $ index , 1 , 'UTF-8' ) ; if ( mb_check_encoding ( $ char , 'UTF-8' ) ) { return hexdec ( bin2hex ( mb_convert_encoding ( $ char , 'UTF-32BE' , 'UTF-8' ) ) ) ; } else { return NULL ; } }
Implementation of JavaScript s String . prototype . charCodeAt function .
7,755
protected function char2hex ( $ a ) { return $ a >= 48 && $ a <= 57 ? $ a - 48 : ( $ a >= 65 && $ a <= 70 ? $ a - 55 : ( $ a >= 97 && $ a <= 102 ? $ a - 87 : - 1 ) ) ; }
Converts a hex character to its integer value . 0 becomes 0 9 becomes 9 A becomes 10 F becomes 15 a becomes 10 f becomes 15
7,756
protected function convertNodes ( Array $ nodes , $ em ) { $ navigationNodes = array ( ) ; foreach ( $ nodes as $ node ) { $ node = ( object ) $ node ; $ navigationNode = $ this -> createNode ( array ( 'de' => $ node -> title ) ) ; $ navigationNode -> setContext ( $ this -> context ) ; $ navigationNode -> generateSlugs ( ) ; $ page = $ this -> createPage ( $ navigationNode -> getSlug ( 'de' ) ) ; $ page -> setActive ( TRUE ) ; $ em -> persist ( $ page ) ; $ navigationNode -> setPage ( $ page ) ; $ navigationNodes [ $ navigationNode -> getTitle ( 'de' ) ] = $ navigationNode ; } foreach ( $ nodes as $ node ) { $ node = ( object ) $ node ; if ( isset ( $ node -> parent ) ) { $ navigationNodes [ $ node -> title ] -> setParent ( $ navigationNodes [ $ node -> parent ] ) ; } } return $ navigationNodes ; }
we elevate every node to an entity and set parent pointers
7,757
public function getRpPoints ( $ rp , $ metric , $ tags , $ granularity , $ startDt = null , $ endDt = null , $ timezone = 'utc' ) { if ( null == $ rp || null == $ metric ) { return [ ] ; } $ where = [ ] ; $ query = $ this -> db -> getQueryBuilder ( ) -> retentionPolicy ( $ rp ) -> sum ( 'value' ) -> from ( $ metric ) ; if ( isset ( $ endDt ) ) { $ where [ ] = "time <= '" . $ endDt . "'" ; } if ( isset ( $ startDt ) ) { $ where [ ] = "time >= '" . $ startDt . "'" ; } foreach ( $ tags as $ key => $ val ) { $ where [ ] = "$key = '" . $ val . "'" ; } $ query -> where ( $ where ) ; $ groupBy = "time(1d) tz('" . $ timezone . "')" ; if ( $ granularity == self :: GRANULARITY_HOURLY ) { $ groupBy = "time(1h) tz('" . $ timezone . "')" ; } else if ( $ granularity == self :: GRANULARITY_DAILY ) { $ groupBy = "time(1d) tz('" . $ timezone . "')" ; } else if ( $ granularity == self :: GRANULARITY_WEEKLY ) { $ groupBy = "time(1w) tz('" . $ timezone . "')" ; } $ query -> groupBy ( $ groupBy ) ; return $ query -> getResultSet ( ) -> getPoints ( ) ; }
Get points from retention policy
7,758
public function getPoints ( $ metric , $ tags , $ granularity , $ endDt , $ timezone = 'utc' ) { if ( null == $ metric ) { return [ ] ; } $ where = [ ] ; $ now = $ this -> normalizeUTC ( date ( "Y-m-d H:i:s" ) ) ; $ min = intval ( date ( 'i' ) ) ; $ minutes = $ min > 45 ? 45 : ( $ min > 30 ? 30 : ( $ min > 15 ? 15 : '00' ) ) ; $ lastHourDt = date ( "Y-m-d" ) . "T" . date ( 'H' ) . ":$minutes:00Z" ; if ( strtotime ( $ endDt ) < strtotime ( $ lastHourDt ) ) { return [ ] ; } $ where [ ] = "time >= '" . $ lastHourDt . "' AND time <= '" . $ now . "'" ; foreach ( $ tags as $ key => $ val ) { $ where [ ] = "$key = '" . $ val . "'" ; } $ query = $ this -> db -> getQueryBuilder ( ) -> sum ( 'value' ) -> from ( $ metric ) -> where ( $ where ) ; $ groupBy = "time(1d) tz('" . $ timezone . "')" ; if ( $ granularity == self :: GRANULARITY_HOURLY ) { $ groupBy = "time(1h) tz('" . $ timezone . "')" ; } else if ( $ granularity == self :: GRANULARITY_DAILY ) { $ groupBy = "time(1d) tz('" . $ timezone . "')" ; } else if ( $ granularity == self :: GRANULARITY_WEEKLY ) { $ groupBy = "time(1w) tz('" . $ timezone . "')" ; } $ query -> groupBy ( $ groupBy ) ; return $ query -> getResultSet ( ) -> getPoints ( ) ; }
Get points from default retention policy
7,759
public function getRpSum ( $ rp , $ metric , $ tags , $ startDt = null , $ endDt = null ) { if ( null == $ rp || null == $ metric ) { return 0 ; } $ where = [ ] ; if ( isset ( $ startDt ) ) { $ where [ ] = "time >= '" . $ startDt . "'" ; } if ( ! isset ( $ endDt ) ) { $ endDt = '2100-01-01T00:00:00Z' ; } $ where [ ] = "time <= '" . $ endDt . "'" ; foreach ( $ tags as $ key => $ val ) { $ where [ ] = "$key = '" . $ val . "'" ; } $ points = $ this -> db -> getQueryBuilder ( ) -> retentionPolicy ( $ rp ) -> from ( $ metric ) -> where ( $ where ) -> sum ( 'value' ) -> getResultSet ( ) -> getPoints ( ) ; return isset ( $ points [ 0 ] ) && isset ( $ points [ 0 ] [ "sum" ] ) ? $ points [ 0 ] [ "sum" ] : 0 ; }
Get total from retention policy
7,760
public function getSum ( $ metric , $ tags , $ endDt = null ) { if ( null == $ metric ) { return 0 ; } $ min = intval ( date ( 'i' ) ) ; $ minutes = $ min > 45 ? 45 : ( $ min > 30 ? 30 : ( $ min > 15 ? 15 : '00' ) ) ; $ lastHourDt = date ( "Y-m-d" ) . "T" . date ( 'H' ) . ":$minutes:00Z" ; $ where = [ ] ; if ( ! isset ( $ endDt ) ) { $ endDt = '2100-01-01T00:00:00Z' ; } if ( strtotime ( $ endDt ) < strtotime ( $ lastHourDt ) ) { return 0 ; } $ where [ ] = "time >= '" . $ lastHourDt . "' AND time <= '" . $ endDt . "'" ; foreach ( $ tags as $ key => $ val ) { $ where [ ] = "$key = '" . $ val . "'" ; } $ points = $ this -> db -> getQueryBuilder ( ) -> from ( $ metric ) -> where ( $ where ) -> sum ( 'value' ) -> getResultSet ( ) -> getPoints ( ) ; return isset ( $ points [ 0 ] ) && isset ( $ points [ 0 ] [ "sum" ] ) ? $ points [ 0 ] [ "sum" ] : 0 ; }
Get total from default retention policy
7,761
public function run ( ) { $ response = $ this -> queue -> handle ( $ this -> request ) ; $ reasonPhrase = $ response -> getReasonPhrase ( ) ; $ reasonPhrase = ( $ reasonPhrase ? ' ' . $ reasonPhrase : '' ) ; header ( sprintf ( 'HTTP/%s %d%s' , $ response -> getProtocolVersion ( ) , $ response -> getStatusCode ( ) , $ reasonPhrase ) ) ; foreach ( $ response -> getHeaders ( ) as $ header => $ values ) { $ first = true ; foreach ( $ values as $ value ) { header ( sprintf ( '%s: %s' , $ header , $ value ) , $ first ) ; $ first = false ; } } echo $ response -> getBody ( ) ; }
run a http based application
7,762
public static function cacheBust ( string $ src ) : string { if ( ! file_exists ( $ src ) ) return $ src ; $ path = pathinfo ( $ src ) ; return $ path [ 'dirname' ] . '/' . $ path [ 'filename' ] . '.' . filemtime ( $ src ) . '.' . $ path [ 'extension' ] ; }
cacheBust function .
7,763
public function getTitle ( string $ prefix = '' , string $ separator = ' | ' , string $ sufix = '' ) : string { if ( empty ( $ this -> getTitleValue ( ) ) ) $ separator = '' ; return $ prefix . $ separator . $ this -> getTitleValue ( ) . $ sufix ; }
Get the view s title .
7,764
protected function getReflectionProperty ( $ name ) { do { $ reflClass = ( ! isset ( $ reflClass ) ) ? new \ ReflectionClass ( $ this -> getObject ( ) ) : $ reflClass ; $ property = $ reflClass -> getProperty ( $ name ) ; if ( isset ( $ property ) ) { break ; } } while ( ( $ reflClass = $ reflClass -> getParentClass ( ) ) !== null ) ; if ( $ property instanceof \ ReflectionProperty ) { $ property -> setAccessible ( true ) ; return $ property ; } else { throw new \ Exception ( 'Property ' . $ name . ' doesn\'t exist on object of class ' . get_class ( $ this -> getObject ( ) ) ) ; } }
Get a reflection property - may need to iterate through class parents
7,765
public function render ( $ template = '' , $ data = [ ] ) { if ( ! isset ( $ this -> blocks [ $ template ] ) ) { $ this -> blocks [ $ template ] = $ this -> blockFactory -> create ( $ template ) ; } $ block = $ this -> blocks [ $ template ] ; $ block -> setData ( $ data ) ; return $ block -> render ( ) ; }
Render a block .
7,766
public static function create ( $ modelAlias = null , $ criteria = null ) { if ( $ criteria instanceof LicenseQuery ) { return $ criteria ; } $ query = new LicenseQuery ( null , null , $ modelAlias ) ; if ( $ criteria instanceof Criteria ) { $ query -> mergeWith ( $ criteria ) ; } return $ query ; }
Returns a new LicenseQuery object .
7,767
public function filterByMaxClients ( $ maxClients = null , $ comparison = null ) { if ( is_array ( $ maxClients ) ) { $ useMinMax = false ; if ( isset ( $ maxClients [ 'min' ] ) ) { $ this -> addUsingAlias ( LicensePeer :: MAX_CLIENTS , $ maxClients [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ maxClients [ 'max' ] ) ) { $ this -> addUsingAlias ( LicensePeer :: MAX_CLIENTS , $ maxClients [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( LicensePeer :: MAX_CLIENTS , $ maxClients , $ comparison ) ; }
Filter the query on the max_clients column
7,768
public function filterByDomain ( $ domain = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ domain ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ domain ) ) { $ domain = str_replace ( '*' , '%' , $ domain ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( LicensePeer :: DOMAIN , $ domain , $ comparison ) ; }
Filter the query on the domain column
7,769
public function filterByValidUntil ( $ validUntil = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ validUntil ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ validUntil ) ) { $ validUntil = str_replace ( '*' , '%' , $ validUntil ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( LicensePeer :: VALID_UNTIL , $ validUntil , $ comparison ) ; }
Filter the query on the valid_until column
7,770
public function filterBySerial ( $ serial = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ serial ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ serial ) ) { $ serial = str_replace ( '*' , '%' , $ serial ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( LicensePeer :: SERIAL , $ serial , $ comparison ) ; }
Filter the query on the serial column
7,771
public function setDOM ( DOMElement $ element ) { $ this -> _element = $ this -> _element -> ownerDocument -> importNode ( $ element , true ) ; }
Update the object from a DOM element
7,772
protected function ensureAppended ( ) { if ( ! $ this -> _appended ) { $ this -> _parentElement -> getDOM ( ) -> appendChild ( $ this -> _element ) ; $ this -> _appended = true ; $ this -> _parentElement -> ensureAppended ( ) ; } }
Appends this element to its parent if necessary .
7,773
public function __isset ( $ var ) { if ( strpos ( $ var , ':' ) !== false ) { list ( $ ns , $ elt ) = explode ( ':' , $ var , 2 ) ; foreach ( $ this -> _element -> childNodes as $ child ) { if ( $ child -> localName == $ elt && $ child -> prefix == $ ns ) { return true ; } } } else { foreach ( $ this -> _element -> childNodes as $ child ) { if ( $ child -> localName == $ var ) { return true ; } } } }
Map isset calls onto the underlying entry representation .
7,774
public function render ( array $ data , ContextInterface $ context ) { $ data = array_merge ( [ 'class' => null ] , $ data ) ; $ data [ 'class' ] .= ' materialize-textarea' ; $ data [ 'class' ] = Str :: trim ( $ data [ 'class' ] ) ; return parent :: render ( $ data , $ context ) ; }
Render a text area form widget .
7,775
public function input ( $ name , $ default = null ) { $ value = e ( $ this -> value ( $ name , $ default ) ) ; $ name = e ( $ name ) ; return "name=\"$name\" value=\"$value\"" ; }
Get the attributes for an input field .
7,776
public function checkbox ( $ name , $ inputValue = 1 , $ checkByDefault = false ) { $ value = $ this -> value ( $ name ) ; if ( is_null ( $ value ) ) { $ checked = $ checkByDefault ; } else { $ checked = $ value == $ inputValue ; } $ name = e ( $ name ) ; $ inputValue = e ( $ inputValue ) ; $ checked = $ checked ? ' checked' : '' ; return "name=\"$name\" value=\"$inputValue\"$checked" ; }
Get the attributes for a checkbox .
7,777
public function radio ( $ name , $ inputValue = 1 , $ checkByDefault = false ) { return $ this -> checkbox ( $ name , $ inputValue , $ checkByDefault ) ; }
Get the attributes for a radio .
7,778
public function options ( $ options , $ name , $ default = null , $ placeholder = null ) { $ tags = [ ] ; if ( $ placeholder ) { $ tags [ ] = '<option value="" selected disabled>' . e ( $ placeholder ) . '</option>' ; } $ value = $ this -> value ( $ name , $ default ) ; if ( ! is_array ( $ value ) ) { $ value = [ $ value ] ; } foreach ( $ options as $ key => $ text ) { $ selected = in_array ( $ key , $ value ) ? ' selected' : '' ; $ key = e ( $ key ) ; $ text = e ( $ text ) ; $ tags [ ] = "<option value=\"$key\"$selected>$text</option>" ; } return implode ( $ tags ) ; }
Get the options for a select .
7,779
public function error ( $ name , $ template = null ) { $ errors = $ this -> session -> get ( 'errors' ) ; if ( is_null ( $ template ) ) { $ template = config ( 'form-helpers.error_template' ) ; } if ( $ errors && $ errors -> has ( $ name ) ) { return str_replace ( ':message' , e ( $ errors -> first ( $ name ) ) , $ template ) ; } }
Get the error message if exists .
7,780
public function value ( $ name , $ default = null ) { if ( ! is_null ( $ value = $ this -> valueFromOld ( $ name ) ) ) { return $ value ; } if ( ! is_null ( $ value = $ this -> valueFromModel ( $ name ) ) ) { return $ value ; } return $ default ; }
Get the value to use in an input field .
7,781
public static function hasFeature ( $ jname , $ feature ) { $ return = false ; $ admin = Factory :: getAdmin ( $ jname ) ; $ user = Factory :: getUser ( $ jname ) ; switch ( $ feature ) { case 'wizard' : $ return = $ admin -> methodDefined ( 'setupFromPath' ) ; break ; case 'useractivity' : $ return = $ user -> methodDefined ( 'activateUser' ) ; break ; case 'duallogin' : $ return = $ user -> methodDefined ( 'createSession' ) ; break ; case 'duallogout' : $ return = $ user -> methodDefined ( 'destroySession' ) ; break ; case 'updatepassword' : $ return = $ user -> methodDefined ( 'updatePassword' ) ; break ; case 'updateusername' : $ return = $ user -> methodDefined ( 'updateUsername' ) ; break ; case 'updateemail' : $ return = $ user -> methodDefined ( 'updateEmail' ) ; break ; case 'updateusergroup' : $ return = $ user -> methodDefined ( 'updateUsergroup' ) ; break ; case 'updateuserlanguage' : $ return = $ user -> methodDefined ( 'updateUserLanguage' ) ; break ; case 'syncsessions' : $ return = $ user -> methodDefined ( 'syncSessions' ) ; break ; case 'blockuser' : $ return = $ user -> methodDefined ( 'blockUser' ) ; break ; case 'activateuser' : $ return = $ user -> methodDefined ( 'activateUser' ) ; break ; case 'deleteuser' : $ return = $ user -> methodDefined ( 'deleteUser' ) ; break ; } return $ return ; }
Check if feature exists
7,782
public static function getXml ( $ data , $ isFile = true ) { libxml_use_internal_errors ( true ) ; if ( $ isFile ) { $ xml = simplexml_load_file ( $ data ) ; } else { $ xml = simplexml_load_string ( $ data ) ; } if ( $ xml === false ) { $ message = null ; if ( $ isFile ) { $ message = Text :: _ ( 'FILE' ) . ': ' . $ data ; } foreach ( libxml_get_errors ( ) as $ error ) { if ( $ message ) { $ message .= ' ' ; } $ message .= ' ' . Text :: _ ( 'MESSAGE' ) . ': ' . $ error -> message ; } throw new RuntimeException ( Text :: _ ( 'ERROR_XML_LOAD' ) . ' : ' . $ message ) ; } return $ xml ; }
Checks to see if a JFusion plugin is properly configured
7,783
public static function raise ( $ type , $ message , $ jname = '' ) { if ( is_array ( $ message ) ) { foreach ( $ message as $ msgtype => $ msg ) { if ( is_numeric ( $ msgtype ) ) { $ msgtype = $ jname ; } static :: raise ( $ type , $ msg , $ msgtype ) ; } } else { $ app = Application :: getInstance ( ) ; if ( $ message instanceof Exception ) { $ message = $ message -> getMessage ( ) ; } if ( ! empty ( $ jname ) ) { $ message = $ jname . ': ' . $ message ; } $ app -> enqueueMessage ( $ message , strtolower ( $ type ) ) ; } }
Raise warning function that can handle arrays
7,784
public static function validate ( $ identifier , $ password , $ name = null ) { return Handler :: create ( $ name ) -> validate ( $ identifier , $ password ) ; }
Validate user credentials
7,785
public static function sign_in ( \ Auth \ User $ user , $ keep_loggedin = true , $ name = null ) { return Handler :: create ( $ name ) -> sign_in ( $ user , $ keep_loggedin ) ; }
Sign in a user
7,786
public static function doUpdate ( $ values , PropelPDO $ con = null ) { if ( $ con === null ) { $ con = Propel :: getConnection ( SystemSettingsPeer :: DATABASE_NAME , Propel :: CONNECTION_WRITE ) ; } $ selectCriteria = new Criteria ( SystemSettingsPeer :: DATABASE_NAME ) ; if ( $ values instanceof Criteria ) { $ criteria = clone $ values ; $ comparison = $ criteria -> getComparison ( SystemSettingsPeer :: ID ) ; $ value = $ criteria -> remove ( SystemSettingsPeer :: ID ) ; if ( $ value ) { $ selectCriteria -> add ( SystemSettingsPeer :: ID , $ value , $ comparison ) ; } else { $ selectCriteria -> setPrimaryTableName ( SystemSettingsPeer :: TABLE_NAME ) ; } } else { $ criteria = $ values -> buildCriteria ( ) ; $ selectCriteria = $ values -> buildPkeyCriteria ( ) ; } $ criteria -> setDbName ( SystemSettingsPeer :: DATABASE_NAME ) ; return BasePeer :: doUpdate ( $ selectCriteria , $ criteria , $ con ) ; }
Performs an UPDATE on the database given a SystemSettings or Criteria object .
7,787
protected function parseTitle ( ) { if ( ( $ registeredName = array_search ( $ this -> className , $ this -> defaultContextSettings ) ) !== false ) { return $ registeredName ; } elseif ( preg_match ( '/\\\\([^\\\\]*)Helper$/' , $ this -> className , $ matches ) ) { return $ matches [ 1 ] ; } return $ this -> className ; }
Get the title from the Eel helper class name
7,788
protected function parseDescription ( ) { $ description = $ this -> classReflection -> getDescription ( ) . chr ( 10 ) . chr ( 10 ) ; $ description .= 'Implemented in: ``' . $ this -> className . '``' . chr ( 10 ) . chr ( 10 ) ; $ helperName = $ this -> parseTitle ( ) ; $ helperInstance = new $ this -> className ( ) ; $ methods = $ this -> getHelperMethods ( ) ; foreach ( $ methods as $ methodReflection ) { if ( ! $ helperInstance instanceof ProtectedContextAwareInterface || $ helperInstance -> allowsCallOfMethod ( $ methodReflection -> getName ( ) ) ) { $ methodDescription = $ this -> getMethodDescription ( $ helperName , $ methodReflection ) ; $ description .= trim ( $ methodDescription ) . chr ( 10 ) . chr ( 10 ) ; } } return $ description ; }
Iterate over all methods in the helper class
7,789
protected function prepareInit ( ) { $ stid = oci_parse ( $ this -> raw , "ALTER SESSION SET NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS'" ) ; oci_execute ( $ stid ) ; oci_free_statement ( $ stid ) ; $ stid = oci_parse ( $ this -> raw , "ALTER SESSION SET NLS_SORT = BINARY_CI" ) ; oci_execute ( $ stid ) ; oci_free_statement ( $ stid ) ; $ stid = oci_parse ( $ this -> raw , "ALTER SESSION SET NLS_COMP = LINGUISTIC" ) ; oci_execute ( $ stid ) ; oci_free_statement ( $ stid ) ; }
Preparing initialization of connection
7,790
public function persist ( $ collection , array $ document ) { if ( $ collection instanceof Collection ) { $ collectionName = $ collection -> getName ( ) ; } else { $ collectionName = $ collection ; $ collection = static :: factory ( $ collection ) ; } $ data = $ this -> marshall ( $ document ) ; $ result = false ; if ( ! isset ( $ document [ '$id' ] ) ) { $ id = $ this -> insert ( $ collectionName , $ data ) ; if ( $ id ) { $ data [ '$id' ] = $ id ; $ result = $ data ; } } else { $ data [ 'id' ] = $ document [ '$id' ] ; unset ( $ data [ '$id' ] ) ; $ result = $ this -> update ( $ collectionName , $ data ) ; if ( $ result ) { $ result = $ data ; } } return $ this -> unmarshall ( $ result ) ; }
Sync data to database . If it s new data we insert it as new document otherwise if the document exists we just update it .
7,791
public function insert ( $ collectionName , $ data ) { $ id = 0 ; $ sql = $ this -> dialect -> grammarInsert ( $ collectionName , $ data ) ; $ stid = oci_parse ( $ this -> raw , $ sql ) ; oci_bind_by_name ( $ stid , ":id" , $ id , - 1 , SQLT_INT ) ; foreach ( $ data as $ key => $ value ) { oci_bind_by_name ( $ stid , ":" . $ key , $ data [ $ key ] ) ; } oci_execute ( $ stid ) ; oci_free_statement ( $ stid ) ; return $ id ; }
Perform insert new document to database .
7,792
public function update ( $ collectionName , $ data ) { $ sql = $ this -> dialect -> grammarUpdate ( $ collectionName , $ data ) ; $ stid = oci_parse ( $ this -> raw , $ sql ) ; oci_bind_by_name ( $ stid , ":id" , $ data [ 'id' ] ) ; foreach ( $ data as $ key => $ value ) { oci_bind_by_name ( $ stid , ":" . $ key , $ data [ $ key ] ) ; } $ result = oci_execute ( $ stid ) ; oci_free_statement ( $ stid ) ; return $ result ; }
Perform update to a document .
7,793
protected function set_options ( array $ options = [ ] ) { foreach ( $ options as $ key => $ value ) { if ( ! array_key_exists ( $ key , $ this -> options ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The option "%1$s" does not have a matching option[%1$s] array key' , $ key ) , 1.0 ) ; continue ; } $ this -> options [ $ key ] = $ value ; } }
Setting the given options from constructor .
7,794
public function check4Client ( $ iCustomerId ) { if ( $ this -> get ( 'security.context' ) -> isGranted ( 'ROLE_ADMIN' ) ) { return true ; } else { $ oUser = $ this -> getUser ( ) ; if ( empty ( $ oUser ) ) { return false ; } $ oResult = UserCustomerRelationQuery :: create ( ) -> findOneByArray ( array ( "UserId" => $ oUser -> getId ( ) , "CustomerId" => $ iCustomerId ) ) ; return ( ! empty ( $ oResult ) ) ; } }
Check if user has access to customer
7,795
public function visitFile ( \ SplFileInfo $ file , MessageCatalogue $ catalogue ) { if ( $ file -> getExtension ( ) != 'yml' ) { return ; } $ path = strtr ( $ file -> getRealPath ( ) , DIRECTORY_SEPARATOR , '/' ) ; if ( strpos ( $ path , 'Resources/config/pageparts' ) === false ) { return ; } $ parser = $ this -> getYmlParser ( ) ; $ pagePartConfigs = $ parser -> parse ( file_get_contents ( $ file ) ) ; if ( array_key_exists ( 'types' , $ pagePartConfigs ) && is_array ( $ pagePartConfigs [ 'types' ] ) ) { foreach ( $ pagePartConfigs [ 'types' ] as $ type ) { if ( is_array ( $ type ) && array_key_exists ( 'name' , $ type ) ) { $ message = new Message ( $ type [ 'name' ] ) ; $ message -> addSource ( new FileSource ( ( string ) $ file ) ) ; $ catalogue -> add ( $ message ) ; } } } }
Collect the pagepart names!
7,796
public function setChatOffset ( $ offsetX , $ offsetY ) { $ offset = array ( ( float ) $ offsetX , ( float ) $ offsetY ) ; $ this -> setProperty ( $ this -> chatProperties , "offset" , implode ( " " , $ offset ) ) ; return $ this ; }
Set the chat offset
7,797
public function setMapInfoPosition ( $ positionX , $ positionY , $ positionZ = null ) { $ this -> setPositionProperty ( $ this -> mapInfoProperties , $ positionX , $ positionY , $ positionZ ) ; return $ this ; }
Set the map info position
7,798
public function setCountdownPosition ( $ positionX , $ positionY , $ positionZ = null ) { $ this -> setPositionProperty ( $ this -> countdownProperties , $ positionX , $ positionY , $ positionZ ) ; return $ this ; }
Set the countdown position
7,799
public function renderStandalone ( ) { $ domDocument = new \ DOMDocument ( "1.0" , "utf-8" ) ; $ domDocument -> xmlStandalone = true ; $ domElement = $ domDocument -> createElement ( "ui_properties" ) ; $ domDocument -> appendChild ( $ domElement ) ; $ allProperties = $ this -> getProperties ( ) ; foreach ( $ allProperties as $ property => $ propertySettings ) { if ( ! $ propertySettings ) { continue ; } $ propertyDomElement = $ domDocument -> createElement ( $ property ) ; $ domElement -> appendChild ( $ propertyDomElement ) ; foreach ( $ propertySettings as $ settingName => $ settingValue ) { $ settingValueString = ( is_string ( $ settingValue ) ? $ settingValue : var_export ( $ settingValue , true ) ) ; $ propertyDomElement -> setAttribute ( $ settingName , $ settingValueString ) ; } } return $ domDocument ; }
Render the UI Properties standalone