60 $this->SapeCommonApi =
get_package(
'sape::sape_common_api' ,
'last' , __FILE__ );
61 $this->SapeUtilities =
get_package(
'sape::sape_utilities' ,
'last' , __FILE__ );
62 $this->Security =
get_package(
'security' ,
'last' , __FILE__ );
92 $Response = $this->SapeUtilities->call_method(
93 $this->SapeCommonApi->Client ,
'sape.get_projects' , array() ,
'Can\'t get projects'
96 return( php_xmlrpc_decode( $Response->value() ) );
134 $ProjectId = $this->Security->get( $ProjectId ,
'integer' );
135 $Days = $this->Security->get( $Days ,
'integer' );
137 $Parameters = array(
new xmlrpcval( $ProjectId ,
'int' ) ,
new xmlrpcval( $Days ,
'string' ) );
139 $Response = $this->SapeUtilities->call_method(
140 $this->SapeCommonApi->Client ,
'sape.get_placements_new_prices' ,
141 $Parameters ,
'Can\'t get placements'
144 return( php_xmlrpc_decode( $Response->value() ) );
146 catch( Exception $e )
174 if( isset( $LinkIds[ 0 ] ) ===
false )
179 $LinkIds = $this->Security->get( $LinkIds ,
'integer' );
181 $LinksToDelete = array();
183 foreach( $LinkIds as $i => $id )
185 $LinksToDelete [] =
new xmlrpcval( $id ,
'string' );
188 $Parameters = array(
new xmlrpcval( $LinksToDelete ,
'array' ) );
190 $Response = $this->SapeUtilities->call_method(
191 $this->SapeCommonApi->Client ,
'sape.placements_delete' , $Parameters ,
'Can\'t delete links'
194 return( php_xmlrpc_decode( $Response->value() ) );
196 catch( Exception $e )
228 $ProjectId = $this->Security->get( $ProjectId ,
'integer' );
230 $Parameters = array(
new xmlrpcval( $ProjectId ,
'int' ) ,
new xmlrpcval(
false ,
'boolean' ) );
232 $Response = $this->SapeUtilities->call_method(
233 $this->SapeCommonApi->Client ,
'sape.get_urls' , $Parameters ,
'Can\'t get URLs'
236 return( php_xmlrpc_decode( $Response->value() ) );
238 catch( Exception $e )
270 $URLId = $this->Security->get( $URLId ,
'integer' );
273 new xmlrpcval( $URLId ,
'int' ) ,
new xmlrpcval(
'' ,
'string' ) ,
274 new xmlrpcval(
'' ,
'string' ) ,
new xmlrpcval(
'' ,
'string' ) ,
new xmlrpcval( 0 ,
'int' )
277 $Response = $this->SapeUtilities->call_method(
278 $this->SapeCommonApi->Client ,
'sape.get_url_links' , $Parameters ,
'Can\'t get links'
281 return( php_xmlrpc_decode( $Response->value() ) );
283 catch( Exception $e )
319 $ProjectId = $this->Security->get( $ProjectId ,
'integer' );
321 $URL = $this->Security->get( $URL ,
'string' );
323 $Name = $this->Security->get( $Name ,
'string' );
326 new xmlrpcval( $ProjectId ,
'int' ) ,
new xmlrpcval( $URL ,
'string' ) ,
327 new xmlrpcval( $Name ,
'string' )
330 $this->SapeUtilities->call_method(
331 $this->SapeCommonApi->Client ,
'sape.url_add' , $Parameters ,
'Can\'t add URL'
334 catch( Exception $e )
366 $URLId = $this->Security->get( $URLId ,
'integer' );
368 $Params = $this->Security->get( $Params ,
'string' );
370 $ParamsHash = array();
372 foreach( $Params as $Key => $Value )
374 $ParamsHash[ $Key ] =
new xmlrpcval( $Value ,
'string' );
377 $Parameters = array(
new xmlrpcval( $URLId ,
'int' ) ,
new xmlrpcval( $ParamsHash ,
'array' ) );
379 $Response = $this->SapeUtilities->call_method(
380 $this->SapeCommonApi->Client ,
'sape.url_update' , $Parameters ,
'Can\'t update URL'
383 return( php_xmlrpc_decode( $Response->value() ) );
385 catch( Exception $e )
413 $URLId = $this->Security->get( $URLId ,
'integer' );
415 $Parameters = array(
new xmlrpcval( $URLId ,
'int' ) );
417 $this->SapeUtilities->call_method(
418 $this->SapeCommonApi->Client ,
'sape.url_delete' , $Parameters ,
'Can\'t delete URL'
421 catch( Exception $e )
453 $URLId = $this->Security->get( $URLId ,
'integer' );
455 $Parameters = array(
new xmlrpcval( $URLId ,
'int' ) );
457 $Response = $this->SapeUtilities->call_method(
458 $this->SapeCommonApi->Client ,
'sape.get_url_anchors' , $Parameters ,
'Can\'t get url anchors'
461 return( php_xmlrpc_decode( $Response->value() ) );
463 catch( Exception $e )
495 $URLId = $this->Security->get( $URLId ,
'integer' );
497 $AnchorIds = $this->Security->get( $URLId ,
'AnchorIds' );
501 foreach( $AnchorIds as $i => $Anchor )
503 $Anchors [] =
new xmlrpcval( $Anchor ,
'int' );
506 $Parameters = array(
new xmlrpcval( $URLId ,
'int' ) ,
new xmlrpcval( $Anchors ,
'array' ) );
508 $this->SapeUtilities->call_method(
509 $this->SapeCommonApi->Client ,
'sape.url_anchors_delete' , $Parameters ,
'Can\'t delete anchors'
512 catch( Exception $e )
548 $URLId = $this->Security->get( $URLId ,
'integer' );
550 $Auto = $Auto ?
true :
false;
552 $RequireConfirm = $RequireConfirm ?
true :
false;
555 new xmlrpcval( $URLId ,
'int' ) ,
new xmlrpcval( $Auto ,
'boolean' ) ,
556 new xmlrpcval( $RequireConfirm ,
'boolean' )
559 $Response = $this->SapeUtilities->call_method(
560 $this->SapeCommonApi->Client ,
'sape.url_set_autoseo' , $Parameters ,
'Can\'t set auto mode'
563 return( php_xmlrpc_decode( $Response->value() ) );
565 catch( Exception $e )
609 private function filter_auto_create_parameters( $FilterId , $URLId , $Quant , $Price , $DailyQuota )
613 $FilterId = $this->Security->get( $FilterId ,
'integer' );
614 $URLId = $this->Security->get( $URLId ,
'integer' );
615 $Quant = $this->Security->get( $Quant ,
'integer' );
616 $Price = $this->Security->get( $Price ,
'float' );
617 $DailyQuota = $this->Security->get( $DailyQuota ,
'integer' );
618 $DailyQuota = $DailyQuota == 0 ? ( 255 <= $Quant ? 255 : $Quant ) : $DailyQuota;
621 new xmlrpcval( $FilterId ,
'int' ) ,
new xmlrpcval( $URLId ,
'int' ) ,
622 new xmlrpcval( $Quant ,
'int' ) ,
new xmlrpcval( $Price ,
'int' ) ,
623 new xmlrpcval( $DailyQuota ,
'int' )
626 catch( Exception $e )
670 $Parameters = $this->filter_auto_create_parameters(
671 $FilterId , $URLId , $Quant , $Price , $DailyQuota
674 $this->SapeUtilities->call_method(
675 $this->SapeCommonApi->Client ,
'sape.filter_auto_create' , $Parameters ,
'Can\'t create auto filter'
678 catch( Exception $e )
718 private function filter_auto_update_parameters( $FilterAutoId , $Quant , $Price , $DailyQuota )
722 $FilterAutoId = $this->Security->get( $FilterAutoId ,
'integer' );
723 $Quant = $this->Security->get( $Quant ,
'integer' );
724 $Price = $this->Security->get( $Price ,
'float' );
725 $DailyQuota = $this->Security->get( $DailyQuota ,
'integer' );
726 $DailyQuota = $DailyQuota == 0 ? ( 255 <= $Quant ? 255 : $Quant ) : $DailyQuota;
729 new xmlrpcval( $FilterAutoId ,
'int' ) ,
new xmlrpcval( $Quant ,
'int' ) ,
730 new xmlrpcval( $Price ,
'int' ) ,
new xmlrpcval( $DailyQuota ,
'int' )
733 return( $Parameters );
735 catch( Exception $e )
775 $Parameters = $this->filter_auto_update_parameters( $FilterAutoId , $Quant , $Price , $DailyQuota );
777 $this->SapeUtilities->call_method(
778 $this->SapeCommonApi->Client ,
'sape.filter_auto_update' , $Parameters ,
'Can\'t update auto filter'
781 catch( Exception $e )
809 $FilterAutoId = $this->Security->get( $FilterAutoId ,
'integer' );
811 $Parameters = array(
new xmlrpcval( $FilterAutoId ,
'int' ) );
813 $this->SapeUtilities->call_method(
814 $this->SapeCommonApi->Client ,
'sape.filter_auto_delete' , $Parameters ,
'Can\'t delete auto filter'
817 catch( Exception $e )
845 $URLId = $this->Security->get( $URLId ,
'integer' );
847 $Parameters = array(
new xmlrpcval( $URLId ,
'int' ) ,
new xmlrpcval(
true ,
'boolean' ) );
849 $Response = $this->SapeUtilities->call_method(
850 $this->SapeCommonApi->Client ,
'sape.get_filters_auto' , $Parameters ,
'Can\'t get auto filters'
853 return( php_xmlrpc_decode( $Response->value() ) );
855 catch( Exception $e )