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);
             });
         }
     }
 }
 function get_posted_records()
 {
     $record_set = $this->controller->params['ActiveRecord'];
     if (!$record_set) {
         return;
     }
     foreach ($record_set as $class_name => $object_set) {
         foreach ($object_set as $id => $updated_fields) {
             if (preg_match('/new-.*/', $id)) {
                 $obj = new $class_name();
                 $action = 'new';
             } else {
                 $obj = new $class_name($id);
                 $action = 'updated';
             }
             $obj->mergeData($updated_fields);
             $posted_record_collection = $action . '_' . snake_case(pluralize($class_name));
             if (!isset($this->controller->{$posted_record_collection})) {
                 $this->controller->{$posted_record_collection} = array();
             }
             $this->controller->posted_records[$class_name][$action][] = $obj;
             $this->controller->{$posted_record_collection}[] = $obj;
         }
     }
 }
Пример #3
0
 public function route_makeRequest()
 {
     $type = pluralize(strip_tags($_GET['type']));
     set_time_limit(0);
     $fp = fopen("../{$type}/latest.zip", 'w+');
     $url = str_replace(" ", "%20", strip_tags($_GET['url']));
     $ch = curl_init($url);
     curl_setopt($ch, CURLOPT_TIMEOUT, 50);
     curl_setopt($ch, CURLOPT_FILE, $fp);
     # write curl response to file
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
     curl_exec($ch);
     curl_close($ch);
     fclose($fp);
     $zip = new ZipArchive();
     if ($zip->open("../{$type}/latest.zip") == true) {
         mkdir("../{$type}/latest", 0777);
         $zip->extractTo("../{$type}/latest");
         $zip->close();
         $handle = opendir("../{$type}/latest");
         if ($handle) {
             while (($file = readdir($handle)) !== false) {
                 if (is_dir("../{$type}/latest/{$file}")) {
                     if ($file != '.' and $file != '..') {
                         rename("../{$type}/latest/{$file}", "../{$type}/{$file}");
                     }
                 }
             }
         }
         $this->rrmdir("../{$type}/latest");
         unlink("../{$type}/latest.zip");
         $this->rrmdir("../{$type}/__MACOSX");
     }
     Flash::notice(__("Extension downloaded successfully.", "extension_manager"), "/admin/?action=extend_manager");
 }
Пример #4
0
 public function test_irregular()
 {
     foreach (require __DIR__ . '/cases/fr/irregular.php' as $singular => $plural) {
         $this->assertEquals($singular, singularize($plural, 'fr'));
         $this->assertEquals($plural, pluralize($singular, 'fr'));
     }
 }
Пример #5
0
 public function testPluralizeObject()
 {
     // arrange
     // act
     $result = pluralize((object) ['Felix', 'Tom'], 'cat');
     // assert
     $this->assertEquals('2 cats', $result);
 }
Пример #6
0
 /**
  * Create a new taxonomy.
  * 
  * @param string $name
  *   The name of the taxonomy.
  * @param $post_types
  * @param boolean $hierarchical (optional)
  * 
  * @ingroup helperfunc
  */
 function new_taxonomy($name, $post_types, $hierarchical = true)
 {
     if (!is_array($name)) {
         $name = array("singular" => $name, "plural" => pluralize($name));
     }
     $uc_plural = ucwords(preg_replace("/_/", " ", $name["plural"]));
     $uc_singular = ucwords(preg_replace("/_/", " ", $name["singular"]));
     $labels = array("name" => $uc_singular, "singular_name" => $uc_singular, "search_items" => sprintf(__("Search %s", "we"), $uc_plural), "all_items" => sprintf(__("All %s", "we"), $uc_plural), "parent_item" => sprintf(__("Parent %s", "we"), $uc_singular), "parent_item_colon" => sprintf(__("Parent %s:", "we"), $uc_singular), "edit_item" => sprintf(__("Edit %s", "we"), $uc_singular), "update_item" => sprintf(__("Update %s", "we"), $uc_singular), "add_new_item" => sprintf(__("Add new %s", "we"), $uc_singular), "new_item_name" => sprintf(__("New %n Name", "we"), $uc_singular), "menu_name" => $uc_plural);
     register_taxonomy($name["singular"], $post_types, array('hierarchical' => $hierarchical, 'labels' => $labels, 'show_ui' => true, 'query_var' => true, 'rewrite' => array('slug' => $name["plural"])));
 }
