public function caseProvider() { $array = array(); foreach (build_list(find_tests()) as $arr) { foreach ($arr as $e) { $name = $e['name']; if ($name === 'index' || in_array($name, self::$skipped)) { continue; } $array[] = array($name); } } return $array; }
public function caseProvider() { $cases = array(); foreach (build_list(find_tests()) as $arr) { foreach ($arr as $e) { $name = $e['name']; if ($name === 'index' || in_array($name, self::$skipped)) { continue; } if (isset(self::$skipped[$name])) { if (defined('HHVM_VERSION') && self::$skipped[$name] === 'hhvm') { continue; } } $cases[] = array($name); } } return $cases; }
if ($prevtag_pre) { $prevtag .= " | "; } else { $prevtag .= "<tr><td>"; } print "{$prevtag} <a onFocus=\"this.blur()\" href='?display=2&mode=file&skip={$nextskip}'>Next Page</a></td></tr>"; } elseif ($skip) { print "{$prevtag}"; } } ?> <h3><?php echo _("Download Fax TIFF Files:"); ?> </h3> <?php $file_array = build_list(); $numf = count($file_array); if ($_REQUEST['del']) { $rmcmd = "rm -f \"" . $path_to_dir . "/" . $_REQUEST['del'] . "\""; exec($rmcmd); $file_array = build_list(); } print "<table width=99% border=0 cellspacing=0 cellpadding=0><tr><td>"; print "<h5> DATE  HOURS</h5>"; print "</td></tr>"; $file_array = build_list(); draw_list($file_array, $path_to_dir, $perpage, $skip, $skipped, $index); print "</table>";
/** A recursive function to build a html list */ function build_list($list, &$i, $depth) { global $matches; // not sure why I global this... while ($i < count($matches[1])) { $class = isolate_class($matches[1][$i]); if (strstr($class, 'B')) { // make sure we are still working with bullet classes if ($class == 'B') { $this_depth = 0; // calling class B depth 0 } else { // set the depth number. So B1 is depth 1 and B2 is depth 2 and so on $this_depth = substr($class, 1); if (!is_numeric($this_depth)) { error("Depth not parsed!"); } } if ($this_depth < $depth) { // we are moving back a level in the nesting break; } if ($this_depth > $depth) { // we are moving in a lvl in nesting $list .= '<ul>'; $list = build_list($list, $i, $this_depth); // once we return back, should go to the start of the while continue; } // no depth changes, so add the match to our list if ($cleanstring = ppt_clean_text($matches[3][$i])) { $list .= '<li>' . ppt_clean_text($matches[3][$i]) . '</li>'; } $i++; } else { // not a B class, so get out of here... break; } } // end the list and return it $list .= '</ul>'; return $list; }
$cerereStatic = Cerere::find_by_id($idCerere); $cerere->idClient = $ClientId; if (isset($subZonaChecked)) { $cerere->Zona = build_list($subZonaChecked); } if (isset($TipProprietate)) { $cerere->TipProprietate = build_list($TipProprietate); } if (isset($NumarCamere)) { $cerere->NumarCamere = build_list($NumarCamere); } if (isset($Confort)) { $cerere->Confort = build_list($Confort); } if (isset($TipApartament)) { $cerere->TipApartament = build_list($TipApartament); } $cerere->EtajMinim = $EtajMin; $cerere->EtajMaxim = $EtajMax; $cerere->EtajeBlocMin = $EtajeBlocMin; $cerere->EtajeBlocMax = $EtajeBlocMax; $cerere->Parter = $Parter; $cerere->EtajIntermediar = $EtajIntermediar; $cerere->UltimulEtaj = $UltimulEtaj; $cerere->AnConstructie = $AnConstructie; if ($TipOferta == 1) { $cerere->Cumparare = 1; $cerere->Inchiriere = 0; } else { $cerere->Cumparare = 0; $cerere->Inchiriere = 1;
function build_list($struct, $level, $temp_tree, $act_cat_id, $class = '', $depth = 0) { // this returns the level structure based on given arrays // it is special for browsing from root levels if ($class != '') { $curClass = ' class="' . $class . $depth . '"'; $curClassNext = ' class="' . $class . ($depth + 1) . '"'; $curClassActive = ' class="' . $class . 'Active' . $depth . '"'; } else { $curClass = ''; $curClassNext = ''; $curClassActive = ' class="listActive"'; } $depth++; $temp_menu = "\n<ul" . $curClass . ">\n"; foreach ($struct as $key => $value) { if (_getStructureLevelDisplayStatus($key, $level)) { if (!$struct[$key]["acat_redirect"]) { $link = 'index.php?'; if ($struct[$key]["acat_alias"]) { $link .= html_specialchars($struct[$key]["acat_alias"]); } else { $link .= 'id=' . $key; //',0,0,1,0,0'; } $redirect['target'] = ''; } else { $redirect = get_redirect_link($struct[$key]["acat_redirect"], ' ', ''); $link = $redirect['link']; } if (!empty($temp_tree[$key])) { if ($act_cat_id == $key) { $temp_menu .= "\n<li" . $curClassActive . ">"; } else { $temp_menu .= "\n<li>"; } $temp_menu .= '<a href="' . $link . '">' . html_specialchars($struct[$key]["acat_name"]) . '</a>'; $temp_menu .= build_list($struct, $key, $temp_tree, $act_cat_id, $class, $depth); $temp_menu .= '</li>'; } else { $temp_menu .= "\n<li>" . '<a href="' . $link . '"' . $redirect['target'] . '>'; $temp_menu .= html_specialchars($struct[$key]["acat_name"]) . "</a></li>\n"; } } } $temp_menu = trim($temp_menu); return $temp_menu != "<ul" . $curClassNext . ">" ? $temp_menu . "\n</ul>" : ''; }
function nav_list_struct(&$struct, $act_cat_id, $level, $class = '') { // start with home directory for the listing = top nav structure // 1. Build the recursive tree for given actual article category ID // return the tree starting with given start_id (like breadcrumb) // if the $start_id = 0 then this stops because 0 = top level $level = intval($level); $data = array(); $start_id = $act_cat_id; $class = trim($class); $depth = 0; while ($start_id) { $data[$start_id] = 1; $start_id = $struct[$start_id]["acat_struct"]; } $temp_tree = sizeof($data) ? array_reverse($data, 1) : false; $temp_menu = build_list($struct, $level, $temp_tree, $act_cat_id, $class, $depth); $temp_menu = str_replace("\n\n", LF, $temp_menu); return $temp_menu ? $temp_menu : ''; }
function settings_edit($event, $step, $message = '', $show_panel = '') { global $txp_user, $vars, $txpcfg, $prefs, $general_settings; extract($prefs); $general_settings = safe_row("*", "store_settings", "1"); pagetop("Store Settings", $message); //JS INCLUDES //================================== //print_r($prefs); echo '<script type="text/javascript" src="http://' . $siteurl . '/jquery.js"></script>'; echo '<script type="text/javascript" src="http://' . $siteurl . '/jquery.js"></script>'; $step = "update"; //CSS FOR SETTINGS EDIT //================================== echo n . '<style type="text/css">' . n . 'td#article-main {' . n . ' width: 500px;' . n . '}' . n . '.customerEdit legend{' . n . ' font-size: 11px;' . n . ' font-weight: bold;' . n . '}' . n . '.customerEdit label{' . n . ' float: left;' . n . ' width: 100px;' . n . ' text-align: right;' . n . ' padding: 8px 5px 5px 5px;' . n . '}' . n . '.customerEdit br{' . n . ' clear: both;' . n . '}' . n . '.customerEdit p.desc{' . n . ' padding: 0px; font-size: 10px; font-style:italic; padding-left: 110px; color:gray;' . n . '}' . n . '.customerEdit input, select{' . n . ' margin: 5px 0 5px 0;' . n . ' font-size: 11px;' . n . '}' . n . '#subNav {' . n . ' list-style:none;' . n . ' padding-left:0px; margin-left:0;' . n . ' background-color:#FFFFCC;' . n . ' border-bottom:1px solid #DDDDDD;' . n . ' border-left:1px solid #F1F1F1;' . n . ' border-right:1px solid #DDDDDD;' . n . '}' . n . '#subNav li {' . n . ' list-style:none;' . n . ' padding:5px 0 5px 0; margin-left:0;' . n . '}' . n . '#subNav li.selected {' . n . ' background-color:white;' . n . '}' . n . '#subNav li.selected a{' . n . ' color:gray;' . n . '}' . n . '#subNav li a{' . n . ' text-align:left;font-size: 10px; font-weight:bold; color:#996633; width:100%; padding:5px;' . n . '}' . n . '.rateList th{ background-color: #EEEEEE; text-align:left;}' . n . '.rateList td, th{' . n . ' padding:3px;' . n . '}' . n . '.rateList {' . n . ' border-style:solid; border-width:0 1px 1px 1px; border-color:#DDDDDD; width:100%;' . n . '}' . n . '.zoneName{' . n . ' font-weight:normal; font-size: 110%; border-style:solid; border-width:0 0 1px 0; border-color:#DDDDDD; padding-bottom:5px; color:gray; margin-bottom:0;' . n . '}' . n . '</style>'; //JS //================================== doJS(); echo startTable('edit') . '<tr>' . n; //if ($view == 'text') //{ //-- markup help -------------- echo '<td id="article-col-1">' . n . '<ul id="subNav">' . n . '<li class="selected" id="generalSettingsTab" onclick="showTab(\'generalSettingsTab\', \'generalSettings\')"><a href="#" >General Settings</a></li>' . n . '<li id="shippingZonesTab"><a href="#" onclick="showTab(\'shippingZonesTab\', \'shippingZones\')">Countries/Regions</a></li>' . n . '<li id="shippingRatesTab"><a href="#" onclick="showTab(\'shippingRatesTab\', \'shippingRates\')">Shipping Rates</a></li>' . n . '<li id="noticesTab"><a href="#" onclick="showTab(\'noticesTab\', \'notices\')">Notices</a></li>' . n . '</ul></td>'; echo '<td id="article-main">' . n; //General Settings //======================================== echo "<div id='generalSettings' class='settingsRegion'>"; extract($general_settings); echo n . n . '<form name="longform" method="post" action="index.php">'; echo hInput('id', $id) . eInput('settings') . sInput($step) . '<input type="hidden" name="settings_update" value="general" />' . n . "<fieldset class='customerEdit'>" . n . "<legend>General Settings</legend>"; echo '<label for="owner_email">Event notify email</label>' . n . '<input type="text" class="text" name="owner_email" id="owner_email" value="' . $owner_email . '"/>' . br . n . '<p class="desc">Email will be used to notify of new orders, low inventory, etc.</p>' . n . '<label for="store_address">Street Address</label>' . n . '<input type="text" class="text" name="store_address" id="store_address" value="' . $store_address . '"/>' . br . n . '<label for="store_city">City</label>' . n . '<input type="text" class="text" name="store_city" id="store_city" value="' . $store_city . '"/>' . br . n . '<label for="store_state">State</label>' . n . '<input type="text" class="text" name="store_state" id="store_state" value="' . $store_state . '"/>' . br . n . '<label for="store_zip">Zip</label>' . n . '<input type="text" class="text" name="store_zip" id="store_zip" value="' . $store_zip . '"/>' . br . n . '<label for="store_country">Country</label>' . n . build_list("store_country", "countries", "id", "name", $store_country, "1", false, "order by name asc") . n . '</fieldset>'; if ($unit_system == "metric") { $metric_selected = 'selected="true"'; } else { $imperial_selected = 'selected="true"'; } echo "<fieldset class='customerEdit'>" . n . "<legend>Standards & Formats</legend>" . n . '<label for="unit_system">Unit system</label>' . n . '<select name="unit_system" id="unit_system"/>' . n . '<option value="imperial" ' . $imperial_selected . '>Imperial System (pound, inch)</option>' . n . '<option value="metric" ' . $metric_selected . '>Metric System (kilogram, centimeter)</option></select>' . n . '<label for="store_currency">Store Currency</label>' . n . build_list("store_currency", "currencies", "currency_code", "currency_name", $store_currency, "1") . br; echo n . '</fieldset>'; if ($hide_inventory_when_depleted == 1) { $inventory_hide_selected = "selected='true'"; } else { $inventory_show_selected = "selected='true'"; $display_message = "display:block;"; } if (isset($inventory_management_on) && $inventory_management_on == 1) { $inventory_management_on_checked = "checked='checked'"; } echo "<fieldset class='customerEdit'>" . n . "<legend>Inventory Settings</legend>" . n . '<p class="desc">These options only apply to products with inventory management turned on</p>' . n . '<label for="hide_inventory_when_depleted"> </label>' . n . '<select name="hide_inventory_when_depleted" id="hide_inventory_when_depleted" onchange="if(this.value == \'0\'){$(\'inventory_message\').style.display = \'block\';}else{$(\'inventory_message\').style.display = \'none\'}"/>' . n . '<option value="1" ' . $inventory_hide_selected . '>Hide Inventory when depleted</option>' . n . '<option value="0" ' . $inventory_show_selected . '">Show message when inventory depleted</option></select>' . br . n . '<div style="' . $display_message . '" id="inventory_message">' . n . '<label for="depleted_inventory_message">Depleted Inventory Message</label>' . n . '<textarea name="depleted_inventory_message" id="depleted_inventory_message">' . $depleted_inventory_message . '</textarea></div>' . br . n . '<label for="inventory_management_on"> </label>' . n . '<input name="inventory_management_on" id="inventory_management_on" type="checkbox" value="1" style="float:left; margin-right:5px;" ' . $inventory_management_on_checked . '/> <p style="padding-top:3px;">Send low inventory warning to store owner</p>' . br; echo n . '</fieldset>' . n . '<div class="submit">'; //-- publish button -------------- echo has_privs('article.publish') ? fInput('submit', 'publish', gTxt('update'), "publish", '', '', '', 4) : fInput('submit', 'publish', gTxt('update'), "publish", '', '', '', 4); echo n . '</div><!--/.submit--></form></div><!--/generalSettings-->'; //Shipping Zones //======================================== echo "<div id='shippingZones' style='display:none;' class='settingsRegion'><fieldset class='customerEdit'>" . n . "<legend>Support a new country or region</legend>"; $zones = safe_rows("*", "shipping_zones", "1"); $countryCriteria = '1 '; foreach ($zones as $zone) { $countryCriteria .= " AND id != " . $zone['country_id'] . " "; } echo n . n . '<form name="longform" method="post" action="index.php">' . eInput('settings') . sInput($step); echo '<input type="hidden" name="settings_update" value="add_zone"/>'; echo '<label for="country_id">Country</label>' . n . build_list("country_id", "countries", "id", "name", " ", $countryCriteria, true, "order by name asc") . n . '</select>' . br; /*echo '<label for="shipping_rate_id">Shipping rate</label>'. n.build_list("shipping_rate_id", "shipping_rates", "id", "title", " ", true, "1"). n.'</select>'.br; echo n.'<p class="desc">You can add more shipping rates to your regions in the Shipping Rates section.</p>';*/ if (empty($tax_rate)) { $tax_rate = "0.0"; } echo '<label for="tax_rate">Tax Rate</label>' . n . '<input type="text" name="tax_rate" id="tax_rate" value="' . $tax_rate . '" style="width: 20px">' . br; echo '<label> </label>'; echo fInput('submit', 'Add', 'Add', "smallerbox", '', '', '', 4); echo '</form>'; echo n . '</fieldset>'; echo n . "<h2>Your Regions</h2>"; echo '<table cellpadding="0" cellspacing="0" border="0" class="rateList">'; echo n . '<tr><th>Country</th><th colspan="2">Tax Rate</th></tr>'; foreach ($zones as $zone) { extract($zone); echo n . n . '<form name="longform" id="zone_' . $id . '_form" method="post" action="index.php">' . hInput('id', $id) . eInput('settings') . sInput($step); echo '<input type="hidden" name="settings_update" id="zone_' . $id . '_action" value="update_zone"/>'; echo '<tr><td>' . $name . '</td>' . n . '<td><input type="text" name="tax_rate" value="' . $tax_rate . '"/></td>' . n . '<td style="text-align:right;"><input type="submit" value="update" class="smallerbox"/> or <a href="javascript:deleteZone(\'' . $id . '\')">Delete</a></td>' . n . '</tr></form>'; } echo "</table>"; echo n . '</div><!--/shippingZones-->'; //Shipping Rates //======================================== echo "<div id='shippingRates' style='display:none;' class='settingsRegion'>" . n . "<h2>Shipping Rates</h2>"; $zones = safe_rows("*", "shipping_zones", "1"); foreach ($zones as $zone) { extract($zone); echo '<h4 class="zoneName">' . $name . ' <small>[<a href="#" onclick="$(\'#addNewShippingRate_' . $id . '\').show();">Add new shipping rate</a>]</small></h4>'; $sql = "select *, shipping_rates.id as shipping_rate_id from shipping_rates\r\n\t\t\t\t\t\t\t\t\t\tJOIN zones_rates\r\n\t\t\t\t\t\t\t\t\t\tON zones_rates.shipping_rate_id = shipping_rates.id\r\n\t\t\t\t\t\t\t\t\t\tJOIN shipping_zones\r\n\t\t\t\t\t\t\t\t\t\tON shipping_zones.id = zones_rates.shipping_zone_id\r\n\t\t\t\t\t\t\t\t\t\tWHERE zones_rates.shipping_zone_id = {$id}"; $rates = safe_query($sql); echo '<table cellpadding="0" cellspacing="0" border="0" class="rateList">'; if (mysql_num_rows($rates) > 0) { echo n . '<tr><th style="width:150px;">Label</th><th style="width:100px;">Amount</th><th style="width:250px;">Weight Range</th></tr>'; } $background = "#FFFFFF"; while ($rate = mysql_fetch_assoc($rates)) { echo '<tr><td colspan="3" style="background-color: ' . $background . '">'; echo n . n . '<form name="longform" method="post" action="index.php" id="rates_' . $rate['shipping_rate_id'] . '_form">' . hInput('id', $id) . eInput('settings') . sInput($step); echo '<input type="hidden" name="settings_update" id="rates_' . $rate['shipping_rate_id'] . '_action" value="update_rate"/>'; echo '<input type="hidden" name="shipping_rate_id" value="' . $rate['shipping_rate_id'] . '"/>'; // JR Chew - Now settings decipher between pounds and kilograms if ($general_settings['unit_system'] == 'metric') { $weight = kg; } else { $weight = lbs; } echo '<table cellpadding="0" cellspacing="0" border="0"><tr><td style="width:150px;"><input type="text" value="' . $rate['title'] . '" name="title"/></td>' . n . '<td valign="center" style="width:100px;padding:0;"><input type="text" value="' . number_format($rate['rate'], 2) . '" name="rate" style="width:25px;"/> ' . $general_settings['store_currency'] . '</td>' . n . '<td valign="center" style="width:130px;padding:0;"><input type="text" name="start_weight" value="' . $rate['start_weight'] . '" style="width:25px;"/> ' . $weight . ' - <input type="text" name="end_weight" value="' . $rate['end_weight'] . '" style="width:25px;"/> ' . $weight . ' </td>' . n . '<td style="text-align:right; width:120px;padding:0;"><input type="submit" value="update" class="smallerbox"/> or <a href="javascript:deleteRate(\'' . $rate['shipping_rate_id'] . '\')">delete</a></td></tr></table>'; echo '</form>'; echo "</td></tr>"; if ($background == "#F6F6F6") { $background = "#FFFFFF"; } else { $background = "#F6F6F6"; } } echo '</table>'; echo br . n . n . '<form name="longform" method="post" action="index.php">' . hInput('id', $id) . eInput('settings') . sInput($step); echo '<input type="hidden" name="settings_update" value="add_rate"/>'; echo '<table id="addNewShippingRate_' . $id . '" style="display: none; border-width:1px 1px 1px 1px;" cellpadding="0" cellspacing="0" border="0" class="rateList">'; echo n . '<tr><th style="width:150px;">Label</th><th style="width:100px;">Amount</th><th style="width:250px;" colspan="2">Weight Range</th></tr>'; echo '<tr style="background-color: ' . $background . '"><td><input type="text" value="" name="title" style="width:100%;"/></td>' . n . '<td valign="center"><input type="text" value="" name="rate" style="width:25px;"/> ' . $general_settings['store_currency'] . '</td>' . n . '<td valign="center"><input type="text" name="start_weight" value="0" style="width:25px;"/> lbs - <input type="text" name="end_weight" value="0" style="width:25px;"/> lbs</td>' . n . '<td style="text-align:right;"><input type="submit" value="save" class="smallerbox"/> <small><a href="javascript:void(0)" onclick="$(\'addNewShippingRate_' . $id . '\').style.display = \'none\'">cancel</a></small></td></tr>'; echo '</table></form>'; } echo n . '</div><!--/shippingRates-->'; //Notices Management //======================================== echo "<div id='notices' style='display:none;' class='settingsRegion'>" . n . "<h2>Notices</h2>"; echo n . n . '<form name="longform" method="post" action="index.php">' . hInput('id', $id) . eInput('settings') . sInput($step); echo '<input type="hidden" name="settings_update" value="notices" />'; echo n . '<fieldset class="customerEdit">' . n . '<legend>Customer Notifications</legend>'; echo n . '<label for="order_confirmation_form" style="width:180px;">Order Confirmation Form</label>' . n . build_list("order_confirmation_form", "txp_form", "name", "name", $order_confirmation_form, "type = 'article' and name != 'default'", true, "order by name asc"); echo '<p class="desc">TXP will send the customer a copy of this form when they complete a purchase</p>'; echo n . '</fieldset>'; echo n . '<fieldset class="customerEdit">' . n . '<legend>Your Notifications</legend>'; echo n . '<label for="new_order_use_form" style="width:180px;">New Order Notification Form</label>' . n . build_list("new_order_notification_form", "txp_form", "name", "name", $new_order_notification_form, "type = 'article' and name != 'default'", true, "order by name asc"); echo '<p class="desc">This is the email that TXP will send to you when a customer makes a new purchase</p>'; echo n . '</fieldset>'; echo fInput('submit', 'publish', gTxt('update'), "publish", '', '', '', 4); echo n . '</form></div><!--/notices-->'; if (isset($show_panel)) { if ($show_panel == "zones") { echo '<script type="text/javascript">' . n . '<!--' . n . 'showTab("shippingZonesTab", "shippingZones");' . n . '//-->' . n . '</script>'; } else { if ($show_panel == "rates") { echo '<script type="text/javascript">' . n . '<!--' . n . 'showTab("shippingRatesTab", "shippingRates");' . n . '//-->' . n . '</script>'; } else { if ($show_panel == "notices") { echo '<script type="text/javascript">' . n . '<!--' . n . 'showTab("noticesTab", "notices");' . n . '//-->' . n . '</script>'; } } } } echo '</td>'; echo '</tr></table>'; }
function get_tests_results($verbose = false) { global $argv; $moreVerbose = array_remove($argv, '--verbose'); if (!(ini_get('allow_url_include') | 0)) { echo "To accelerate the test execution, set in php.ini :\nallow_url_include = On\n\n"; } $nav_list = build_list(find_tests()); $success = 0; $failures = 0; $results = array(); foreach ($nav_list as $type => $arr) { foreach ($arr as $e) { $name = $e['name']; if ($name === 'index' || isset($argv[1]) && false === stripos($argv[0], 'phpunit') && $name !== $argv[1] && $argv[1] !== '.') { continue; } if ($result = get_test_result($name, $verbose, $moreVerbose)) { $results[] = $result[1]; if ($result[0]) { $success++; } else { $failures++; } } } } return array('success' => $success, 'failures' => $failures, 'results' => $results); }
function product_edit($event, $step, $message = '') { global $vars, $txp_user, $comments_disabled_after, $txpcfg, $prefs; extract($prefs); define("IMPATH", $path_to_site . '/' . $img_dir . '/'); extract(gpsa(array('view', 'from_view', 'step'))); if (!empty($GLOBALS['ID'])) { // newly-saved article $ID = $GLOBALS['ID']; $step = 'edit'; } else { $ID = gps('ID'); } //GET ARTICLE DATA FOR 'EDIT' & 'SAVE' STEP //================================== if ($step == "edit" || $step == "save" && !empty($ID)) { $pull = true; //-- it's an existing article - off we go to the db $ID = assert_int($ID); $rs = safe_row("*, unix_timestamp(Posted) as sPosted,\n\t\t\t\tunix_timestamp(LastMod) as sLastMod", "textpattern", "ID={$ID}"); extract($rs); if ($AnnotateInvite != $comments_default_invite) { $AnnotateInvite = $AnnotateInvite; } else { $AnnotateInvite = $comments_default_invite; } $custom_fields = safe_rows("*", "product_custom_fields", "articleID = {$ID} ORDER BY id DESC"); $step = "save"; //print_r($rs); } else { if (empty($step)) { $step = "create"; } } $textile = new Textile(); $textile_body = $use_textile; $textile_excerpt = $use_textile; $page_title = "Add a new product"; $message = ""; pagetop($page_title, $message); if (count($custom_fields) > 0) { $startFieldNum = $custom_fields[0]['id'] + 1; } else { $startFieldNum = 0; } //JS INCLUDES //================================== //print_r($prefs); echo '<script type="text/javascript" src="http://' . $siteurl . '/js/prototype.js"></script>'; echo '<script type="text/javascript" src="http://' . $siteurl . '/js/scriptaculous.js"></script>'; //CSS FOR PRODUCT DISPLAY //================================== echo n . '<style type="text/css">' . n . 'h4.productHeading{' . n . ' color:gray;' . n . ' margin-bottom:0px;' . n . '}' . n . 'h4.productHeading span{' . n . ' float:right;' . n . ' font-size:9px;' . n . ' font-style:italic;' . n . ' font-weight:normal;' . n . '}' . n . '.product-options-sub{' . n . ' padding: 10px;' . n . '}' . n . '.product-options-sub em{' . n . ' color:gray;' . n . '}' . n . '.product-options-sub legend{' . n . ' font-size:11px;' . n . '}' . n . '.product-options-sub label{' . n . ' font-size:11px;' . n . ' padding-bottom: 5px;' . n . '}' . n . '#images ul.plain-list li{' . n . ' float:left;' . n . ' margin-right:10px;' . n . ' margin-bottom:10px;' . n . ' width:375px;' . n . '}' . n . '#images ul.plain-list li img{' . n . ' border-width: 1px;' . n . ' border-color:#BBBBBB;' . n . ' border-style:solid;' . n . ' padding:3px;' . n . ' background-color: #E0E0E0;' . n . ' float:left;' . n . '}' . n . '#images ul.plain-list li .imageEdit{' . n . ' background-color:#E0E0E0;' . n . ' height: 15px;' . n . ' width: 250px;' . n . ' text-align:left;' . n . ' padding:3px 3px 3px 110px;' . n . ' margin-top:0px;' . n . '}' . n . '#images ul.plain-list li .imageUpload{' . n . ' margin-top: 5px;' . n . ' padding:3px;' . n . ' width: 275px;' . n . ' border-width: 1px;' . n . ' border-color:#E0E0E0;' . n . ' border-style:solid;' . n . '}' . n . '</style>'; echo n . '<script type="text/javascript">' . n . ' <!--' . n . ' fieldNum = ' . $startFieldNum . ';' . n . ' function addCustomField(index){' . n . ' //$("custom_fields").innerHTML = $("custom_fields").innerHTML + getCustomField(fieldNum);' . n . ' $("custom_fields").appendChild(getCustomField(fieldNum))' . n . ' fieldNum = fieldNum+1;' . n . ' }' . n . ' function deleteCustomField(index){' . n . ' if(confirm("Are you sure?")){' . n . ' $("custom_field_"+index).style.display = "none";' . n . ' $("custom_fields["+index+"][value]").value = "delete";' . n . ' $("custom_fields["+index+"][label]").value = "delete";' . n . ' }else{ return false; }' . n . ' }' . n . ' function getCustomField(index){' . n . ' var span = document.createElement("span");' . n . ' span.setAttribute("id","custom_field_"+index);' . n . ' var label = document.createElement("label");' . n . ' label.setAttribute("for","custom_fields["+index+"][label]");' . n . ' labelText = document.createTextNode("Label ");' . n . ' var input = document.createElement("input");' . n . ' input.setAttribute("id","custom_fields["+index+"][label]");' . n . ' input.setAttribute("name","custom_fields["+index+"][label]");' . n . ' var labelValue = document.createElement("label");' . n . ' labelValue.setAttribute("for","custom_fields["+index+"][value]");' . n . ' labelTextValue = document.createTextNode(" Value ");' . n . ' var inputValue = document.createElement("input");' . n . ' inputValue.setAttribute("id","custom_fields["+index+"][value]");' . n . ' inputValue.setAttribute("name","custom_fields["+index+"][value]");' . n . ' var deleteLink = document.createElement("a");' . n . ' deleteLink.setAttribute("href","javascript:void(0)");' . n . ' deleteLink.setAttribute("onclick","deleteCustomField("+index+");");' . n . ' deleteLink.setAttribute("style","font-size: 11px;");' . n . ' deleteText = document.createTextNode("Delete");' . n . ' label.appendChild(labelText);' . n . ' span.appendChild(label);' . n . ' span.appendChild(input);' . n . ' labelValue.appendChild(labelTextValue);' . n . ' span.appendChild(labelValue);' . n . ' span.appendChild(inputValue);' . n . ' deleteLink.appendChild(deleteText);' . n . ' span.appendChild(deleteLink);' . n . ' span.appendChild(document.createElement("br"));' . n . ' span.appendChild(document.createElement("br"));' . n . ' return span;' . n . ' }' . n . '//-->' . n . '</script>'; echo n . n . '<form name="product" method="post" action="index.php" enctype="multipart/form-data">'; echo '<input type="hidden" name="textile_body" value="1"/>'; echo '<input type="hidden" name="textile_excerpt" value="1"/>'; echo '<input type="hidden" name="Section" value="store"/>'; echo hInput('ID', $ID) . eInput('product') . sInput($step) . '<input type="hidden" name="view" />' . startTable('edit') . '<tr>' . n; //if ($view == 'text') //{ //-- markup help -------------- echo '<td id="article-main">'; echo "<h4 class='productHeading'>Product name</h4>"; echo '<p><input type="text" id="title" name="Title" value="' . cleanfInput($Title) . '" class="edit" size="40" tabindex="1" />'; if (($Status == 4 or $Status == 5) and $step != 'create') { include_once txpath . '/publish/taghandlers.php'; echo sp . sp . '<a href="' . permlinkurl_id($ID) . '">' . gTxt('view') . '</a>'; } echo '</p>'; echo "<h4 class='productHeading'><span>Textile & HTML allowed</span> Describe the product</h4>"; echo n . graf('<textarea id="body" name="Body" cols="55" rows="31" tabindex="2" style="height: 180px;">' . htmlspecialchars($Body) . '</textarea>'); //PRODUCT OPTIONS //================================ //echo '<div id="productOptions" style="border-width:1px; border-color:#E1E1E1; border-style:solid; padding:5px; background-color:#F3F4F4;">'; //PRODUCT & PRICE //================================ echo n . n . '<fieldset class="product-options-sub" style="background-color:white">' . '<div style="float:left; margin-right: 40px;">' . n . graf('<label for="price">Price</label> ' . br . n . '<input style="width: 50px;" type="text" name="custom_1" id="price" value="' . cleanfInput($custom_1) . '"/> <em>usd</em>') . n . '</div>' . n . graf('<label for="weight">Weight</label>' . br . n . '<input type="text" style="width: 50px;" name="custom_2" id="weight" value="' . cleanfInput($custom_2) . '"/> <em>lbs</em>'); echo n . "</fieldset>"; //CUSTOM FIELDS //================================ if (isset($ID)) { $custom_fields = get_custom_fields($ID); } else { $custom_fields = ''; } echo n . n . '<fieldset class="product-options-sub" style="background-color:white" id="custom_fields">' . n . '<legend>Custom Fields <span>[<a href="javascript:addCustomField(0);">Add a new custom field</a>]</span></legend>'; echo $custom_fields; echo n . "</fieldset>"; //CATEGORIES //================================ //if(!is_callable("rss_admin_catlist")){ echo n . n . '<fieldset class="product-options-sub" style="background-color:white">' . n . '<legend>Categorize <small>[<a href="?event=category">edit</a>]</small></legend>' . '<div style="float:left; margin-right: 10px;">' . n . graf('<label for="category-1">' . gTxt('category1') . '</label> ' . n . '<select name="Category1" id="category-1"><option></option>' . n . product_cateogry_option_list($Category1) . n . '</select>') . n . '</div>' . n . graf('<label for="category-2">' . gTxt('category2') . '</label>' . n . '<select name="Category2" id="category-2"><option></option>' . n . product_cateogry_option_list($Category2) . n . '</select>'); echo n . "</fieldset>"; //} //VENDORS //================================ echo n . n . '<fieldset class="product-options-sub" style="background-color:white">' . n . '<legend>Vendor <em>The creator or manufacturer of the product. </em></legend>' . '<div style="float:left; width:50%;">' . n . '<label for="vendor">Select existing vendor </label> ' . br . n . build_list("vendor", "txp_category", "name", "title", $custom_5, "parent='Vendors'", true) . n . '</div>' . n . graf('<label for="new_vendor_name">Or create a new vendor</label>' . br . n . '<input id="new_vendor_name" type="text" name="new_vendor_name"/>'); echo n . "</fieldset>"; //INVENTORY //================================ echo n . '<fieldset class="product-options-sub" style="background-color:white">' . n . '<legend>Inventory</legend>'; echo n . '<label for="sku">SKU <em>Stock keeping unit</em></label>' . n . br . '<input type="text" name="custom_3" id="sku" value="' . $custom_3 . '"/>' . br . br; if (isset($custom_4) && !empty($custom_4)) { $showLevel = true; $levelSelected = "selected = 'true'"; $levelStyle = 'display:block;'; } else { $showLevel = false; $levelSelected = ""; $levelStyle = 'display:none;'; } echo n . '<select name="trackOptions" id="trackOptions" onchange="if(this.value == \'doTrack\'){$(\'stockLevel\').style.display = \'block\';}else{$(\'stockLevel\').style.display = \'none\';}">' . n . n . '<option value="dontTrack">Don\'t track stock level</option>' . n . '<option value="doTrack" ' . $levelSelected . '>Keep track of stock level</option>' . n . '</select>' . br . br; echo n . '<div id="stockLevel" style="' . $levelStyle . '">' . n . '<label for="items_in_stock">Number of items in stock:</label>' . n . '<input type="text" name="custom_4" id="items_in_stock" style="width: 20px;" value="' . cleanfInput($custom_4) . '"/>' . n . '</div><!--/stockLevel-->'; echo n . "</fieldset>"; //IMAGES //================================ echo ' <script type="text/javascript"> <!-- function deleteImage(id){ if(confirm("Are you sure?")){ if(id == "1"){ $("image1").style.display = "none"; $("imageField1").value = "delete"; }else if(id == "2"){ $("image2").style.display = "none"; $("imageField2").value = "delete"; }else if(id == "3"){ $("image3").style.display = "none"; $("imageField3").value = "delete"; }else if(id == "4"){ $("image4").style.display = "none"; $("imageField4").value = "delete"; } document.forms["product"].submit(); } } function updateImage(id){ if(id == "1"){ new Effect.SlideDown($("imageUpload1")); $("updateImage1").value = $("imageField1").value; $("imageField1").value = "delete"; }else if(id == "2"){ new Effect.SlideDown($("imageUpload2")); $("updateImage2").value = $("imageField2").value; $("imageField2").value = "delete"; }else if(id == "3"){ new Effect.SlideDown($("imageUpload3")); $("updateImage3").value = $("imageField3").value; $("imageField3").value = "delete"; }else if(id == "4"){ new Effect.SlideDown($("imageUpload4")); $("updateImage4").value = $("imageField4").value; $("imageField4").value = "delete"; } } function cancelUpload(id){ if(id == "1"){ new Effect.SlideUp($("imageUpload1")); $("imageField1").value = $("updateImage1").value; }else if(id == "2"){ new Effect.SlideUp($("imageUpload2")); $("imageField2").value = $("updateImage2").value; }else if(id == "3"){ new Effect.SlideUp($("imageUpload3")); $("imageField3").value = $("updateImage3").value; }else if(id == "4"){ new Effect.SlideUp($("imageUpload4")); $("imageField4").value = $("updateImage4").value; } } --> </script> '; if ($step == "create") { echo n . '<fieldset class="product-options-sub" style="background-color:white">' . n . '<legend>Product images</legend>'; echo n . '<em>Allowed file types are JPG, GIF & PNG</em>'; echo n . '<input type="file" name="uploadFile"/>' . n; echo n . "</fieldset>"; } else { if ($step == "edit" || $step == "save" || empty($step)) { echo n . '<fieldset class="product-options-sub" id="images" style="background-color:white">' . n . '<legend>Product images</legend>'; echo n . '<ul class="plain-list" id="image_list">'; if (isset($Image) && !empty($Image)) { echo n . '<li id="image1"> <img src="' . product_image_display($Image, "small") . '" alt="Product Image"/> <div class="imageEdit" style="display:block;"> <a href="javascript:deleteImage(\'1\')">Delete Image</a> | <a href="javascript:updateImage(\'1\')">Update Image</a> <div class="imageUpload" id="imageUpload1" style="display:none;"> Browse for new image: <input type="file" name="uploadFile1"/> and <input type="submit" value="Save"/> <a href="javascript:cancelUpload(\'1\')">Cancel</a> <input type="hidden" name="updateImage1" id="updateImage1" value="0"/> </div> <input id="imageField1" type="hidden" name="Image" value="' . $Image . '"/> </div> </li>'; } if (isset($custom_6) && !empty($custom_6)) { echo n . '<li id="image2"><img src="' . product_image_display($custom_6, "small") . '" alt="Product Image"/> <div class="imageEdit" id="image1Control" style="display:block;"> <a href="javascript:deleteImage(\'2\')">Delete Image</a> | <a href="javascript:updateImage(\'2\')">Update Image</a> <div class="imageUpload" id="imageUpload2" style="display:none;"> Browse for new image: <input type="file" name="uploadFile2"/> and <input type="submit" value="Save"/> <a href="javascript:cancelUpload(\'2\')">Cancel</a> <input type="hidden" name="updateImage2" id="updateImage2" value="0"/> </div> </div><input id="imageField2" type="hidden" name="custom_6" value="' . $custom_6 . '"/></li>'; } if (isset($custom_7) && !empty($custom_7)) { echo n . '<li id="image3"><img src="' . product_image_display($custom_7, "small") . '" alt="Product Image"/> <div class="imageEdit" id="image1Control" style="display:block;"> <a href="javascript:deleteImage(\'3\')">Delete Image</a> | <a href="javascript:updateImage(\'3\')">Update Image</a> <div class="imageUpload" id="imageUpload3" style="display:none;"> Browse for new image: <input type="file" name="uploadFile3"/> and <input type="submit" value="Save"/> <a href="javascript:cancelUpload(\'3\')">Cancel</a> <input type="hidden" name="updateImage3" id="updateImage3" value="0"/> </div> </div> <input id="imageField3" type="hidden" name="custom_7" value="' . $custom_7 . '"/></li>'; } if (isset($custom_8) && !empty($custom_8)) { echo n . '<li id="image4"><img src="' . product_image_display($custom_8, "small") . '" alt="Product Image"/> <div class="imageEdit" id="image1Control" style="display:block;"> <a href="javascript:deleteImage(\'4\')">Delete Image</a> | <a href="javascript:updateImage(\'4\')">Update Image</a> <div class="imageUpload" id="imageUpload4" style="display:none;"> Browse for new image: <input type="file" name="uploadFile4"/> and <input type="submit" value="Save"/> <a href="javascript:cancelUpload(\'4\')">Cancel</a> <input type="hidden" name="updateImage4" id="updateImage4" value="0"/> </div> </div><input id="imageField4" type="hidden" name="custom_8" value="' . $custom_8 . '"/></li>'; } echo n . "</ul><br style='clear:both;'/>"; echo n . '<a href="javascript:void(0);" onclick="document.getElementById(\'otherImageUpload\').style.display = \'block\'">Add an image</a>' . n; echo n . '<div id="otherImageUpload" style="display:none; margin-top: 10px;">'; echo n . '<em>Allowed file types are JPG, GIF & PNG</em>'; echo n . '<input type="file" name="uploadFile"/> and <input type="submit" value="upload"/>' . n; echo n . '</div>'; echo n . "</fieldset>"; echo n . '<div id="data"></div>'; } } //echo '</div>'; // end productOptions // end left content area echo hInput('from_view', $view), '</td>'; echo '<td id="article-col-2" style="padding-top: 75px;">'; //start article-col-2 //PRODUCT STATUS //================================ echo n . n . '<fieldset id="write-status">' . n . '<legend>' . gTxt('status') . '</legend>' . n . status_radio_product($Status) . n . '</fieldset>'; //-- comments stuff -------------- if ($step == "create") { //Avoiding invite disappear when previewing $AnnotateInvite = !empty($store_out['AnnotateInvite']) ? $store_out['AnnotateInvite'] : $comments_default_invite; if ($comments_on_default == 1) { $Annotate = 1; } } if ($use_comments == 1) { echo n . n . '<fieldset id="write-comments">' . n . '<legend>Allow product reviews</legend>'; $comments_expired = false; if ($step != 'create' && $comments_disabled_after) { $lifespan = $comments_disabled_after * 86400; $time_since = time() - $sPosted; if ($time_since > $lifespan) { $comments_expired = true; } } if ($comments_expired) { echo n . n . graf(gTxt('expired')); } else { echo n . n . graf(onoffRadio('Annotate', $Annotate)) . n . n . graf('<label for="comment-invite">' . gTxt('comment_invitation') . '</label>' . br . fInput('text', 'AnnotateInvite', $AnnotateInvite, 'edit', '', '', '', '', 'comment-invite')); } echo n . n . '</fieldset>'; } /*if(is_callable("rss_admin_catlist")){ echo "<fieldset id='write-sort'></fieldset>"; echo rss_admin_catlist(); }*/ //wilshireone multipule categories //-- publish button -------------- echo has_privs('article.publish') ? fInput('submit', 'publish', gTxt('save'), "publish", '', '', '', 4) : fInput('submit', 'publish', gTxt('save'), "publish", '', '', '', 4); echo '</td> <!--/article-col-2-->'; //end article-col-2 echo '</td></tr></table></form>'; }
if (!isset($group_list[$parts[0]])) { $group_list[$parts[0]] = array(); } $group_list[$parts[0]][] = array('link' => $test, 'name' => $name); } return $group_list; } function show_php($file) { $jade = new \Jade\Jade(true); return $jade->render($file); } mb_internal_encoding('utf-8'); error_reporting(E_ALL); setup_autoload(); $nav_list = build_list(find_tests()); foreach ($nav_list as $type => $arr) { foreach ($arr as $e) { if ($e['name'] == 'index' || isset($argv[1]) && $e['name'] != $argv[1] && $argv[1] != '.') { continue; } $html = @file_get_contents($e['name'] . '.html'); if ($html === FALSE) { print "! sample for test '{$e['name']}' not found.\n"; continue; } print "* rendering test '{$e['name']}'\n"; try { $new = show_php($e['name'] . '.jade'); } catch (Exception $err) { print "! FATAL: php exception: " . str_replace("\n", "\n\t", $err) . "\n";
function get_tests_results($verbose = false) { global $argv; $nav_list = build_list(find_tests()); $success = 0; $failures = 0; $results = array(); foreach ($nav_list as $type => $arr) { foreach ($arr as $e) { $name = $e['name']; if ($name == 'index' || isset($argv[1]) && false === stripos($argv[0], 'phpunit') && $name != $argv[1] && $argv[1] != '.') { continue; } $result = get_test_result($name, $verbose); $results[] = $result[1]; if ($result[0]) { $success++; } else { $failures++; if (isset($argv[1]) && $argv[1] == '.') { exit; } } } } return array('success' => $success, 'failures' => $failures, 'results' => $results); }
/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); echo $before_widget; if (!empty($title)) { echo $before_title . $title . $after_title; } //echo __( 'Hello, World!', 'text_domain' ); $showfolder = urlencode($instance['folderpath']); if (!empty($showfolder)) { $ret = ""; try { $client = new CMISService(get_option('cmis_repo_url'), get_option('cmis_user'), get_option('cmis_pass')); $folder = $client->getObjectByPath($showfolder); if ($folder) { if (empty($title)) { $title = $folder->properties["cmis:name"]; echo $before_title . $title . $after_title; } $objs = $client->getChildren($folder->id); $ret .= build_list($objs, $folder, FALSE); } else { $ret = "Folder not found: " . $showfolder; } } catch (Exception $e) { $ret = "Error retrieving documents: {$e}"; } echo $ret; } echo $after_widget; }