Best Phoronix-test-suite code snippet using pts_web_embed.cookie_input_helper
pts_web_embed.php
Source:pts_web_embed.php
...30 }31 32 return $html . '</p>';33 }34 public static function cookie_input_helper($cookie_name, $description_string)35 {36 $html = '<p style="margin-top: 0; margin-bottom: 1px;"><input type="text" onchange="javascript:document.cookie=\'' . $cookie_name . '=\' + this.value + \'\'; location.reload();" value="' . (self::cookie_check($cookie_name) ? self::cookie_check($cookie_name) : '') . '" placeholder="' . $description_string . '" /> </p>';37 38 return $html;39 }40 public static function cookie_check($cookie_name)41 {42 return isset($_COOKIE[$cookie_name]) && $_COOKIE[$cookie_name] ? $_COOKIE[$cookie_name] : false;43 }44 public static function tests_cmp_result_object_sort($a, $b)45 {46 $a_comp = $a->get_test_hardware_type() . $a->get_title();47 $b_comp = $b->get_test_hardware_type() . $b->get_title();48 return strcmp($a_comp, $b_comp);49 }50 public static function tests_list($tests_to_show = false)51 {52 $html = '';53 $html .= pts_web_embed::cookie_checkbox_option_helper('show_linux_tests', 'Limit to tests that support Linux.');54 $html .= pts_web_embed::cookie_checkbox_option_helper('show_windows_tests', 'Limit to tests that support Windows.');55 $html .= pts_web_embed::cookie_checkbox_option_helper('show_macos_tests', 'Limit to tests that support macOS.');56 $html .= pts_web_embed::cookie_checkbox_option_helper('show_bsd_tests', 'Limit to tests that support BSD.');57 $html .= pts_web_embed::cookie_checkbox_option_helper('include_outdated_tests', 'Include test profiles not actively maintained (potentially outdated).');58 $html .= pts_web_embed::cookie_checkbox_option_helper('include_deprecated_tests', 'Include test profiles marked deprecated or broken.');59 $html .= pts_web_embed::cookie_checkbox_option_helper('linear_list', 'Show test profiles in a linear list.');60 $html .= pts_web_embed::cookie_input_helper('search_tests', 'Search test profiles');61 $tests = pts_openbenchmarking::available_tests(false, false, true);62 if($tests_to_show == false)63 {64 $tests_to_show = array();65 foreach($tests as $identifier)66 {67 $test_profile = new pts_test_profile($identifier);68 if($test_profile->get_title() == null)69 {70 // Don't show unsupported tests71 continue;72 }73 $tests_to_show[] = $test_profile;74 }75 }76 77 if(empty($tests_to_show))78 {79 $html .= '<p>No cached test profiles found.</p>';80 }81 else82 {83 $html .= '<p><em>The test profiles below are cached on the local system and in a current state. For a complete listing of available tests visit <a href="https://openbenchmarking.org/">OpenBenchmarking.org</a>.</em></p>';84 }85 $html .= '<div class="pts_test_boxes">';86 $tests_to_show = array_unique($tests_to_show);87 usort($tests_to_show, array('pts_web_embed', 'tests_cmp_result_object_sort'));88 $category = null;89 $tests_in_category = 0;90 foreach($tests_to_show as &$test_profile)91 {92 if($category != $test_profile->get_test_hardware_type())93 {94 $category = $test_profile->get_test_hardware_type();95 if($category == null)96 {97 continue;98 }99 if($tests_in_category > 0)100 {101 $html .= '<br style="clear: both;" /><em>' . pts_strings::plural_handler($tests_in_category, 'Test') . '</em>';102 }103 $tests_in_category = 0;104 $html .= '</div><a name="' . $category . '"></a>' . PHP_EOL . '<h2>' . $category . '</h2>' . PHP_EOL . '<div class="pts_test_boxes">';105 $popularity_index = pts_openbenchmarking_client::popular_tests(-1, pts_openbenchmarking_client::read_repository_test_profile_attribute($test_profile, 'test_type'));106 }107 if($category == null)108 {109 continue;110 }111 if(self::cookie_check('include_deprecated_tests') == false && ($test_profile->get_status() == 'Deprecated' || $test_profile->get_status() == 'Broken'))112 {113 // Don't show deprecated/broken tests114 continue;115 }116 if(self::cookie_check('show_linux_tests') && !in_array('Linux', $test_profile->get_supported_platforms()))117 {118 continue;119 }120 if(self::cookie_check('show_windows_tests') && !in_array('Windows', $test_profile->get_supported_platforms()))121 {122 continue;123 }124 if(self::cookie_check('show_macos_tests') && !in_array('MacOSX', $test_profile->get_supported_platforms()))125 {126 continue;127 }128 if(self::cookie_check('show_bsd_tests') && !in_array('BSD', $test_profile->get_supported_platforms()))129 {130 continue;131 }132 $last_updated = pts_openbenchmarking_client::read_repository_test_profile_attribute($test_profile, 'last_updated');133 $versions = pts_openbenchmarking_client::read_repository_test_profile_attribute($test_profile, 'versions');134 $popularity = isset($popularity_index) && is_array($popularity_index) ? array_search($test_profile->get_identifier(false), $popularity_index) : false;135 136 if(self::cookie_check('include_outdated_tests') == false && $last_updated < (time() - (86400 * 365 * 4)))137 {138 // Don't show really old tests139 continue;140 }141 if(!empty($search_query = self::cookie_check('search_tests')) && !pts_search::check_test_profile_match($test_profile, $search_query))142 {143 continue;144 }145 $secondary_message = '';146 if($last_updated > (time() - (86400 * 30)))147 {148 $secondary_message = count($versions) == 1 ? '- <em>Newly Added</em>' : '- <em>Recently Updated</em>';149 }150 else if($popularity === 0)151 {152 $secondary_message = '- <em>Most Popular</em>';153 }154 else if($popularity < 4)155 {156 $secondary_message = '- <em>Very Popular</em>';157 }158 else if($popularity < 6)159 {160 $secondary_message = '- <em>Quite Popular</em>';161 }162 if(defined('PHOROMATIC_SERVER'))163 {164 $test_page_url = '/?tests/' . $test_profile->get_identifier();165 if(!PHOROMATIC_USER_IS_VIEWER)166 {167 $secondary_message .= (strpos($test_profile->get_identifier(), 'local/') !== false ? '<a href="/?create_test/' . $test_profile->get_identifier() . '">Edit Test</a> - <a href="/?create_test/' . $test_profile->get_identifier() . '&delete" onclick="return confirm(\'Are you sure you want to delete this test?\');">Delete Test</a>' : '');168 }169 }170 else171 {172 $test_page_url = WEB_URL_PATH . 'test/' . base64_encode($test_profile->get_identifier());173 }174 if(self::cookie_check('linear_list'))175 {176 $html .= '<h1 style="margin-bottom: 0;"><a href="' . $test_page_url . '">' . $test_profile->get_title() . '</a></h1>';177 $html .= '<p><strong>' . $test_profile->get_identifier() . '</strong> ' . $secondary_message . ' <em>-</em> ' . $test_profile->get_description() . '</p>';178 }179 else180 {181 $html .= '<a href="' . $test_page_url . '"><div class="table_test_box"><strong>' . $test_profile->get_title(). '</strong><br /><span>~' . pts_strings::plural_handler(max(1, round(pts_openbenchmarking_client::read_repository_test_profile_attribute($test_profile, 'average_run_time') / 60)),182'min') . ' run-time ' . $secondary_message . '</span></div></a>';183 }184 $tests_in_category++;185 }186 if($tests_in_category > 0)187 {188 $html .= '<br style="clear: both;" /><em>' . $tests_in_category . ' Tests</em>';189 }190 $html .= '</div>';191 192 return $html;193 }194 public static function suites_cmp_result_object_sort($a, $b)195 {196 $a_comp = $a->get_suite_type() . $a->get_title();197 $b_comp = $b->get_suite_type() . $b->get_title();198 return strcmp($a_comp, $b_comp);199 }200 public static function test_suites_list()201 {202 $html = '';203 $suites = pts_test_suites::all_suites_cached();204 $suites_to_show = array();205 foreach($suites as $identifier)206 {207 $test_suite = new pts_test_suite($identifier);208 if($test_suite->get_title() == null)209 {210 // Don't show unsupported suites211 continue;212 }213 $suites_to_show[] = $test_suite;214 }215 if(empty($suites_to_show))216 {217 $html .= '<p>No cached test suites found.</p>';218 }219 else220 {221 $html .= pts_web_embed::cookie_input_helper('search_suites', 'Search test suites');222 $html .= '<p><em>The test suites below are cached and available on the local system. For a complete listing of available test suites visit <a href="https://openbenchmarking.org/">OpenBenchmarking.org</a>.</em></p>';223 }224 $html .= '<div class="pts_test_boxes">';225 $suites_to_show = array_unique($suites_to_show);226 usort($suites_to_show, array('pts_web_embed', 'suites_cmp_result_object_sort'));227 $category = null;228 $suites_in_category = 0;229 foreach($suites_to_show as &$test_suite)230 {231 if(!empty($search_query = self::cookie_check('search_suites')) && !pts_search::check_test_suite_match($test_suite, $search_query))232 {233 continue;234 }235 if($category != $test_suite->get_suite_type())...
cookie_input_helper
Using AI Code Generation
1$pts_web_embed = new pts_web_embed();2$pts_web_embed->cookie_input_helper();3$pts_web_embed = new pts_web_embed();4$pts_web_embed->cookie_output_helper();5require_once('pts_web_embed.php');6$pts_web_embed = new pts_web_embed();7$pts_web_embed = new pts_web_embed();8$pts_web_embed->cookie_input_helper();9$pts_web_embed = new pts_web_embed();10$pts_web_embed->cookie_output_helper();11require_once('pts_web_embed.php');12$pts_web_embed = new pts_web_embed();13$pts_web_embed = new pts_web_embed();14$pts_web_embed->cookie_input_helper();15$pts_web_embed = new pts_web_embed();16$pts_web_embed->cookie_output_helper();17require_once('pts_web_embed.php');18$pts_web_embed = new pts_web_embed();
cookie_input_helper
Using AI Code Generation
1$pts = new pts_web_embed();2$pts->cookie_input_helper('2');3$pts = new pts_web_embed();4$pts->cookie_input_helper('3');5$pts = new pts_web_embed();6$pts->cookie_input_helper('4');7$pts = new pts_web_embed();8$pts->cookie_input_helper('5');9$pts = new pts_web_embed();10$pts->cookie_input_helper('6');11$pts = new pts_web_embed();12$pts->cookie_input_helper('7');13$pts = new pts_web_embed();14$pts->cookie_input_helper('8');15$pts = new pts_web_embed();16$pts->cookie_input_helper('9');17$pts = new pts_web_embed();18$pts->cookie_input_helper('10');19$pts = new pts_web_embed();20$pts->cookie_input_helper('11');21$pts = new pts_web_embed();22$pts->cookie_input_helper('12');23$pts = new pts_web_embed();24$pts->cookie_input_helper('13');
cookie_input_helper
Using AI Code Generation
1include_once('pts_web_embed.class.php');2$pts_web_embed = new pts_web_embed();3$pts_web_embed->cookie_input_helper();4include_once('pts_web_embed.class.php');5$pts_web_embed = new pts_web_embed();6$cookie_value = $pts_web_embed->get_cookie_value();7echo $cookie_value;8include_once('pts_web_embed.class.php');9$pts_web_embed = new pts_web_embed();10$pts_web_embed->delete_cookie();11include_once('pts_web_embed.class.php');12$pts_web_embed = new pts_web_embed();13$cookie_is_set = $pts_web_embed->cookie_is_set();14if($cookie_is_set)15{16echo 'Cookie is set';17}18{19echo 'Cookie is not set';20}
cookie_input_helper
Using AI Code Generation
1require_once('pts_web_embed.php');2$pts_web_embed = new pts_web_embed();3$pts_web_embed->cookie_input_helper('name', 'value', 'time', 'path');4require_once('pts_web_embed.php');5$pts_web_embed = new pts_web_embed();6$pts_web_embed->set_cookie('name', 'value', 'time', 'path');7require_once('pts_web_embed.php');8$pts_web_embed = new pts_web_embed();9$pts_web_embed->get_cookie('name');10require_once('pts_web_embed.php');11$pts_web_embed = new pts_web_embed();12$pts_web_embed->delete_cookie('name');13require_once('pts_web_embed.php');14$pts_web_embed = new pts_web_embed();15$pts_web_embed->check_cookie('name');16require_once('pts_web_embed.php');17$pts_web_embed = new pts_web_embed();18$pts_web_embed->set_session('name', 'value');19require_once('pts_web_embed.php');20$pts_web_embed = new pts_web_embed();21$pts_web_embed->get_session('name');
cookie_input_helper
Using AI Code Generation
1require_once('pts-web-embed.php');2$pts = new pts_web_embed();3$cookie = $pts->cookie_input_helper();4";5require_once('pts-web-embed.php');6$pts = new pts_web_embed();7$cookie = $pts->cookie_input_helper();8";
cookie_input_helper
Using AI Code Generation
1$cookie_value = $pts_web_embed->cookie_input_helper('cookie_name');2echo $cookie_value;3$pts_web_embed->cookie_output_helper('cookie_name', 'cookie_value');4$cookie_value = $pts_web_embed->cookie_input_helper('cookie_name');5echo $cookie_value;6$cookie_value = $pts_web_embed->cookie_input_helper('cookie_name');7echo $cookie_value;8$pts_web_embed->cookie_output_helper('cookie_name', 'cookie_value');
cookie_input_helper
Using AI Code Generation
1require_once('pts_web_embed.class.php');2$pts = new pts_web_embed();3$pts->cookie_input_helper('mycookie','myfield');4require_once('pts_web_embed.class.php');5$pts = new pts_web_embed();6$pts->cookie_input_helper('mycookie','myfield');7require_once('pts_web_embed.class.php');8$pts = new pts_web_embed();9$pts->cookie_input_helper('mycookie','myfield');10require_once('pts_web_embed.class.php');11$pts = new pts_web_embed();12$pts->cookie_input_helper('mycookie','myfield');13require_once('pts_web_embed.class.php');14$pts = new pts_web_embed();15$pts->cookie_input_helper('mycookie','myfield');
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with cookie_input_helper on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!