How to use logic class

Best Atoum code snippet using logic

Techanalysis.php

Source:Techanalysis.php Github

copy

Full Screen

1<?php2namespace Helpers;3use Log;4$answerHauts=array('','A','C','D','C','B','A','04','03','02','16','19','16','B','B','*','D','A','B','B','A','D','D','D','D');5$answerJuniors=array('','C','D','C','C','D','B','D','A','C','19','02','03','07','A','B','D','C','B','D','A','C','A');6Class Techanalysis{7 protected static $juniors=array(8 '1'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>2,'Analysis'=>0),9 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>2,'Analysis'=>0),10 'C'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>6),11 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>3,'Analysis'=>4) ),12 '2'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>1),13 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>2),14 'C'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>3),15 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>5) ),16 '3'=>array( 'A'=> array('OutBox'=>3,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>3),17 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),18 'C'=> array('OutBox'=>6,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>6),19 'D'=> array('OutBox'=>3,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>3) ),20 '4'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),21 'B'=> array('OutBox'=>3,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>3),22 'C'=> array('OutBox'=>6,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>6),23 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0) ),24 '5'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),25 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),26 'C'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),27 'D'=> array('OutBox'=>0,'Maths'=>2,'Crypto'=>0,'Logic'=>4,'Analysis'=>4) ),28 '6'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),29 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>3,'Analysis'=>5),30 'C'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),31 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0) ),32 '7'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),33 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),34 'C'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>2,'Analysis'=>3),35 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>6) ),36 '8'=>array( 'A'=> array('OutBox'=>2,'Maths'=>0,'Crypto'=>0,'Logic'=>5,'Analysis'=>5),37 'B'=> array('OutBox'=>1,'Maths'=>0,'Crypto'=>0,'Logic'=>3,'Analysis'=>3),38 'C'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),39 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0) ),40 '9'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>2,'Logic'=>0,'Analysis'=>0),41 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>2,'Logic'=>0,'Analysis'=>0),42 'C'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>6,'Logic'=>0,'Analysis'=>2),43 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>2,'Logic'=>0,'Analysis'=>6) ),44 '10'=>array( '19'=> array('OutBox'=>0,'Maths'=>2,'Crypto'=>0,'Logic'=>4,'Analysis'=>5),45 '20'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),46 '21'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),47 '22'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),48 '23'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),49 '24'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),50 '25'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),51 '26'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),52 '27'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),53 '28'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),54 '29'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),55 '30'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),56 '31'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),57 '32'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),58 '33'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),59 '34'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),60 '35'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),61 '36'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),62 '37'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),63 '38'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0)),64 '11'=>array( '02'=> array('OutBox'=>6,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>4),65 '03'=> array('OutBox'=>6,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>2) ),66 '12'=>array( '03'=> array('OutBox'=>0,'Maths'=>8,'Crypto'=>0,'Logic'=>0,'Analysis'=>4),67 '04'=> array('OutBox'=>0,'Maths'=>6,'Crypto'=>0,'Logic'=>0,'Analysis'=>2),68 '05'=> array('OutBox'=>0,'Maths'=>4,'Crypto'=>0,'Logic'=>0,'Analysis'=>1) ),69 '13'=>array( '07'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>7),70 '08'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>3,'Analysis'=>4) ),71 '14'=>array( 'A'=> array('OutBox'=>0,'Maths'=>2,'Crypto'=>0,'Logic'=>3,'Analysis'=>3),72 'B'=> array('OutBox'=>0,'Maths'=>1,'Crypto'=>0,'Logic'=>1,'Analysis'=>1),73 'C'=> array('OutBox'=>0,'Maths'=>1,'Crypto'=>0,'Logic'=>1,'Analysis'=>1),74 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0) ),75 '15'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),76 'B'=> array('OutBox'=>2,'Maths'=>0,'Crypto'=>0,'Logic'=>3,'Analysis'=>3),77 'C'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),78 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0) ),79 '16'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),80 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),81 'C'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),82 'D'=> array('OutBox'=>3,'Maths'=>3,'Crypto'=>0,'Logic'=>0,'Analysis'=>0) ),83 '17'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),84 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),85 'C'=> array('OutBox'=>10,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>2),86 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0) ),87 '18'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>2,'Logic'=>0,'Analysis'=>0),88 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>6,'Logic'=>0,'Analysis'=>0),89 'C'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>2,'Logic'=>0,'Analysis'=>0),90 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>2,'Logic'=>0,'Analysis'=>0) ),91 '19'=>array( 'A'=> array('OutBox'=>0,'Maths'=>2,'Crypto'=>0,'Logic'=>0,'Analysis'=>1),92 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),93 'C'=> array('OutBox'=>0,'Maths'=>4,'Crypto'=>0,'Logic'=>0,'Analysis'=>2),94 'D'=> array('OutBox'=>0,'Maths'=>8,'Crypto'=>0,'Logic'=>0,'Analysis'=>4) ),95 '20'=>array( 'A'=> array('OutBox'=>0,'Maths'=>6,'Crypto'=>0,'Logic'=>0,'Analysis'=>2),96 'B'=> array('OutBox'=>0,'Maths'=>2,'Crypto'=>0,'Logic'=>0,'Analysis'=>1),97 'C'=> array('OutBox'=>0,'Maths'=>2,'Crypto'=>0,'Logic'=>0,'Analysis'=>1),98 'D'=> array('OutBox'=>0,'Maths'=>2,'Crypto'=>0,'Logic'=>0,'Analysis'=>1) ),99 '21'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>1,'Analysis'=>1),100 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>3,'Analysis'=>3),101 'C'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>5,'Analysis'=>5),102 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0) ),103 '22'=>array( 'A'=> array('OutBox'=>8,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>2),104 'B'=> array('OutBox'=>2,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>1),105 'C'=> array('OutBox'=>3,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>1),106 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0) )107 );108 protected static $hauts=array(109 '1'=>array( 'A'=> array('OutBox'=>0,'Maths'=>3,'Crypto'=>0,'Logic'=>0,'Analysis'=>4),110 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),111 'C'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),112 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0) ),113 '2'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),114 'B'=> array('OutBox'=>1,'Maths'=>3,'Crypto'=>0,'Logic'=>0,'Analysis'=>1),115 'C'=> array('OutBox'=>2,'Maths'=>5,'Crypto'=>0,'Logic'=>0,'Analysis'=>2),116 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0) ),117 '3'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),118 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),119 'C'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),120 'D'=> array('OutBox'=>0,'Maths'=>2,'Crypto'=>0,'Logic'=>4,'Analysis'=>4) ),121 '4'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),122 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),123 'C'=> array('OutBox'=>0,'Maths'=>6,'Crypto'=>0,'Logic'=>0,'Analysis'=>3),124 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0) ),125 '5'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>2,'Analysis'=>7),126 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>1,'Analysis'=>2),127 'C'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>1,'Analysis'=>2),128 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>1,'Analysis'=>2) ),129 '6'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>5,'Analysis'=>5),130 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),131 'C'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),132 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0) ),133 '7'=>array( '04'=> array('OutBox'=>0,'Maths'=>2,'Crypto'=>0,'Logic'=>3,'Analysis'=>3),134 '05'=> array('OutBox'=>0,'Maths'=>1,'Crypto'=>0,'Logic'=>1,'Analysis'=>1) ),135 '8'=>array( '03'=> array('OutBox'=>0,'Maths'=>6,'Crypto'=>0,'Logic'=>0,'Analysis'=>2),136 '04'=> array('OutBox'=>0,'Maths'=>2,'Crypto'=>0,'Logic'=>0,'Analysis'=>0) ),137 '9'=>array( '02'=> array('OutBox'=>6,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>4),138 '03'=> array('OutBox'=>6,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>2) ),139 '10'=>array( '16'=> array('OutBox'=>6,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>6),140 '14'=> array('OutBox'=>3,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>3) ),141 '11'=>array( '19'=> array('OutBox'=>0,'Maths'=>2,'Crypto'=>0,'Logic'=>4,'Analysis'=>5),142 '20'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),143 '21'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),144 '22'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),145 '23'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),146 '24'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),147 '25'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),148 '26'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),149 '27'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),150 '28'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),151 '29'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),152 '30'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),153 '31'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),154 '32'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),155 '33'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),156 '34'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),157 '35'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),158 '36'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),159 '37'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0),160 '38'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>4,'Analysis'=>0) ),161 '12'=>array( '16'=> array('OutBox'=>10,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>2) ),162 '13'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>4,'Logic'=>0,'Analysis'=>0),163 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>6,'Logic'=>0,'Analysis'=>2),164 'C'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>3,'Logic'=>0,'Analysis'=>0),165 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>2,'Logic'=>0,'Analysis'=>0) ),166 '14'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),167 'B'=> array('OutBox'=>0,'Maths'=>4,'Crypto'=>0,'Logic'=>0,'Analysis'=>3),168 'C'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),169 'D'=> array('OutBox'=>0,'Maths'=>3,'Crypto'=>0,'Logic'=>0,'Analysis'=>0) ),170 //Q15 is bonus171 '15'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),172 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),173 'C'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),174 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0) ),175 '16'=>array( 'A'=> array('OutBox'=>0,'Maths'=>2,'Crypto'=>0,'Logic'=>0,'Analysis'=>1),176 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),177 'C'=> array('OutBox'=>0,'Maths'=>4,'Crypto'=>0,'Logic'=>0,'Analysis'=>2),178 'D'=> array('OutBox'=>0,'Maths'=>8,'Crypto'=>0,'Logic'=>0,'Analysis'=>4) ),179 '17'=>array( 'A'=> array('OutBox'=>0,'Maths'=>6,'Crypto'=>0,'Logic'=>0,'Analysis'=>2),180 'B'=> array('OutBox'=>0,'Maths'=>2,'Crypto'=>0,'Logic'=>0,'Analysis'=>1),181 'C'=> array('OutBox'=>0,'Maths'=>2,'Crypto'=>0,'Logic'=>0,'Analysis'=>1),182 'D'=> array('OutBox'=>0,'Maths'=>2,'Crypto'=>0,'Logic'=>0,'Analysis'=>1) ),183 '18'=>array( 'A'=> array('OutBox'=>0,'Maths'=>1,'Crypto'=>0,'Logic'=>0,'Analysis'=>1),184 'B'=> array('OutBox'=>2,'Maths'=>4,'Crypto'=>0,'Logic'=>0,'Analysis'=>5),185 'C'=> array('OutBox'=>1,'Maths'=>3,'Crypto'=>0,'Logic'=>0,'Analysis'=>3),186 'D'=> array('OutBox'=>0,'Maths'=>1,'Crypto'=>0,'Logic'=>0,'Analysis'=>1) ),187 '19'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),188 'B'=> array('OutBox'=>0,'Maths'=>8,'Crypto'=>0,'Logic'=>0,'Analysis'=>2),189 'C'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),190 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0) ),191 '20'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>7,'Logic'=>0,'Analysis'=>0),192 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),193 'C'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),194 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0) ),195 '21'=>array( 'A'=> array('OutBox'=>0,'Maths'=>1,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),196 'B'=> array('OutBox'=>0,'Maths'=>1,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),197 'C'=> array('OutBox'=>0,'Maths'=>4,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),198 'D'=> array('OutBox'=>0,'Maths'=>8,'Crypto'=>0,'Logic'=>0,'Analysis'=>0) ),199 '22'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>2,'Analysis'=>0),200 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>6,'Analysis'=>0),201 'C'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>3,'Analysis'=>0),202 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>8,'Analysis'=>0) ),203 '23'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),204 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>3,'Logic'=>3,'Analysis'=>0),205 'C'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),206 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>3,'Logic'=>3,'Analysis'=>4) ),207 '24'=>array( 'A'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),208 'B'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),209 'C'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0),210 'D'=> array('OutBox'=>0,'Maths'=>0,'Crypto'=>3,'Logic'=>3,'Analysis'=>0) )211 );212 public static function MaxHauts()213 { 214 $Max=array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0);215 foreach(Techanalysis::$hauts as $key=>$value)216 if(preg_replace('/\s+/','',$answerHauts[$key])=='C'||preg_replace('/\s+/','',$answerHauts[$key])=='A'||preg_replace('/\s+/','',$answerHauts[$key])=='B'||preg_replace('/\s+/','',$answerHauts[$key])=='D'||is_numeric(preg_replace('/\s+/','',$answerHauts[$key])))217 { global $hauts,$answerHauts;218 $Max['OutBox']+=$hauts[$key][$answerHauts[$key]]['OutBox'];219 $Max['Maths']+=$hauts[$key][$answerHauts[$key]]['Maths'];220 $Max['Crypto']+=$hauts[$key][$answerHauts[$key]]['Crypto'];221 $Max['Logic']+=$hauts[$key][$answerHauts[$key]]['Analysis'];222 $Max['Analysis']+=$hauts[$key][$answerHauts[$key]]['Analysis'];223 }224 return $Max;225 }226 public static function MaxJuniors()227 { 228 229 $Max=array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0);230 foreach(Techanalysis::$juniors as $key=>$value)231 if(preg_replace('/\s+/','',$answerJuniors[$key])=='C'||preg_replace('/\s+/','',$answerJuniors[$key])=='A'||preg_replace('/\s+/','',$answerJuniors[$key])=='B'||preg_replace('/\s+/','',$answerJuniors[$key])=='D'||is_numeric(preg_replace('/\s+/','',$answerJuniors[$key])))232 {233 $Max['OutBox']+=$juniors[$key][$answerJuniors[$key]]['OutBox'];234 $Max['Maths']+=$juniors[$key][$answerJuniors[$key]]['Maths'];235 $Max['Crypto']+=$juniors[$key][$answerJuniors[$key]]['Crypto'];236 $Max['Logic']+=$juniors[$key][$answerJuniors[$key]]['Analysis'];237 $Max['Analysis']+=$juniors[$key][$answerJuniors[$key]]['Analysis'];238 }239 return $Max;240 }241 public static function TechnalysisJuniors($resp)242 { 243 // global $juniors,$answerJuniors;244 $score=array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0);245 $juniors = Techanalysis::$juniors;246 foreach(Techanalysis::$juniors as $key=>$values)247 {248 Log::info('QNo:'.$key.'\n'.$resp->roll.'\n');249 250 try{251 if(preg_replace('/\s+/','',$resp->{'q'.$key}) == '')252 continue;253 else if(is_numeric(preg_replace('/\s+/','',$resp->{'q'.$key})))254 { 255 foreach($juniors[$key] as $k=>$v)256 if(intval($k)==intval($resp->{'q'.$key}))257 {258 $score['OutBox']+=$juniors[$key][$k]['OutBox'];259 $score['Maths']+=$juniors[$key][$k]['Maths'];260 $score['Crypto']+=$juniors[$key][$k]['Crypto'];261 $score['Logic']+=$juniors[$key][$k]['Logic'];262 $score['Analysis']+=$juniors[$key][$k]['Analysis'];263 }264 }265 else266 {267 if(preg_replace('/\s+/','',$resp->{'q'.$key})=='A')268 {269 $score['OutBox']+=$juniors[$key]['A']['OutBox'];270 $score['Maths']+=$juniors[$key]['A']['Maths'];271 $score['Crypto']+=$juniors[$key]['A']['Crypto'];272 $score['Logic']+=$juniors[$key]['A']['Logic'];273 $score['Analysis']+=$juniors[$key]['A']['Analysis'];274 }275 elseif(preg_replace('/\s+/','',$resp->{'q'.$key})=='B')276 {277 $score['OutBox']+=$juniors[$key]['B']['OutBox'];278 $score['Maths']+=$juniors[$key]['B']['Maths'];279 $score['Crypto']+=$juniors[$key]['B']['Crypto'];280 $score['Logic']+=$juniors[$key]['B']['Logic'];281 $score['Analysis']+=$juniors[$key]['B']['Analysis'];282 }283 elseif(preg_replace('/\s+/','',$resp->{'q'.$key})=='C')284 {285 $score['OutBox']+=$juniors[$key]['C']['OutBox'];286 $score['Maths']+=$juniors[$key]['C']['Maths'];287 $score['Crypto']+=$juniors[$key]['C']['Crypto'];288 $score['Logic']+=$juniors[$key]['C']['Logic'];289 $score['Analysis']+=$juniors[$key]['C']['Analysis'];290 }291 elseif(preg_replace('/\s+/','',$resp->{'q'.$key})=='D')292 {293 $score['OutBox']+=$juniors[$key]['D']['OutBox'];294 $score['Maths']+=$juniors[$key]['D']['Maths'];295 $score['Crypto']+=$juniors[$key]['D']['Crypto'];296 $score['Logic']+=$juniors[$key]['D']['Logic'];297 $score['Analysis']+=$juniors[$key]['D']['Analysis'];298 }299 }300 }catch(Exception $e){}301 }302 return $score;303 }304 public static function TechnalysisHauts($resp)305 { 306 // global $hauts,$answerHauts;307 $score=array('OutBox'=>0,'Maths'=>0,'Crypto'=>0,'Logic'=>0,'Analysis'=>0);308 $hauts = Techanalysis::$hauts;309 foreach(Techanalysis::$hauts as $key=>$values)310 {311 Log::info('QNo:'.$key.'\n'.$resp->roll.'\n');312 try{313 if(preg_replace('/\s+/','',$resp->{'q'.$key}) == '' || $resp->{'q'.$key} == NULL)314 continue;315 else if(is_numeric(preg_replace('/\s+/','',$resp->{'q'.$key})))316 { 317 foreach($hauts[$key] as $k=>$v)318 if(intval($k)==intval($resp->{'q'.$key}))319 {320 $score['OutBox']+=$hauts[$key][$k]['OutBox'];321 $score['Maths']+=$hauts[$key][$k]['Maths'];322 $score['Crypto']+=$hauts[$key][$k]['Crypto'];323 $score['Logic']+=$hauts[$key][$k]['Logic'];324 $score['Analysis']+=$hauts[$key][$k]['Analysis'];325 }326 }327 else328 {329 if(preg_replace('/\s+/','',$resp->{'q'.$key})=='A')330 {331 $score['OutBox']+=$hauts[$key]['A']['OutBox'];332 $score['Maths']+=$hauts[$key]['A']['Maths'];333 $score['Crypto']+=$hauts[$key]['A']['Crypto'];334 $score['Logic']+=$hauts[$key]['A']['Logic'];335 $score['Analysis']+=$hauts[$key]['A']['Analysis'];336 }337 elseif(preg_replace('/\s+/','',$resp->{'q'.$key})=='B')338 {339 $score['OutBox']+=$hauts[$key]['B']['OutBox'];340 $score['Maths']+=$hauts[$key]['B']['Maths'];341 $score['Crypto']+=$hauts[$key]['B']['Crypto'];342 $score['Logic']+=$hauts[$key]['B']['Logic'];343 $score['Analysis']+=$hauts[$key]['B']['Analysis'];344 }345 elseif(preg_replace('/\s+/','',$resp->{'q'.$key})=='C')346 {347 $score['OutBox']+=$hauts[$key]['C']['OutBox'];348 $score['Maths']+=$hauts[$key]['C']['Maths'];349 $score['Crypto']+=$hauts[$key]['C']['Crypto'];350 $score['Logic']+=$hauts[$key]['C']['Logic'];351 $score['Analysis']+=$hauts[$key]['C']['Analysis'];352 }353 elseif(preg_replace('/\s+/','',$resp->{'q'.$key})=='D')354 {355 $score['OutBox']+=$hauts[$key]['D']['OutBox'];356 $score['Maths']+=$hauts[$key]['D']['Maths'];357 $score['Crypto']+=$hauts[$key]['D']['Crypto'];358 $score['Logic']+=$hauts[$key]['D']['Logic'];359 $score['Analysis']+=$hauts[$key]['D']['Analysis'];360 }361 }362 } catch(Exception $e){}363 }364 return $score;365 }366 367}368?>...