Пример #7
0
function validates_confirmation_of($model, $field, $options = array())
{
    $params = array_merge($_GET, $_POST);
    $model_name = strtolower(get_class($model));
    if (isset($params[$model_name][$field])) {
        if ($params[$model_name]["confirm_{$field}"] != $model->fields[$field]) {
            add_error_message_to($model, $field, !$options['custom_message'] ? pluralize(humanize($field)) . " do not match." : $options['custom_message']);
        }
        unset($model->fields["confirm_{$field}"]);
    }
}
Пример #8
0
function jal_time_since($original)
{
    if (!isset($_SESSION['Year'])) {
        $_SESSION['Year'] = __('year', wordspew);
        $_SESSION['years'] = __('years', wordspew);
        $_SESSION['Month'] = __('month', wordspew);
        $_SESSION['months'] = __('months', wordspew);
        $_SESSION['Week'] = __('week', wordspew);
        $_SESSION['weeks'] = __('weeks', wordspew);
        $_SESSION['Day'] = __('day', wordspew);
        $_SESSION['days'] = __('days', wordspew);
        $_SESSION['Hour'] = __('hour', wordspew);
        $_SESSION['hours'] = __('hours', wordspew);
        $_SESSION['Minute'] = __('minute', wordspew);
        $_SESSION['minutes'] = __('minutes', wordspew);
    }
    // array of time period chunks
    $chunks = array(array(60 * 60 * 24 * 365, $_SESSION['Year'], $_SESSION['years']), array(60 * 60 * 24 * 30, $_SESSION['Month'], $_SESSION['months']), array(60 * 60 * 24 * 7, $_SESSION['Week'], $_SESSION['weeks']), array(60 * 60 * 24, $_SESSION['Day'], $_SESSION['days']), array(60 * 60, $_SESSION['Hour'], $_SESSION['hours']), array(60, $_SESSION['Minute'], $_SESSION['minutes']));
    $original = $original - 10;
    // Shaves a second, eliminates a bug where $time and $original match.
    $today = time();
    /* Current unix time  */
    $since = $today - $original;
    // $j saves performing the count function each time around the loop
    for ($i = 0, $j = count($chunks); $i < $j; $i++) {
        $seconds = $chunks[$i][0];
        $name = $chunks[$i][1];
        $name_s = $chunks[$i][2];
        // finding the biggest chunk (if the chunk fits, break)
        if (($count = floor($since / $seconds)) != 0) {
            break;
        }
    }
    $print = $count . " " . pluralize($count, $name, $name_s);
    if ($i + 1 < $j) {
        // now getting the second item
        $seconds2 = $chunks[$i + 1][0];
        $name2 = $chunks[$i + 1][1];
        $name2_s = $chunks[$i + 1][2];
        // add second item if it's greater than 0
        if (($count2 = floor(($since - $seconds * $count) / $seconds2)) != 0) {
            $print .= ", " . $count2 . " " . pluralize($count2, $name2, $name2_s);
        }
    }
    return $print;
}
Пример #9
0
 function deliver($view, $data)
 {
     $headers = array();
     $headers[] = "From: {$this->from}";
     if (isset($this->reply_to)) {
         $headers[] = "Return-Path: {$this->reply_to}";
     }
     $class_name = strtolower(pluralize(str_replace('Mailer', '', get_class($this))));
     // Load HTML View
     if (!isset($this->html) && file_exists(APPLICATION_ROOT . "/app/views/{$class_name}/{$view}.php")) {
         ob_start();
         require APPLICATION_ROOT . "/app/views/{$class_name}/{$view}.php";
         $this->html = ob_get_contents();
         ob_end_clean();
     }
     // Load Text View
     if (!isset($this->text) && file_exists(APPLICATION_ROOT . "/app/views/{$class_name}/{$view}_text.php")) {
         ob_start();
         require APPLICATION_ROOT . "/app/views/{$class_name}/{$view}_text.php";
         $this->text = ob_get_contents();
         ob_end_clean();
     }
     $mime_boundary = '=' . md5(time());
     // Headers
     $headers[] = "From: {$this->from}";
     $headers[] = "MIME-Version: 1.0";
     $headers[] = "Content-Type: multipart/alternative; boundary=\"{$mime_boundary}\"";
     // Mashed Body
     $body .= "--{$mime_boundary}\n";
     $body .= "Content-Type: text/plain; charset=iso-8859-1\n";
     $body .= "Content-Transfer-Encoding: 8bit\n\n";
     $body .= "{$this->text}\n\n";
     $body .= "--{$mime_boundary}\n";
     $body .= "Content-Type: text/html; charset=iso-8859-1\n";
     $body .= "Content-Transfer-Encoding: quoted-printable\n\n";
     $body .= "{$this->html}\n\n";
     $body .= "--{$mime_boundary}--\n\n";
     foreach ($this->recipients as $recipient) {
         mail($recipient, $this->subject, $body, join($headers, "\n"));
     }
 }
