public function add_taxonomy($name, $args = array(), $labels = array())
 {
     if (!empty($name)) {
         // We need to know the post type name, so the new taxonomy can be attached to it.
         $post_type_name = $this->post_type_name;
         // Taxonomy properties
         $taxonomy_name = uglify($name);
         $taxonomy_labels = $labels;
         $taxonomy_args = $args;
         if (!taxonomy_exists($taxonomy_name)) {
             //Capitilize the words and make it plural
             $name = beautify($name);
             $plural = pluralize($name);
             // Default labels, overwrite them with the given labels.
             $labels = array_merge(array('name' => _x($plural, 'taxonomy general name', $this->post_domain), 'singular_name' => _x($name, 'taxonomy singular name', $this->post_domain), 'search_items' => __('Search ' . $plural, $this->post_domain), 'all_items' => __('All ' . $plural, $this->post_domain), 'parent_item' => __('Parent ' . $name, $this->post_domain), 'parent_item_colon' => __('Parent ' . $name . ':', $this->post_domain), 'edit_item' => __('Edit ' . $name, $this->post_domain), 'update_item' => __('Update ' . $name, $this->post_domain), 'add_new_item' => __('Add New ' . $name, $this->post_domain), 'new_item_name' => __('New ' . $name . ' Name', $this->post_domain), 'menu_name' => __($name, $this->post_domain)), $taxonomy_labels);
             // Default arguments, overwitten with the given arguments
             $args = array_merge(array('label' => $plural, 'labels' => $labels, 'public' => true, 'show_ui' => true, 'show_in_nav_menus' => true, '_builtin' => false), $taxonomy_args);
             // Add the taxonomy to the post type
             add_action('init', function () use($taxonomy_name, $post_type_name, $args) {
                 register_taxonomy($taxonomy_name, $post_type_name, $args);
             });
         } else {
             add_action('init', function () use($taxonomy_name, $post_type_name) {
                 register_taxonomy_for_object_type($taxonomy_name, $post_type_name);
             });
         }
     }
 }
Esempio n. 2
0
 function minimize($str)
 {
     $str = beautify($str);
     $str = str_replace(array('/', '\\', '-', $str));
     do {
         $str = str_replace('--', '-', $str, $r);
     } while ($r != 0);
     return $str;
 }
Esempio n. 3
0
 public function __construct($str, $prefix = '', $suffix = '')
 {
     if ($prefix) {
         self::$prefix = $prefix;
     }
     if ($suffix) {
         self::$suffix = $suffix;
     }
     $this->url = beautify($str);
 }
 /**
  * @return mixed
  */
 public function getDataTable()
 {
     $usrs = $this->users->with(['county'])->select('*');
     $data = Datatables::of($usrs)->addColumn('edit', function ($user) {
         return link_to(route('backend.users.edit', ['user' => $user->id]), 'Edit', ['data-target-model' => $user->id, 'class' => 'btn btn-xs btn-primary']);
     })->editColumn('updated_at', function ($user) {
         return $user->updated_at->diffForHumans();
     })->editColumn('created_at', function ($user) {
         return $user->created_at->diffForHumans();
     })->editColumn('first_name', function ($user) {
         return beautify($user->first_name);
     })->editColumn('last_name', function ($user) {
         return beautify($user->last_name);
     });
     return $data->make(true);
 }
 /**
  * @return mixed
  */
 public function getGuestsOrdersTable()
 {
     $orders = $this->ordersRepository->has('guests', false)->select('*');
     $data = Datatables::of($orders)->addColumn('details', function ($order) {
         return link_to(route('backend.orders.show', ['order' => $order->id, 'guest' => 1]), 'details', ['data-target-model' => $order->id, 'class' => 'btn btn-xs btn-primary']);
     })->addColumn('quantity', function ($order) {
         return array_get($order->data['cart'], 'total_products');
     })->addColumn('price', function ($order) {
         return format_money(array_get($order->data['cart'], 'grand_total'));
     })->addColumn('delivered', function ($order) {
         return $order->delivered ? "Yes" : "Not Yet";
     })->addColumn('user', function ($order) {
         $f = $order->guests->implode('first_name');
         $l = $order->guests->implode('last_name');
         return beautify($f . ' ' . $l);
     })->addColumn('email', function ($order) {
         return $order->guests->fetch('email');
     });
     return $data->make(true);
 }