Full Screen

Full Screen

widget_logic.php

Source:widget_logic.php Github

copy

Full Screen

...4Author URI: https://wpchef.org5Description: Control widgets with WP's conditional tags is_home etc6Version: 5.10.47Author: WPChef8Text Domain: widget-logic9*/10$plugin_dir = basename(dirname(__FILE__));11global $wl_options, $wl_in_customizer;12$wl_in_customizer = false;13add_action( 'init', 'widget_logic_init' );14function widget_logic_init()15{16 load_plugin_textdomain( 'widget-logic', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );17}18if((!$wl_options = get_option('widget_logic')) || !is_array($wl_options) )19 $wl_options = array();20if (is_admin())21{22 add_filter( 'in_widget_form', 'widget_logic_in_widget_form', 10, 3 );23 add_filter( 'widget_update_callback', 'widget_logic_update_callback', 10, 4);24 add_action( 'sidebar_admin_setup', 'widget_logic_expand_control');25 // before any HTML output save widget changes and add controls to each widget on the widget admin page26 add_action( 'sidebar_admin_page', 'widget_logic_options_control');27 add_action( 'widgets_init', 'widget_logic_add_controls', 999 );28}29else30{31 $loadpoint = isset($wl_options['widget_logic-options-load_point']) ? (string)@$wl_options['widget_logic-options-load_point'] : '';32 if ( 'plugins_loaded' == $loadpoint )33 widget_logic_sidebars_widgets_filter_add();34 else35 {36 if ( !in_array( $loadpoint, array( 'after_setup_theme', 'wp_loaded', 'wp_head' ) ) )37 $loadpoint = 'parse_query';38 add_action( $loadpoint, 'widget_logic_sidebars_widgets_filter_add' );39 }40 if ( !empty($wl_options['widget_logic-options-filter']) )41 add_filter( 'dynamic_sidebar_params', 'widget_logic_widget_display_callback', 10);42 // redirect the widget callback so the output can be buffered and filtered43}44function widget_logic_in_customizer()45{46 global $wl_in_customizer;47 $wl_in_customizer = true;48 //add_filter( 'widget_display_callback', 'widget_logic_customizer_display_callback', 10, 3 );49 add_action( 'dynamic_sidebar', 'widget_logic_customizer_dynamic_sidebar_callback' );50}51add_action( 'customize_preview_init', 'widget_logic_in_customizer' );52function widget_logic_sidebars_widgets_filter_add()53{54 // actually remove the widgets from the front end depending on widget logic provided55 add_filter( 'sidebars_widgets', 'widget_logic_filter_sidebars_widgets', 10);56}57// wp-admin/widgets.php explicitly checks current_user_can('edit_theme_options')58// which is enough security, I believe. If you think otherwise please contact me59// CALLED VIA 'widget_update_callback' FILTER (ajax update of a widget)60function widget_logic_update_callback( $instance, $new_instance, $old_instance, $this_widget )61{62 if ( isset( $new_instance['widget_logic'] ) )63 $instance['widget_logic'] = $new_instance['widget_logic'];64 return $instance;65}66// CALLED VIA 'sidebar_admin_setup' ACTION67// adds in the admin control per widget, but also processes import/export68function widget_logic_expand_control()69{ global $wp_registered_widgets, $wp_registered_widget_controls, $wl_options;70 // EXPORT ALL OPTIONS71 if (isset($_GET['wl-options-export']) && isset( $_GET['widget_logic_nonce'] ) && wp_verify_nonce( $_GET['widget_logic_nonce'], 'widget_logic_export'))72 {73 header("Content-Disposition: attachment; filename=widget_logic_options.txt");74 header('Content-Type: text/plain; charset=utf-8');75 echo "[START=WIDGET LOGIC OPTIONS]\n";76 foreach ($wl_options as $id => $text)77 echo "$id\t".json_encode($text)."\n";78 echo "[STOP=WIDGET LOGIC OPTIONS]";79 exit;80 }81 // IMPORT ALL OPTIONS82 if ( isset($_POST['wl-options-import']) && current_user_can('administrator') && isset( $_POST['widget_logic_nonce'] ) && wp_verify_nonce( $_POST['widget_logic_nonce'], 'widget_logic_import'))83 { if ($_FILES['wl-options-import-file']['tmp_name'])84 { $import=explode("\n",file_get_contents($_FILES['wl-options-import-file']['tmp_name'], false));85 if (array_shift($import)=="[START=WIDGET LOGIC OPTIONS]" && array_pop($import)=="[STOP=WIDGET LOGIC OPTIONS]")86 { foreach ($import as $import_option)87 { list($key, $value)=explode("\t",$import_option);88 $wl_options[$key]=json_decode($value);89 }90 $wl_options['msg']= __('Success! Options file imported','widget-logic');91 }92 else93 { $wl_options['msg']= __('Invalid options file','widget-logic');94 }95 }96 else97 $wl_options['msg']= __('No options file provided','widget-logic');98 update_option('widget_logic', $wl_options);99 wp_redirect( admin_url('widgets.php') );100 exit;101 }102 // UPDATE OTHER WIDGET LOGIC OPTIONS103 // must update this to use http://codex.wordpress.org/Settings_API104 if ( isset($_POST['widget_logic-options-submit']) && current_user_can('administrator') && isset( $_POST['widget_logic_nonce'] ) && wp_verify_nonce( $_POST['widget_logic_nonce'], 'widget_logic_settings') )105 {106 if ( !empty($_POST['widget_logic-options-filter']) )107 $wl_options['widget_logic-options-filter'] = true;108 else109 unset( $wl_options['widget_logic-options-filter'] );110 $wl_options['widget_logic-options-wp_reset_query'] = !empty($_POST['widget_logic-options-wp_reset_query']);111 $wl_options['widget_logic-options-show_errors'] = !empty($_POST['widget_logic-options-show_errors']);112 $wl_options['widget_logic-options-load_point'] = sanitize_text_field($_POST['widget_logic-options-load_point']);113 }114 update_option('widget_logic', $wl_options);115}116// CALLED VIA 'sidebar_admin_page' ACTION117// output extra HTML118// to update using http://codex.wordpress.org/Settings_API asap119function widget_logic_options_control()120{ global $wp_registered_widget_controls, $wl_options;121 if ( isset($wl_options['msg']))122 { if (substr($wl_options['msg'],0,2)=="OK")123 echo '<div id="message" class="updated">';124 else125 echo '<div id="message" class="error">';126 echo '<p>Widget Logic – '.$wl_options['msg'].'</p></div>';127 unset($wl_options['msg']);128 update_option('widget_logic', $wl_options);129 }130 ?><div class="wrap">131 <h2><?php _e('Widget Logic options', 'widget-logic'); ?></h2>132 <form method="POST" style="float:left; width:45%">133 <ul>134 <?php if ( !empty($wl_options['widget_logic-options-filter']) ): ?>135 <li><label for="widget_logic-options-filter" title="<?php _e('Adds a new WP filter you can use in your own code. Not needed for main Widget Logic functionality.', 'widget-logic'); ?>">136 <input id="widget_logic-options-filter" name="widget_logic-options-filter" type="checkbox" value="checked" class="checkbox" <?php if (!empty($wl_options['widget_logic-options-filter'])) echo "checked" ?>/>137 <?php _e('Add \'widget_content\' filter', 'widget-logic'); ?>138 </label>139 </li>140 <?php endif ?>141 <li><label for="widget_logic-options-wp_reset_query" title="<?php _e('Resets a theme\'s custom queries before your Widget Logic is checked', 'widget-logic'); ?>">142 <input id="widget_logic-options-wp_reset_query" name="widget_logic-options-wp_reset_query" type="checkbox" value="checked" class="checkbox" <?php if (!empty($wl_options['widget_logic-options-wp_reset_query'])) echo "checked" ?> />143 <?php _e('Use \'wp_reset_query\' fix', 'widget-logic'); ?>144 </label>145 </li>146 <li><label for="widget_logic-options-load_point" title="<?php _e('Delays widget logic code being evaluated til various points in the WP loading process', 'widget-logic'); ?>"><?php _e('Load logic', 'widget-logic'); ?>147 <select id="widget_logic-options-load_point" name="widget_logic-options-load_point" ><?php148 $wl_load_points = array(149 'parse_query' => __( 'after query variables set (default)', 'widget-logic' ),150 'plugins_loaded' => __( 'when plugin starts', 'widget-logic' ),151 'after_setup_theme' => __( 'after theme loads', 'widget-logic' ),152 'wp_loaded' => __( 'when all PHP loaded', 'widget-logic' ),153 'wp_head' => __( 'during page header', 'widget-logic' )154 );155 foreach($wl_load_points as $action => $action_desc)156 { echo "<option value='".$action."'";157 if (isset($wl_options['widget_logic-options-load_point']) && $action==$wl_options['widget_logic-options-load_point'])158 echo " selected ";159 echo ">".$action_desc."</option>"; //160 }161 ?>162 </select>163 </label>164 </li>165 <li>166 <label for="widget_logic-options-show_errors">167 <input id="widget_logic-show_errors" name="widget_logic-options-show_errors" type="checkbox" value="1" class="checkbox" <?php if (!empty($wl_options['widget_logic-options-show_errors'])) echo "checked" ?> />168 <?php esc_html_e('Display logic errors to admin', 'widget-logic'); ?>169 </label>170 </ul>171 <?php wp_nonce_field( 'widget_logic_settings', 'widget_logic_nonce' ); ?>172 <?php submit_button( __( 'Save WL options', 'widget-logic' ), 'button-primary', 'widget_logic-options-submit', false ); ?>173 </form>174 <form method="POST" enctype="multipart/form-data" style="float:left; width:45%">175 <a class="submit button" href="<?php echo wp_nonce_url( '?wl-options-export', 'widget_logic_export', 'widget_logic_nonce' ); ?>" title="<?php _e('Save all WL options to a plain text config file', 'widget-logic'); ?>"><?php _e('Export options', 'widget-logic'); ?></a><p>176 <?php submit_button( __( 'Import options', 'widget-logic' ), 'button', 'wl-options-import', false, array('title'=> __( 'Load all WL options from a plain text config file', 'widget-logic' ) ) ); ?>177 <input type="file" name="wl-options-import-file" id="wl-options-import-file" title="<?php _e('Select file for importing', 'widget-logic'); ?>" /></p>178 <?php wp_nonce_field( 'widget_logic_import', 'widget_logic_nonce' ); ?>179 </form>180 </div>181 <?php182}183function widget_logic_add_controls()184{185 global $wp_registered_widget_controls, $wp_registered_widgets, $wp_registered_widget_updates;186 foreach ( $wp_registered_widgets as $id => $widget )187 {188 if ( preg_match( '/^(.+)-(\d+)$/', $id) )189 continue;190 if ( !isset( $wp_registered_widget_controls[ $id ] ) )191 {192 wp_register_widget_control( $id, $id, 'widget_logic_extra_control', array(), $id, null );193 continue;194 }195 if ( @$wp_registered_widget_controls[ $id ]['callback'] != 'widget_logic_extra_control' )196 {197 $wp_registered_widget_controls[$id]['params'][] = $id;198 $wp_registered_widget_controls[$id]['params'][] = @$wp_registered_widget_controls[$id]['callback'];199 $wp_registered_widget_controls[$id]['callback'] = 'widget_logic_extra_control';200 $wp_registered_widget_updates[$id]['params'][] = $id;201 $wp_registered_widget_updates[$id]['params'][] = @$wp_registered_widget_updates[$id]['callback'];202 $wp_registered_widget_updates[$id]['callback'] = 'widget_logic_extra_control';203 }204 }205}206function widget_logic_in_widget_form( $widget, $return, $instance )207{208 $logic = isset( $instance['widget_logic'] ) ? $instance['widget_logic'] : widget_logic_by_id( $widget->id );209 ?>210 <p>211 <label for="<?php echo $widget->get_field_id('widget_logic'); ?>">212 <?php esc_html_e('Widget logic:','widget-logic') ?>213 </label>214 <textarea class="widefat" name="<?php echo $widget->get_field_name('widget_logic'); ?>" id="<?php echo $widget->get_field_id('widget_logic'); ?>"><?php echo esc_textarea( $logic ) ?></textarea>215 </p>216 <?php217 return;218}219// added to widget functionality in 'widget_logic_expand_control' (above)220function widget_logic_extra_control()221{222 global $wp_customize;223 $args = func_get_args();224 $callback = array_pop( $args );225 $widget_id = array_pop( $args );226 if ( is_callable($callback) )227 call_user_func_array( $callback, $args );228 if ( isset( $_POST["widget-$widget_id"]['widget_logic'] ) )229 {230 $logic = stripslashes( $_POST["widget-$widget_id"]['widget_logic'] );231 widget_logic_save( $widget_id, $logic );232 }233 else234 $logic = widget_logic_by_id( $widget_id );235 $input_id = "widget-$widget_id-widget_logic";236 $input_name = "widget-{$widget_id}[widget_logic]";237 ?>238 <p>239 <label for="<?php echo $input_id ?>">240 <?php esc_html_e('Widget logic:','widget-logic') ?>241 </label>242 <?php if ( !empty($wp_customize) && $wp_customize->is_preview() ): ?>243 <textarea class="widefat" id="<?php echo $input_id ?>" readonly><?php echo esc_textarea( $logic ) ?></textarea>244 <br>245 <span class="description"><?php printf( esc_html__('This is a "wp register sidebar widget" and is different from regular widgets. Hence it can only be edited from the %s page.', 'widget-logic'), sprintf( '<a href="%s" target="_blank">%s</a>', esc_attr(admin_url('widgets.php')), __('widgets') ) ) ?></span>246 <?php else: ?>247 <textarea class="widefat" name="<?php echo $input_name ?>" id="<?php echo $input_id ?>"><?php echo esc_textarea( $logic ) ?></textarea>248 <?php endif ?>249 <?php wp_nonce_field( 'widget_logic_save', 'widget_logic_nonce' ); ?>250 </p>251 <?php252 return true;253}254// FRONT END FUNCTIONS...255function widget_logic_by_id( $widget_id )256{257 global $wl_options;258 if ( preg_match( '/^(.+)-(\d+)$/', $widget_id, $m ) )259 {260 $widget_class = $m[1];261 $widget_i = $m[2];262 $info = get_option( 'widget_'.$widget_class );263 if ( empty( $info[ $widget_i ] ) )264 return '';265 $info = $info[ $widget_i ];266 }267 else268 $info = (array)get_option( 'widget_'.$widget_id, array() );269 if ( isset( $info['widget_logic'] ) )270 $logic = $info['widget_logic'];271 elseif ( isset( $wl_options[ $widget_id ] ) )272 {273 $logic = stripslashes( $wl_options[ $widget_id ] );274 widget_logic_save( $widget_id, $logic );275 unset( $wl_options[ $widget_id ] );276 update_option( 'widget_logic', $wl_options );277 }278 else279 $logic = '';280 return $logic;281}282function widget_logic_save( $widget_id, $logic )283{284 global $wl_options;285 if ( preg_match( '/^(.+)-(\d+)$/', $widget_id, $m ) )286 {287 $widget_class = $m[1];288 $widget_i = $m[2];289 $info = get_option( 'widget_'.$widget_class );290 if ( !is_array( $info[ $widget_i ] ) )291 $info[ $widget_i ] = array();292 $info[ $widget_i ]['widget_logic'] = $logic;293 update_option( 'widget_'.$widget_class, $info );294 }295 else if( isset( $_POST['widget_logic_nonce'] ) && wp_verify_nonce( $_POST['widget_logic_nonce'], 'widget_logic_save') ) {296 $info = (array)get_option( 'widget_'.$widget_id, array() );297 $info['widget_logic'] = $logic;298 update_option( 'widget_'.$widget_id, $info );299 }300}301// CALLED ON 'sidebars_widgets' FILTER302function widget_logic_filter_sidebars_widgets( $sidebars_widgets )303{304 global $wl_options, $wl_in_customizer;305 if ( $wl_in_customizer )306 return $sidebars_widgets;307 // reset any database queries done now that we're about to make decisions based on the context given in the WP query for the page308 if ( !empty( $wl_options['widget_logic-options-wp_reset_query'] ) )309 wp_reset_query();310 // loop through every widget in every sidebar (barring 'wp_inactive_widgets') checking WL for each one311 foreach($sidebars_widgets as $widget_area => $widget_list)312 {313 if ($widget_area=='wp_inactive_widgets' || empty($widget_list))314 continue;315 foreach($widget_list as $pos => $widget_id)316 {317 $logic = widget_logic_by_id( $widget_id );318 if ( !widget_logic_check_logic( $logic ) )319 unset($sidebars_widgets[$widget_area][$pos]);320 }321 }322 return $sidebars_widgets;323}324function widget_logic_check_logic( $logic )325{326 $logic = @trim( (string)$logic );327 $logic = apply_filters( "widget_logic_eval_override", $logic );328 if ( is_bool( $logic ) )329 return $logic;330 if ( $logic === '' )331 return true;332 if ( stristr( $logic, "return" ) === false )333 $logic = "return ( $logic );";334 set_error_handler( 'widget_logic_error_handler' );335 try {336 $show_widget = eval($logic);337 }338 catch ( Error $e ) {339 trigger_error( $e->getMessage(), E_USER_WARNING );340 $show_widget = false;341 }342 restore_error_handler();343 return $show_widget;344}345function widget_logic_error_handler( $errno , $errstr )346{347 global $wl_options;348 $show_errors = !empty($wl_options['widget_logic-options-show_errors']) && current_user_can('manage_options');349 if ( $show_errors )350 echo 'Invalid Widget Logic: '.$errstr;351 return true;352}353function widget_logic_customizer_dynamic_sidebar_callback( $widget )354{355 widget_logic_customizer_display( $widget['id'] );356}357function widget_logic_customizer_display( $widget_id )358{359 if ( !preg_match( '/^(.+)-(\d+)$/', $widget_id) )360 return;361 $logic = widget_logic_by_id( $widget_id );362 global $wl_options;363 $show_errors = !empty($wl_options['widget_logic-options-show_errors']) && current_user_can('manage_options');364 ob_start();365 $show_widget = widget_logic_check_logic( $logic );366 $error = ob_get_clean();367 if ( $show_errors && $error ) :368 ?><script>jQuery(function($){$('#<?php echo $widget_id?>').append( $('<p class="widget-logic-error">').html(<?php echo json_encode($error)?>) );})</script><?php369 endif;370 if ( !$show_widget ):371 ?><script>jQuery(function($){$('#<?php echo $widget_id?>').children().not('.widget-logic-error').css('opacity', '0.2');})</script><?php372 endif;373}374// CALLED ON 'dynamic_sidebar_params' FILTER - this is called during 'dynamic_sidebar' just before each callback is run375// swap out the original call back and replace it with our own376function widget_logic_widget_display_callback($params)377{ global $wp_registered_widgets;378 $id=$params[0]['widget_id'];379 $wp_registered_widgets[$id]['callback_wl_redirect']=$wp_registered_widgets[$id]['callback'];380 $wp_registered_widgets[$id]['callback']='widget_logic_redirected_callback';381 return $params;382}383// the redirection comes here384function widget_logic_redirected_callback()385{ global $wp_registered_widgets;386 // replace the original callback data387 $params=func_get_args();388 $id=$params[0]['widget_id'];389 $callback=$wp_registered_widgets[$id]['callback_wl_redirect'];390 $wp_registered_widgets[$id]['callback']=$callback;391 // run the callback but capture and filter the output using PHP output buffering392 if ( is_callable($callback) )393 { ob_start();394 call_user_func_array($callback, $params);395 $widget_content = ob_get_contents();396 ob_end_clean();397 echo apply_filters( 'widget_content', $widget_content, $id);398 }...