Пример #10
0
function calculateDiff($dayDelta, $minuteDelta)
{
    if ($dayDelta != 'null' && $dayDelta != '0') {
        if ($dayDelta < 0) {
            $diff = "-" . pluralize(abs(intval($dayDelta)) . " day");
        } else {
            if ($dayDelta > 0) {
                $diff = "+" . pluralize(intval($dayDelta) . " day");
            }
        }
    } else {
        $diff = "";
    }
    if ($minuteDelta != 'null' && $minuteDelta != '0') {
        if ($minuteDelta < 0) {
            $diff .= "-" . pluralize(abs(intval($minuteDelta)) . " minute");
        } else {
            $diff .= "+" . pluralize(intval($minuteDelta) . " minute");
        }
    }
    return $diff;
}
Пример #11
0
/**
 * Returns the age of a date/time.
 *
 *		Usage example:
 *			{$order.date_created|age} # 27 minutes ago
 */
function age($params, $delay = 0)
{
    $date = is_array($params) && $params['of'] ? $params['of'] : $params;
    // Make sure we have a timestamp.
    $time = is_numeric($date) ? (int) $date : strtotime($date);
    $seconds_elapsed = time() - $time - $delay;
    // Seconds.
    if ($seconds_elapsed < 60) {
        return 'just now';
    } else {
        if ($seconds_elapsed >= 60 && $seconds_elapsed < 3600) {
            $age = floor($seconds_elapsed / 60) . ' ' . pluralize(array('word' => 'minute', 'if_many' => floor($seconds_elapsed / 60)));
        } else {
            if ($seconds_elapsed >= 3600 && $seconds_elapsed < 86400) {
                $age = floor($seconds_elapsed / 3600) . ' ' . pluralize(array('word' => 'hour', 'if_many' => floor($seconds_elapsed / 3600)));
            } else {
                if ($seconds_elapsed >= 86400 && $seconds_elapsed < 604800) {
                    $age = floor($seconds_elapsed / 86400) . ' ' . pluralize(array('word' => 'day', 'if_many' => floor($seconds_elapsed / 86400)));
                } else {
                    if ($seconds_elapsed >= 604800 && $seconds_elapsed < 2626560) {
                        $age = floor($seconds_elapsed / 604800) . ' ' . pluralize(array('word' => 'week', 'if_many' => floor($seconds_elapsed / 604800)));
                    } else {
                        if ($seconds_elapsed >= 2626560 && $seconds_elapsed < 31536000) {
                            $age = floor($seconds_elapsed / 2626560) . ' ' . pluralize(array('word' => 'month', 'if_many' => floor($seconds_elapsed / 2626560)));
                        } else {
                            if ($seconds_elapsed >= 31536000) {
                                $age = floor($seconds_elapsed / 31536000) . ' ' . pluralize(array('word' => 'year', 'if_many' => floor($seconds_elapsed / 31536000)));
                            }
                        }
                    }
                }
            }
        }
    }
    return "{$age} ago";
}
Пример #12
0
<?php

