Example #1
0
/**
* Parse the event into the url structured
*/
function parseEventUrl($event)
{
    $prefix = "parties";
    if (is_object($event) && $event instanceof \Crave\Api\Event) {
        $ct_event = $event->getEvent();
    } else {
        $ct_event = $event;
    }
    $market_slug = $ct_event->market_slug ?: $ct_event->ct_contract->market_slug;
    if ($event->is->bc) {
        $event_slug = $event->ct_event_slug ?: $event->slug;
        $prefix = "barcrawl";
        $url = sprintf('/%s/%s_%s', $market_slug, $prefix, $event_slug);
    } else {
        if (!$event->where && $ct_event->venue) {
            $event->where = $ct_event->venue;
        }
        $event_slug = $event->venue_slug ?: $event->where->slug ?: slugize($event->where->name);
        $city = $event->venue_city ?: $event->where->city;
        $state = $event->venue_state ?: $event->where->state;
        $address_slug = slugize($event->where->address1 . ' ' . $city . ' ' . $state);
        /**
         * /newyork/parties_cipriani_42nd
         */
        $url = sprintf('/%s/%s_%s_%s', $market_slug, $prefix, $event_slug, $address_slug);
    }
    $url = strtolower($url);
    return $url;
}
Example #2
0
 public function test_slugize()
 {
     $text = "Example title";
     $this->assertEquals(Helpers::slugize($text), slugize($text));
     Helpers::patch('slugize', function () {
         return 'slugize-override';
     });
     $this->assertEquals('slugize-override', slugize($text));
     Helpers::patch('slugize', __NAMESPACE__ . '\\Helpers::slugize');
 }
Example #3
0
 public function startCSV()
 {
     if (!$this->title) {
         throw new Exception('Cannot generate a CSV without a filename');
         return;
     }
     $this->_title = slugize($this->title);
     if (!$this->tmp_filename) {
         $this->tmp_filename = 'csv-' . md5(time() . rand(0, 2345));
     }
     // set and make the tmp file for the csv
     $this->_tmpfilename = tempnam(sys_get_temp_dir(), $this->tmp_filename);
     $this->_tmpfile = fopen($this->_tmpfilename, 'w');
     // write theaders
     if ($this->headers) {
         $this->_putcsv($this->headers);
     }
     return $this;
 }
Example #4
0
File: add.php Project: hshoghi/cms
<?php

$_POST['slug'] = slugize($_POST['name']);
$_POST['iorder'] = 0;
$aql = "blog_category {\n\t\t\tname,\n\t\t\tslug,\n\t\t\tblog_id,\n\t\t\tiorder\n\t\t\t \n\t\t\t}";
aql::save();
echo '<span style="color: #ff0000;">Saved.</span>';