echo inspect($num1) . PHP_EOL;
beautify();
echo 'Inspecting $num2:' . PHP_EOL;
echo inspect($num2) . PHP_EOL;
beautify();
echo 'Inspecting $num3:' . PHP_EOL;
echo inspect($num3) . PHP_EOL;
beautify();
echo 'Inspecting $num4:' . PHP_EOL;
echo inspect($num4) . PHP_EOL;
beautify();
echo 'Inspecting $null:' . PHP_EOL;
echo inspect($null) . PHP_EOL;
beautify();
echo 'Inspecting $bool1' . PHP_EOL;
echo inspect($bool1) . PHP_EOL;
beautify();
echo 'Inspecting $bool2' . PHP_EOL;
echo inspect($bool2) . PHP_EOL;
beautify();
echo 'Inspecting $string1' . PHP_EOL;
echo inspect($string1) . PHP_EOL;
beautify();
echo 'Inspecting $string2' . PHP_EOL;
echo inspect($string2) . PHP_EOL;
beautify();
echo 'Inspecting $array1' . PHP_EOL;
echo inspect($array1) . PHP_EOL;
beautify();
echo 'Inspecting $array2' . PHP_EOL;
echo inspect($array2) . PHP_EOL;
Esempio n. 7
0
<!-- no standards mode doctype, otherwise VML in IE won't work :-[  -->
<html>
<head>
<title>Beautify example</title>
</head>
<body>
<?php 
require_once "../beautify.php";
$file = file_get_contents("example.md");
$beautifiedFile = beautify($file);
echo $beautifiedFile;
?>
</body>
</html>
Esempio n. 8
0
 /**
  * @return string
  */
 public function getUserName()
 {
     return beautify($this->first_name . " " . $this->last_name);
 }
 /**
  * Returns the name of a product
  *
  * @return string
  */
 public function name()
 {
     return beautify($this->name);
 }
$xml = str_replace("%INFO/URL%", $config['info']['url'], $xml);
$xml = str_replace("%INFO/DOMAIN%", $config['info']['domain'], $xml);
$xml = str_replace("%TTL%", $config['ttl'], $xml);
$xml = str_replace("%SERVER/SMTP/SSL_ON%", isOnOrOff($config['server']['smtp']['socket'] == "SSL"), $xml);
$xml = str_replace("%SERVER/IMAP/SSL_ON%", isOnOrOff($config['server']['imap']['socket'] == "SSL"), $xml);
$xml = str_replace("%SERVER/IMAP/DOMAIN_REQUIRED%", isOnOrOff($config['server']['domain_required']), $xml);
$xml = str_replace("%SERVER/SMTP/DOMAIN_REQUIRED%", isOnOrOff($config['server']['domain_required']), $xml);
$xml = str_replace("%SERVER/IMAP/HOST%", $config['server']['imap']['host'], $xml);
$xml = str_replace("%SERVER/IMAP/PORT%", $config['server']['imap']['port'], $xml);
$xml = str_replace("%SERVER/IMAP/SOCKET%", $config['server']['imap']['socket'], $xml);
$xml = str_replace("%SERVER/SMTP/HOST%", $config['server']['smtp']['host'], $xml);
$xml = str_replace("%SERVER/SMTP/PORT%", $config['server']['smtp']['port'], $xml);
$xml = str_replace("%SERVER/SMTP/SOCKET%", $config['server']['smtp']['socket'], $xml);
$xml = str_replace("%EMAIL%", getRequestEmail(), $xml);
$xml = removeComments($xml);
$xml = beautify($xml);
echo $xml;
function removeComments($xml)
{
    $pattern = '/<!--(.*)?-->/sU';
    return preg_replace($pattern, '', $xml);
}
function beautify($xml)
{
    $dom = new DOMDocument();
    $dom->preserveWhiteSpace = false;
    $dom->loadXML($xml);
    $dom->formatOutput = true;
    return $dom->saveXml();
}
function isOnOrOff($value)
Esempio n. 11
0
 public static function doList($selected = null)
 {
     $data['template']['selected'] = $selected;
     if ($handle = opendir(TEMPLATES)) {
         while (false !== ($template = readdir($handle))) {
             #52: Skip files that start with a dot
             if (substr($template, 0, 1) == '.') {
                 continue;
             }
             if (is_file(TEMPLATES . $template)) {
                 $data['template']['list'][] = array('value' => $template, 'title' => beautify($template));
             }
         }
         View::do_dump(getPath('views/admin/list_templates.php'), $data);
     } else {
         return false;
     }
 }