if (!isset($this->twitchObj->data['memberCard']['memberID'])) {
    exit;
}
$twitchObj = $this->twitchObj;
?>


<div class='twitchCardContainer'>
	<div class='twitchPreview'>
	<?php 
if ($twitchObj->data['memberCard']['online']) {
    echo "\n\t\t\t\t<div class='twitchLiveIcon'></div>\n\t\t\t\t<div class='twitchGameOverlay'><img src='" . $twitchObj->getGameImageURL($twitchObj->data['memberCard']['game']) . "' onmouseover=\"showToolTip('" . filterText($twitchObj->data['memberCard']['game']) . "')\" onmouseout=\"hideToolTip()\"></div>\n\t\t\t\t<div class='twitchViewers'>" . number_format($twitchObj->data['memberCard']['viewers']) . " " . pluralize("viewer", $twitchObj->data['memberCard']['viewers']) . "</div>\n\t\t\t\t<a href='" . MAIN_ROOT . "plugins/twitch/?user="******"'><img src='" . $twitchObj->data['memberCard']['rawData']['stream']['preview']['medium'] . "'></a>\n\t\t\t";
} else {
    echo "<a href='" . MAIN_ROOT . "plugins/twitch/?user="******"'><img src='" . MAIN_ROOT . "plugins/twitch/images/offlinepreview.png'></a>";
}
?>
	
	</div>
	<div class='twitchChannelDescription ellipsis' title='<?php 
echo filterText($twitchObj->data['memberCard']['streamTitle']);
?>
'><?php 
echo $twitchObj->data['memberCard']['streamTitle'];
?>
</div>
	<div class='twitchChannelDescription'><?php 
echo $twitchObj->data['memberCard']['memberLink'];
?>
 streaming as <a href='http://twitch.tv/<?php 
Пример #13
0
function pluralize($what)
{
    if ($what == "this") {
        return "these";
    } else {
        if ($what == "has") {
            return "have";
        } else {
            if ($what == "is") {
                return "are";
            } else {
                if (str_ends_with($what, ")") && preg_match('/\\A(.*?)(\\s*\\([^)]*\\))\\z/', $what, $m)) {
                    return pluralize($m[1]) . $m[2];
                } else {
                    if (preg_match('/\\A.*?(?:s|sh|ch|[bcdfgjklmnpqrstvxz][oy])\\z/', $what)) {
                        if (substr($what, -1) == "y") {
                            return substr($what, 0, -1) . "ies";
                        } else {
                            return $what . "es";
                        }
                    } else {
                        return $what . "s";
                    }
                }
            }
        }
    }
}
Пример #14
0
 protected static function table()
 {
     return pluralize(dash(get_called_class()));
 }
Пример #15
0
 /**
  * Function: disable
  * Disables a module or feather.
  */
 public function disable()
 {
     $config = Config::current();
     $visitor = Visitor::current();
     $type = isset($_GET['module']) ? "module" : "feather";
     if (!$visitor->group->can("toggle_extensions")) {
         if ($type == "module") {
             show_403(__("Access Denied"), __("You do not have sufficient privileges to enable/disable modules."));
         } else {
             show_403(__("Access Denied"), __("You do not have sufficient privileges to enable/disable feathers."));
         }
     }
     if ($type == "module" and !module_enabled($_GET[$type])) {
         Flash::warning(__("Module already disabled."), "/admin/?action=modules");
     }
     if ($type == "feather" and !feather_enabled($_GET[$type])) {
         Flash::warning(__("Feather already disabled."), "/admin/?action=feathers");
     }
     $enabled_array = $type == "module" ? "enabled_modules" : "enabled_feathers";
     $folder = $type == "module" ? MODULES_DIR : FEATHERS_DIR;
     $class_name = camelize($_GET[$type]);
     if (method_exists($class_name, "__uninstall")) {
         call_user_func(array($class_name, "__uninstall"), false);
     }
     $config->set($type == "module" ? "enabled_modules" : "enabled_feathers", array_diff($config->{$enabled_array}, array($_GET[$type])));
     $info = YAML::load($folder . "/" . $_GET[$type] . "/info.yaml");
     if ($type == "module") {
         Flash::notice(_f("&#8220;%s&#8221; module disabled.", array($info["name"])), "/admin/?action=" . pluralize($type));
     } elseif ($type == "feather") {
         Flash::notice(_f("&#8220;%s&#8221; feather disabled.", array($info["name"])), "/admin/?action=" . pluralize($type));
     }
 }
