idx
int64 0
60.3k
| question
stringlengths 64
4.24k
| target
stringlengths 5
618
|
|---|---|---|
5,500
|
public static function split ( string $ string , string $ delimiter = ',' ) : array { return preg_split ( '/\s*' . preg_quote ( $ delimiter , '/' ) . '\s*/' , $ string , - 1 , PREG_SPLIT_NO_EMPTY ) ; }
|
Splits a string into chunks on a given delimiter .
|
5,501
|
public static function padBoth ( $ str , $ length , $ padStr = ' ' ) : string { return ( string ) BaseStringy :: create ( $ str ) -> padBoth ( $ length , $ padStr ) ; }
|
Returns a new string of a given length such that both sides of the string are padded .
|
5,502
|
public static function padLeft ( string $ str , int $ length , string $ padStr = ' ' ) : string { return ( string ) BaseStringy :: create ( $ str ) -> padLeft ( $ length , $ padStr ) ; }
|
Returns a new string of a given length such that the beginning of the string is padded .
|
5,503
|
public static function padRight ( string $ str , int $ length , string $ padStr = ' ' ) : string { return ( string ) BaseStringy :: create ( $ str ) -> padRight ( $ length , $ padStr ) ; }
|
Returns a new string of a given length such that the end of the string is padded .
|
5,504
|
public static function asciiCharMap ( ) : array { if ( self :: $ _asciiCharMap !== null ) { return self :: $ _asciiCharMap ; } self :: $ _asciiCharMap = ( new Stringy ( '' ) ) -> getAsciiCharMap ( ) ; return self :: $ _asciiCharMap ; }
|
Returns ASCII character mappings merging in any custom defined mappings from the customAsciiCharMappings config setting .
|
5,505
|
public static function convertToUtf8 ( string $ string ) : string { if ( static :: isUtf8 ( $ string ) ) { return HtmlPurifier :: cleanUtf8 ( $ string ) ; } $ config = \ HTMLPurifier_Config :: createDefault ( ) ; $ config -> set ( 'Core.Encoding' , static :: encoding ( $ string ) ) ; $ string = HtmlPurifier :: cleanUtf8 ( $ string ) ; if ( function_exists ( 'iconv' ) && \ HTMLPurifier_Encoder :: testIconvTruncateBug ( ) === \ HTMLPurifier_Encoder :: ICONV_OK ) { $ string = HtmlPurifier :: convertToUtf8 ( $ string , $ config ) ; } else { $ encoding = static :: encoding ( $ string ) ; $ string = mb_convert_encoding ( $ string , 'utf-8' , $ encoding ) ; } return $ string ; }
|
Attempts to convert a string to UTF - 8 and clean any non - valid UTF - 8 characters .
|
5,506
|
public static function encodeMb4 ( string $ string ) : string { if ( max ( array_map ( 'ord' , str_split ( $ string ) ) ) >= 240 ) { $ string = preg_replace_callback ( '/./u' , function ( array $ match ) { if ( strlen ( $ match [ 0 ] ) >= 4 ) { $ unpacked = unpack ( 'H*' , mb_convert_encoding ( $ match [ 0 ] , 'UTF-32' , 'UTF-8' ) ) ; return isset ( $ unpacked [ 1 ] ) ? '&#x' . ltrim ( $ unpacked [ 1 ] , '0' ) . ';' : '' ; } return $ match [ 0 ] ; } , $ string ) ; } return $ string ; }
|
HTML - encodes any 4 - byte UTF - 8 characters .
|
5,507
|
public function add_page ( $ config ) { foreach ( $ this -> required_params ( ) as $ param ) { if ( ! isset ( $ config [ $ param ] ) ) { throw new \ RuntimeException ( 'Missing required parameter "' . $ param . '" for submenu' ) ; } } $ this -> config [ 'submenu-pages' ] [ ] = $ config ; }
|
Add a page to this menu .
|
5,508
|
private function set_config ( $ config ) { if ( ! isset ( $ config [ 'title' ] ) ) { throw new \ RuntimeException ( 'Missing required parameter "title" for menu' ) ; } if ( ! isset ( $ config [ 'slug' ] ) || '' == $ config [ 'slug' ] ) { $ config [ 'slug' ] = \ Amarkal \ Common \ Tools :: strtoslug ( $ config [ 'title' ] ) ; } $ this -> config = array_merge ( $ this -> get_defaults ( ) , $ config ) ; }
|
Set the configuration for this menu page .
|
5,509
|
public function add_menu_page ( ) { extract ( $ this -> config ) ; $ icon .= '' != $ class ? '" class="' . $ class : '' ; $ icon .= array ( ) != $ style ? '" style="' . $ this -> array_to_css ( $ style ) : '' ; $ page = $ this -> config [ 'submenu-pages' ] [ 0 ] ; \ add_menu_page ( $ title , $ title , $ page [ 'capability' ] , $ slug , $ page [ 'content' ] , $ icon , $ position ) ; if ( count ( $ this -> config [ 'submenu-pages' ] ) > 1 ) { $ this -> add_submenu_pages ( ) ; } }
|
Add this page and all it s submenus to the admin sidebar .
|
5,510
|
private function array_to_css ( array $ rules ) { $ css = '' ; foreach ( $ rules as $ rule => $ value ) { $ css .= $ rule . ':' . $ value . ';' ; } return $ css ; }
|
Array to CSS .
|
5,511
|
public static function available_map_fields ( $ class ) { if ( ! in_array ( $ class , self :: config ( ) -> allowed_classes ) || ! \ ClassInfo :: exists ( $ class ) ) return false ; $ available = \ Config :: inst ( ) -> get ( $ class , 'public_fields' ) ? \ Config :: inst ( ) -> get ( $ class , 'public_fields' ) : array_keys ( singleton ( $ class ) -> summaryFields ( ) ) ; $ fields = array_diff ( $ available , self :: config ( ) -> disable_map_fields ) ; return count ( $ fields ) ? $ fields : false ; }
|
Return an array of fields that can be mapped to a class name Looks for public_fields set via config otherwise defaults to summary_fields
|
5,512
|
private static function init ( ) { ob_start ( ) ; set_time_limit ( 0 ) ; ini_set ( 'memory_limit' , '256M' ) ; ini_set ( 'upload_max_filesize' , '128M' ) ; ini_set ( 'post_max_size' , '256M' ) ; ini_set ( 'max_input_time' , '7200' ) ; ini_set ( 'max_execution_time' , '0' ) ; ini_set ( 'expect.timeout' , '7200' ) ; ini_set ( 'default_socket_timeout' , '7200' ) ; ob_end_clean ( ) ; }
|
function will attempt to alocate more resources to run the sync
|
5,513
|
public static function getLogData ( $ syncid , $ type = 'all' , $ limitstart = null , $ limit = null , $ sort = 'id' , $ dir = 'ASC' ) { $ db = Factory :: getDBO ( ) ; $ query = $ db -> getQuery ( true ) -> select ( '*' ) -> from ( '#__jfusion_sync_details' ) -> where ( 'syncid = ' . $ db -> quote ( $ syncid ) ) ; if ( ! empty ( $ sort ) ) { $ query -> order ( $ sort . ' ' . $ dir ) ; } if ( $ type != 'all' ) { $ query -> where ( 'action = ' . $ db -> quote ( $ type ) ) ; } $ db -> setQuery ( $ query , $ limitstart , $ limit ) ; $ results = $ db -> loadObjectList ( 'id' ) ; return $ results ; }
|
Retrieve log data
|
5,514
|
public static function saveData ( Registry $ syncdata ) { $ db = Factory :: getDBO ( ) ; $ data = new stdClass ; $ data -> syncdata = $ syncdata -> toString ( ) ; $ data -> syncid = $ syncdata -> get ( 'syncid' ) ; $ data -> time_start = time ( ) ; $ data -> action = $ syncdata -> get ( 'action' ) ; $ db -> insertObject ( '#__jfusion_sync' , $ data ) ; }
|
Save sync data
|
5,515
|
public static function markResolved ( $ id ) { $ db = Factory :: getDBO ( ) ; $ query = $ db -> getQuery ( true ) -> update ( '#__jfusion_sync_details' ) -> set ( 'action = ' . $ db -> quote ( 'resolved' ) ) -> where ( 'id = ' . $ db -> quote ( $ id ) ) ; $ db -> setQuery ( $ query ) ; $ db -> execute ( ) ; }
|
Marks an error in sync details as resolved to prevent it from constantly showing up in the resolve error view
|
5,516
|
protected static function getFieldDefinition ( Schema $ schema , Type $ parentType , Field $ fieldAST ) { $ name = $ fieldAST -> get ( 'name' ) -> get ( 'value' ) ; $ schemaMeta = Introspection :: schemaMetaFieldDefinition ( ) ; if ( $ name === $ schemaMeta -> getName ( ) && $ schema -> getQueryType ( ) === $ parentType ) { return $ schemaMeta ; } $ typeMeta = Introspection :: typeMetaFieldDefinition ( ) ; if ( $ name === $ typeMeta -> getName ( ) && $ schema -> getQueryType ( ) === $ parentType ) { return $ typeMeta ; } $ typeNameMeta = Introspection :: typeNameMetaFieldDefinition ( ) ; if ( $ name === $ typeNameMeta -> getName ( ) && ( $ parentType instanceof ObjectType || $ parentType instanceof InterfaceType || $ parentType instanceof UnionType ) ) { return $ typeNameMeta ; } if ( $ parentType instanceof ObjectType || $ parentType instanceof InterfaceType ) { $ fields = $ parentType -> getFields ( ) ; return isset ( $ fields [ $ name ] ) ? $ fields [ $ name ] : NULL ; } return NULL ; }
|
Not exactly the same as the executor s definition of getFieldDef in this statically evaluated environment we do not always have an Object type and need to handle Interface and Union types .
|
5,517
|
protected function factorySyncService ( $ serviceName ) { $ syncClass = '\\ufocoder\\SyncSocial\\components\\services\\' . ucfirst ( $ serviceName ) ; if ( ! class_exists ( $ syncClass ) ) { throw new Exception ( Yii :: t ( 'SyncSocial' , 'SyncSocial Extension not support "{serviceName}" service' , [ 'serviceName' => $ serviceName ] ) ) ; } return new $ syncClass ( [ 'serviceSettings' => isset ( $ this -> settings [ $ serviceName ] ) ? $ this -> settings [ $ serviceName ] : [ ] , 'connectUrl' => $ this -> getConnectUrl ( $ serviceName ) ] ) ; }
|
Create service synchronizer wrapper class
|
5,518
|
public function syncActiveRecord ( $ serviceName = null , ActiveRecord $ model ) { $ service = $ this -> getService ( $ serviceName ) ; if ( $ service -> isConnected ( ) && ! $ this -> isExistsSyncModelByActiveRecord ( $ service , $ model ) ) { $ message = $ model -> { $ this -> modelAttribute } ; $ function = $ this -> absolutePostUrl ; $ url = null ; if ( is_callable ( $ function ) && ( $ function instanceof Closure ) ) { $ url = $ function ( $ serviceName , $ model -> getPrimaryKey ( ) ) ; } $ publishData = $ service -> publishPost ( $ message , $ url ) ; return $ this -> checkPostData ( $ publishData ) && $ this -> createSyncModel ( $ service , $ model , $ publishData ) ; } else { return false ; } }
|
Post message with URL to Social Network
|
5,519
|
public function dispatch ( Event $ event ) { foreach ( $ this -> getSubscribers ( $ event ) as $ subscriber ) { $ subscriber -> trigger ( $ event ) ; } return $ this ; }
|
Dispatched ein Event
|
5,520
|
public static function create ( $ name = null , $ conf = null ) { if ( is_null ( $ name ) ) { $ name = static :: $ _default ; } if ( ! is_null ( $ conf ) && is_array ( $ conf ) ) { return static :: $ _instances [ $ name ] = new static ( $ name , $ conf ) ; } if ( ! isset ( static :: $ _instances [ $ name ] ) ) { static :: $ _instances [ $ name ] = new static ( $ name ) ; } return static :: $ _instances [ $ name ] ; }
|
Get an auth instance or create one
|
5,521
|
public function kill_restore ( ) { CCCookie :: delete ( $ this -> config -> get ( 'restore.id_cookie' ) ) ; CCCookie :: delete ( $ this -> config -> get ( 'restore.token_cookie' ) ) ; }
|
Kill the restore keys
|
5,522
|
public function restore_key ( $ user ) { return \ CCStr :: hash ( $ user -> password . '@' . $ user -> { $ this -> config -> user_key } . '%' . \ CCIn :: client ( ) -> agent ) ; }
|
generate the current restore key
|
5,523
|
public function login ( ) { return $ this -> select_logins ( ) -> where ( 'restore_id' , $ this -> user -> { $ this -> config -> user_key } ) -> where ( 'restore_token' , $ this -> restore_key ( $ this -> user ) ) -> limit ( 1 ) -> run ( ) ; }
|
Get the current login of the user
|
5,524
|
public function validate ( $ identifier , $ password ) { $ user = null ; $ user_model = $ this -> config -> user_model ; foreach ( $ this -> config -> identifiers as $ property ) { if ( $ user = $ user_model :: find ( $ property , $ identifier ) ) { break ; } } if ( ! $ user ) { return false ; } if ( empty ( $ user -> password ) ) { return false ; } if ( \ CCStr :: verify_hash ( $ password , $ user -> password ) ) { return $ user ; } return false ; }
|
Validate an identifier with the password In other words is the login correct?
|
5,525
|
public function sign_in ( \ Auth \ User $ user , $ keep_login = true ) { $ this -> session -> set ( $ this -> config -> session_key , $ user -> { $ this -> config -> user_key } ) ; $ this -> user = $ user ; $ this -> user -> last_login = time ( ) ; $ this -> user = \ CCEvent :: pass ( 'auth.sign_in' , $ this -> user ) ; $ this -> user -> save ( ) ; if ( $ keep_login ) { $ restore_id_cookie = $ this -> config -> get ( 'restore.id_cookie' ) ; $ restore_token_cookie = $ this -> config -> get ( 'restore.token_cookie' ) ; $ restore_lifetime = $ this -> config -> get ( 'restore.lifetime' ) ; $ restore_id = $ this -> session -> get ( $ this -> config -> session_key ) ; $ restore_token = $ this -> restore_key ( $ this -> user ) ; CCCookie :: set ( $ restore_id_cookie , $ restore_id , $ restore_lifetime ) ; CCCookie :: set ( $ restore_token_cookie , $ restore_token , $ restore_lifetime ) ; $ login = $ this -> select_logins ( ) -> where ( 'restore_id' , $ restore_id ) -> where ( 'restore_token' , $ restore_token ) ; $ login_data = array ( 'restore_id' => $ restore_id , 'restore_token' => $ restore_token , 'last_login' => time ( ) , 'client_agent' => \ CCIn :: client ( ) -> agent , ) ; $ login_data = \ CCEvent :: pass ( 'auth.store_login' , $ login_data ) ; if ( ! $ login -> run ( ) ) { \ DB :: insert ( $ this -> config -> get ( 'logins.table' ) , $ login_data ) -> run ( $ this -> config -> get ( 'logins.handler' ) ) ; } else { \ DB :: update ( $ this -> config -> get ( 'logins.table' ) , $ login_data ) -> where ( 'restore_id' , $ restore_id ) -> where ( 'restore_token' , $ restore_token ) -> run ( $ this -> config -> get ( 'logins.handler' ) ) ; } } return $ this -> authenticated = true ; }
|
Sign the user and optinal also set the resore keys
|
5,526
|
public function sign_out ( ) { if ( ! $ this -> authenticated ) { return false ; } \ DB :: delete ( $ this -> config -> get ( 'logins.table' ) ) -> where ( 'restore_token' , $ this -> restore_key ( $ this -> user ) ) -> run ( ) ; $ this -> session -> delete ( $ this -> config -> session_key ) ; $ this -> user = \ CCEvent :: pass ( 'auth.sign_out' , $ this -> user ) ; $ this -> user -> save ( ) ; $ user_model = $ this -> config -> user_model ; $ this -> user = new $ user_model ; return $ this -> authenticated = false ; }
|
Sign a user out
|
5,527
|
public function renderToggleButton ( ) { if ( $ this -> toggleButton !== null ) { $ tag = ArrayHelper :: removeValue ( $ this -> toggleButton , 'tag' , 'button' ) ; $ label = ArrayHelper :: removeValue ( $ this -> toggleButton , 'label' , 'Show' ) ; if ( $ tag === 'button' && ! isset ( $ this -> toggleButton [ 'type' ] ) ) { $ this -> toggleButton [ 'type' ] = 'button' ; } $ this -> toggleButton [ 'data-reveal-id' ] = $ this -> getId ( ) ; return \ CHtml :: tag ( $ tag , $ this -> toggleButton , $ label ) ; } else { return null ; } }
|
Renders the toggle button
|
5,528
|
protected function renderCloseButton ( ) { if ( $ this -> closeButton !== null ) { $ tag = ArrayHelper :: removeValue ( $ this -> closeButton , 'tag' , 'a' ) ; $ label = ArrayHelper :: removeValue ( $ this -> closeButton , 'label' , '×' ) ; if ( $ tag === 'button' && ! isset ( $ this -> closeButton [ 'type' ] ) ) { $ this -> closeButton [ 'type' ] = 'button' ; } Html :: addCssClass ( $ this -> closeButton , Enum :: DIALOG_CLOSE ) ; return \ CHtml :: tag ( $ tag , $ this -> closeButton , $ label ) ; } else { return null ; } }
|
Renders the close button .
|
5,529
|
public function init ( ) { parent :: init ( ) ; $ this -> datetimeFormat = ( empty ( Yii :: $ app -> params [ 'site' ] -> datetimeFormat ) ) ? $ this -> datetimeFormat : Yii :: $ app -> params [ 'site' ] -> datetimeFormat ; $ this -> timezone = ( empty ( Yii :: $ app -> params [ 'site' ] -> timezone ) ) ? $ this -> timezone : Yii :: $ app -> params [ 'site' ] -> timezone ; }
|
Set default timezone and datetime format for model
|
5,530
|
public function getDisplayDateTime ( $ input , $ format = null , $ timezone = null ) { return \ enpii \ enpiiCms \ helpers \ DateTimeHelper :: fromDbFormat ( $ input , ( $ format === null ? $ this -> datetimeFormat : $ format ) , ( $ timezone === null ? $ this -> timezone : $ timezone ) ) ; }
|
Display datetime from the result retrieve from database ( stored by GMT datetime
|
5,531
|
public function getCreatedAt ( $ format = null , $ timezone = null ) { return $ this -> getDisplayDateTime ( $ this -> created_at , $ format , $ timezone ) ; }
|
Display create_at datetime
|
5,532
|
public function getUpdatedAt ( $ format = null , $ timezone = null ) { return $ this -> getDisplayDateTime ( $ this -> updated_at , $ format , $ timezone ) ; }
|
Display updated_at datetime
|
5,533
|
public function getPublishedAt ( $ format = null , $ timezone = null ) { return $ this -> getDisplayDateTime ( $ this -> published_at , $ format , $ timezone ) ; }
|
Display published_at datetime
|
5,534
|
public function getUploadTmpPath ( ) { $ path = Yii :: getAlias ( '@root' . '/' . Yii :: $ app -> params [ 'uploads' ] [ 'folderName' ] . '/' . 'tmp' ) ; if ( ! file_exists ( $ path ) ) { FileHelper :: createDirectory ( $ path , 0777 ) ; } return $ path ; }
|
Temporary upload path
|
5,535
|
public function setTogglingControl ( Control $ control ) { $ control -> checkId ( ) ; if ( $ control instanceof Scriptable ) { $ control -> setScriptEvents ( true ) ; } $ this -> togglingControl = $ control ; return $ this ; }
|
Set the toggling Control
|
5,536
|
public function setOnlyShow ( $ onlyShow ) { $ this -> onlyShow = ( bool ) $ onlyShow ; if ( $ this -> onlyShow ) { $ this -> onlyHide = null ; } return $ this ; }
|
Set Show Only
|
5,537
|
public function setOnlyHide ( $ onlyHide ) { $ this -> onlyHide = ( bool ) $ onlyHide ; if ( $ this -> onlyHide ) { $ this -> onlyShow = null ; } return $ this ; }
|
Set Hide Only
|
5,538
|
protected function dumpRequest ( Request $ request ) { $ body = $ request -> getBody ( ) ; $ dump = "Body of request is:\n" ; if ( is_object ( $ body ) || is_array ( $ body ) ) { $ dump .= json_encode ( $ body ) ; } elseif ( is_string ( $ body ) ) { $ dump .= sprintf ( '"%s"' , $ body ) ; } return $ dump ; }
|
returns a importable string representation of the request
|
5,539
|
public function render ( array $ data , ContextInterface $ context ) { $ data += [ 'name' => '' , 'templateVars' => [ ] , 'escape' => true ] ; unset ( $ data [ 'val' ] ) ; $ title = ( Arr :: key ( 'title' , $ data ) ) ? $ data [ 'title' ] : $ data [ 'name' ] ; return $ this -> _templates -> format ( 'file' , [ 'title' => $ title , 'name' => $ data [ 'name' ] , 'templateVars' => $ data [ 'templateVars' ] , 'attrs' => $ this -> _templates -> formatAttributes ( $ data , [ 'name' ] ) ] ) ; }
|
Render a file upload form widget .
|
5,540
|
public function getMatches ( ) { $ matches = ArrayHelper :: merge ( $ this -> homeMatches , $ this -> awayMatches ) ; ArrayHelper :: multisort ( $ matches , 'date' , SORT_ASC ) ; return $ matches ; }
|
Get all matches
|
5,541
|
public function showAction ( Request $ request ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ rep = $ em -> getRepository ( 'AnimeDbAppBundle:Notice' ) ; $ notice = $ rep -> getFirstShow ( ) ; $ response = $ this -> getCacheTimeKeeper ( ) -> getResponse ( [ ] , - 1 , new JsonResponse ( ) ) ; $ response -> setEtag ( md5 ( $ notice ? $ notice -> getId ( ) : 0 ) ) ; if ( $ response -> isNotModified ( $ request ) ) { return $ response ; } if ( ! is_null ( $ notice ) ) { $ notice -> shown ( ) ; $ em -> persist ( $ notice ) ; $ em -> flush ( ) ; $ response -> setData ( [ 'notice' => $ notice -> getId ( ) , 'close' => $ this -> generateUrl ( 'notice_close' , [ 'id' => $ notice -> getId ( ) ] ) , 'see_later' => $ this -> generateUrl ( 'notice_see_later' ) , 'content' => $ this -> renderView ( 'AnimeDbAppBundle:Notice:show.html.twig' , [ 'notice' => $ notice , 'link_all' => $ request -> query -> getBoolean ( 'all' ) , ] ) , ] ) ; } return $ response ; }
|
Show last notice .
|
5,542
|
protected function setConnectedRelationOptions ( ) { $ pivotTable = $ this -> defaultOptions [ 'pivot_table' ] ; $ foreignKey = $ this -> defaultOptions [ 'foreign_key' ] ; $ relatedKey = $ this -> defaultOptions [ 'related_key' ] ; if ( ! $ this -> db -> isTableExists ( $ pivotTable ) ) { $ question = "Can't find table {$this->text['pivot_table']} in the database as {$this->text['pivot_text']}, choice one!" ; $ pivotTable = $ this -> options [ 'pivot_table' ] = $ this -> command -> choice ( $ question , $ this -> getTables ( ) ) ; $ this -> text [ 'pivot_table' ] = "[" . $ this -> command -> paintString ( $ pivotTable , 'green' ) . "]" ; } if ( ! $ this -> db -> isFieldExists ( $ pivotTable , $ foreignKey ) ) { $ question = "Can't find field {$this->text['foreign_key']} in the table {$this->text['pivot_table']} as {$this->text['foreign_text']} of table {$this->text['table']}, choice one!" ; $ this -> options [ 'foreign_key' ] = $ this -> command -> choice ( $ question , $ this -> getFields ( $ pivotTable ) ) ; } if ( ! $ this -> db -> isFieldExists ( $ pivotTable , $ relatedKey ) ) { $ question = "Can't find field {$this->text['related_key']} in the table {$this->text['pivot_table']} as {$this->text['related_text']} of table {$this->text['to_table']}, choice one!" ; $ this -> options [ 'related_key' ] = $ this -> command -> choice ( $ question , $ this -> getFields ( $ pivotTable ) ) ; } }
|
get connected db relation options
|
5,543
|
public static function make ( $ attributes = [ ] ) { $ jobset = new static ( ) ; $ model = $ jobset -> makeModel ( $ attributes ) ; $ jobset -> setModel ( $ model ) ; $ jobset -> makeJobs ( ) ; $ jobsetTryAt = $ jobset -> getJobsEarliestTryAt ( ) ; $ jobset -> model -> setTryAt ( $ jobsetTryAt ) ; $ jobset -> model -> persist ( ) ; return $ jobset ; }
|
Make new jobset
|
5,544
|
public static function get ( $ id ) { $ jobset = new static ( ) ; $ model = $ jobset -> findModel ( $ id ) ; $ jobset -> setModel ( $ model ) ; $ jobset -> initJobs ( ) ; return $ jobset ; }
|
Get an existed jobset
|
5,545
|
public function execute ( ) { if ( $ this -> isFinished ( ) || $ this -> isFailed ( ) ) { return true ; } if ( ! $ this -> isInTime ( ) ) { return false ; } if ( $ this -> isDispatched ( ) || $ this -> isCanceled ( ) ) { return false ; } try { if ( ! $ this -> jobs ) { $ this -> initJobs ( ) ; } $ this -> doUnorderedJobs ( ) ; $ this -> doOrderedJobs ( ) ; $ status = $ this -> getJobsetExecutionStatus ( ) ; if ( $ status === JobsConst :: JOB_SET_STATUS_FAILED ) { $ this -> failed ( ) ; } else { $ this -> updateStatus ( $ status ) ; } } catch ( \ Exception $ e ) { throw $ e ; } return true ; }
|
If return true the jobset should be dispatched with considering its status Or the jobset process should be terminated
|
5,546
|
public function dispatched ( ) { if ( $ this -> isFinished ( ) || $ this -> isFailed ( ) ) { $ status = $ this -> isFinished ( ) ? JobsConst :: JOB_SET_STATUS_FINISHED_AND_DISPATCHED : JobsConst :: JOB_SET_STATUS_FAILED_AND_DISPATCHED ; return $ this -> model -> updateStatus ( $ status ) ; } return false ; }
|
After successfully notice to commander we mark the jobset as dispatched here .
|
5,547
|
public function getJobsetExecutionStatus ( ) { $ finished = count ( $ this -> jobs ) > 0 ? true : false ; $ failed = false ; $ middle = false ; foreach ( $ this -> jobs as $ job ) { if ( $ job -> isFailed ( ) ) { $ finished = false ; $ middle = false ; $ failed = true ; break ; } $ finished = $ finished && $ job -> isFinished ( ) ; if ( ! $ job -> isFinished ( ) && ! $ job -> isFailed ( ) ) { $ middle = true ; } } if ( $ failed ) { return JobsConst :: JOB_SET_STATUS_FAILED ; } elseif ( $ finished ) { return JobsConst :: JOB_SET_STATUS_FINISHED ; } elseif ( $ middle ) { return JobsConst :: JOB_SET_STATUS_ONGOING ; } else { return JobsConst :: JOB_SET_STATUS_DEFAULT ; } }
|
Get jobset execution status from sub jobs statuses . At least one job failed the jobset is failed . All jobs finished the jobset is finished . At least one job has been executed the jobset is ongoing . All jobs have not been executed the jobset is in default status .
|
5,548
|
protected function doOrderedJobs ( ) { $ jobNames = $ this -> getOrderedJobNames ( ) ; foreach ( $ jobNames as $ jobName ) { $ job = $ this -> getLocalJob ( $ jobName ) ; if ( ! $ job ) { throw new \ Exception ( "job [$jobName] not exists" ) ; } $ job -> execute ( ) ; $ this -> updateLocalJob ( $ job ) ; if ( ! $ job -> isFinished ( ) ) { break ; } } }
|
Do ordered jobs
|
5,549
|
protected function doUnorderedJobs ( ) { $ jobNames = $ this -> getUnorderedJobNames ( ) ; foreach ( $ jobNames as $ jobName ) { $ job = $ this -> getLocalJob ( $ jobName ) ; if ( ! $ job ) { throw new \ Exception ( "job [$jobName] not exists" ) ; } $ job -> execute ( ) ; $ this -> updateLocalJob ( $ job ) ; } }
|
Do unordered jobs
|
5,550
|
protected function getJobsEarliestTryAt ( ) { $ tryAt = date ( 'Y-m-d H:i:s' ) ; foreach ( $ this -> jobs as $ job ) { if ( ! $ job -> isFinished ( ) && Helper :: datetimeLT ( $ job -> getTryAt ( ) , $ tryAt ) ) { $ tryAt = $ job -> getTryAt ( ) ; } } return $ tryAt ; }
|
get the earliest job try at time except the finished jobs
|
5,551
|
public static function format ( string $ format , string ... $ arguments ) : string { foreach ( $ arguments as $ key => $ value ) { $ format = str_replace ( "{{$key}}" , ( string ) $ value , $ format ) ; } return $ format ; }
|
Replaces the format items in a specified string with the string representation of n specified objects .
|
5,552
|
public static function ellipsize ( string $ string , int $ maxLength , string $ suffix = '...' ) : string { if ( $ maxLength < 0 ) { throw new \ InvalidArgumentException ( '$maxLength is negative' ) ; } if ( strlen ( $ string ) <= $ maxLength ) { return $ string ; } $ trimmedLength = $ maxLength - strlen ( $ suffix ) ; $ string = substr ( $ string , 0 , max ( 0 , $ trimmedLength ) ) ; if ( $ string === '' ) { return substr ( $ suffix , 0 , $ maxLength ) ; } return $ string . $ suffix ; }
|
Truncates the string to the given length with an ellipsis at the end .
|
5,553
|
public function enable ( $ enable = true ) { if ( ! is_bool ( $ enable ) ) { throw new InvalidArgumentException ( "enable must be a boolean. [$enable] given." ) ; } $ this -> enabled = $ enable ; return $ this ; }
|
Enable the option .
|
5,554
|
public function hasValue ( $ value ) { $ index = array_search ( $ value , $ this -> values ) ; if ( $ index === false ) { return false ; } return true ; }
|
Return whether this option has the given value or not .
|
5,555
|
public function addValue ( $ value ) { $ this -> assertCanHaveValue ( ) ; $ this -> assertValueIsValid ( $ value ) ; if ( $ this -> canHaveMultipleValues ( ) && ! $ this -> hasValue ( $ value ) ) { $ value = array_merge ( $ this -> values , ( array ) $ value ) ; } $ this -> values = ( array ) $ value ; return $ this ; }
|
Add a new value to this option .
|
5,556
|
public function addValues ( array $ values = [ ] ) { $ this -> assertCanHaveMultipleValues ( ) ; foreach ( $ values as $ value ) { $ this -> addValue ( $ value ) ; } return $ this ; }
|
Add multiple values to this option .
|
5,557
|
public function removeValue ( $ value ) { if ( ! $ this -> canHaveMultipleValues ( ) && ! isset ( $ value ) ) { $ this -> values = [ ] ; $ this -> enable ( $ enable = false ) ; return $ this ; } $ this -> assertValueIsValid ( $ value ) ; $ this -> assertCanHaveValue ( ) ; if ( $ this -> hasValue ( $ value ) ) { $ index = array_search ( $ value , $ this -> values ) ; unset ( $ this -> values [ $ index ] ) ; $ this -> values = array_values ( $ this -> values ) ; } return $ this ; }
|
Remove the given value from the option .
|
5,558
|
public function removeValues ( array $ values = [ ] ) { $ this -> assertCanHaveMultipleValues ( ) ; foreach ( $ values as $ value ) { $ this -> removeValue ( $ value ) ; } return $ this ; }
|
Remove the given values from the option .
|
5,559
|
public function getArray ( ) { $ options = [ ] ; if ( $ this -> isDisabled ( ) || $ this -> canHaveValue ( ) && empty ( $ this -> values ) ) { return $ options ; } foreach ( $ this -> values as $ value ) { $ options [ ] = $ this -> flag ( ) ; $ options [ ] = $ value ; } if ( empty ( $ options ) ) { $ options [ ] = $ this -> flag ( ) ; } return $ options ; }
|
Get the option and its values as an array .
|
5,560
|
private function parseFlag ( $ flag ) { $ flag = trim ( $ flag ) ; $ pattern = '/^' . '(' . '(?<flag>(?:-\w|--\w[\w-]+))' . '(?<enable>\+)?' . ')' . '(' . '(?<can_have_value>=)?' . '(?<can_have_multiple_values>\*)?' . '(?<values>' . '(?(<can_have_multiple_values>)' . '(\w+,)*\w+|' . '(?(<can_have_value>)' . '\w+' . ')' . ')' . ')?' . ')?' . '(' . '\s+:\s+' . '(?<description>.+)' . ')?' . '$/' ; $ matches = [ ] ; $ result = preg_match ( $ pattern , $ flag , $ matches ) ; if ( $ result === 0 || $ result === false ) { throw new LogicException ( "[$flag] is improperly formatted for a shell option." ) ; } $ parsedFlag [ 'flag' ] = null ; if ( isset ( $ matches [ 'flag' ] ) ) { $ parsedFlag [ 'flag' ] = $ matches [ 'flag' ] ; } $ parsedFlag [ 'enable' ] = false ; if ( ! empty ( $ matches [ 'enable' ] ) ) { $ parsedFlag [ 'enable' ] = true ; } $ parsedFlag [ 'can_have_value' ] = false ; if ( ! empty ( $ matches [ 'can_have_value' ] ) ) { $ parsedFlag [ 'can_have_value' ] = true ; } $ parsedFlag [ 'can_have_multiple_values' ] = false ; if ( ! empty ( $ matches [ 'can_have_multiple_values' ] ) ) { $ parsedFlag [ 'can_have_multiple_values' ] = true ; } $ parsedFlag [ 'values' ] = [ ] ; if ( ! empty ( $ matches [ 'values' ] ) && $ parsedFlag [ 'can_have_value' ] ) { $ parsedFlag [ 'values' ] = $ matches [ 'values' ] ; if ( $ parsedFlag [ 'can_have_multiple_values' ] ) { $ parsedFlag [ 'values' ] = explode ( ',' , $ matches [ 'values' ] ) ; } } $ parsedFlag [ 'description' ] = null ; if ( isset ( $ matches [ 'description' ] ) ) { $ parsedFlag [ 'description' ] = $ matches [ 'description' ] ; } return $ parsedFlag ; }
|
Parse a given flag .
|
5,561
|
private function setDescription ( $ description = null ) { if ( isset ( $ description ) && ! is_string ( $ description ) ) { throw new InvalidArgumentException ( "Description must be a string. [$description] given." ) ; } $ this -> description = $ description ; }
|
Set the description .
|
5,562
|
private function setValues ( $ values ) { if ( ! empty ( $ values ) ) { if ( $ this -> canHaveMultipleValues ( ) ) { $ this -> addValues ( $ values ) ; } elseif ( $ this -> canHaveValue ( ) ) { $ this -> addValue ( $ values ) ; } } return $ this ; }
|
Set the values for this option .
|
5,563
|
public function Link ( $ action = null ) { $ name = $ this -> name ; if ( ( $ pos = stripos ( $ name , '[' ) ) !== false ) { $ name = substr ( $ name , 0 , $ pos ) ; $ action = substr ( $ this -> name , $ pos + 1 , strlen ( $ this -> name ) - 1 - ( $ pos + 1 ) ) . 'Tree' ; } return Controller :: join_links ( $ this -> form -> FormAction ( ) , 'field/' . $ name , $ action ) ; }
|
Return a Link to this field
|
5,564
|
private function setWhereResultCallback ( QueryBuilder $ qb ) { if ( ! empty ( $ this -> callbacks [ 'WhereResult' ] ) ) { foreach ( $ this -> callbacks [ 'WhereResult' ] as $ callback ) { $ callback ( $ qb ) ; } } return $ this ; }
|
Set where result callback .
|
5,565
|
private function setWhereAllCallback ( QueryBuilder $ qb ) { if ( ! empty ( $ this -> callbacks [ 'WhereAll' ] ) ) { foreach ( $ this -> callbacks [ 'WhereAll' ] as $ callback ) { $ callback ( $ qb ) ; } } return $ this ; }
|
Set where all callback .
|
5,566
|
private function setSelectFrom ( ) { foreach ( $ this -> selectColumns as $ key => $ value ) { $ this -> qb -> addSelect ( $ key ) ; } $ this -> qb -> from ( $ this -> entity , $ this -> tableName ) ; return $ this ; }
|
Set select from .
|
5,567
|
private function setLeftJoins ( QueryBuilder $ qb ) { foreach ( $ this -> joins as $ key => $ value ) { $ qb -> leftJoin ( $ key , $ value ) ; } return $ this ; }
|
Set leftJoins .
|
5,568
|
private function setOrderBy ( ) { if ( isset ( $ this -> requestParams [ 'order' ] ) && count ( $ this -> requestParams [ 'order' ] ) ) { $ counter = count ( $ this -> requestParams [ 'order' ] ) ; for ( $ i = 0 ; $ i < $ counter ; ++ $ i ) { $ columnIdx = ( integer ) $ this -> requestParams [ 'order' ] [ $ i ] [ 'column' ] ; $ requestColumn = $ this -> requestParams [ 'columns' ] [ $ columnIdx ] ; if ( 'true' == $ requestColumn [ 'orderable' ] ) { $ this -> qb -> addOrderBy ( $ this -> orderColumns [ $ columnIdx ] , $ this -> requestParams [ 'order' ] [ $ i ] [ 'dir' ] ) ; } } } return $ this ; }
|
Ordering . Construct the ORDER BY clause for server - side processing SQL query .
|
5,569
|
private function setLimit ( ) { if ( isset ( $ this -> requestParams [ 'start' ] ) && - 1 != $ this -> requestParams [ 'length' ] ) { $ this -> qb -> setFirstResult ( $ this -> requestParams [ 'start' ] ) -> setMaxResults ( $ this -> requestParams [ 'length' ] ) ; } return $ this ; }
|
Paging . Construct the LIMIT clause for server - side processing SQL query .
|
5,570
|
private function getCountAllResults ( $ rootEntityIdentifier ) { $ qb = $ this -> em -> createQueryBuilder ( ) ; $ qb -> select ( 'count(distinct ' . $ this -> tableName . '.' . $ rootEntityIdentifier . ')' ) ; $ qb -> from ( $ this -> entity , $ this -> tableName ) ; $ this -> setLeftJoins ( $ qb ) ; $ this -> setWhereAllCallback ( $ qb ) ; return ( int ) $ qb -> getQuery ( ) -> getSingleScalarResult ( ) ; }
|
Query results before filtering .
|
5,571
|
private function execute ( ) { $ query = $ this -> qb -> getQuery ( ) ; if ( true === $ this -> configs [ 'translation_query_hints' ] ) { if ( true === $ this -> doctrineExtensions ) { $ query -> setHint ( \ Doctrine \ ORM \ Query :: HINT_CUSTOM_OUTPUT_WALKER , 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker' ) ; $ query -> setHint ( \ Gedmo \ Translatable \ TranslatableListener :: HINT_TRANSLATABLE_LOCALE , $ this -> locale ) ; $ query -> setHint ( \ Gedmo \ Translatable \ TranslatableListener :: HINT_FALLBACK , 1 ) ; } else { throw new \ Exception ( 'execute(): "DoctrineExtensions" does not exist.' ) ; } } $ query -> setHydrationMode ( Query :: HYDRATE_OBJECT ) ; return $ query ; }
|
Constructs a Query instance .
|
5,572
|
private function entityFieldToArray ( array $ data , $ entity , $ path ) { $ parts = explode ( '.' , $ path , 2 ) ; if ( count ( $ parts ) === 1 ) { if ( $ entity instanceof \ Traversable ) { $ data = [ ] ; foreach ( $ entity as $ item ) { $ id = $ this -> em -> getClassMetadata ( get_class ( $ item ) ) -> getSingleIdentifierColumnName ( ) ; $ data [ ] = [ $ id => $ this -> propertyAccessor -> getValue ( $ item , $ id ) , $ parts [ 0 ] => $ this -> propertyAccessor -> getValue ( $ item , $ parts [ 0 ] ) , ] ; } } else { if ( count ( $ data ) === 0 ) { $ data = [ ] ; $ id = $ this -> em -> getClassMetadata ( get_class ( $ entity ) ) -> getSingleIdentifierColumnName ( ) ; $ data [ $ id ] = $ this -> propertyAccessor -> getValue ( $ entity , $ id ) ; } $ data [ $ parts [ 0 ] ] = $ this -> propertyAccessor -> getValue ( $ entity , $ parts [ 0 ] ) ; } return $ data ; } else { $ data [ $ parts [ 0 ] ] = $ this -> entityFieldToArray ( isset ( $ data [ $ parts [ 0 ] ] ) ? $ data [ $ parts [ 0 ] ] : [ ] , $ this -> propertyAccessor -> getValue ( $ entity , $ parts [ 0 ] ) , $ parts [ 1 ] ) ; return $ data ; } }
|
Normalizes an entity path into an array . Each entity of each level will have its id set . All values are retrieved using a property accessor with magic call activated .
|
5,573
|
private function setIdentifierFromAssociation ( $ association , $ key = '' , $ i = 0 , $ metadata = null ) { if ( null === $ metadata ) { $ metadata = $ this -> metadata ; } if ( is_string ( $ association ) ) { $ targetEntityClass = $ metadata -> getAssociationTargetClass ( $ association ) ; $ targetMetadata = $ this -> getMetadata ( $ targetEntityClass ) ; $ this -> selectColumns [ $ association ] [ ] = $ this -> getIdentifier ( $ targetMetadata ) ; } if ( is_array ( $ association ) && array_key_exists ( $ i , $ association ) ) { $ column = $ association [ $ i ] ; $ count = count ( $ association ) - 1 ; if ( true === $ metadata -> hasAssociation ( $ column ) ) { $ targetEntityClass = $ metadata -> getAssociationTargetClass ( $ column ) ; $ targetMetadata = $ this -> getMetadata ( $ targetEntityClass ) ; if ( $ count == $ i ) { $ this -> selectColumns [ $ key ] [ ] = $ this -> getIdentifier ( $ targetMetadata ) ; } else { ++ $ i ; $ this -> setIdentifierFromAssociation ( $ association , $ key , $ i , $ targetMetadata ) ; } } } return $ this ; }
|
Set identifier from association .
|
5,574
|
private function isSelectColumn ( $ data ) { if ( null !== $ data && ! in_array ( $ data , $ this -> virtualColumns ) ) { return true ; } return false ; }
|
Is select column .
|
5,575
|
private function isSearchColumn ( AbstractColumn $ column ) { if ( false === $ this -> configs [ 'search_on_non_visible_columns' ] ) { if ( null !== $ column -> getDql ( ) && true === $ column -> getSearchable ( ) && true === $ column -> getVisible ( ) ) { return true ; } } else { if ( null !== $ column -> getDql ( ) && true === $ column -> getSearchable ( ) ) { return true ; } } return false ; }
|
Is search column .
|
5,576
|
private function renderImage ( $ imageName , ImageColumn $ column ) { return $ this -> twig -> render ( 'SgDatatablesBundle:Helper:ii_render_image.html.twig' , array ( 'image_id' => 'sg_image_' . uniqid ( rand ( 10000 , 99999 ) ) , 'image_name' => $ imageName , 'filter' => $ column -> getImagineFilter ( ) , 'path' => $ column -> getRelativePath ( ) , 'holder_url' => $ column -> getHolderUrl ( ) , 'width' => $ column -> getHolderWidth ( ) , 'height' => $ column -> getHolderHeight ( ) , 'enlarge' => $ column -> getEnlarge ( ) , ) ) ; }
|
Render image .
|
5,577
|
public function countUserRoles ( Criteria $ criteria = null , $ distinct = false , PropelPDO $ con = null ) { $ partial = $ this -> collUserRolesPartial && ! $ this -> isNew ( ) ; if ( null === $ this -> collUserRoles || null !== $ criteria || $ partial ) { if ( $ this -> isNew ( ) && null === $ this -> collUserRoles ) { return 0 ; } if ( $ partial && ! $ criteria ) { return count ( $ this -> getUserRoles ( ) ) ; } $ query = UserRoleQuery :: create ( null , $ criteria ) ; if ( $ distinct ) { $ query -> distinct ( ) ; } return $ query -> filterByRole ( $ this ) -> count ( $ con ) ; } return count ( $ this -> collUserRoles ) ; }
|
Returns the number of related UserRole objects .
|
5,578
|
public function addUserRole ( UserRole $ l ) { if ( $ this -> collUserRoles === null ) { $ this -> initUserRoles ( ) ; $ this -> collUserRolesPartial = true ; } if ( ! in_array ( $ l , $ this -> collUserRoles -> getArrayCopy ( ) , true ) ) { $ this -> doAddUserRole ( $ l ) ; if ( $ this -> userRolesScheduledForDeletion and $ this -> userRolesScheduledForDeletion -> contains ( $ l ) ) { $ this -> userRolesScheduledForDeletion -> remove ( $ this -> userRolesScheduledForDeletion -> search ( $ l ) ) ; } } return $ this ; }
|
Method called to associate a UserRole object to this object through the UserRole foreign key attribute .
|
5,579
|
public function getUserRolesJoinUser ( $ criteria = null , $ con = null , $ join_behavior = Criteria :: LEFT_JOIN ) { $ query = UserRoleQuery :: create ( null , $ criteria ) ; $ query -> joinWith ( 'User' , $ join_behavior ) ; return $ this -> getUserRoles ( $ query , $ con ) ; }
|
If this collection has already been initialized with an identical criteria it returns the collection . Otherwise if this Role is new it will return an empty collection ; or if this Role has previously been saved it will retrieve related UserRoles from storage .
|
5,580
|
public function sendRequest ( $ request , $ wait = self :: WAIT ) { $ this -> getSocket ( ) -> send ( $ request , ( $ wait ) ? 0 : \ ZMQ :: MODE_DONTWAIT ) ; return $ this ; }
|
Send request via ZMQ socket .
|
5,581
|
protected function getValue ( $ key ) { if ( ! array_key_exists ( $ key , $ this -> store ) ) { throw new KeyNotFoundException ( ) ; } $ getResult = $ this -> store [ $ key ] ; $ unserialized = @ unserialize ( $ getResult ) ; if ( Util :: hasInternalExpireTime ( $ unserialized ) ) { $ this -> handleTtl ( $ key , $ unserialized [ 'ts' ] , $ unserialized [ 's' ] ) ; $ getResult = $ unserialized [ 'v' ] ; } return $ getResult ; }
|
Gets value watches expiring .
|
5,582
|
protected function handleTtl ( $ key , $ expireSetTs , $ expireSec ) { $ ttl = $ expireSetTs + $ expireSec - time ( ) ; if ( $ ttl <= 0 ) { unset ( $ this -> store [ $ key ] ) ; throw new KeyNotFoundException ( ) ; } return $ ttl ; }
|
If ttl is lesser or equals 0 delete key .
|
5,583
|
protected function connectHandshake ( $ host , $ port = 443 , $ http_ver = '1.1' , array & $ headers = array ( ) ) { $ request = "CONNECT $host:$port HTTP/$http_ver\r\n" . "Host: " . $ this -> config [ 'proxy_host' ] . "\r\n" ; if ( isset ( $ this -> config [ 'useragent' ] ) ) { $ request .= "User-agent: " . $ this -> config [ 'useragent' ] . "\r\n" ; } if ( isset ( $ headers [ 'proxy-authorization' ] ) ) { $ request .= "Proxy-authorization: " . $ headers [ 'proxy-authorization' ] . "\r\n" ; unset ( $ headers [ 'proxy-authorization' ] ) ; } $ request .= "\r\n" ; if ( ! @ fwrite ( $ this -> socket , $ request ) ) { require_once 'Zend/Http/Client/Adapter/Exception.php' ; throw new Zend_Http_Client_Adapter_Exception ( "Error writing request to proxy server" ) ; } $ response = '' ; $ gotStatus = false ; while ( $ line = @ fgets ( $ this -> socket ) ) { $ gotStatus = $ gotStatus || ( strpos ( $ line , 'HTTP' ) !== false ) ; if ( $ gotStatus ) { $ response .= $ line ; if ( ! chop ( $ line ) ) break ; } } if ( Zend_Http_Response :: extractCode ( $ response ) != 200 ) { require_once 'Zend/Http/Client/Adapter/Exception.php' ; throw new Zend_Http_Client_Adapter_Exception ( "Unable to connect to HTTPS proxy. Server response: " . $ response ) ; } $ modes = array ( STREAM_CRYPTO_METHOD_TLS_CLIENT , STREAM_CRYPTO_METHOD_SSLv3_CLIENT , STREAM_CRYPTO_METHOD_SSLv23_CLIENT , STREAM_CRYPTO_METHOD_SSLv2_CLIENT ) ; $ success = false ; foreach ( $ modes as $ mode ) { $ success = stream_socket_enable_crypto ( $ this -> socket , true , $ mode ) ; if ( $ success ) break ; } if ( ! $ success ) { require_once 'Zend/Http/Client/Adapter/Exception.php' ; throw new Zend_Http_Client_Adapter_Exception ( "Unable to connect to" . " HTTPS server through proxy: could not negotiate secure connection." ) ; } }
|
Preform handshaking with HTTPS proxy using CONNECT method
|
5,584
|
public function setTranslation ( string $ locale , string $ value ) { if ( strlen ( $ value ) === 0 ) { unset ( $ this -> translations [ $ locale ] ) ; } else { $ this -> translations [ $ locale ] = mb_convert_encoding ( $ value , 'UTF-8' , 'UTF-8' ) ; } return $ this ; }
|
Sets a translation of the localised string .
|
5,585
|
public function initDoctrinePackage ( ) { $ module = $ GLOBALS [ 'env' ] [ 'container' ] -> getModule ( 'Doctrine' ) ; $ this -> dc = new DCPackage ( $ module , $ module -> getEntityManager ( $ this -> getConnectionName ( ) ) ) ; $ this -> attachEntityMetaListener ( ) ; }
|
Erstellt das DCPackage
|
5,586
|
public function hydrateEntity ( $ entityName , $ identifier ) { return $ this -> getDoctrinePackage ( ) -> getRepository ( $ this -> getDoctrinePackage ( ) -> getModule ( ) -> getEntityName ( $ entityName ) ) -> hydrate ( $ identifier ) ; }
|
Hydriert ein einzelnes Entity
|
5,587
|
public function dispatch ( ) { $ handler = current ( $ this -> handlers ) ; if ( ! $ handler ) { return ; } $ this -> resolveHandler ( $ handler ) ; return $ this ; }
|
Dispatch handlers .
|
5,588
|
function getKarma ( $ circle , $ player ) { if ( ! $ circle ) { throw new Exception ( 'Invalid circle' ) ; } if ( ! $ player ) { throw new Exception ( 'Invalid player' ) ; } return $ this -> execute ( 'GET' , '/trust/%s/karma/%s/' , array ( $ circle , $ player ) ) ; }
|
Get how many times a player has been blacklisted and whitelisted within a circle
|
5,589
|
public function createSection ( $ settings = null ) { $ sectionCount = $ this -> _countSections ( ) + 1 ; $ section = new PHPWord_Section ( $ sectionCount , $ settings ) ; $ this -> _sectionCollection [ ] = $ section ; return $ section ; }
|
Create a new Section
|
5,590
|
public function addFontStyle ( $ styleName , $ styleFont , $ styleParagraph = null ) { PHPWord_Style :: addFontStyle ( $ styleName , $ styleFont , $ styleParagraph ) ; }
|
Adds a font style definition to styles . xml
|
5,591
|
public function addTableStyle ( $ styleName , $ styleTable , $ styleFirstRow = null ) { PHPWord_Style :: addTableStyle ( $ styleName , $ styleTable , $ styleFirstRow ) ; }
|
Adds a table style definition to styles . xml
|
5,592
|
public function addTitleStyle ( $ titleCount , $ styleFont , $ styleParagraph = null ) { PHPWord_Style :: addTitleStyle ( $ titleCount , $ styleFont , $ styleParagraph ) ; }
|
Adds a heading style definition to styles . xml
|
5,593
|
public function loadTemplate ( $ strFilename ) { if ( file_exists ( $ strFilename ) ) { $ template = new PHPWord_Template ( $ strFilename ) ; return $ template ; } else { trigger_error ( 'Template file ' . $ strFilename . ' not found.' , E_ERROR ) ; } }
|
Load a Template File
|
5,594
|
public function addItem ( Control $ item , Control $ control , $ isStartElement = false ) { $ menuElement = new MenuElement ( $ item , $ control ) ; $ this -> addElement ( $ menuElement , $ isStartElement ) ; return $ this ; }
|
Add a Menu item
|
5,595
|
public function addElement ( MenuElement $ menuElement , $ isStartElement = false ) { if ( ! in_array ( $ menuElement , $ this -> elements , true ) ) { array_push ( $ this -> elements , $ menuElement ) ; if ( $ isStartElement ) { $ this -> setStartElement ( $ menuElement ) ; } else { $ menuElement -> getControl ( ) -> setVisible ( false ) ; } } return $ this ; }
|
Add a Menu Element
|
5,596
|
public function setStartElement ( MenuElement $ startElement = null ) { $ this -> startElement = $ startElement ; if ( $ startElement && ! in_array ( $ startElement , $ this -> elements , true ) ) { array_push ( $ this -> elements , $ startElement ) ; } return $ this ; }
|
Set the Element to start with
|
5,597
|
protected function getElementsArrayText ( ) { $ elements = array ( ) ; foreach ( $ this -> elements as $ element ) { $ elementId = $ element -> getItem ( ) -> getId ( ) ; $ elements [ $ elementId ] = $ element -> getControl ( ) -> getId ( ) ; } return Builder :: getArray ( $ elements , true ) ; }
|
Build the array text for the Elements
|
5,598
|
public function getTagNameList ( ) { $ tags = $ this -> owner -> Tags ( ) ; $ names = [ ] ; foreach ( $ tags as $ tag ) { $ names [ ] = $ tag -> Name ; } return implode ( ', ' , $ names ) ; }
|
Helper to get a comma separated list of all the associated tags .
|
5,599
|
public function getRelatedFAQs ( $ limit = null ) { $ tags = $ this -> owner -> Tags ( ) ; if ( $ tags -> count ( ) == 0 ) { return null ; } $ faqs = FAQ :: get ( ) -> innerJoin ( 'FAQ_Tags' , '"FAQ"."ID" = "FAQ_Tags"."FAQID"' ) -> where ( sprintf ( '"FAQ_Tags"."TaxonomyTermID" IN (%s)' , implode ( ',' , $ tags -> column ( 'ID' ) ) ) ) -> exclude ( 'ID' , $ this -> owner -> ID ) ; if ( $ limit && is_int ( $ limit ) ) { $ faqs = $ faqs -> limit ( $ limit ) ; } return $ faqs ; }
|
Helper to get all the FAQ articles that are tagged with the same tags .
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.