Full Screen

Full Screen

OfficeWorkTimeLogicSpec.php

Source:OfficeWorkTimeLogicSpec.php Github

copy

Full Screen

1<?php2namespace Core\OfficeWorkTimeBundle\Spec\Logic;3use PhpSpec\ObjectBehavior;4use Prophecy\Argument;5use Doctrine\ORM\EntityManagerInterface;6use Core\ConfigBundle\Logic\ConfigLogic;7class OfficeWorkTimeLogicSpec extends ObjectBehavior8{9 /**10 * @param Doctrine\ORM\EntityManager $em11 * @param Core\OfficeWorkTimeBundle\Logic\BasicDataLogic $basicDataLogic12 * @param Core\ConfigBundle\Logic\ConfigLogic $configLogic13 * @param Core\OfficeWorkTimeBundle\Entity\Repository\ScheduleRepository $repo14 */15 function let($em, $basicDataLogic, $configLogic, $repo)16 {17 $em->getRepository('CoreOfficeWorkTimeBundle:Schedule')18 ->willReturn($repo);19 20 $basicDataLogic->getSchedule()->willReturn([21 'result' => true,22 'data' => []23 ]);24 $configLogic->get('office-work-time')->willReturn('09:00-18:00');25 $options = array(26 'uri' => 'http://basicdata.ru/api/json/calend/',27 'timezone' => 'Europe/Moscow',28 'options' => [29 'basic_data' => ['uri' => 'http://basicdata.ru/api/json/calend/']30 ]);31 $services = [32 'basic_data' => $basicDataLogic33 ];34 $this->beConstructedWith($options, $services, $em, $configLogic);35 }36 37 function it_is_initializable()38 {39 $this->shouldHaveType('Core\OfficeWorkTimeBundle\Logic\OfficeWorkTimeLogic');40 }41 42 /**43 * @param Doctrine\ORM\EntityManager $em44 * @param Core\OfficeWorkTimeBundle\Logic\BasicDataLogic $basicDataLogic45 * @param Core\ConfigBundle\Logic\ConfigLogic $configLogic46 * @param Core\OfficeWorkTimeBundle\Entity\Repository\ScheduleRepository $repo47 */48 function it_get_schedule($em, $basicDataLogic, $configLogic, $repo)49 {50 $repo->findAll()->willReturn([]);51 $this->let($em, $basicDataLogic, $configLogic, $repo);52 $this->getSchedule()->shouldReturn(null);53 }54 /**55 * @param Doctrine\ORM\EntityManager $em56 * @param Core\OfficeWorkTimeBundle\Logic\BasicDataLogic $basicDataLogic57 * @param Core\ConfigBundle\Logic\ConfigLogic $configLogic58 */59 function it_get_state($em, $basicDataLogic, $configLogic)60 {61 $this->getState()->shouldBeArray(); 62 }63}...