Пример #16
0
/**
 * human readable age
 *
 * @param integer $unixtimestamp
 * @return string
 */
function how_old($unixtimestamp)
{
    $iga = time() - $unixtimestamp;
    $minut = 60;
    $tund = $minut * 60;
    $paev = $tund * 24;
    $nadal = $paev * 7;
    $kuu = $nadal * 4 + 2.5 * $paev;
    $aasta = $kuu * 12;
    if ($iga < $minut) {
        return pluralize($iga, 'second', 'seconds');
    } elseif ($iga < $tund) {
        return pluralize(ceil($iga / $minut), 'minute', 'minutes');
    } elseif ($iga < $paev) {
        return pluralize(ceil($iga / $tund), 'hour', ' hours');
    } elseif ($iga < $nadal) {
        return pluralize(ceil($iga / $paev), 'day', 'days');
    } elseif ($iga < $kuu) {
        return pluralize(ceil($iga / $nadal), 'week', ' weeks');
    } elseif ($iga < $aasta) {
        return pluralize(ceil($iga / $kuu), 'month', 'months');
    } else {
        return pluralize(ceil($iga / $aasta), 'year', 'years');
    }
}
Пример #17
0
 /**
  * @dataProvider provide_irregular
  */
 public function test_irregular($singular, $plural)
 {
     $this->assertEquals($singular, singularize($plural, 'tr'));
     $this->assertEquals($plural, pluralize($singular, 'tr'));
 }
Пример #18
0
function twig_pluralize_string_filter($string, $number = null)
{
    if ($number and $number == 1) {
        return $string;
    } else {
        return pluralize($string);
    }
}
Пример #19
0
 /**
  * Function: delete
  * Deletes a given object. Calls the @delete_(model)@ trigger with the objects ID.
  *
  * Parameters:
  *     $model - The model name.
  *     $id - The ID of the object to delete.
  */
 protected static function destroy($model, $id)
 {
     $model = strtolower($model);
     if (Trigger::current()->exists("delete_" . $model)) {
         Trigger::current()->call("delete_" . $model, new $model($id));
     }
     SQL::current()->delete(pluralize($model), array("id" => $id));
 }
Пример #20
0
/**
 * Function: relative_time
 * Returns the difference between the given timestamps or now.
 *
 * Parameters:
 *     $time - Timestamp to compare to.
 *     $from - Timestamp to compare from. If not specified, defaults to now.
 *
 * Returns:
 *     A string formatted like "3 days ago" or "3 days from now".
 */