Esempio n. 12
0
 /**
  * @param $value
  *
  * @return string
  */
 public function getNameAttribute($value)
 {
     return beautify($value);
 }
Esempio n. 13
0
function handleFile($src_file, $dest_file)
{
    if (strrpos($src_file, '.php') == strlen($src_file) - 4) {
        beautify($src_file, $dest_file);
    } else {
        if (strrpos($src_file, '~') === false) {
            copy($src_file, $dest_file);
        }
    }
}
Esempio n. 14
0
 /**
  * @return string
  */
 public function firstName()
 {
     return beautify($this->first_name);
 }
Esempio n. 15
0
			<?php 
if (isset($_POST["url"])) {
    /********return sourcecode**************/
    $url = $_POST["url"];
    $sourcecode = file_get_contents($url);
    /************search for config*****************/
    $searchfor = 'var enigmaConf';
    // finalise the regular expression, matching the whole line
    $pattern = "/^.*{$searchfor}.*\$\n/m";
    // search, and store all matching occurences in $matches
    if (preg_match_all($pattern, $sourcecode, $matches)) {
        $newsourcecode = implode("<br/><hr><br/>", $matches[0]);
        $trimmedNewSource = trim($newsourcecode);
        $substring = strpos($trimmedNewSource, "{");
        $lastsemicolon = strrpos($trimmedNewSource, "'");
        $actualsubstring = substr($trimmedNewSource, $substring, -2);
        $str = str_replace("\\", "", $actualsubstring);
        $str = str_replace('"', "", $str);
        $indent = "&nbsp&nbsp&nbsp&nbsp";
        echo "<br><br><br><br><div class = 'config'>" . beautify($str, $indent) . "</div>";
    } else {
        echo "<br><br><br><br><div class = 'config'><pre>No matches found</pre></div>";
    }
}
?>
		</div>	
		 
	
	</body>
</html>
Esempio n. 16
0
/**
 * @param array list of tasks
 *
 * @return string HTML
*/
function html_render_tasks($tasks)
{
    $out = '<ul class="tasks">';
    $currYMD = '';
    $prevYMD = '';
    foreach ($tasks as $t) {
        $currYMD = date('l j F Y', $t['start']) . ' ' . date_default_timezone_get();
        if ($currYMD != $prevYMD) {
            $out .= sprintf('</ul></li><li><strong>%s</strong><ul>', $currYMD);
            $prevYMD = $currYMD;
        }
        if ($t['stop'] != 'undefined') {
            $out .= sprintf('<li>Travaillé %s <span class="dt">(de %s à %s)</span></li>', beautify($t['duration']), date('H:i', $t['start']), date('H:i', $t['stop']));
        } else {
            /*
            $out .= sprintf('<li>Started working at %s <span class="dt">(%s and counting...)</span></li>',
                date('H:i', $t['start']),
                beautify(floor(time() - $t['start'])));
            */
            $out .= sprintf('<li>Travaillant depuis %s <span class="dt">(depuis %s)</span></li>', beautify(floor(time() - $t['start'])), date('H:i', $t['start']));
        }
    }
    $out .= '</ul>';
    return $out;
}