Full Screen

Full Screen

logic

Using AI Code Generation

copy

Full Screen

1require_once 'atoum/classes/autoloader.php';2spl_autoload_register(array('mageekguy\atoum\autoloader', 'autoloader'));3$runner = new \mageekguy\atoum\runner();4$runner->addTestsFromDirectory('tests/units');5$script->getRunner()->setBootstrapFile('bootstrap.php');6$report = $runner->getScore()->addDefaultReport();7$report->addField(new \mageekguy\atoum\report\fields\runner\atoum\logo());8$report->addField(new \mageekguy\atoum\report\fields\runner\atoum\version());9$report->addField(new \mageekguy\atoum\report\fields\runner\result\logo());10$report->addField(new \mageekguy\atoum\report\fields\runner\result\duration());11$report->addField(new \mageekguy\atoum\report\fields\runner\result\memory());12$report->addField(new \mageekguy\atoum\report\fields\runner\result\readme());13$report->addField(new \mageekguy\atoum\report\fields\runner\failures\logo());14$report->addField(new \mageekguy\atoum\report\fields\runner\failures\uncompleted());15$report->addField(new \mageekguy\atoum\report\fields\runner\failures\failures());16$report->addField(new \mageekguy\atoum\report\fields\runner\failures\errors());17$report->addField(new \mageekguy\atoum\report\fields\runner\failures\exceptions());18$report->addField(new \mageekguy\atoum\report\fields\runner\failures\outputs());19$report->addField(new \mageekguy\atoum\report\fields\runner\outputs\logo());20$report->addField(new \mageekguy\atoum\report\fields\runner\outputs\stdOut());21$report->addField(new \mageekguy\atoum\report\fields\runner\outputs\stdErr());22$report->addField(new \mageekguy\atoum\report\

Full Screen

Full Screen

logic

Using AI Code Generation

copy

Full Screen

1$logic = new logic();2$logic2 = new logic2();3$logic3 = new logic3();4$logic4 = new logic4();5$logic5 = new logic5();6$logic = new logic();7$logic2 = new logic2();8$logic3 = new logic3();9$logic4 = new logic4();10$logic5 = new logic5();11$logic = new logic();12$logic2 = new logic2();13$logic3 = new logic3();14$logic4 = new logic4();15$logic5 = new logic5();16$logic = new logic();17$logic2 = new logic2();18$logic3 = new logic3();19$logic4 = new logic4();20$logic5 = new logic5();21$logic = new logic();22$logic2 = new logic2();23$logic3 = new logic3();24$logic4 = new logic4();25$logic5 = new logic5();

Full Screen

Full Screen

logic

Using AI Code Generation

copy

Full Screen

1$logic = new Logic();2$logic->test();3$logic = new Logic();4$logic->test();5$logic = new Logic();6$logic->test();7$logic = new Logic();8$logic->test();9$logic = new Logic();10$logic->test();11$logic = new Logic();12$logic->test();13$logic = new Logic();14$logic->test();15$logic = new Logic();16$logic->test();17$logic = new Logic();18$logic->test();19$logic = new Logic();20$logic->test();21$logic = new Logic();22$logic->test();23$logic = new Logic();24$logic->test();25$logic = new Logic();26$logic->test();27$logic = new Logic();28$logic->test();29$logic = new Logic();30$logic->test();31$logic = new Logic();32$logic->test();33$logic = new Logic();34$logic->test();35$logic = new Logic();36$logic->test();37$logic = new Logic();38$logic->test();39$logic = new Logic();40$logic->test();41$logic = new Logic();

Full Screen

Full Screen

logic

Using AI Code Generation

copy

Full Screen

1use Atoum\Logic;2$logic = new Logic();3echo $logic->getHello();4use Atoum\Logic;5$logic = new Logic();6echo $logic->getHello();7use Atoum\Logic;8$logic = new Logic();9echo $logic->getHello();10use Atoum\Logic;11$logic = new Logic();12echo $logic->getHello();13use Atoum\Logic;14$logic = new Logic();15echo $logic->getHello();16use Atoum\Logic;17$logic = new Logic();18echo $logic->getHello();19use Atoum\Logic;20$logic = new Logic();21echo $logic->getHello();22use Atoum\Logic;23$logic = new Logic();24echo $logic->getHello();25use Atoum\Logic;26$logic = new Logic();27echo $logic->getHello();28use Atoum\Logic;29$logic = new Logic();30echo $logic->getHello();31use Atoum\Logic;32$logic = new Logic();33echo $logic->getHello();34use Atoum\Logic;35$logic = new Logic();36echo $logic->getHello();37use Atoum\Logic;38$logic = new Logic();39echo $logic->getHello();

Full Screen

Full Screen

logic

Using AI Code Generation

copy

Full Screen

1$atoum = new Atoum();2$atoum->addTestMethod('testOne');3$atoum->addTestMethod('testTwo');4$atoum->addTestMethod('testThree');5$atoum->run();6$atoum = new Atoum();7$atoum->addTestMethod('testOne');8$atoum->addTestMethod('testTwo');9$atoum->addTestMethod('testThree');10$atoum->run();11$atoum = new Atoum();12$atoum->addTestMethod('testOne');13$atoum->addTestMethod('testTwo');14$atoum->addTestMethod('testThree');15$atoum->run();16$atoum = new Atoum();17$atoum->addTestMethod('testOne');18$atoum->addTestMethod('testTwo');19$atoum->addTestMethod('testThree');20$atoum->run();21$atoum = new Atoum();22$atoum->addTestMethod('testOne');23$atoum->addTestMethod('testTwo');24$atoum->addTestMethod('testThree');25$atoum->run();26$atoum = new Atoum();27$atoum->addTestMethod('testOne');28$atoum->addTestMethod('testTwo');29$atoum->addTestMethod('testThree');30$atoum->run();31$atoum = new Atoum();32$atoum->addTestMethod('testOne');33$atoum->addTestMethod('testTwo');34$atoum->addTestMethod('testThree');35$atoum->run();36$atoum = new Atoum();37$atoum->addTestMethod('testOne');

Full Screen

Full Screen

logic

Using AI Code Generation

copy

Full Screen

1$logic = new Logic();2$logic->get();3$logic->set();4$logic->delete();5$logic->update();6$logic = new Logic();7$logic->get();8$logic->set();9$logic->delete();10$logic->update();11$logic = new Logic();12$logic->get();13$logic->set();14$logic->delete();15$logic->update();16$logic = new Logic();17$logic->get();18$logic->set();19$logic->delete();20$logic->update();21$logic = new Logic();22$logic->get();23$logic->set();24$logic->delete();25$logic->update();26$logic = new Logic();27$logic->get();28$logic->set();29$logic->delete();30$logic->update();31$logic = new Logic();32$logic->get();33$logic->set();34$logic->delete();35$logic->update();36$logic = new Logic();37$logic->get();38$logic->set();39$logic->delete();40$logic->update();41$logic = new Logic();42$logic->get();43$logic->set();44$logic->delete();45$logic->update();46$logic = new Logic();47$logic->get();48$logic->set();49$logic->delete();50$logic->update();51$logic = new Logic();52$logic->get();53$logic->set();54$logic->delete();55$logic->update();56$logic = new Logic();57$logic->get();

Full Screen

Full Screen

logic

Using AI Code Generation

copy

Full Screen

1$logic = new logic();2$logic->add(1,2);3$logic = new logic();4$logic->add(1,2);5$logic = new logic();6$logic->add(1,2);7$logic = new logic();8$logic->add(1,2);9$logic = new logic();10$logic->add(1,2);11$logic = new logic();12$logic->add(1,2);13$logic = new logic();14$logic->add(1,2);15$logic = new logic();16$logic->add(1,2);17$logic = new logic();18$logic->add(1,2);19$logic = new logic();20$logic->add(1,2);21$logic = new logic();22$logic->add(1,2);23$logic = new logic();24$logic->add(1,2

Full Screen

Full Screen

logic

Using AI Code Generation

copy

Full Screen

1$c = new Atoum\Logic();2$c->add(1,2);3$c->sub(3,2);4$c->mul(2,3);5$c->div(4,2);6$c = new Atoum\Logic();7$c->add(2,4);8$c->sub(4,1);9$c->mul(4,2);10$c->div(6,3);11$c = new Atoum\Logic();12$c->add(3,5);13$c->sub(5,2);14$c->mul(5,3);15$c->div(10,2);16$c = new Atoum\Logic();17$c->add(4,6);18$c->sub(6,3);19$c->mul(6,4);20$c->div(12,3);21$c = new Atoum\Logic();22$c->add(5,7);23$c->sub(7,4);24$c->mul(7,5);25$c->div(14,4);26$c = new Atoum\Logic();27$c->add(6,8);28$c->sub(8,5);29$c->mul(8,6);30$c->div(16,5);31$c = new Atoum\Logic();32$c->add(7,9);33$c->sub(9,6);34$c->mul(9,7);35$c->div(18,6);36$c = new Atoum\Logic();37$c->add(8,10);38$c->sub(10,7);39$c->mul(10,8);40$c->div(20,7);41$c = new Atoum\Logic();42$c->add(9,11);43$c->sub(11,8);

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used methods in logic

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful