function display_blog($blog, $row) { if ($row['tracks'] > 0) { $img_src = "http://www.google.com/s2/favicons?domain=" . urlencode(parse_url($row['blog'], PHP_URL_HOST)); return ax_a_href_title(ax_img_src($img_src, array('class' => 'icon')), $row['blog'], 'Go to this blog'); } }
/** * Create an image element. This is an alias for ax_img_src. * \param $src Source for the image * \param $attributes Additional element attributes (optional) * \see ax_img_src */ function ax_img($src, $attributes = null) { $element = ax_img_src($src, $attributes); return $element; }
function display_actions($action, $row) { $action = ax_a_href_title(ax_img_src("img/delete.png"), "editor/?action=delete&what=job&id=" . $row['id'] . '&url=' . urlencode($this->make_url(1)), "remove job " . $row['id'] . " from queue"); return $action; }
function build_widget() { $value = $this->_get('value'); if (is_null($value)) { $value = ""; } assert('is_string($value); // only plain strings can be used as field value: type: ' . gettype($value)); $name = $this->get('name'); $widgets = array(); if ($this->get('show-img-preview') && $value) { $widgets[] = ax_div_class(ax_img_src($this->get('preview-dir') . $value), 'preview'); } elseif ($this->get('show-link-preview') && $value) { $widgets[] = ax_div_class(ax_a_href($value, $this->get('preview-dir') . $value), 'preview'); } $remove_label = $this->_get('remove-label'); if ($remove_label && $value) { $subattr = array('type' => 'checkbox', 'name' => $name . '-remove'); $widgets[] = new AnewtXHTMLInput(null, $subattr); $subattr = array('for' => $name . '-remove'); $widgets[] = new AnewtXHTMLLabel($remove_label, $subattr); $widgets[] = ax_br(); } /* XML tag attributes used both for single line and multiline */ $attr = array('name' => $this->get('name'), 'id' => $this->get('id'), 'type' => 'file'); if ($this->_get('readonly')) { $attr['readonly'] = 'readonly'; } if ($this->_get('disabled')) { $attr['disabled'] = 'disabled'; } $size = $this->_get('size'); if (!is_null($size)) { assert('is_int($size);'); $attr['size'] = (string) $size; } $maxlength = $this->_get('maxlength'); if (!is_null($maxlength)) { assert('is_int($maxlength);'); $attr['maxlength'] = (string) $maxlength; } $max_file_size = $this->_get('max_file_size'); if (!is_null($max_file_size)) { $subattr = array('type' => 'hidden', 'name' => 'MAX_FILE_SIZE', 'value' => (string) $max_file_size); $widgets[] = new AnewtXHMTLInput(null, $subattr); } $widget = new AnewtXHTMLInput(null, $attr); /* Styling */ $widget->add_class('fileupload'); if (!$this->_get('required')) { $widget->add_class('optional'); } /* Optional extra class value */ $class = $this->_get('class'); if (!is_null($class)) { $widget->add_class($class); } /* Help text, if any */ $help = $this->_get('help'); if (!is_null($help)) { $help_text = to_string($help); $widget->set_attribute('title', $help_text); $widget->add_class('with-help'); } $widgets[] = $widget; /* Add secondary label, if any */ $secondary_label = $this->_get('secondary-label'); if (!is_null($secondary_label)) { $widgets[] = $secondary_label; } $out = ax_fragment($widgets); return $out; }