function relative_time($when, $from = null)
{
    fallback($from, time());
    $time = is_numeric($when) ? $when : strtotime($when);
    $difference = $from - $time;
    if ($difference < 0) {
        $word = "from now";
        $difference = -$difference;
    } elseif ($difference > 0) {
        $word = "ago";
    } else {
        return "just now";
    }
    $units = array("second" => 1, "minute" => 60, "hour" => 60 * 60, "day" => 60 * 60 * 24, "week" => 60 * 60 * 24 * 7, "month" => 60 * 60 * 24 * 30, "year" => 60 * 60 * 24 * 365, "decade" => 60 * 60 * 24 * 365 * 10, "century" => 60 * 60 * 24 * 365 * 100, "millennium" => 60 * 60 * 24 * 365 * 1000);
    $possible_units = array();
    foreach ($units as $name => $val) {
        if ($name == "week" and $difference >= $val * 2 or $name != "week" and $difference >= $val) {
            $unit = $possible_units[] = $name;
        }
    }
    $precision = (int) in_array("year", $possible_units);
    $amount = round($difference / $units[$unit], $precision);
    return $amount . " " . pluralize($unit, $amount) . " " . $word;
}
Пример #21
0
function is_plural($word)
{
    return pluralize($word) == $word;
}
Пример #22
0
function from_controller_to_file($class_name)
{
    $class_name = str_replace('Controller', '', $class_name);
    $class_name = underscore(pluralize($class_name));
    return $class_name;
}
Пример #23
0
$from_walk_upto = 0.5;
// kilometers
$to_walk_upto = 0.5;
// kilometers
$types = array();
if (isset($_REQUEST['railway'])) {
    $types[] = 'railway';
}
if (isset($_REQUEST['bus'])) {
    $types[] = 'bus';
}
if (isset($_REQUEST['train'])) {
    $types[] = 'train';
}
foreach ($types as $type) {
    $temp = 'get_' . pluralize($type) . '_near_node';
    $from_railways = $temp($from_node['lat'], $from_node['lon'], $from_walk_upto);
    $to_railways = $temp($to_node['lat'], $to_node['lon'], $from_walk_upto);
    foreach (filter_useful_railways($from_railways, $to_railways, $type) as $railway_id) {
        $temp = 'get_' . $type . '_info';
        $railway_info = $temp($railway_id);
        $temp = 'get_' . $type . '_ways';
        $results[] = array('name' => $railway_info['name'], 'operator' => $railway_info['operator'], 'ways' => $temp($railway_id), 'from_node' => $from_railways[$railway_id]['node'], 'from_ways' => list_way_names_for_node_id($from_railways[$railway_id]['node']['id']), 'to_node' => $to_railways[$railway_id]['node'], 'to_ways' => list_way_names_for_node_id($to_railways[$railway_id]['node']['id']), 'walk_distance' => $from_railways[$railway_id]['distance'] + $to_railways[$railway_id]['distance'], 'type' => $type);
    }
}
function walk_distance_sort($a, $b)
{
    if ($a['walk_distance'] == $b['walk_distance']) {
        return 0;
    }
    return $a['walk_distance'] < $b['walk_distance'] ? -1 : 1;
Пример #24
0
        <div class="column xs-span12<?php 
if (is_active_sidebar('main-sidebar')) {
    echo ' lg-span8';
}
?>
">
            <div class="column-inner">
                <?php 
if (have_posts()) {
    ?>
                    <h2>Tag: <?php 
    single_tag_title();
    ?>
</h2>
                    <h4><?php 
    echo pluralize($wp_query->found_posts, 'post');
    ?>
 tagged as &quot;<?php 
    echo single_tag_title();
    ?>
&quot;</h4>
                    <?php 
    while (have_posts()) {
        the_post();
        get_template_part('theme/partials/loop');
    }
    get_template_part('theme/partials/pagination');
    ?>
                <?php 
} else {
    ?>
Пример #25
0
function jal_get_useronline_extended($usertimeout = 60)
{
    global $shout_tb;
    if ($_SESSION['Show_Users'] == 1) {
        if (!isset($_SESSION['guest'])) {
            $_SESSION['NoOne'] = __('No one online.', wordspew);
            $_SESSION['guest'] = " " . __('guest', wordspew);
            $_SESSION['guests'] = " " . __('guests', wordspew);
            $_SESSION['glue'] = " " . __('and', wordspew) . " ";
            $_SESSION['bot'] = " " . __('is crawling the site.', wordspew);
            $_SESSION['bots'] = " " . __('are crawling the site.', wordspew);
            $_SESSION['online'] = " " . __('is online.', wordspew);
            $_SESSION['onlines'] = " " . __('are online.', wordspew);
        }
        $array = jal_get_useronline_engine($usertimeout);
        $u = $array["users"];
        $g = $array["num_guests"];
        $b = $array["bots"];
        /* desired verbiage: */
        /* "Pierre, Framboise and 2 guests online.  Google is crawling the site." */
        /* "Pierre, Framboise and 1 guest online.  Google, Inktomi are crawling the site." */
        /* thus we get an array with nicknames and a string describing the number of guests */
        $tobeimploded = $u;
        if ($g == 0) {
            /* do not do anything */
        } else {
            $tobeimploded[] = $g . pluralize($g, $_SESSION['guest'], $_SESSION['guests']);
        }
        if ($g + count($u) + count($b) == 0) {
            return $_SESSION['NoOne'];
        }
        // no one's here
        $users_online = jal_implode_human(", ", $_SESSION['glue'], $tobeimploded);
        if ($g > 0 || count($u) > 0) {
            $users_online .= pluralize($g + count($u), $_SESSION['online'], $_SESSION['onlines']);
        }
        if (count($b)) {
            $bots_online = jal_implode_human(", ", $_SESSION['glue'], $b);
            $bots_online .= pluralize(count($b), $_SESSION['bot'], $_SESSION['bots']);
        } else {
            $bots_online = "";
        }
        return $users_online . " " . $bots_online;
    } else {
        return "";
    }
}
Пример #26
0
function renderMessageCount($pos, $total, $lang)
{
    echo '<div class="counter">' . $pos . '/' . $total . ' ' . translate(pluralize('message', $total), $lang) . '</div>';
}
Пример #27
0
<?php

if ($searched) {
    ?>
	
	<h1><?php 
    echo count($posts);
    ?>
 Search <?php 
    echo pluralize(count($posts), 'Result');
    ?>
 Returned for &ldquo;<?php 
    echo $q;
    ?>
&rdquo;</h1>
	<?php 
    if (!empty($posts)) {
        ?>

		<?php 
        foreach ($posts as $post) {
            ?>
			<h2><a href="<?php 
            echo $post->url;
            ?>
"><?php 
            echo highlight_phrase($post->title, $q, '<span class="search_highlight">', '</span>');
            ?>
</a></h2>
			<?php 
            echo highlight_phrase($post->get_excerpt_formatted(50, '', TRUE), $q, '<span class="search_highlight">', '</span>');
Пример #28
0
 /**
  * Function: url
  * Returns a post's URL.
  */
 public function url()
 {
     if ($this->no_results) {
         return false;
     }
     $config = Config::current();
     $visitor = Visitor::current();
     if (!$config->clean_urls) {
         return $config->url . "/?action=view&amp;url=" . urlencode($this->url);
     }
     $login = strpos($config->post_url, "(author)") !== false ? $this->user->login : null;
     $vals = array(when("Y", $this->created_at), when("m", $this->created_at), when("d", $this->created_at), when("H", $this->created_at), when("i", $this->created_at), when("s", $this->created_at), $this->id, urlencode($login), urlencode($this->clean), urlencode($this->url), urlencode($this->feather), urlencode(pluralize($this->feather)));
     Trigger::current()->filter($vals, "url_vals", $this);
     return $config->url . "/" . str_replace(array_keys(self::$url_attrs), $vals, $config->post_url);
 }
Пример #29
0
{<{<{ defined('BASEPATH') OR exit('No direct script access allowed');

/**
 * @author      OA Wu <*****@*****.**>
 * @copyright   Copyright (c) 2016 OA Wu Design
 */

class Migration_<?php 
echo ucfirst($action);
?>
_<?php 
echo pluralize($name);
?>
 extends CI_Migration {
  public function up () {
    $this->db->query (
      ""
    );
  }
  public function down () {
    $this->db->query (
      ""
    );
  }
}
Пример #30
0
<?php

$item = $arResult;
$props = $item['PROPERTIES'];
?>
<div class="groups">
  <div href="#" class="groups__item groups__item--big">
	<div style="background-image: url(http://myqube.ru/<?php 
echo $item['DETAIL_PICTURE']['SRC'];
?>
)" class="groups__image"></div>
	<div class="groups__name"><?php 
echo $item['NAME'];
?>
</div>
	<div class="groups__description"><?php 
echo $item['PREVIEW_TEXT'];
?>
</div>
	<div class="groups__users"><img src="/layout/images/svg/people.svg" alt="">
		<?php 
echo $props['USERS'][VALUE];
?>
</span> <?php 
echo pluralize($props['USERS'][VALUE], array('участников', 'участников', 'участник', 'участника'));
?>
	</div>
	<div class="groups__lock"><img src="/layout/images/svg/lock-group.svg" alt=""><br><span class="hidden-xs">Это закрытая<br/> группа</span></div>
  </div>
</div>