idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
27,600 | public function getThemeRegionConfig ( $ theme ) { $ regions = variable_get ( 'ucms_layout_regions_' . $ theme , [ ] ) ; if ( null === $ regions ) { $ regions = array_keys ( system_region_list ( $ theme ) ) ; $ regions = array_fill_keys ( $ regions , self :: CONTEXT_PAGE ) ; } return array_map ( 'intval' , $ regions ) ; } | Get the enabled regions of the given theme . |
27,601 | private function getUserRoleCacheValue ( AccountInterface $ account , Site $ site = null ) { $ userId = $ account -> id ( ) ; if ( ! isset ( $ this -> accessCache [ $ userId ] ) ) { $ r = $ this -> db -> query ( " SELECT a.uid, a.site_id, a.role, s.state AS site_state, u.name, u.mail, u.status FROM {ucms_site_access} a JOIN {users} u ON u.uid = a.uid JOIN {ucms_site} s ON s.id = a.site_id WHERE a.uid = :userId " , [ ':userId' => $ userId ] ) ; $ r -> setFetchMode ( \ PDO :: FETCH_CLASS , SiteAccessRecord :: class ) ; $ this -> accessCache [ $ userId ] = [ ] ; foreach ( $ r -> fetchAll ( ) as $ record ) { $ this -> accessCache [ $ userId ] [ $ record -> getSiteId ( ) ] = $ record ; } } if ( null !== $ site ) { if ( ! empty ( $ this -> accessCache [ $ userId ] [ $ site -> id ] ) ) { return $ this -> accessCache [ $ userId ] [ $ site -> id ] ; } else { return Access :: ROLE_NONE ; } } return $ this -> accessCache [ $ userId ] ; } | Get user role in site |
27,602 | public function updateStateTransitionMatrix ( array $ matrix ) { foreach ( $ matrix as $ from => $ toList ) { foreach ( $ toList as $ to => $ roleList ) { $ current = array_filter ( $ roleList ) ; if ( $ from == $ to || empty ( $ current ) ) { unset ( $ matrix [ $ from ] [ $ to ] ) ; } else { $ matrix [ $ from ] [ $ to ] = array_combine ( $ current , $ current ) ; } } } variable_set ( 'ucms_site_state_transition_matrix' , $ matrix ) ; } | Update state transition matrix |
27,603 | public function getDrupalRoleList ( ) { if ( null === $ this -> roleListCache ) { $ this -> roleListCache = $ this -> db -> query ( "SELECT rid, name FROM {role} ORDER BY rid" ) -> fetchAllKeyed ( ) ; } return $ this -> roleListCache ; } | Get Drupal role list |
27,604 | public function getRelativeRoleName ( $ role ) { $ roles = $ this -> collectRelativeRoles ( ) ; if ( isset ( $ roles [ $ role ] ) ) { return $ roles [ $ role ] ; } } | Get a relative role name |
27,605 | public function userIsWebmaster ( AccountInterface $ account , Site $ site = null ) { return $ this -> userHasRole ( $ account , $ site , Access :: ROLE_WEBMASTER ) ; } | Is the given user a webmaster . If a site is given is the given user webmaster of this site . |
27,606 | public function userIsContributor ( AccountInterface $ account , Site $ site = null ) { return $ this -> userHasRole ( $ account , $ site , Access :: ROLE_CONTRIB ) ; } | Is the given user a contributor . If a site is given the given user contributor of this site . |
27,607 | public function userHasRole ( AccountInterface $ account , Site $ site = null , $ role = null ) { if ( null === $ site && null === $ role ) { return ( bool ) count ( $ this -> getUserRoleCacheValue ( $ account ) ) ; } if ( null === $ site ) { foreach ( $ this -> getUserRoleCacheValue ( $ account ) as $ grant ) { if ( $ grant -> getRole ( ) === ( int ) $ role ) { return true ; } } return false ; } if ( null === $ role ) { $ grant = $ this -> getUserRoleCacheValue ( $ account , $ site ) ; return ( $ grant instanceof SiteAccessRecord ) && ( $ grant -> getRole ( ) !== Access :: ROLE_NONE ) ; } if ( $ grant = $ this -> getUserRoleCacheValue ( $ account , $ site ) ) { return $ grant -> getRole ( ) === ( int ) $ role ; } return false ; } | Has the user the given role for the given site . |
27,608 | public function userCanSwitch ( AccountInterface $ account , $ site , $ state ) { $ allowed = $ this -> getAllowedTransitions ( $ account , $ site ) ; return isset ( $ allowed [ $ state ] ) ; } | Can the given user switch the given site to the given state |
27,609 | public function getAllowedTransitions ( AccountInterface $ account , Site $ site ) { $ ret = [ ] ; $ states = SiteState :: getList ( ) ; $ matrix = $ this -> getStateTransitionMatrix ( ) ; $ drupalRoles = $ account -> getRoles ( ) ; foreach ( $ states as $ state => $ name ) { if ( isset ( $ matrix [ $ site -> state ] [ $ state ] ) ) { foreach ( $ matrix [ $ site -> state ] [ $ state ] as $ target ) { list ( $ type , $ role ) = explode ( ':' , $ target , 2 ) ; if ( 'site' === $ type ) { if ( $ this -> userHasRole ( $ account , $ site , $ role ) ) { $ ret [ $ state ] = $ name ; break ; } } else if ( 'drupal' === $ type ) { if ( in_array ( $ role , $ drupalRoles ) ) { $ ret [ $ state ] = $ name ; break ; } } } } } return $ ret ; } | Get allow transition list for the given site and user |
27,610 | public function mergeUsersWithRole ( Site $ site , $ userIdList , $ role ) { if ( ! is_array ( $ userIdList ) && ! $ userIdList instanceof \ Traversable ) { $ userIdList = [ $ userIdList ] ; } foreach ( $ userIdList as $ userId ) { $ this -> db -> merge ( 'ucms_site_access' ) -> key ( [ 'site_id' => $ site -> id , 'uid' => $ userId ] ) -> fields ( [ 'role' => $ role ] ) -> execute ( ) ; } $ this -> resetCache ( ) ; } | Merge users with role |
27,611 | public function removeUsersWithRole ( Site $ site , $ userIdList , $ role = null ) { $ q = $ this -> db -> delete ( 'ucms_site_access' ) -> condition ( 'site_id' , $ site -> id ) -> condition ( 'uid' , $ userIdList ) ; if ( $ role ) { $ q -> condition ( 'role' , $ role ) ; } $ q -> execute ( ) ; $ this -> resetCache ( ) ; } | Remove users with role |
27,612 | public function listUsersWithRole ( Site $ site , $ role = null , $ limit = 100 , $ offset = 0 ) { $ q = $ this -> db -> select ( 'ucms_site_access' , 'sa' ) -> fields ( 'sa' ) -> fields ( 'u' , [ 'name' , 'mail' , 'status' ] ) -> condition ( 'sa.site_id' , $ site -> id ) ; if ( $ role ) { $ q -> condition ( 'sa.role' , $ role ) ; } $ q -> join ( 'users' , 'u' , "u.uid = sa.uid" ) ; $ r = $ q -> range ( $ offset , $ limit ) -> orderBy ( 'sa.uid' ) -> execute ( ) ; $ r -> setFetchMode ( \ PDO :: FETCH_CLASS , SiteAccessRecord :: class ) ; return $ r -> fetchAll ( ) ; } | List users with role |
27,613 | public function countUsersWithRole ( Site $ site , $ role = null ) { $ q = $ this -> db -> select ( 'ucms_site_access' , 'u' ) -> condition ( 'u.site_id' , $ site -> id ) ; if ( $ role ) { $ q -> condition ( 'u.role' , $ role ) ; } $ q -> addExpression ( 'COUNT(*)' ) ; $ r = $ q -> execute ( ) ; return $ r -> fetchField ( ) ; } | Count users having a specific role . If role is null count all users . |
27,614 | public function actionIndex ( $ configFile = false ) { echo "Start building PHAR package...\n" ; $ this -> loadConfiguration ( $ configFile ) ; $ this -> clean ( false ) ; $ phar = new \ Phar ( \ Yii :: getAlias ( $ this -> module -> path ) , 0 , $ this -> module -> pharName ) ; Builder :: addFilesFromIterator ( $ phar , $ this -> module ) ; Builder :: addStub ( $ phar , $ this -> module -> stub ) ; Builder :: addCompress ( $ phar , $ this -> module -> compress ) ; Builder :: addSignature ( $ phar , $ this -> module -> signature , $ this -> module -> openSSLPrivateKeyAlias ) ; echo "\n\nFinish\n" ; } | Action of building phar archive . |
27,615 | protected function loadConfiguration ( $ configFile = false ) { if ( $ configFile === false ) { return ; } echo "\nLoad configuration" ; $ configuration = require $ configFile ; foreach ( $ configuration as $ name => $ value ) { if ( $ this -> module -> canSetProperty ( $ name ) == true ) { $ this -> module -> $ name = $ value ; } else { throw new InvalidConfigException ( "Invalid configuration. Unknown configuration option '{$name}'" ) ; } } $ this -> module -> loadComponents ( ) ; } | Loads and update module default configuration . |
27,616 | protected function removePhars ( ) { $ path = \ Yii :: getAlias ( $ this -> module -> path ) ; foreach ( [ '' , '.gz' , '.bz2' ] as $ extension ) { $ fullPath = $ path . DIRECTORY_SEPARATOR . $ extension ; if ( file_exists ( $ fullPath ) === true ) { \ Phar :: unlinkArchive ( $ fullPath ) ; } } } | Remove existing old phar archives . |
27,617 | public function setSite ( Site $ site ) { if ( $ this -> site || $ site -> getId ( ) !== $ this -> getSiteId ( ) ) { throw new \ LogicException ( "this object is not really immutable, but it should be, site is already set anyway" ) ; } $ this -> site = $ site ; } | Set preloaded site |
27,618 | public static function createController ( \ Aimeos \ MShop \ Context \ Item \ Iface $ context , $ name = null ) { if ( $ name === null ) { $ name = $ context -> getConfig ( ) -> get ( 'controller/extjs/order/base/coupon/name' , 'Standard' ) ; } $ interface = '\\Aimeos\\Controller\\ExtJS\\Iface' ; $ classname = '\\Aimeos\\Controller\\ExtJS\\Order\\Base\\Coupon\\' . $ name ; $ controller = self :: createControllerBase ( $ context , $ classname , $ interface ) ; return self :: addControllerDecorators ( $ context , $ controller , 'order/base/coupon' ) ; } | Creates a new order base coupon controller object . |
27,619 | public static function addCompress ( \ Phar $ phar , $ configuration ) { if ( $ configuration === false ) { return ; } echo "\nAdd compress" ; foreach ( $ configuration as $ compress ) { if ( in_array ( $ compress , [ \ Phar :: NONE , \ Phar :: GZ , \ Phar :: BZ2 ] , true ) === false ) { throw new InvalidConfigException ( "Invalid configuration. Unknown compress type '{$compress}'." ) ; } if ( \ Phar :: canCompress ( $ compress ) === true ) { $ phar -> compress ( $ compress ) ; } } } | Add compress to phar file . |
27,620 | public static function addSignature ( \ Phar $ phar , $ signature , $ privateKeyAlias = null ) { if ( $ signature === false ) { return ; } echo "\nAdd signature" ; if ( in_array ( $ signature , [ \ Phar :: MD5 , \ Phar :: SHA1 , \ Phar :: SHA256 , \ Phar :: SHA512 ] , true ) === true ) { $ phar -> setSignatureAlgorithm ( $ signature ) ; } elseif ( $ signature === \ Phar :: OPENSSL ) { self :: setOpenSSLSignature ( $ phar , $ privateKeyAlias ) ; } else { throw new InvalidConfigException ( "Invalid configuration. Unknown signature type '{$signature}'." ) ; } } | Add signature to phar file . |
27,621 | public static function addStub ( \ Phar $ phar , $ stubAlias ) { if ( $ stubAlias === false ) { return ; } echo "\nAdd stub" ; $ path = \ Yii :: getAlias ( $ stubAlias ) ; if ( file_exists ( $ path ) === false ) { throw new InvalidConfigException ( "Invalid configuration. Stub file '{$path}' does not exists." ) ; } $ phar -> setStub ( file_get_contents ( $ path ) ) ; } | Add stub from file to phar file . |
27,622 | protected static function setOpenSSLSignature ( \ Phar $ phar , $ pathAlias ) { $ path = \ Yii :: getAlias ( $ pathAlias ) ; if ( file_exists ( $ path ) === false ) { throw new InvalidConfigException ( "Invalid configuration. Private key '{$path}' does not exists." ) ; } $ pemFile = file_get_contents ( $ path ) ; $ resource = openssl_get_privatekey ( $ pemFile ) ; $ privateKey = '' ; openssl_pkey_export ( $ resource , $ privateKey ) ; $ phar -> setSignatureAlgorithm ( \ Phar :: OPENSSL , $ privateKey ) ; } | Set OpenSSL signature and creating public key file . |
27,623 | public function streamFile ( $ file ) { $ body = $ this -> builder -> messages ( ) -> stream ( $ file ) ; return $ this -> response ( $ body ) ; } | Stream a file to the client |
27,624 | public function download ( $ fileName , $ contentType , $ contents ) { $ body = $ this -> builder -> messages ( ) -> stringStream ( $ contents ) ; return $ this -> downloadResponse ( $ fileName , $ contentType , $ body ) ; } | Download of contents as file |
27,625 | public function downloadFile ( $ fileName , $ contentType , $ file ) { $ body = $ this -> builder -> messages ( ) -> stream ( $ file ) ; return $ this -> downloadResponse ( $ fileName , $ contentType , $ body ) ; } | Download of a local file |
27,626 | protected function downloadResponse ( $ fileName , $ contentType , $ body ) { $ headers = array ( 'Content-Type' => $ contentType , 'Content-Disposition' => 'attachment; filename="' . $ fileName . '"' ) ; return $ this -> response ( $ body , $ headers ) ; } | Build a download response |
27,627 | private function registerSettingsStore ( ) { $ this -> bind ( 'arcanedev.settings.store' , function ( Application $ app ) { return $ app -> make ( 'arcanedev.settings.manager' ) -> driver ( ) ; } ) ; $ this -> bind ( \ Arcanedev \ Settings \ Contracts \ Store :: class , 'arcanedev.settings.store' ) ; } | Register the Settings Store . |
27,628 | protected function processVideoIdValue ( $ videoString ) { $ video = stripslashes ( trim ( $ videoString ) ) ; if ( strpos ( $ video , 'iframe' ) !== false ) { $ anchorRegex = '/src="(.*)?"/isU' ; $ results = array ( ) ; if ( preg_match ( $ anchorRegex , $ video , $ results ) ) { $ link = trim ( $ results [ 1 ] ) ; } } else { $ link = $ video ; } if ( ! empty ( $ link ) ) { $ id = null ; $ videoIdRegex = null ; $ results = [ ] ; if ( strpos ( $ link , 'youtu' ) !== false ) { if ( strpos ( $ link , 'youtube.com' ) !== false ) { $ videoIdRegex = "/^(?:http(?:s)?:\/\/)?(?:www\.)?(?:m\.)?(?:youtube\.com\/(?:(?:watch)?\?(?:.*&)?v(?:i)?=|(?:embed|v|vi|user)\/))([^\?&\"'>]+)/" ; } elseif ( strpos ( $ link , 'youtu.be' ) !== false ) { $ videoIdRegex = '/youtu.be\/([a-zA-Z0-9_-]+)\??/i' ; } if ( $ videoIdRegex !== null ) { if ( preg_match ( $ videoIdRegex , $ link , $ results ) ) { $ id = $ results [ 1 ] ; $ provider = 'youtube' ; } } } elseif ( strpos ( $ video , 'vimeo' ) !== false ) { if ( strpos ( $ video , 'player.vimeo.com' ) !== false ) { $ videoIdRegex = '/player.vimeo.com\/video\/([0-9]+)\??/i' ; } else { $ videoIdRegex = '/vimeo.com\/([0-9]+)\??/i' ; } if ( $ videoIdRegex !== null ) { if ( preg_match ( $ videoIdRegex , $ link , $ results ) ) { $ id = $ results [ 1 ] ; $ provider = 'vimeo' ; } } } if ( ! empty ( $ id ) ) { return compact ( 'id' , 'provider' ) ; } } } | Processes Video id and gets it from provider url . |
27,629 | public static function escapeToken ( $ token , $ force = false ) { $ escaped = preg_replace ( self :: RE_SPECIALS , '\\\\\\0' , $ token ) ; if ( $ force || preg_match ( '/ /' , $ escaped ) || strlen ( $ token ) != strlen ( $ escaped ) ) { return '"' . $ escaped . '"' ; } else { return $ escaped ; } } | Add chars if necessary to a token value and escape Lucene query syntax reserved chars |
27,630 | public function value ( $ value , $ type = null ) { switch ( true ) { case is_object ( $ value ) : if ( ! method_exists ( $ value , '__toString' ) ) { throw new InvalidArgumentException ( 'Object can not be converted to string value.' ) ; } $ value = ( string ) $ value ; break ; case is_bool ( $ value ) : $ value = ( int ) $ value ; break ; case ( is_numeric ( $ value ) && ( string ) ( $ value + 0 ) === ( string ) $ value ) : $ value = $ value + 0 ; break ; case is_null ( $ value ) : $ value = 'NULL' ; break ; case is_array ( $ value ) : $ value = array_map ( function ( $ value ) { if ( is_array ( $ value ) ) { $ value = 'Array' ; } return $ this -> value ( $ value ) ; } , $ value ) ; $ value = implode ( ', ' , $ value ) ; break ; default : $ value = call_user_func ( $ this -> quoteFn , $ value , $ type ) ; } return $ value ; } | Quote a database value . |
27,631 | public function into ( $ text , $ value , $ type = null ) { return str_replace ( '?' , $ this -> value ( $ value , $ type ) , $ text ) ; } | Quote into the value for the database . |
27,632 | protected function regionUpdate ( Layout $ layout , Region $ region ) { if ( $ region -> isUpdated ( ) ) { $ this -> db -> delete ( 'ucms_layout_data' ) -> condition ( 'layout_id' , $ layout -> getId ( ) ) -> condition ( 'region' , $ region -> getName ( ) ) -> execute ( ) ; $ values = [ ] ; foreach ( $ region as $ delta => $ item ) { $ values [ ] = [ $ layout -> getId ( ) , $ region -> getName ( ) , $ item -> getNodeId ( ) , $ delta , $ item -> getViewMode ( ) , ] ; } if ( ! empty ( $ values ) ) { $ q = $ this -> db -> insert ( 'ucms_layout_data' ) ; $ q -> fields ( [ 'layout_id' , 'region' , 'nid' , 'weight' , 'view_mode' ] ) ; foreach ( $ values as $ row ) { $ q -> values ( $ row ) ; } $ q -> execute ( ) ; } $ region -> toggleUpdateStatus ( false ) ; return true ; } return false ; } | Update a single region of a layout |
27,633 | public function validateSegment ( $ element , FormStateInterface $ formState ) { $ originalValue = trim ( $ formState -> getValue ( 'segment' ) ) ; if ( ! empty ( $ originalValue ) ) { $ value = $ this -> seoService -> normalizeSegment ( $ originalValue ) ; if ( $ originalValue !== $ value ) { $ formState -> setError ( $ element , $ this -> t ( "The alias '%alias' is invalid and has been normalized to: <strong>%normalized</strong>, please change the value below." , [ '%alias' => $ originalValue , '%normalized' => $ value ] ) ) ; } $ formState -> setValueForElement ( $ element , $ value ) ; } } | Validate the alias segment field |
27,634 | public function init ( ) { parent :: init ( ) ; if ( ( $ this -> module === null ) || ( $ this -> match === false ) ) { return ; } $ this -> module -> on ( Module :: EVENT_BEFORE_ACTION , function ( ActionEvent $ event ) { $ this -> beforeAction ( $ event ) ; } ) ; $ this -> module -> on ( Module :: EVENT_AFTER_ACTION , function ( ActionEvent $ event ) { $ this -> afterAction ( $ event ) ; } ) ; $ this -> module -> on ( Module :: EVENT_PROCESS_FILE , function ( $ event ) { $ this -> onProcessFile ( $ event ) ; } ) ; } | If module and matches ok - connect events to Phar module . |
27,635 | public function isAppropriate ( FileEvent $ event ) { if ( $ this -> match === false ) { return false ; } foreach ( $ this -> match as $ pattern ) { if ( preg_match ( $ pattern , $ event -> realPath ) > 0 ) { return true ; } } return false ; } | Check if file apply to any match . |
27,636 | public function makeTemporary ( FileEvent $ event ) { if ( $ event -> isTemporary === true ) { return ; } $ temporaryPath = tempnam ( \ Yii :: getAlias ( '@runtime/yii2-phar' ) , basename ( $ event -> realPath ) ) ; copy ( $ event -> realPath , $ temporaryPath ) ; $ event -> isTemporary = true ; $ event -> realPath = $ temporaryPath ; } | Creates tmp file for modificators . |
27,637 | public function setMatch ( $ value ) { switch ( gettype ( $ value ) ) { case 'array' : $ this -> match = $ value ; break ; case 'string' : $ this -> match = [ $ value ] ; break ; case 'boolean' : if ( $ value === false ) { $ this -> match = false ; break ; } default : throw new InvalidConfigException ( "Invalid configuration. Wrong march type '{$value}'." ) ; } } | Changes match to one format . |
27,638 | public function getInfoPost ( $ tid , $ fid ) { Container :: get ( 'hooks' ) -> fire ( 'model.post.get_info_post_start' , $ tid , $ fid ) ; $ cur_posting [ 'where' ] = '(fp.read_forum IS NULL OR fp.read_forum=1)' ; if ( $ tid ) { $ cur_posting [ 'select' ] = [ 'f.id' , 'f.forum_name' , 'f.moderators' , 'f.redirect_url' , 'fp.post_replies' , 'fp.post_topics' , 't.subject' , 't.closed' , 'is_subscribed' => 's.user_id' ] ; $ cur_posting = DB :: forTable ( 'topics' ) -> table_alias ( 't' ) -> select_many ( $ cur_posting [ 'select' ] ) -> inner_join ( DB :: prefix ( ) . 'forums' , [ 'f.id' , '=' , 't.forum_id' ] , 'f' ) -> left_outer_join ( DB :: prefix ( ) . 'forum_perms' , '(fp.forum_id=f.id AND fp.group_id=' . User :: get ( ) -> g_id . ')' , 'fp' ) -> left_outer_join ( DB :: prefix ( ) . 'topic_subscriptions' , '(t.id=s.topic_id AND s.user_id=' . User :: get ( ) -> id . ')' , 's' ) -> where_raw ( $ cur_posting [ 'where' ] ) -> where ( 't.id' , $ tid ) ; } else { $ cur_posting [ 'select' ] = [ 'f.id' , 'f.forum_name' , 'f.moderators' , 'f.redirect_url' , 'fp.post_replies' , 'fp.post_topics' ] ; $ cur_posting = DB :: forTable ( 'forums' ) -> table_alias ( 'f' ) -> select_many ( $ cur_posting [ 'select' ] ) -> left_outer_join ( DB :: prefix ( ) . 'forum_perms' , '(fp.forum_id=f.id AND fp.group_id=' . User :: get ( ) -> g_id . ')' , 'fp' ) -> where_raw ( $ cur_posting [ 'where' ] ) -> where ( 'f.id' , $ fid ) ; } $ cur_posting = Container :: get ( 'hooks' ) -> fireDB ( 'model.post.get_info_post_query' , $ cur_posting ) ; $ cur_posting = $ cur_posting -> find_one ( ) ; if ( ! $ cur_posting ) { throw new RunBBException ( __ ( 'Bad request' ) , 404 ) ; } $ cur_posting = Container :: get ( 'hooks' ) -> fire ( 'model.post.get_info_post' , $ cur_posting ) ; return $ cur_posting ; } | Get some info about the post |
27,639 | public function getInfoEdit ( $ id ) { $ id = Container :: get ( 'hooks' ) -> fire ( 'model.post.get_info_edit_start' , $ id ) ; $ cur_post [ 'select' ] = [ 'fid' => 'f.id' , 'f.forum_name' , 'f.moderators' , 'f.redirect_url' , 'fp.post_topics' , 'tid' => 't.id' , 't.subject' , 't.posted' , 't.first_post_id' , 't.sticky' , 't.closed' , 'p.poster' , 'p.poster_id' , 'p.message' , 'p.hide_smilies' ] ; $ cur_post = DB :: forTable ( 'posts' ) -> table_alias ( 'p' ) -> select_many ( $ cur_post [ 'select' ] ) -> inner_join ( DB :: prefix ( ) . 'topics' , [ 't.id' , '=' , 'p.topic_id' ] , 't' ) -> inner_join ( DB :: prefix ( ) . 'forums' , [ 'f.id' , '=' , 't.forum_id' ] , 'f' ) -> left_outer_join ( DB :: prefix ( ) . 'forum_perms' , '(fp.forum_id=f.id AND fp.group_id=' . User :: get ( ) -> g_id . ')' , 'fp' ) -> where_raw ( '(fp.read_forum IS NULL OR fp.read_forum=1)' ) -> where ( 'p.id' , $ id ) ; $ cur_post = Container :: get ( 'hooks' ) -> fireDB ( 'model.post.get_info_edit_query' , $ cur_post ) ; $ cur_post = $ cur_post -> find_one ( ) ; if ( ! $ cur_post ) { throw new RunBBException ( __ ( 'Bad request' ) , 400 ) ; } return $ cur_post ; } | Fetch some info about the post the topic and the forum |
27,640 | public function warnBannedUser ( $ post , $ new_pid ) { Container :: get ( 'hooks' ) -> fire ( 'model.post.warn_banned_user_start' , $ post , $ new_pid ) ; $ mail_tpl = Lang :: getMailTemplate ( 'banned_email_post' ) -> text ; $ mail_tpl = Container :: get ( 'hooks' ) -> fire ( 'model.post.warn_banned_user_mail_tpl' , $ mail_tpl ) ; $ first_crlf = strpos ( $ mail_tpl , "\n" ) ; $ mail_subject = trim ( substr ( $ mail_tpl , 8 , $ first_crlf - 8 ) ) ; $ mail_message = trim ( substr ( $ mail_tpl , $ first_crlf ) ) ; $ mail_message = str_replace ( '<username>' , $ post [ 'username' ] , $ mail_message ) ; $ mail_message = str_replace ( '<email>' , $ post [ 'email' ] , $ mail_message ) ; $ mail_message = str_replace ( '<post_url>' , Router :: pathFor ( 'viewPost' , [ 'pid' => $ new_pid ] ) . '#p' . $ new_pid , $ mail_message ) ; $ mail_message = str_replace ( '<board_mailer>' , ForumSettings :: get ( 'o_board_title' ) , $ mail_message ) ; $ mail_message = Container :: get ( 'hooks' ) -> fire ( 'model.post.warn_banned_user_mail_message' , $ mail_message ) ; Container :: get ( 'email' ) -> dispatchMail ( ForumSettings :: get ( 'o_mailing_list' ) , $ mail_subject , $ mail_message ) ; } | Warn the admin if a banned user posts |
27,641 | public function incrementPostCount ( $ post , $ new_tid ) { Container :: get ( 'hooks' ) -> fire ( 'model.post.increment_post_count_start' , $ post , $ new_tid ) ; if ( ! User :: get ( ) -> is_guest ) { $ increment = DB :: forTable ( 'users' ) -> where ( 'id' , User :: get ( ) -> id ) -> find_one ( ) -> set ( 'last_post' , $ post [ 'time' ] ) -> set_expr ( 'num_posts' , 'num_posts+1' ) ; $ increment = Container :: get ( 'hooks' ) -> fireDB ( 'model.post.increment_post_count_query' , $ increment ) ; $ increment = $ increment -> save ( ) ; if ( User :: get ( ) -> g_promote_next_group != 0 && User :: get ( ) -> num_posts + 1 >= User :: get ( ) -> g_promote_min_posts ) { $ new_group_id = User :: get ( ) -> g_promote_next_group ; $ promote = DB :: forTable ( 'users' ) -> where ( 'id' , User :: get ( ) -> id ) -> find_one ( ) -> set ( 'group_id' , $ new_group_id ) ; $ promote = Container :: get ( 'hooks' ) -> fireDB ( 'model.post.increment_post_count_query' , $ promote ) ; $ promote = $ promote -> save ( ) ; } $ tracked_topics = Track :: getTrackedTopics ( ) ; $ tracked_topics [ 'topics' ] [ $ new_tid ] = time ( ) ; Track :: setTrackedTopics ( $ tracked_topics ) ; } else { $ last_post = DB :: forTable ( 'online' ) -> where ( 'ident' , Utils :: getIp ( ) ) -> find_one ( ) -> set ( 'last_post' , $ post [ 'time' ] ) ; $ last_post = Container :: get ( 'hooks' ) -> fireDB ( 'model.post.increment_post_count_last_post' , $ last_post ) ; $ last_post = $ last_post -> save ( ) ; } Container :: get ( 'hooks' ) -> fire ( 'model.post.increment_post_count' ) ; } | Increment post count change group if needed |
27,642 | public function getQuoteMessage ( $ qid , $ tid ) { $ retVal = '' ; $ retVal = Container :: get ( 'hooks' ) -> fire ( 'model.post.begin_quote_message' , $ retVal , $ qid , $ tid ) ; $ quote = DB :: forTable ( 'posts' ) -> select_many ( [ 'poster' , 'message' ] ) -> where ( 'id' , $ qid ) -> where ( 'topic_id' , $ tid ) ; $ quote = Container :: get ( 'hooks' ) -> fireDB ( 'model.post.get_quote_message_query' , $ quote ) ; $ quote = $ quote -> find_one ( ) ; if ( ! $ quote ) { throw new RunBBException ( __ ( 'Bad request' ) , 404 ) ; } $ quote -> message = preg_replace ( '%\[img(?:=(?:[^\[]*?))?\]((ht|f)tps?://)([^\s<"]*?)\[/img\]%U' , '\1\3' , $ quote -> message ) ; if ( ForumSettings :: get ( 'o_censoring' ) == '1' ) { $ quote -> message = Utils :: censor ( $ quote -> message ) ; } $ quote -> message = Utils :: escape ( $ quote -> message ) ; if ( ForumSettings :: get ( 'p_message_bbcode' ) == '1' ) { $ retVal .= '> --- **' . $ quote -> poster . '** *[' . __ ( 'wrote' ) . '](' . Router :: pathFor ( 'viewPost' , [ 'pid' => $ qid ] ) . '#p' . $ qid . ')*' . "\n" ; $ retVal .= preg_replace ( '/^/m' , '>' , $ quote -> message ) ; } else { $ quote -> message .= preg_replace ( '/^/m' , '>' , $ quote -> message ) ; $ retVal = '> --- ' . $ quote -> poster . ' ' . __ ( 'wrote' ) . "\n" . $ quote -> message . "\n" ; } $ retVal = Container :: get ( 'hooks' ) -> fire ( 'model.post.finish_quote_message' , $ retVal ) ; return $ retVal ; } | If we are quoting a message |
27,643 | public function getCheckboxes ( $ fid , $ is_admmod , $ is_subscribed ) { Container :: get ( 'hooks' ) -> fire ( 'model.post.get_checkboxes_start' , $ fid , $ is_admmod , $ is_subscribed ) ; $ cur_index = 1 ; $ checkboxes = [ ] ; if ( $ fid && $ is_admmod ) { $ checkboxes [ ] = '<label class="checkbox-inline">' . '<input type="checkbox" name="stick_topic" value="1" tabindex="' . ( $ cur_index ++ ) . '"' . ( Input :: post ( 'stick_topic' ) ? ' checked="checked"' : '' ) . ' />' . __ ( 'Stick topic' ) . '<br /></label>' ; } if ( ! User :: get ( ) -> is_guest ) { if ( ForumSettings :: get ( 'o_smilies' ) == '1' ) { $ checkboxes [ ] = '<label class="checkbox-inline">' . '<input type="checkbox" name="hide_smilies" value="1" tabindex="' . ( $ cur_index ++ ) . '"' . ( Input :: post ( 'hide_smilies' ) ? ' checked="checked"' : '' ) . ' />' . __ ( 'Hide smilies' ) . '<br /></label>' ; } if ( ForumSettings :: get ( 'o_topic_subscriptions' ) == '1' ) { $ subscr_checked = false ; if ( Input :: post ( 'preview' ) ) { $ subscr_checked = ( Input :: post ( 'subscribe' ) ) ? true : false ; } elseif ( User :: get ( ) -> auto_notify ) { $ subscr_checked = true ; } elseif ( $ is_subscribed ) { $ subscr_checked = true ; } $ checkboxes [ ] = '<label class="checkbox-inline">' . '<input type="checkbox" name="subscribe" value="1" tabindex="' . ( $ cur_index ++ ) . '"' . ( $ subscr_checked ? ' checked="checked"' : '' ) . ' />' . ( $ is_subscribed ? __ ( 'Stay subscribed' ) : __ ( 'Subscribe' ) ) . '<br /></label>' ; } } elseif ( ForumSettings :: get ( 'o_smilies' ) == '1' ) { $ checkboxes [ ] = '<label class="checkbox-inline">' . '<input type="checkbox" name="hide_smilies" value="1" tabindex="' . ( $ cur_index ++ ) . '"' . ( Input :: post ( 'hide_smilies' ) ? ' checked="checked"' : '' ) . ' />' . __ ( 'Hide smilies' ) . '<br /></label>' ; } $ checkboxes = Container :: get ( 'hooks' ) -> fire ( 'model.post.get_checkboxes' , $ checkboxes ) ; return $ checkboxes ; } | Get the current state of checkboxes |
27,644 | public function topicReview ( $ tid ) { $ post_data = [ ] ; $ post_data = Container :: get ( 'hooks' ) -> fire ( 'model.post.topic_review_start' , $ post_data , $ tid ) ; $ select_topic_review = [ 'poster' , 'message' , 'hide_smilies' , 'posted' ] ; $ result = DB :: forTable ( 'posts' ) -> select_many ( $ select_topic_review ) -> where ( 'topic_id' , $ tid ) -> order_by_desc ( 'id' ) ; $ result = Container :: get ( 'hooks' ) -> fire ( 'model.post.topic_review_query' , $ result ) ; $ result = $ result -> find_many ( ) ; foreach ( $ result as $ cur_post ) { $ cur_post [ 'message' ] = Container :: get ( 'parser' ) -> parseMessage ( $ cur_post [ 'message' ] , $ cur_post [ 'hide_smilies' ] ) ; $ post_data [ ] = $ cur_post ; } $ post_data = Container :: get ( 'hooks' ) -> fire ( 'model.post.topic_review' , $ post_data ) ; return $ post_data ; } | Display the topic review if needed |
27,645 | public static function getDifference ( Release $ release1 , Release $ release2 = null ) { if ( $ release2 === null ) { return self :: MAJOR ; } $ version1 = explode ( '.' , $ release1 -> getVersion ( ) ) ; $ version2 = explode ( '.' , $ release2 -> getVersion ( ) ) ; if ( isset ( $ version1 [ 0 ] ) === false || isset ( $ version2 [ 0 ] ) === false || $ version1 [ 0 ] != $ version2 [ 0 ] ) { return self :: MAJOR ; } elseif ( isset ( $ version1 [ 1 ] ) === false || isset ( $ version2 [ 1 ] ) === false || $ version1 [ 1 ] != $ version2 [ 1 ] ) { return self :: MINOR ; } elseif ( isset ( $ version1 [ 2 ] ) === false || isset ( $ version2 [ 2 ] ) === false || $ version1 [ 2 ] != $ version2 [ 2 ] ) { return self :: PATCH ; } } | Returns the highest version category difference between two Release instances . |
27,646 | public static function matchesStrategy ( $ strategy , Release $ release1 , Release $ release2 = null ) { if ( in_array ( $ strategy , array ( self :: MATCH_MAJOR_DIFFERENCE , self :: MATCH_MINOR_DIFFERENCE , self :: MATCH_ALWAYS ) ) === false ) { throw new InvalidArgumentException ( sprintf ( 'The match strategy "%s" is invalid.' , $ strategy ) ) ; } if ( $ strategy === self :: MATCH_ALWAYS ) { return true ; } $ match = false ; $ versionCategoryDifference = self :: getDifference ( $ release1 , $ release2 ) ; if ( $ strategy === self :: MATCH_MAJOR_DIFFERENCE && $ versionCategoryDifference === self :: MAJOR ) { $ match = true ; } elseif ( $ strategy === self :: MATCH_MINOR_DIFFERENCE && in_array ( $ versionCategoryDifference , array ( self :: MAJOR , self :: MINOR ) ) ) { $ match = true ; } return $ match ; } | Returns true when the version category difference matches the supplied match strategy . |
27,647 | public function onFailedEventLogToLogger ( FailedEvent $ event ) { $ context = array ( 'event.name' => $ event -> getLastEventName ( ) , ) ; $ message = 'An unknown error occured.' ; $ exception = $ event -> getException ( ) ; if ( $ exception instanceof Exception ) { $ message = $ exception -> getMessage ( ) ; } if ( $ exception instanceof TaskRuntimeException && $ exception -> getTask ( ) instanceof EventSubscriberInterface ) { $ eventSubscriberClassName = get_class ( $ exception -> getTask ( ) ) ; if ( strrpos ( $ eventSubscriberClassName , '\\' ) !== false ) { $ eventSubscriberClassName = substr ( $ eventSubscriberClassName , strrpos ( $ eventSubscriberClassName , '\\' ) + 1 ) ; } $ context [ 'event.task.name' ] = $ eventSubscriberClassName ; } $ this -> logger -> log ( LogLevel :: CRITICAL , $ message , $ context ) ; if ( $ exception instanceof TaskCommandExecutionException && $ exception -> getProcessExecutionResult ( ) instanceof ProcessExecutionResult ) { $ context [ 'command.result' ] = $ exception -> getProcessExecutionResult ( ) -> getOutput ( ) ; $ context [ 'separator' ] = "\n=================\n" ; $ this -> logger -> log ( LogLevel :: DEBUG , "{separator} Command output:{separator}\n{command.result}{separator}" , $ context ) ; } } | Logs the FailedEvent to the logger instance . |
27,648 | public function activate ( Composer $ composer , IOInterface $ io ) { $ composer -> getConfig ( ) -> merge ( [ 'config' => [ 'root_extra_config' => $ composer -> getPackage ( ) -> getExtra ( ) , ] , ] ) ; $ this -> initConfig ( $ composer ) ; $ this -> initMultiVcsRepositories ( $ composer , $ io ) ; } | Plug - in activation |
27,649 | protected function initMultiVcsRepositories ( Composer $ composer , IOInterface $ io ) { $ repoDownloader = new GitMultiRepoDownloader ( $ io , $ composer -> getConfig ( ) ) ; foreach ( $ this -> getVcsTypes ( ) as $ type ) { $ composer -> getDownloadManager ( ) -> setDownloader ( $ type , $ repoDownloader ) ; $ composer -> getRepositoryManager ( ) -> setRepositoryClass ( $ type , $ this -> getMultiRepositoryClassName ( ) ) ; } return $ this ; } | Init multi VCS repository |
27,650 | protected function initConfig ( Composer $ composer ) { $ repositories = $ composer -> getConfig ( ) -> getRepositories ( ) ; $ updated = false ; foreach ( $ repositories as $ name => $ repo ) { if ( empty ( $ repo [ 'multi-repo-type' ] ) ) { continue ; } $ repo [ 'type' ] = $ repo [ 'multi-repo-type' ] ; $ repositories [ $ name . '-multi-repo' ] = $ repo ; $ repositories [ $ name ] = false ; $ updated = true ; } if ( $ updated ) { $ composer -> getConfig ( ) -> merge ( [ 'repositories' => $ repositories ] ) ; } return $ this ; } | Reset multi - repository type |
27,651 | private function getRoleIds ( ) { $ assign_to_roles = $ this -> option ( 'assign-to-roles' ) ; if ( $ assign_to_roles ) { $ role_ids = explode ( ',' , $ assign_to_roles ) ; return array_map ( 'intval' , $ role_ids ) ; } return [ ] ; } | Parse role ids from the command option and return them as array if ids |
27,652 | public function get ( $ key ) { $ setting = $ this -> getSettingOrFail ( $ key ) ; $ value = $ this -> backend -> getSetting ( $ key ) ; return is_null ( $ value ) ? $ setting -> default ( ) : $ value ; } | Returns the value of a setting |
27,653 | public function update ( array $ settings ) { foreach ( $ settings as $ key => $ value ) { $ this -> getSettingOrFail ( $ key ) ; } $ this -> backend -> setSettings ( $ settings ) ; } | Update multiple settings at once . It s OK to pass settings that have no values yet |
27,654 | public function reset ( array $ keys ) { foreach ( $ keys as $ key ) { $ this -> getSettingOrFail ( $ key ) ; } $ this -> backend -> removeSettings ( $ keys ) ; } | Reset values of multiple settings at once . |
27,655 | protected function getSettingOrFail ( string $ key ) { if ( ! $ this -> registry -> has ( $ key ) ) { throw new UnregisteredSettingException ( sprintf ( 'There\'s no setting registered with key `%s`' , $ key ) ) ; } return $ this -> registry -> get ( $ key ) ; } | Returns the setting registered with the given key and throws and exception if it doesn t exist |
27,656 | public function nodeAdminListAction ( Request $ request , $ tab , $ page ) { $ pageId = 'ucms_contrib.content_admin.' . $ tab ; return $ this -> renderPage ( $ pageId , $ request , [ 'base_query' => $ this -> getTypeHandler ( ) -> getAdminPageBaseQuery ( $ tab , $ page ) , ] ) ; } | Node admin list page |
27,657 | public function move ( $ req , $ res , $ args ) { $ args [ 'id' ] = Container :: get ( 'hooks' ) -> fire ( 'controller.topic.move' , $ args [ 'id' ] ) ; if ( $ new_fid = Input :: post ( 'move_to_forum' ) ) { $ this -> model -> moveTo ( $ args [ 'fid' ] , $ new_fid , $ args [ 'id' ] ) ; return Router :: redirect ( Router :: pathFor ( 'Topic' , [ 'id' => $ args [ 'id' ] , 'name' => $ args [ 'name' ] ] ) , __ ( 'Move topic redirect' ) ) ; } if ( ! $ this -> model -> checkMovePossible ( ) ) { throw new RunBBException ( __ ( 'Nowhere to move' ) , 403 ) ; } View :: setPageInfo ( [ 'title' => [ Utils :: escape ( ForumSettings :: get ( 'o_board_title' ) ) , __ ( 'Moderate' ) ] , 'active_page' => 'moderate' , 'action' => 'single' , 'topics' => $ args [ 'id' ] , 'list_forums' => $ this -> model -> getForumListMove ( $ args [ 'fid' ] ) , ] ) -> display ( '@forum/moderate/move_topics' ) ; } | Move a single topic |
27,658 | public function siteAliasListAction ( Request $ request , Site $ site ) { return $ this -> renderPage ( 'ucms_seo.site_alias' , $ request , [ 'base_query' => [ 'site' => $ site -> getId ( ) , ] , ] ) ; } | Site alias action |
27,659 | public function nodeRedirectListAction ( Request $ request , NodeInterface $ node ) { return $ this -> renderPage ( 'ucms_seo.node_redirect' , $ request , [ 'base_query' => [ 'node' => $ node -> id ( ) , ] , ] ) ; } | Node redirect list action |
27,660 | public function siteRedirectListAction ( Request $ request , Site $ site ) { return $ this -> renderPage ( 'ucms_seo.site_redirect' , $ request , [ 'base_query' => [ 'site' => $ site -> getId ( ) , ] , ] ) ; } | Site redirect list action |
27,661 | public function loadComponents ( ) { $ components = $ this -> getComponents ( ) ; foreach ( $ components as $ component ) { $ component [ 'module' ] = $ this ; \ Yii :: createObject ( $ component ) ; } } | Reloading methods should be useful on external configuration include . |
27,662 | public function execute ( $ text , $ fuzziness = 0 , $ field = 'autocomplete' ) { $ params = [ 'index' => $ this -> index , 'body' => [ 'autocomplete-suggest' => [ 'text' => $ text , 'completion' => [ 'field' => $ field , 'fuzzy' => [ 'fuzziness' => $ fuzziness , ] , ] , ] , ] , ] ; if ( $ this -> siteManager -> hasContext ( ) ) { $ params [ 'body' ] [ 'autocomplete-suggest' ] [ 'completion' ] [ 'context' ] = [ 'site_id' => $ this -> siteManager -> getContext ( ) -> getId ( ) , ] ; } $ result = $ this -> client -> suggest ( $ params ) ; $ suggestions = [ ] ; foreach ( $ result [ 'autocomplete-suggest' ] [ 0 ] [ 'options' ] as $ suggestion ) { $ suggestions [ ] = filter_xss ( $ suggestion [ 'text' ] ) ; } return new JsonResponse ( $ suggestions ) ; } | Execute the completion suggestion and return the response in JSON . |
27,663 | public function addItem ( $ level , $ path ) { $ items = $ this -> getItems ( ) ; $ item = new Shopgate_Model_Abstract ( ) ; $ item -> setData ( 'level' , $ level ) ; $ item -> setData ( 'path' , $ path ) ; array_push ( $ items , $ item ) ; $ this -> setItems ( $ items ) ; } | add category path |
27,664 | public function actionCreate ( ) { $ model = new Account ( ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> save ( ) ) { return $ this -> redirect ( [ 'view' , 'id' => $ model -> account_id ] ) ; } else { return $ this -> render ( 'create' , [ 'model' => $ model , ] ) ; } } | Creates a new Account model . If creation is successful the browser will be redirected to the view page . |
27,665 | public function setProxy ( $ proxy_url , $ socks5 = false ) { curl_setopt ( $ this -> ch , CURLOPT_PROXY , $ proxy_url ) ; if ( $ socks5 ) { curl_setopt ( $ this -> ch , CURLOPT_PROXYTYPE , CURLPROXY_SOCKS5 ) ; } } | Set proxy to use for each curl request |
27,666 | public function sendPostData ( $ url , $ postdata , $ ip = null , $ timeout = 10 ) { curl_setopt ( $ this -> ch , CURLOPT_URL , $ url ) ; curl_setopt ( $ this -> ch , CURLOPT_RETURNTRANSFER , true ) ; if ( $ ip ) { curl_setopt ( $ this -> ch , CURLOPT_INTERFACE , $ ip ) ; } curl_setopt ( $ this -> ch , CURLOPT_TIMEOUT , $ timeout ) ; curl_setopt ( $ this -> ch , CURLOPT_POST , true ) ; $ post_string = is_array ( $ postdata ) ? http_build_query ( $ postdata ) : $ postdata ; curl_setopt ( $ this -> ch , CURLOPT_POSTFIELDS , $ post_string ) ; $ result = curl_exec ( $ this -> ch ) ; if ( $ this -> hasError ( ) ) { return false ; } return $ result ; } | Send post request to target URL |
27,667 | public function fetchIntoFile ( $ url , $ fp , $ ip = null , $ timeout = 5 ) { curl_setopt ( $ this -> ch , CURLOPT_URL , $ url ) ; curl_setopt ( $ this -> ch , CURLOPT_HTTPGET , true ) ; curl_setopt ( $ this -> ch , CURLOPT_FILE , $ fp ) ; if ( $ ip ) { curl_setopt ( $ this -> ch , CURLOPT_INTERFACE , $ ip ) ; } curl_setopt ( $ this -> ch , CURLOPT_TIMEOUT , $ timeout ) ; curl_exec ( $ this -> ch ) ; if ( $ this -> hasError ( ) ) { return false ; } return true ; } | Fetch data from target URL and store it directly into file |
27,668 | public function storeCookies ( $ cookie_file ) { curl_setopt ( $ this -> ch , CURLOPT_COOKIEJAR , $ cookie_file ) ; curl_setopt ( $ this -> ch , CURLOPT_COOKIEFILE , $ cookie_file ) ; } | Set file location where cookie data will be stored on curl handle close and then parsed and send along on new requests |
27,669 | public function setCookie ( $ cookie ) { if ( is_array ( $ cookie ) ) { $ cookies_data = [ ] ; foreach ( $ cookie as $ key => $ value ) { $ cookies_data [ ] = "{$key}={$value}" ; } $ cookie = implode ( '; ' , $ cookies_data ) ; } curl_setopt ( $ this -> ch , CURLOPT_COOKIE , $ cookie ) ; } | Set custom cookie |
27,670 | public function getRegion ( $ name ) { if ( ! isset ( $ this -> regions [ $ name ] ) ) { $ this -> regions [ $ name ] = new Region ( $ name ) ; } return $ this -> regions [ $ name ] ; } | Get a single region |
27,671 | public function get ( $ name , $ default = '' ) { $ lines = $ this -> getLines ( $ name ) ; if ( count ( $ lines ) === 0 ) { return $ default ; } return $ this -> implode ( $ lines ) ; } | Get joined header values or if missing return a default value |
27,672 | public function getLines ( $ name , $ default = array ( ) ) { $ name = $ this -> normalizeName ( $ name ) ; if ( ! $ this -> existsNormalized ( $ name ) ) { return $ default ; } return $ this -> headers [ $ name ] ; } | Get header lines or if missing return a default array |
27,673 | public function getRequiredLines ( $ name ) { $ name = $ this -> normalizeName ( $ name ) ; if ( ! $ this -> existsNormalized ( $ name ) ) { throw new \ PHPixie \ HTTP \ Exception ( "Header '$name' is not set" ) ; } return $ this -> headers [ $ name ] ; } | Get header lines or if missing throw an exception |
27,674 | public function getPlatform ( ) { switch ( $ this -> getDriver ( ) ) { case 'pdo_mysql' : return new Platform \ Mysql ( ) ; break ; case 'pdo_pgsql' : return new Platform \ Postgresql ( ) ; break ; case 'pdo_sqlite' : return new Platform \ Sqlite ( ) ; break ; case 'pdo_sqlsrv' : return new Platform \ SqlServer ( ) ; break ; default : throw new \ Exception ( sprintf ( 'Unknown platform %s.' , $ this -> getPlatform ( ) ) ) ; break ; } } | Gets platform . |
27,675 | protected function exportCreateTable ( ) { $ table = new Table ( self :: TABLE_NAME , array ( ) , array ( ) , array ( ) , false , array ( ) ) ; $ table -> addColumn ( 'id' , 'string' , array ( 'length' => 64 , 'notnull' => true ) ) ; $ table -> setPrimaryKey ( array ( 'id' ) ) ; $ table -> addColumn ( 'value' , 'string' , array ( 'length' => 64 ) ) ; $ sql = $ this -> getConnection ( ) -> getDatabasePlatform ( ) -> getCreateTableSQL ( $ table , AbstractPlatform :: CREATE_INDEXES ) ; return array_pop ( $ sql ) . ';' . PHP_EOL ; } | Exports create table SQL . |
27,676 | protected function exportInsert ( array $ data ) { $ insertSql = '' ; $ insert = new Insert ( self :: TABLE_NAME ) ; foreach ( $ data as $ id => $ value ) { $ insertSql .= @ $ insert -> values ( array ( 'id' => $ id , 'value' => $ value ) ) -> getSqlString ( $ this -> getPlatform ( ) ) . ';' . PHP_EOL ; } return $ insertSql ; } | Exports insert SQL . |
27,677 | private function getConnection ( ) { if ( ! isset ( $ this -> connections [ $ this -> getDriver ( ) ] ) ) { $ this -> connections [ $ this -> getDriver ( ) ] = DriverManager :: getConnection ( array ( 'driver' => $ this -> getDriver ( ) , 'host' => str_replace ( 'pdo_' , '' , $ this -> getDriver ( ) ) , 'dbname' => 'list' , 'user' => 'list' , 'password' => 'list' , ) ) ; } return $ this -> connections [ $ this -> getDriver ( ) ] ; } | DB config matches docker config . |
27,678 | private function treeOutput ( TreeBase $ tree , Menu $ menu = null ) { $ items = [ ] ; foreach ( $ tree -> getChildren ( ) as $ item ) { $ element = [ ] ; $ input = [ '#prefix' => '<div class="tree-item clearfix">' , '#type' => 'textfield' , '#attributes' => [ 'class' => [ '' ] ] , '#value' => $ item -> getTitle ( ) , '#theme_wrappers' => [ ] , '#suffix' => '<span class="fa fa-times"></span></div>' , ] ; $ element [ 'data' ] = drupal_render ( $ input ) ; $ element [ 'data-item-type' ] = 'node' ; $ element [ 'data-item-id' ] = $ item -> getNodeId ( ) ; $ element [ 'data-mlid' ] = $ item -> getId ( ) ; if ( $ item -> hasChildren ( ) ) { $ elements = $ this -> treeOutput ( $ item ) ; $ element [ 'data' ] .= drupal_render ( $ elements ) ; } $ items [ ] = $ element ; } $ build = [ '#theme' => 'item_list' , '#type' => 'ol' , '#items' => $ items , ] ; if ( $ menu ) { $ build [ '#attributes' ] = [ 'data-menu' => $ menu -> getName ( ) , 'class' => [ 'sortable' ] , ] ; $ build [ '#title' ] = $ menu -> getTitle ( ) ; if ( ! $ tree -> hasChildren ( ) ) { $ build [ '#items' ] = [ ' ' ] ; } } return $ build ; } | Recursively outputs a tree as nested item lists . |
27,679 | public function onPrepareWorkspaceInstallComposer ( WorkspaceEvent $ event , $ eventName , EventDispatcherInterface $ eventDispatcher ) { $ host = $ event -> getHost ( ) ; $ connection = $ this -> ensureConnection ( $ host ) ; $ workspace = $ event -> getWorkspace ( ) ; if ( $ workspace instanceof Workspace === false ) { throw new TaskRuntimeException ( 'The workspace of the host has not been created.' , $ this ) ; } if ( $ connection -> isFile ( $ host -> getPath ( ) . '/composer.phar' ) === false ) { $ eventDispatcher -> dispatch ( AccompliEvents :: LOG , new LogEvent ( LogLevel :: INFO , 'Installing the Composer binary...' , $ eventName , $ this , array ( 'event.task.action' => TaskInterface :: ACTION_IN_PROGRESS ) ) ) ; $ connection -> changeWorkingDirectory ( $ host -> getPath ( ) ) ; $ connection -> putFile ( __DIR__ . '/../Resources/Composer/composer.phar' , $ host -> getPath ( ) . '/composer.phar' ) ; if ( $ connection -> isFile ( $ host -> getPath ( ) . '/composer.phar' ) ) { $ eventDispatcher -> dispatch ( AccompliEvents :: LOG , new LogEvent ( LogLevel :: INFO , 'Installed the Composer binary.' , $ eventName , $ this , array ( 'event.task.action' => TaskInterface :: ACTION_COMPLETED , 'output.resetLine' => true ) ) ) ; } else { throw new TaskRuntimeException ( 'Failed installing the Composer binary.' , $ this ) ; } } $ eventDispatcher -> dispatch ( AccompliEvents :: LOG , new LogEvent ( LogLevel :: INFO , 'Updating the Composer binary.' , $ eventName , $ this , array ( 'event.task.action' => TaskInterface :: ACTION_IN_PROGRESS ) ) ) ; $ connection -> changeWorkingDirectory ( $ host -> getPath ( ) ) ; $ result = $ connection -> executeCommand ( 'php composer.phar self-update' ) ; if ( $ result -> isSuccessful ( ) ) { $ eventDispatcher -> dispatch ( AccompliEvents :: LOG , new LogEvent ( LogLevel :: INFO , 'Updated the Composer binary.' , $ eventName , $ this , array ( 'event.task.action' => TaskInterface :: ACTION_COMPLETED , 'output.resetLine' => true ) ) ) ; } else { $ eventDispatcher -> dispatch ( AccompliEvents :: LOG , new LogEvent ( LogLevel :: WARNING , 'Failed updating the Composer binary.' , $ eventName , $ this , array ( 'event.task.action' => TaskInterface :: ACTION_FAILED ) ) ) ; } $ eventDispatcher -> dispatch ( AccompliEvents :: LOG , new LogEvent ( LogLevel :: DEBUG , "{separator} Command output:{separator}\n{command.result}{separator}" , $ eventName , $ this , array ( 'command.result' => $ result -> getOutput ( ) , 'separator' => "\n=================\n" ) ) ) ; } | Installs or updates the Composer binary . |
27,680 | public function onInstallReleaseExecuteComposerInstall ( InstallReleaseEvent $ event , $ eventName , EventDispatcherInterface $ eventDispatcher ) { $ release = $ event -> getRelease ( ) ; $ host = $ release -> getWorkspace ( ) -> getHost ( ) ; $ connection = $ this -> ensureConnection ( $ host ) ; $ eventDispatcher -> dispatch ( AccompliEvents :: LOG , new LogEvent ( LogLevel :: NOTICE , 'Installing Composer dependencies.' , $ eventName , $ this , array ( 'event.task.action' => TaskInterface :: ACTION_IN_PROGRESS ) ) ) ; $ authenticationFile = $ release -> getPath ( ) . '/auth.json' ; if ( empty ( $ this -> authentication ) === false ) { $ connection -> putContents ( $ authenticationFile , json_encode ( $ this -> authentication ) ) ; } $ connection -> changeWorkingDirectory ( $ host -> getPath ( ) ) ; $ result = $ connection -> executeCommand ( sprintf ( 'php composer.phar install --no-interaction --working-dir="%s" --no-dev --no-scripts --optimize-autoloader' , $ release -> getPath ( ) ) ) ; if ( $ connection -> isFile ( $ authenticationFile ) ) { $ connection -> delete ( $ authenticationFile ) ; } if ( $ result -> isSuccessful ( ) ) { $ eventDispatcher -> dispatch ( AccompliEvents :: LOG , new LogEvent ( LogLevel :: NOTICE , 'Installed Composer dependencies.' , $ eventName , $ this , array ( 'event.task.action' => TaskInterface :: ACTION_COMPLETED , 'output.resetLine' => true ) ) ) ; $ eventDispatcher -> dispatch ( AccompliEvents :: LOG , new LogEvent ( LogLevel :: DEBUG , "{separator} Command output:{separator}\n{command.result}{separator}" , $ eventName , $ this , array ( 'command.result' => $ result -> getOutput ( ) , 'separator' => "\n=================\n" ) ) ) ; } else { throw new TaskCommandExecutionException ( 'Failed installing Composer dependencies.' , $ result , $ this ) ; } } | Runs the Composer install command to install the dependencies for the release . |
27,681 | public static function numberFormat ( $ number , $ decimals = 0 ) { return is_numeric ( $ number ) ? number_format ( $ number , $ decimals , __ ( 'lang_decimal_point' ) , __ ( 'lang_thousands_sep' ) ) : $ number ; } | A wrapper for PHP s number_format function |
27,682 | public static function ucpPregReplace ( $ pattern , $ replace , $ subject , $ callback = false ) { if ( $ callback ) { $ replaced = preg_replace_callback ( $ pattern , create_function ( '$matches' , 'return ' . $ replace . ';' ) , $ subject ) ; } else { $ replaced = preg_replace ( $ pattern , $ replace , $ subject ) ; } if ( $ replaced === false ) { if ( is_array ( $ pattern ) ) { foreach ( $ pattern as $ cur_key => $ cur_pattern ) { $ pattern [ $ cur_key ] = str_replace ( '\p{L}\p{N}' , '\w' , $ cur_pattern ) ; } $ replaced = preg_replace ( $ pattern , $ replace , $ subject ) ; } else { $ replaced = preg_replace ( str_replace ( '\p{L}\p{N}' , '\w' , $ pattern ) , $ replace , $ subject ) ; } } return $ replaced ; } | Replace string matching regular expression This function takes care of possibly disabled unicode properties in PCRE builds |
27,683 | public static function fileSize ( $ size ) { $ units = [ 'B' , 'KiB' , 'MiB' , 'GiB' , 'TiB' , 'PiB' , 'EiB' ] ; for ( $ i = 0 ; $ size > 1024 ; $ i ++ ) { $ size /= 1024 ; } return __ ( 'Size unit ' . $ units [ $ i ] , round ( $ size , 2 ) ) ; } | Converts the file size in bytes to a human readable file size |
27,684 | public static function generatePageTitle ( $ page_title , $ p = null ) { if ( ! is_array ( $ page_title ) ) { $ page_title = [ $ page_title ] ; } $ page_title = array_reverse ( $ page_title ) ; if ( $ p > 1 ) { $ page_title [ 0 ] .= ' (' . sprintf ( __ ( 'Page' ) , self :: numberFormat ( $ p ) ) . ')' ; } $ crumbs = implode ( __ ( 'Title separator' ) , $ page_title ) ; return $ crumbs ; } | Generate browser s title |
27,685 | public static function getTitle ( $ title = '' , $ name = '' , $ groupTitle = '' , $ gid = 0 ) { static $ ban_list ; if ( empty ( $ ban_list ) ) { $ ban_list = [ ] ; foreach ( Container :: get ( 'bans' ) as $ cur_ban ) { $ ban_list [ ] = utf8_strtolower ( $ cur_ban [ 'username' ] ) ; } } if ( $ title != '' ) { $ user_title = self :: escape ( $ title ) ; } elseif ( in_array ( utf8_strtolower ( $ name ) , $ ban_list ) ) { $ user_title = __ ( 'Banned' ) ; } elseif ( $ groupTitle != '' ) { $ user_title = self :: escape ( $ groupTitle ) ; } elseif ( $ gid == ForumEnv :: get ( 'FEATHER_GUEST' ) ) { $ user_title = __ ( 'Guest' ) ; } else { $ user_title = __ ( 'Member' ) ; } return $ user_title ; } | Determines the correct user title |
27,686 | public static function generateAvatarMarkup ( $ user_id ) { $ filetypes = [ 'jpg' , 'gif' , 'png' ] ; $ avatar_markup = '' ; foreach ( $ filetypes as $ cur_type ) { $ path = ForumSettings :: get ( 'o_avatars_dir' ) . '/' . $ user_id . '.' . $ cur_type ; if ( file_exists ( ForumEnv :: get ( 'WEB_ROOT' ) . $ path ) && $ img_size = getimagesize ( ForumEnv :: get ( 'WEB_ROOT' ) . $ path ) ) { $ avatar_markup = '<img class="avatar" src="' . \ RunBB \ Core \ Utils :: escape ( Container :: get ( 'url' ) -> base ( ) . $ path . '?m=' . filemtime ( ForumEnv :: get ( 'WEB_ROOT' ) . $ path ) ) . '" ' . $ img_size [ 3 ] . ' alt="" />' ; break ; } } return $ avatar_markup ; } | Outputs markup to display a user s avatar |
27,687 | public function onPrepareWorkspaceConstructWorkspaceInstance ( WorkspaceEvent $ event , $ eventName , EventDispatcherInterface $ eventDispatcher ) { $ eventDispatcher -> dispatch ( AccompliEvents :: LOG , new LogEvent ( LogLevel :: NOTICE , 'Creating Workspace.' , $ eventName , $ this , array ( 'event.task.action' => TaskInterface :: ACTION_IN_PROGRESS ) ) ) ; $ workspace = new Workspace ( $ event -> getHost ( ) ) ; $ workspace -> setReleasesDirectory ( $ this -> releasesDirectory ) ; $ workspace -> setDataDirectory ( $ this -> dataDirectory ) ; $ workspace -> setCacheDirectory ( $ this -> cacheDirectory ) ; $ workspace -> setOtherDirectories ( $ this -> otherDirectories ) ; $ event -> setWorkspace ( $ workspace ) ; $ eventDispatcher -> dispatch ( AccompliEvents :: LOG , new LogEvent ( LogLevel :: NOTICE , 'Created Workspace.' , $ eventName , $ this , array ( 'event.task.action' => TaskInterface :: ACTION_COMPLETED , 'output.resetLine' => true ) ) ) ; } | Constructs a new Workspace instance and sets the Workspace on the event . |
27,688 | public function onPrepareWorkspaceCreateWorkspace ( WorkspaceEvent $ event , $ eventName , EventDispatcherInterface $ eventDispatcher ) { $ workspace = $ event -> getWorkspace ( ) ; $ connection = $ this -> ensureConnection ( $ workspace -> getHost ( ) ) ; $ workspacePath = $ workspace -> getHost ( ) -> getPath ( ) ; if ( $ connection -> isDirectory ( $ workspacePath ) === false && $ connection -> createDirectory ( $ workspacePath ) === false ) { throw new TaskRuntimeException ( sprintf ( 'The workspace path "%s" does not exist and could not be created.' , $ workspacePath ) , $ this ) ; } $ directories = array_merge ( array ( $ workspace -> getReleasesDirectory ( ) , $ workspace -> getDataDirectory ( ) , $ workspace -> getCacheDirectory ( ) , ) , $ workspace -> getOtherDirectories ( ) ) ; foreach ( $ directories as $ directory ) { $ context = array ( 'directory' => $ directory , 'event.task.action' => TaskInterface :: ACTION_IN_PROGRESS ) ; $ eventDispatcher -> dispatch ( AccompliEvents :: LOG , new LogEvent ( LogLevel :: INFO , 'Creating directory "{directory}".' , $ eventName , $ this , $ context ) ) ; if ( $ connection -> isDirectory ( $ directory ) === false ) { if ( $ connection -> createDirectory ( $ directory ) ) { $ context [ 'event.task.action' ] = TaskInterface :: ACTION_COMPLETED ; $ context [ 'output.resetLine' ] = true ; $ eventDispatcher -> dispatch ( AccompliEvents :: LOG , new LogEvent ( LogLevel :: INFO , 'Created directory "{directory}".' , $ eventName , $ this , $ context ) ) ; } else { $ context [ 'event.task.action' ] = TaskInterface :: ACTION_FAILED ; $ context [ 'output.resetLine' ] = true ; $ eventDispatcher -> dispatch ( AccompliEvents :: LOG , new LogEvent ( LogLevel :: WARNING , 'Failed creating directory "{directory}".' , $ eventName , $ this , $ context ) ) ; } } else { $ context [ 'event.task.action' ] = TaskInterface :: ACTION_COMPLETED ; $ context [ 'output.resetLine' ] = true ; $ eventDispatcher -> dispatch ( AccompliEvents :: LOG , new LogEvent ( LogLevel :: INFO , 'Directory "{directory}" exists.' , $ eventName , $ this , $ context ) ) ; } } } | Creates the workspace directories when not already existing . |
27,689 | public function getCompetitivePricingForASIN ( $ request ) { if ( ! ( $ request instanceof MarketplaceWebServiceProducts_Model_GetCompetitivePricingForASINRequest ) ) { require_once ( dirname ( __FILE__ ) . '/Model/GetCompetitivePricingForASINRequest.php' ) ; $ request = new MarketplaceWebServiceProducts_Model_GetCompetitivePricingForASINRequest ( $ request ) ; } $ parameters = $ request -> toQueryParameterArray ( ) ; $ parameters [ 'Action' ] = 'GetCompetitivePricingForASIN' ; $ httpResponse = $ this -> _invoke ( $ parameters ) ; require_once ( dirname ( __FILE__ ) . '/Model/GetCompetitivePricingForASINResponse.php' ) ; $ response = MarketplaceWebServiceProducts_Model_GetCompetitivePricingForASINResponse :: fromXML ( $ httpResponse [ 'ResponseBody' ] ) ; $ response -> setResponseHeaderMetadata ( $ httpResponse [ 'ResponseHeaderMetadata' ] ) ; return $ response ; } | Get Competitive Pricing For ASIN Gets competitive pricing and related information for a product identified by the MarketplaceId and ASIN . |
27,690 | private function _convertGetCompetitivePricingForASIN ( $ request ) { $ parameters = array ( ) ; $ parameters [ 'Action' ] = 'GetCompetitivePricingForASIN' ; if ( $ request -> isSetSellerId ( ) ) { $ parameters [ 'SellerId' ] = $ request -> getSellerId ( ) ; } if ( $ request -> isSetMWSAuthToken ( ) ) { $ parameters [ 'MWSAuthToken' ] = $ request -> getMWSAuthToken ( ) ; } if ( $ request -> isSetMarketplaceId ( ) ) { $ parameters [ 'MarketplaceId' ] = $ request -> getMarketplaceId ( ) ; } if ( $ request -> isSetASINList ( ) ) { $ ASINListGetCompetitivePricingForASINRequest = $ request -> getASINList ( ) ; foreach ( $ ASINListGetCompetitivePricingForASINRequest -> getASIN ( ) as $ ASINASINListIndex => $ ASINASINList ) { $ parameters [ 'ASINList' . '.' . 'ASIN' . '.' . ( $ ASINASINListIndex + 1 ) ] = $ ASINASINList ; } } return $ parameters ; } | Convert GetCompetitivePricingForASINRequest to name value pairs |
27,691 | public function getCompetitivePricingForSKU ( $ request ) { if ( ! ( $ request instanceof MarketplaceWebServiceProducts_Model_GetCompetitivePricingForSKURequest ) ) { require_once ( dirname ( __FILE__ ) . '/Model/GetCompetitivePricingForSKURequest.php' ) ; $ request = new MarketplaceWebServiceProducts_Model_GetCompetitivePricingForSKURequest ( $ request ) ; } $ parameters = $ request -> toQueryParameterArray ( ) ; $ parameters [ 'Action' ] = 'GetCompetitivePricingForSKU' ; $ httpResponse = $ this -> _invoke ( $ parameters ) ; require_once ( dirname ( __FILE__ ) . '/Model/GetCompetitivePricingForSKUResponse.php' ) ; $ response = MarketplaceWebServiceProducts_Model_GetCompetitivePricingForSKUResponse :: fromXML ( $ httpResponse [ 'ResponseBody' ] ) ; $ response -> setResponseHeaderMetadata ( $ httpResponse [ 'ResponseHeaderMetadata' ] ) ; return $ response ; } | Get Competitive Pricing For SKU Gets competitive pricing and related information for a product identified by the SellerId and SKU . |
27,692 | private function _convertGetCompetitivePricingForSKU ( $ request ) { $ parameters = array ( ) ; $ parameters [ 'Action' ] = 'GetCompetitivePricingForSKU' ; if ( $ request -> isSetSellerId ( ) ) { $ parameters [ 'SellerId' ] = $ request -> getSellerId ( ) ; } if ( $ request -> isSetMWSAuthToken ( ) ) { $ parameters [ 'MWSAuthToken' ] = $ request -> getMWSAuthToken ( ) ; } if ( $ request -> isSetMarketplaceId ( ) ) { $ parameters [ 'MarketplaceId' ] = $ request -> getMarketplaceId ( ) ; } if ( $ request -> isSetSellerSKUList ( ) ) { $ SellerSKUListGetCompetitivePricingForSKURequest = $ request -> getSellerSKUList ( ) ; foreach ( $ SellerSKUListGetCompetitivePricingForSKURequest -> getSellerSKU ( ) as $ SellerSKUSellerSKUListIndex => $ SellerSKUSellerSKUList ) { $ parameters [ 'SellerSKUList' . '.' . 'SellerSKU' . '.' . ( $ SellerSKUSellerSKUListIndex + 1 ) ] = $ SellerSKUSellerSKUList ; } } return $ parameters ; } | Convert GetCompetitivePricingForSKURequest to name value pairs |
27,693 | public function getLowestOfferListingsForASIN ( $ request ) { if ( ! ( $ request instanceof MarketplaceWebServiceProducts_Model_GetLowestOfferListingsForASINRequest ) ) { require_once ( dirname ( __FILE__ ) . '/Model/GetLowestOfferListingsForASINRequest.php' ) ; $ request = new MarketplaceWebServiceProducts_Model_GetLowestOfferListingsForASINRequest ( $ request ) ; } $ parameters = $ request -> toQueryParameterArray ( ) ; $ parameters [ 'Action' ] = 'GetLowestOfferListingsForASIN' ; $ httpResponse = $ this -> _invoke ( $ parameters ) ; require_once ( dirname ( __FILE__ ) . '/Model/GetLowestOfferListingsForASINResponse.php' ) ; $ response = MarketplaceWebServiceProducts_Model_GetLowestOfferListingsForASINResponse :: fromXML ( $ httpResponse [ 'ResponseBody' ] ) ; $ response -> setResponseHeaderMetadata ( $ httpResponse [ 'ResponseHeaderMetadata' ] ) ; return $ response ; } | Get Lowest Offer Listings For ASIN Gets some of the lowest prices based on the product identified by the given MarketplaceId and ASIN . |
27,694 | private function _convertGetLowestOfferListingsForASIN ( $ request ) { $ parameters = array ( ) ; $ parameters [ 'Action' ] = 'GetLowestOfferListingsForASIN' ; if ( $ request -> isSetSellerId ( ) ) { $ parameters [ 'SellerId' ] = $ request -> getSellerId ( ) ; } if ( $ request -> isSetMWSAuthToken ( ) ) { $ parameters [ 'MWSAuthToken' ] = $ request -> getMWSAuthToken ( ) ; } if ( $ request -> isSetMarketplaceId ( ) ) { $ parameters [ 'MarketplaceId' ] = $ request -> getMarketplaceId ( ) ; } if ( $ request -> isSetASINList ( ) ) { $ ASINListGetLowestOfferListingsForASINRequest = $ request -> getASINList ( ) ; foreach ( $ ASINListGetLowestOfferListingsForASINRequest -> getASIN ( ) as $ ASINASINListIndex => $ ASINASINList ) { $ parameters [ 'ASINList' . '.' . 'ASIN' . '.' . ( $ ASINASINListIndex + 1 ) ] = $ ASINASINList ; } } if ( $ request -> isSetItemCondition ( ) ) { $ parameters [ 'ItemCondition' ] = $ request -> getItemCondition ( ) ; } if ( $ request -> isSetExcludeMe ( ) ) { $ parameters [ 'ExcludeMe' ] = $ request -> getExcludeMe ( ) ? "true" : "false" ; } return $ parameters ; } | Convert GetLowestOfferListingsForASINRequest to name value pairs |
27,695 | private function _convertGetLowestOfferListingsForSKU ( $ request ) { $ parameters = array ( ) ; $ parameters [ 'Action' ] = 'GetLowestOfferListingsForSKU' ; if ( $ request -> isSetSellerId ( ) ) { $ parameters [ 'SellerId' ] = $ request -> getSellerId ( ) ; } if ( $ request -> isSetMWSAuthToken ( ) ) { $ parameters [ 'MWSAuthToken' ] = $ request -> getMWSAuthToken ( ) ; } if ( $ request -> isSetMarketplaceId ( ) ) { $ parameters [ 'MarketplaceId' ] = $ request -> getMarketplaceId ( ) ; } if ( $ request -> isSetSellerSKUList ( ) ) { $ SellerSKUListGetLowestOfferListingsForSKURequest = $ request -> getSellerSKUList ( ) ; foreach ( $ SellerSKUListGetLowestOfferListingsForSKURequest -> getSellerSKU ( ) as $ SellerSKUSellerSKUListIndex => $ SellerSKUSellerSKUList ) { $ parameters [ 'SellerSKUList' . '.' . 'SellerSKU' . '.' . ( $ SellerSKUSellerSKUListIndex + 1 ) ] = $ SellerSKUSellerSKUList ; } } if ( $ request -> isSetItemCondition ( ) ) { $ parameters [ 'ItemCondition' ] = $ request -> getItemCondition ( ) ; } if ( $ request -> isSetExcludeMe ( ) ) { $ parameters [ 'ExcludeMe' ] = $ request -> getExcludeMe ( ) ? "true" : "false" ; } return $ parameters ; } | Convert GetLowestOfferListingsForSKURequest to name value pairs |
27,696 | private function _convertGetMatchingProduct ( $ request ) { $ parameters = array ( ) ; $ parameters [ 'Action' ] = 'GetMatchingProduct' ; if ( $ request -> isSetSellerId ( ) ) { $ parameters [ 'SellerId' ] = $ request -> getSellerId ( ) ; } if ( $ request -> isSetMWSAuthToken ( ) ) { $ parameters [ 'MWSAuthToken' ] = $ request -> getMWSAuthToken ( ) ; } if ( $ request -> isSetMarketplaceId ( ) ) { $ parameters [ 'MarketplaceId' ] = $ request -> getMarketplaceId ( ) ; } if ( $ request -> isSetASINList ( ) ) { $ ASINListGetMatchingProductRequest = $ request -> getASINList ( ) ; foreach ( $ ASINListGetMatchingProductRequest -> getASIN ( ) as $ ASINASINListIndex => $ ASINASINList ) { $ parameters [ 'ASINList' . '.' . 'ASIN' . '.' . ( $ ASINASINListIndex + 1 ) ] = $ ASINASINList ; } } return $ parameters ; } | Convert GetMatchingProductRequest to name value pairs |
27,697 | private function _convertGetMatchingProductForId ( $ request ) { $ parameters = array ( ) ; $ parameters [ 'Action' ] = 'GetMatchingProductForId' ; if ( $ request -> isSetSellerId ( ) ) { $ parameters [ 'SellerId' ] = $ request -> getSellerId ( ) ; } if ( $ request -> isSetMWSAuthToken ( ) ) { $ parameters [ 'MWSAuthToken' ] = $ request -> getMWSAuthToken ( ) ; } if ( $ request -> isSetMarketplaceId ( ) ) { $ parameters [ 'MarketplaceId' ] = $ request -> getMarketplaceId ( ) ; } if ( $ request -> isSetIdType ( ) ) { $ parameters [ 'IdType' ] = $ request -> getIdType ( ) ; } if ( $ request -> isSetIdList ( ) ) { $ IdListGetMatchingProductForIdRequest = $ request -> getIdList ( ) ; foreach ( $ IdListGetMatchingProductForIdRequest -> getId ( ) as $ IdIdListIndex => $ IdIdList ) { $ parameters [ 'IdList' . '.' . 'Id' . '.' . ( $ IdIdListIndex + 1 ) ] = $ IdIdList ; } } return $ parameters ; } | Convert GetMatchingProductForIdRequest to name value pairs |
27,698 | private function _convertGetMyPriceForASIN ( $ request ) { $ parameters = array ( ) ; $ parameters [ 'Action' ] = 'GetMyPriceForASIN' ; if ( $ request -> isSetSellerId ( ) ) { $ parameters [ 'SellerId' ] = $ request -> getSellerId ( ) ; } if ( $ request -> isSetMWSAuthToken ( ) ) { $ parameters [ 'MWSAuthToken' ] = $ request -> getMWSAuthToken ( ) ; } if ( $ request -> isSetMarketplaceId ( ) ) { $ parameters [ 'MarketplaceId' ] = $ request -> getMarketplaceId ( ) ; } if ( $ request -> isSetASINList ( ) ) { $ ASINListGetMyPriceForASINRequest = $ request -> getASINList ( ) ; foreach ( $ ASINListGetMyPriceForASINRequest -> getASIN ( ) as $ ASINASINListIndex => $ ASINASINList ) { $ parameters [ 'ASINList' . '.' . 'ASIN' . '.' . ( $ ASINASINListIndex + 1 ) ] = $ ASINASINList ; } } return $ parameters ; } | Convert GetMyPriceForASINRequest to name value pairs |
27,699 | private function _convertGetMyPriceForSKU ( $ request ) { $ parameters = array ( ) ; $ parameters [ 'Action' ] = 'GetMyPriceForSKU' ; if ( $ request -> isSetSellerId ( ) ) { $ parameters [ 'SellerId' ] = $ request -> getSellerId ( ) ; } if ( $ request -> isSetMWSAuthToken ( ) ) { $ parameters [ 'MWSAuthToken' ] = $ request -> getMWSAuthToken ( ) ; } if ( $ request -> isSetMarketplaceId ( ) ) { $ parameters [ 'MarketplaceId' ] = $ request -> getMarketplaceId ( ) ; } if ( $ request -> isSetSellerSKUList ( ) ) { $ SellerSKUListGetMyPriceForSKURequest = $ request -> getSellerSKUList ( ) ; foreach ( $ SellerSKUListGetMyPriceForSKURequest -> getSellerSKU ( ) as $ SellerSKUSellerSKUListIndex => $ SellerSKUSellerSKUList ) { $ parameters [ 'SellerSKUList' . '.' . 'SellerSKU' . '.' . ( $ SellerSKUSellerSKUListIndex + 1 ) ] = $ SellerSKUSellerSKUList ; } } return $ parameters ; } | Convert GetMyPriceForSKURequest to name value pairs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.