text:
using NetSort.Sorting;
using System.Linq;

namespace NetSort
{
    public static partial class SortableExtensions
    {
        /// <summary>
        /// Returns an ordered queryable per the specified 'key' in the order specified on the 'SortableAttribute' of the key passed in, or the default (Ascending).
        /// </summary>
        /// <typeparam name="T">The type of data being sorted</typeparam>
        /// <param name="items">The data to sort</param>
        /// <param name="key">The 'key' to sort by. This key must be present as the 'SortKey' of exactly one 'SortableAttribute' on a property of type T</param>
        /// <param name="delimiter">The char used to separate nested properties</param>
        public static IOrderedQueryable<T> ThenSortByKey<T>(this IOrderedQueryable<T> items, string key, char delimiter) where T : class
        {
            return new IQueryableThenBySorter<T>()
                .Sort(items, key, delimiter, null);
        }

        /// <summary>
        /// Returns an ordered queryable per the specified 'key' and 'order'.
        /// </summary>
        /// <typeparam name="T">The type of data being sorted</typeparam>
        /// <param name="items">The data to sort</param>
        /// <param name="key">The 'key' to sort by. This key must be present as the 'SortKey' of exactly one 'SortableAttribute' on a property of type T</param>
        /// <param name="direction">The direction to sort (Asc | Desc)</param>
        /// <param name="delimiter">The char used to separate nested properties</param>
        public static IOrderedQueryable<T> ThenSortByKey<T>(this IOrderedQueryable<T> items, string key, char delimiter, SortDirection direction) where T : class
        {
            return new IQueryableThenBySorter<T>()
                .Sort(items, key, delimiter, direction);
        }

        /// <summary>
        /// Returns an ordered queryable per the specified 'key' in the order specified on the 'SortableAttribute' of the key passed in, or the default (Ascending).
        /// </summary>
        /// <typeparam name="T">The type of data being sorted</typeparam>
        /// <param name="items">The data to sort</param>
        /// <param name="key">The 'key' to sort by. This key must be present as the 'SortKey' of exactly one 'SortableAttribute' on a property of type T</param>
        public static IOrderedQueryable<T> ThenSortByKey<T>(this IOrderedQueryable<T> items, string key) where T : class
        {
            return new IQueryableThenBySorter<T>()
                .Sort(items, key, Constants.DEFAULT_NESTED_PROP_DELIMITER, null);
        }

        /// <summary>
        /// Returns an ordered queryable per the specified 'key' and 'order'.
        /// </summary>
        /// <typeparam name="T">The type of data being sorted</typeparam>
        /// <param name="items">The data to sort</param>
        /// <param name="key">The 'key' to sort by. This key must be present as the 'SortKey' of exactly one 'SortableAttribute' on a property of type T</param>
        /// <param name="direction">The direction to sort (Asc | Desc)</param>
        public static IOrderedQueryable<T> ThenSortByKey<T>(this IOrderedQueryable<T> items, string key, SortDirection direction) where T : class
        {
            return new IQueryableThenBySorter<T>()
                .Sort(items, key, Constants.DEFAULT_NESTED_PROP_DELIMITER, direction);
        }

        /// <summary>
        /// Returns an ordered queryable per the specified 'key' in the specified 'order'.
        /// </summary>
        /// <typeparam name="T">The type of data being sorted</typeparam>
        /// <param name="items">The data to sort</param>
        /// <param name="key">The 'key' to sort by. This key must be present as the 'SortKey' of exactly one 'SortableAttribute' on a property of type T</param>
        /// <param name="direction">The direction to sort (Asc | Desc)</param>
        /// <param name="delimiter">The char used to separate nested properties</param>
        public static IOrderedQueryable<T> ThenSortByKey<T>(this IOrderedQueryable<T> items, string key, char delimiter, string direction) where T : class
        {
            return new IQueryableThenBySorter<T>()
                .SortWithStringDirection(items, key, delimiter, direction);
        }

        /// <summary>
        /// Returns an ordered queryable per the specified 'key' in the specified 'order'.
        /// </summary>
        /// <typeparam name="T">The type of data being sorted</typeparam>
        /// <param name="items">The data to sort</param>
        /// <param name="key">The 'key' to sort by. This key must be present as the 'SortKey' of exactly one 'SortableAttribute' on a property of type T</param>
        /// <param name="direction">The direction to sort (Asc | Desc)</param>
        public static IOrderedQueryable<T> ThenSortByKey<T>(this IOrderedQueryable<T> items, string key, string direction) where T : class
        {
            return new IQueryableThenBySorter<T>()
                .SortWithStringDirection(items, key, Constants.DEFAULT_NESTED_PROP_DELIMITER, direction);
        }
    }
}


text:
;

blogApp.controller('ArticleTagCtrl', ['$scope', '$routeParams', 'TagService', 'HelperService',
    function ($scope, $routeParams, TagService, HelperService) {
        $scope.tagName = $routeParams.tagName;
        $scope.articles = [];
        $scope.GetDateTime = HelperService.GetDateTime;

        //lets get all the articles
        TagService.Execute(TagService.OperationType.GetArticlesByTagName, $scope.tagName).
            then(function (args) { $scope.articles = args.data; });
    }]);

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>所有类</title>
<meta name="date" content="2015-05-02">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">

所有类

AbstractCompiler

CompileMessage

Compiler

CompileType

Configuration

Controller

JudgeCompare

JudgeResult

MemoryCheck

OJCCompiler

OJCPPCompiler

OJJavaCompiler

ResultType

RunCCPP

RunCCPPThread

RunJava

RunJavaThread

RunMessage

SimpleCompare

StringSourceJavaFileObject


text:
from autotranslate.utils import translate_strings

from django.conf import settings
from django.core.management.base import BaseCommand

import os

class Command(BaseCommand):
    help = 'autotranslate all the po files that have been generated'

    def handle(self, *args, **options):
        for directory in settings.LOCALE_PATHS:
            for root, dirs, files in os.walk(directory):
                for file in files:
                    if file.endswith('.po'):
                        target_language = os.path.basename(os.path.dirname(root))
                        self._translate_file(root, file, target_language)

    def _translate_file(self, root, file, target_language):
        # TODO
        # FIXME
        _strings = []
        _translations = {}
        _file = os.path.join(root, file)
        with open(_file) as _input_file:
            _original_file = _input_file.readlines()
            for index, line in enumerate(_original_file):
                if line.startswith('msgid'):
                    # separate the actual string from the whole line
                    # for each line in input file
                    _strings.append('"'.join(line.split('"')[1:-1]))
                if line.startswith('msgstr'):
                    _translations.update({
                        index: line
                    })

        # translate the strings
        _translated_strings = translate_strings(_strings, target_language, 'en', False)
        _index = 0
        _keys = [_ for _ in _translations.keys()]
        _keys.sort()
        for key in _keys:
            _line = _translations.get(key).split('"')
            _line = [_line[0], _line[-1]]
            _line.insert(1, _translated_strings[_index])
            _line = '"'.join(_line)
            _translations[key] = _line
            _index += 1

        with open(_file, 'w') as _output_file:
            for index, line in enumerate(_original_file):
                if index in _translations.keys():
                    line = _translations.get(index)
                    _output_file.write(line)
                    continue
                _output_file.write(line)


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package BechCarRental.Utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 *
 * @author Ileana Ontiveros
 */
public class Utils {

    public Utils() {
    }

    public int calculateDays (String initialDate, String finalDate) throws ParseException{

        final long MILLSECS_PER_DAY = 24 * 60 * 60 * 1000;
        Date startDate = null;
        Date endDate = null;
        SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");

        Calendar date1;
        startDate = dateFormat.parse(initialDate);
        date1 = Calendar.getInstance();

        Calendar date2;
        endDate = dateFormat.parse(finalDate);
        date2 = Calendar.getInstance();

        date1.setTime(startDate);
        date2.setTime(endDate);

        long totalDays;
        totalDays = ( endDate.getTime() - startDate.getTime() )/ MILLSECS_PER_DAY;

        return (int) totalDays;

    }

}


text:
package net.androidbootcamp.hotfoot;

import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class Registar extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_registar);
        Button next = (Button)findViewById(R.id.btnNext);
        next.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(Registar.this, Information.class));
            }
        });
    }

}


text:
package com.feedhenry.armark;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.feedhenry.sdk.FH;
import com.feedhenry.sdk.FHActCallback;
import com.feedhenry.sdk.FHResponse;
import com.feedhenry.sdk.api.FHCloudRequest;

import org.json.JSONException;
import org.json.JSONObject;

public class RegistrarUsuario extends AppCompatActivity {

    private Button BtnRegistrar;
    private Button BtnVolver;

    private TextView TxtNombre;
    private TextView TxtApellidos;
    private TextView TxtEmail;
    private TextView TxtUsuario;
    private TextView TxtPassword;
    private TextView TxtCelular;

    private View mProgressView;
    private View mLoginFormView;

    private static final String TAG = "";

    private SharedPreferences preferences;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_registrar_usuario);

        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setTitle(getResources().getString(R.string.BtnRegistrar));

        preferences = getSharedPreferences("Preferences", Context.MODE_PRIVATE);

        BtnRegistrar = (Button) findViewById(R.id.BtnRegistrar);

        Inicializar();

        BtnRegistrar.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                String Nombre = TxtNombre.getText().toString();
                String Apellidos = TxtApellidos.getText().toString();
                String Celular = TxtCelular.getText().toString();
                String Email = TxtEmail.getText().toString();
                String Password = TxtPassword.getText().toString();

                if (Validacion(Nombre, Apellidos, Celular, Email, Password)) {
                    Registrar(v, Nombre, Apellidos, Celular, Email, Password);
                }

            }
        });
/*
        BtnVolver.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                goLogin();
            }
        });*/
    }

    private void Inicializar() {
        TxtNombre = (TextView) findViewById(R.id.TxtNombres);
        TxtApellidos = (TextView) findViewById(R.id.TxtApellidos);
        TxtCelular = (TextView) findViewById(R.id.TxtTelefono);
        TxtEmail = (TextView) findViewById(R.id.TxtEmail);
        TxtPassword = (TextView) findViewById(R.id.TxtPassword);
        BtnVolver = (Button) findViewById(R.id.btn_back);

        mLoginFormView = findViewById(R.id.registrar_form);
        mProgressView = findViewById(R.id.progressBar);
    }

    private boolean Validacion(String Nombre, String Apellidos, String Celular, String Email, String Password) {

        if (!isValidString(Nombre)) {
            Toast.makeText(this, "Digite su nombre", Toast.LENGTH_LONG).show();
            return false;
        } else if (!isValidString(Apellidos)) {
            Toast.makeText(this, "Digite su(s) apellido(s)", Toast.LENGTH_LONG).show();
            return false;
        } else if (!isValidString(Celular)) {
            Toast.makeText(this, "Digite su numero de celular", Toast.LENGTH_LONG).show();
            return false;
        } else if (!isValidEmail(Email)) {
            Toast.makeText(this, "Digite un Email valido!", Toast.LENGTH_LONG).show();
            return false;
        } else if (!isValidPassword(Password)) {
            Toast.makeText(this, "La contraseña debe tener minimo 6 caracteres!", Toast.LENGTH_LONG).show();
            return false;
        } else {
            return true;
        }
    }

    private boolean isValidString(String valor) {
        return !TextUtils.isEmpty(valor);
    }

    private boolean isValidEmail(String Email) {
        return !TextUtils.isEmpty(Email) && android.util.Patterns.EMAIL_ADDRESS.matcher(Email).matches();
    }

    private boolean isValidPassword(String Password) {
        return !TextUtils.isEmpty(Password) && Password.length() > 5;
    }

    private void Registrar(final View v, String Nombre, String Apellidos, String Celular, String Email, final String Password) {
        try {

            mProgressView.setVisibility(View.VISIBLE);
            mLoginFormView.setVisibility(View.GONE);

            String[] arrayUser = Email.split("@");
            final String Usuario = arrayUser[0];

            String Data = "{ Nombre: '" + Nombre + "', Apellido: '" + Apellidos + "', Telefono: '" + Celular + "', Email: '" + Email + "', Usuario: '" + Usuario + "',  Contrasena: '" + Password + "', IdFb: '1', IdRol: '1' }";

            org.json.fh.JSONObject params = new org.json.fh.JSONObject(Data);

            FHCloudRequest request = FH.buildCloudRequest("registroUsuario", "POST", null, params);
            request.executeAsync(new FHActCallback() {
                @Override
                public void success(FHResponse fhResponse) {
                    Log.d(TAG, "cloudCall - success");

                    v.setEnabled(true);

                    try {
                        JSONObject obj = new JSONObject(fhResponse.getJson().toString());
                        org.json.JSONObject jsonRespuesta = obj.getJSONObject("Respuesta");
                        String Estado = jsonRespuesta.getString("Estado");
                        if (Estado.equals("OK")) {
                            GuardarPrefences(Usuario, Password);
                            goClasePrincipal();
                        } else if (Estado.equals("ERROR")) {
                            String Mensaje = jsonRespuesta.getString("Mensaje");
                            Toast.makeText(v.getContext(), "Alerta, " + Mensaje, Toast.LENGTH_LONG).show();
                            Limpiar();
                        }

                    } catch (JSONException e) {
                        e.printStackTrace();
                        Toast.makeText(v.getContext(), "No se pudo registrar el usuario, error: " + e.getMessage(), Toast.LENGTH_LONG).show();
                        Limpiar();
                    }

                }

                @Override
                public void fail(FHResponse fhResponse) {
                    Log.d(TAG, "cloudCall - fail");
                    Log.e(TAG, fhResponse.getErrorMessage(), fhResponse.getError());
                    v.setEnabled(true);
                    Toast.makeText(v.getContext(), "No se registrar el usuario, error: " + fhResponse.getErrorMessage(), Toast.LENGTH_LONG).show();

                    Limpiar();
                }
            });
        } catch (Exception e) {
            Toast.makeText(v.getContext(), "No se pudo registrar el usuario, error: " + e.getMessage(), Toast.LENGTH_LONG).show();
            Log.e(TAG, e.getMessage(), e.getCause());
            Limpiar();
        }

    }

    private void Limpiar() {
        TxtNombre.setText("");
        TxtApellidos.setText("");
        TxtEmail.setText("");
        TxtCelular.setText("");
        TxtPassword.setText("");

        mProgressView.setVisibility(View.GONE);
        mLoginFormView.setVisibility(View.VISIBLE);
    }

    private void goLogin() {
        Intent intent = new Intent(this, Loggin.class);
        startActivity(intent);
    }

    private void GuardarPrefences(String Usuario, String Password) {
        SharedPreferences.Editor editor = preferences.edit();
        editor.putString("usuario", Usuario);
        editor.putString("password", Password);
        editor.commit();
        editor.apply();
    }

    private void goClasePrincipal() {

        Intent intent = new Intent(this, MainActivity.class);

        // AÑADIMOS banderas que nos permite limpiar el recorrido anterior, cuando presionemos atras no nos devuelve al login.
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
                Intent.FLAG_ACTIVITY_CLEAR_TASK |
                Intent.FLAG_ACTIVITY_NEW_TASK);

        /*intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);*/

        startActivity(intent);

    }

}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
			 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

	 <title>Pixenate example code : Combining many operations in a single click.</title>

This example demonstrates how multiple image-editing
		operations can be combined and applied with a single
		click. When you click the Crop & Prepare button, the
		image will be cropped, converted to gray-scale, resized and a
		diffuse border added around the image. This functionality is
		useful for photo-merchandising websites, allowing for
		simplified workflows for turning user-supplied photos into
		custom photo products - T-Shirts, Laser etchings, etc.

Please select the area of the photo you would like to use.

		<button onclick="prepareImage()">Crop & Prepare Image</button>
		<button onclick="PXN8.tools.undo()">Undo</button>
		<button onclick="PXN8.tools.redo()">Redo</button>


text:
- Bumped Development Status to 5 - Production/Stable
- Enforced clean before building for PyPI

### Added
- `foostache` as an installed script

## 1.1.1 - 2015-10-09
### Fixed
- "path exists" was always evaluating true

## 1.1.0 - 2015-08-10
### Added
- foostache 1.1.0 support
	- `jss` filter support

## 1.0.1 - 2015-08-04
### Fixed
- Throw exception when "path is type" has invalid path
- Quoted string handling
- Whitespace handling
- foostache.py

### Added
- This CHANGELOG
- template.dump(indent=2)

## 1.0.0 - 2015-08-03
### Added
- Initial foostache implementation


text:
(function() {
    'use strict';

    angular.module('textualLoader', []);

    angular
        .module('textualLoader')
        .directive('textualLoader', textualLoader);

    textualLoader.$inject = [];
    /* @ngInject */
    function textualLoader() {
        //Usage:
        //<button>Loading

        var directive = {
          scope: {
            enabled: '=tlEnabled',
            speed: '=?tlSpeed'
          },
          restrict: 'AE',
          link: linkFunc
        };
        return directive;

        function linkFunc(scope, element, attrs) {
          var speed = scope.speed || 500;
          var elementText = element.text();
          var characters = [];
          var currentChar = 0;
          var character;
          var interval;

          // Clear element
          empty();
          build();

          // Set enabled by default (if not set)
          if(typeof scope.enabled === 'undefined') {
            scope.enabled = true;
          }

          if(scope.enabled) {
            start();
          }

          // Watch for changes on the enabled state
          scope.$watch('enabled', function(newValue, oldValue) {
            var diff = (newValue !== oldValue);

            if(newValue && diff && scope.enabled) {
              start();
            } else if(diff) {
              stop();
            }
          });

          /**
           * Starts the loader
           */
          function start() {
            console.info('start');

            interval = setInterval(function() {
              nextChar();
            }, speed);

          }

          /**
           * Stops the loader
           */
          function stop() {
            clearInterval(interval);
            //empty();
          }

          /**
           * Shows a single character
           * @param  {integer} index Character index
           */
          function showChar(index) {
            characters[index].addClass('tl-fadein');
          }

          /**
           * Processes the next character
           */
          function nextChar() {
            if(currentChar === -1) {
              clearChars();
            } else {
              showChar(currentChar);
            }

            if(currentChar === characters.length-1) {
              currentChar = -1;
            } else {
              currentChar++;
            }
          }

          /**
           * Hides all the characters
           */
          function clearChars() {
            for(var i=0;i<characters.length;i++) {
              characters[i].removeClass('tl-fadein');
            }
          }

          /**
           * Empties the directive container
           */
          function empty() {
            element.html('');
          }

          /**
           * Builds the html template
           */
          function build() {
            for(var i=0;i<elementText.length;i++) {
              character = angular.element('.');
              element.append(character);
              characters.push(character);
            }
          }

        }
    }

})();


text:
#ifndef _KERNEL_HPP_
#define _KERNEL_HPP_

class Kernel
{
public:
	static void Start();
};

#endif /* _KERNEL_HPP_ */


text:
<?php
namespace HodgePodge\Exception\HTTP;

class Error extends \HodgePodge\Exception\HTTP
{
    protected $header = 'HTTP/1.1 500 Internal Server Error';
	public function __construct($message = null, $data = null, \Exception $previous_exception = null)
	{
		parent::__construct(500, $message, $data, $previous_exception);
	}
}


text:
package ru.osetsky.bank;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

/**
 * Created by koldy on 22.07.2017.
 */
public class Bank {
    /**
     *  В течении дня в банк заходят люди, у каждого человека есть время захода в банк и время выхода.
     * Всего за день у банка было N посетителей. Банк работает с 8:00 до 20:00.
     * Человек посещает банк только один раз за день.
     * Написать программу, которая определяет периоды времени,
     * когда в банке было максимальное количество посетителей.
    */

    /**
     * Массив содержащий имена клиентов.
     */
    private ArrayList<String> names = new ArrayList<String>();
    /**
     * Массив содержащий время прихода клиентов.
     */
    private List<Long> timeEntry = new LinkedList<Long>();
    /**
     * Количество человек.
     */
    private int countPeople = 0;
    /**
     * количество человек на текущий момент в банке.
     */
    private int countCurrent = 0;
    /**
     * Максимальное количество человек, данная переменная необходима для определения максимума.
     */
    private long[] countCurrentMax = {0, 0};
    /**
     * Булевская переменная для того чтобы вычитать человека из количества людей находящихся в текущий момент в банке.
     */
    private boolean delete = false;

    /**
     * @param timeParam передает время входа или выхода клиента.
     * @param name передает имя клиента.
     * @return максимальное количество человек находившихся в банке одновременно и определяет время максимума
     * людей в банке по последнему вошедшему.
     */
    public long[] maxcountpeople(long timeParam, String name) {
        if (countPeople != 0) {
            for (int i = 0; i < countPeople; i++) {
                if (name.equals(names.get(i))) {
                  delete = true;
                  if (timeEntry.indexOf(timeParam) != -1) {
                      timeEntry.remove(timeEntry.indexOf(timeParam));
                  }
                }
            }
        }
        if (delete) {
            countCurrent--;
            delete = false;
            System.out.println(countCurrent);
        } else {
                timeEntry.add(timeParam);
                names.add(countPeople, name);
                countPeople++;
                countCurrent++;
            }
        if (countCurrent > countCurrentMax[0]) {
            countCurrentMax[0] = countCurrent;
            for (int i = 0; i < countPeople; i++) {
                if (timeParam > timeEntry.get(i)) {
                    countCurrentMax[1] = timeParam;
                }
            }
        }

       return countCurrentMax;
    }

}


text:
namespace Serenity.Services
{
    /// <summary>
    /// Generic validation error mostly used by services.
    /// </summary>
    /// <seealso cref="Exception" />
    public class ValidationError : Exception, IIsSensitiveMessage
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ValidationError"/> class.
        /// </summary>
        public ValidationError() : base() { }

        /// <summary>
        /// Initializes a new instance of the <see cref="ValidationError"/> class.
        /// </summary>
        /// <param name="message">The message that describes the error.</param>
        public ValidationError(string message) : base(message) { }

        /// <summary>
        /// Initializes a new instance of the <see cref="ValidationError"/> class.
        /// </summary>
        /// <param name="message">The error message that explains the reason for the exception.</param>
        /// <param name="innerException">The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.</param>
        public ValidationError(string message, Exception innerException) : base(message, innerException) { }

        /// <summary>
        /// Initializes a new instance of the <see cref="ValidationError"/> class.
        /// </summary>
        /// <param name="errorCode">The error code.</param>
        /// <param name="errorMessage">The error message.</param>
        public ValidationError(string errorCode, string errorMessage)
            : this(errorCode, null, errorMessage)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ValidationError"/> class.
        /// </summary>
        /// <param name="errorCode">The error code.</param>
        /// <param name="arguments">The arguments.</param>
        /// <param name="errorMessage">The error message.</param>
        public ValidationError(string errorCode, string arguments, string errorMessage) : base(errorMessage)
        {
            ErrorCode = errorCode;
            Arguments = arguments;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ValidationError"/> class.
        /// </summary>
        /// <param name="errorCode">The error code.</param>
        /// <param name="arguments">The arguments.</param>
        /// <param name="errorMessageFormat">The error message format.</param>
        /// <param name="formatArgs">The format arguments.</param>
        public ValidationError(string errorCode, string arguments, string errorMessageFormat, params object[] formatArgs)
            : base(string.Format(errorMessageFormat, formatArgs))
        {
            ErrorCode = errorCode;
            Arguments = arguments;
        }

        /// <summary>
        /// Gets or sets the error code.
        /// </summary>
        /// <value>
        /// The error code.
        /// </value>
        public string ErrorCode { get; set; }

        /// <summary>
        /// Gets or sets the arguments.
        /// </summary>
        /// <value>
        /// The arguments.
        /// </value>
        public string Arguments { get; set; }

        /// <summary>
        /// By default all ValidationErrors are end user exceptions (e.g. message can be shown safely to the end user)
        /// </summary>
        public bool IsSensitiveMessage { get; set; }
    }
}


text:
<!doctype html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="Front-end design tips for professionals .">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
    <title>Front-end design professionals</title>
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:regular,bold,italic,thin,light,bolditalic,black,medium&lang=en">
    <link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.grey-pink.min.css" />
    <link rel="stylesheet" href="styles/styles.css" />
    <link rel="stylesheet" href="vendors/css/material-alfa.css" />
    <link rel="stylesheet" href="vendors/css/prism.css" />
    <link rel="icon" type="image/png" sizes="32x32" href="images/favicons/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="16x16" href="images/favicons/favicon-16x16.png">

    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">

                Front-end Design Professionals

                F-D-P

                    Blogs
                    Portfolio
                    About
                    Contact

                Blogs
                Portfolio
                About
                Contact

By:   tony14pro

Help

Privacy & Terms


text:
@interface NSBezierPath (WORoundedRect)

- (void)appendBezierPathWithRoundedRectangle:(NSRect)aRect
                                      radius:(float)radius;

@end


text:
<?php

class RegisterUser
{

    private $crud,$setcripto,$validate,$email,$pass,$select,$insert,$result;

    public function setCad($firstname,$lastname,$username,$email,$password,$passwordagain,$cpf,$cep,$bairro,$rua,$casan,$complemento,$sexo)
    {

        @session_start();

        $this->validate = new AuthValidate();

        $this->crud = new CRUD();

        $this->email = $this->validate->setValidateEmail($email);
        $this->pass = $this->validate->setValidatePass($password);
        $this->setcripto = $this->validate->setEncryption($password);

        if(empty($firstname))
        {
               return 'Informe o nome';
        }
        else{

            if(empty($lastname))
            {
                return 'Informe o sobrenome';
            }else
            {
               if(empty($email))
               {
                   return 'Informe o email';

               }else

               {

                 if(empty($password))
                 {
                  return 'Informe a senha';

                 }else{

                 }
                 if (empty($passwordagain))
               {
                   return 'Repita a senha';

               }else{

                 }if($password <> $passwordagain)
               {
                   return 'Senhas não coincidem';

               }else
                  {

                    if($email <> $this->email)
                    {
                      return 'Email inválido';

                    }else
                    {
                       if($password <> $this->pass)
                    {
                        return 'Senha inválida';

                    }
                       else
                       {
                           if(empty($cpf) or strlen($cpf) <> 11 and !is_integer($cpf))
                           {
                               return 'CPF inválido';

                           }else{
                               if(empty($cep))
                               {
                                   return 'Informe o CEP';

                               }else{
                                   if(strlen($_POST['firstname']) > 25 or strlen($_POST['firstname']) > 25)
                                   {
                                       return 'Nome ou sobrenome exedeu o numero de caracteres';
                                   }else
                                   {
                           $this->select = $this->crud->select('*','usuarios','WHERE email=?',array($email));

                         if($this->select->rowCount() > 0)
                         {
                             return 'Email já cadastrado';

                         }else
                         {

                                 if(!is_numeric($casan))
                                 {
                                     echo 'Numero da casa inválido';
                                 }else
                                 {

                             date_default_timezone_set('America/Sao_Paulo');                                                                                //0,$this->validate->setEncryption(46868820)
                             $date = date('d/m/Y');

                             $this->insert = $this->crud->insert('usuarios','firstname=?,lastname=?,email=?,pass=?,CPF=?,username=?,photo=?,cep=?,endereco=?,sexo=?',array(utf8_decode($firstname),utf8_decode($lastname),$this->email,$this->setcripto,$cpf,$username,'resources/images/user.png',$cep,$rua.'-'.$bairro.'-'.$casan.'-'.$complemento,$sexo));

                                     echo '
                                     <script>
                                     $.post("../../views/admin/ajax/email.php",{email:"'.$this->email.'",name:"'.utf8_decode($firstname).'",link:"http://localhost/lancedecentavos/home?verify='.$this->insert.'",type:"0"},function(res) {

                                     });
                                     </script>
                                     ';

                             /*
                             @$this->crud->insert('notify_push','title=?,image=?,text=?,user=?',array('Seja bem vindo ao NarradorCast','resources/images/user.png',utf8_decode('Olá, seja muito bem vindo ao NarradorCast um agragador de podcasts 100% nacional. Aqui você poderá encontrar seus podcasts favoritos alem de poder adicionar seus proprios podcasts.'),$this->insert));
                             @$this->crud->insert('log','id_user=?,data=?',array($this->insert,date('d-m-Y')));
                             @$this->crud->insert('interact_report','id_user=?,title=?,text=?,image=?,link=?,data=?',array($this->insert,'Cadastro feito por '.$email,utf8_decode('Cadastro realizado com sucesso por '.$email),'resources/images/user.png','#',date('H:i d-m-Y')));
                             @$playlist = $this->crud->insert('playlist_channel','id_playlist=?,id_adm=?,data=?,name=?,actived=?',array($this->insert,$this->insert,date('d-m-Y'),'Playlist de '.$firstname.'.',1));

                             @$this->crud->insert('followplay','id_user=?,id_playlist=?',array($this->insert,$playlist));
*/

                             $_SESSION['Auth01'] = 'logado';
                             $_SESSION['NAME'] = $firstname;
                             $_SESSION['EMAIL'] = $email;
                             $_SESSION['PASS'] = $this->setcripto;
                             $_SESSION['ID'] = $this->insert;

                             return 11;

                            }}}}}}}}}}}}

}


text:
package com.axxessio.oauth2.server.controller.to;

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class ErrorMessageTO extends GenericTO{
	String error;
	int    error_code;
	String error_description;
	String error_uri;

	public ErrorMessageTO (String newError, int newErrorCode, String newErrorDescription) {
		this.error = newError;
		this.error_code = newErrorCode;
		this.error_description = newErrorDescription;
	}

	public ErrorMessageTO (String newError, int newErrorCode, String newErrorDescription, String newErrorURI) {
		this.error = newError;
		this.error_code = newErrorCode;
		this.error_description = newErrorDescription;
		this.error_uri = newErrorURI;
	}

	public String getError() {
		return error;
	}

	public int getErrorCode () {
		return this.error_code;
	}

	public String getError_description() {
		return error_description;
	}

	public String getError_uri() {
		return error_uri;
	}
}


text:
<?php
/**
 * Twenty Seventeen functions and definitions
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @package WordPress
 * @subpackage Twenty_Seventeen
 * @since 1.0
 */

/**
 * Twenty Seventeen only works in WordPress 4.7 or later.
 */
if ( version_compare( $GLOBALS['wp_version'], '4.7-alpha', '<' ) ) {
	require get_template_directory() . '/inc/back-compat.php';
	return;
}

/**
 * Sets up theme defaults and registers support for various WordPress features.
 *
 * Note that this function is hooked into the after_setup_theme hook, which
 * runs before the init hook. The init hook is too late for some features, such
 * as indicating support for post thumbnails.
 */
function um_setup() {
	/*
	 * Make theme available for translation.
	 * Translations can be filed at WordPress.org. See: https://translate.wordpress.org/projects/wp-themes/um
	 * If you're building a theme based on Twenty Seventeen, use a find and replace
	 * to change 'um' to the name of your theme in all the template files.
	 */
	load_theme_textdomain( 'um' );

	// Add default posts and comments RSS feed links to head.
	add_theme_support( 'automatic-feed-links' );

	/*
	 * Let WordPress manage the document title.
	 * By adding theme support, we declare that this theme does not use a
	 * hard-coded <title> tag in the document head, and expect WordPress to
	 * provide it for us.
	 */
	add_theme_support( 'title-tag' );

	/*
	 * Enable support for Post Thumbnails on posts and pages.
	 *
	 * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
	 */
	add_theme_support( 'post-thumbnails' );

	add_image_size( 'um-featured-image', 2000, 1200, true );

	add_image_size( 'um-thumbnail-avatar', 100, 100, true );

	// Set the default content width.
	$GLOBALS['content_width'] = 525;

	// This theme uses wp_nav_menu() in two locations.
	register_nav_menus( array(
		'top'    => __( 'Top Menu', 'um' ),
		'social' => __( 'Social Links Menu', 'um' ),
	) );

	/*
	 * Switch default core markup for search form, comment form, and comments
	 * to output valid HTML5.
	 */
	add_theme_support( 'html5', array(
		'comment-form',
		'comment-list',
		'gallery',
		'caption',
	) );

	/*
	 * Enable support for Post Formats.
	 *
	 * See: https://codex.wordpress.org/Post_Formats
	 */
	add_theme_support( 'post-formats', array(
		'aside',
		'image',
		'video',
		'quote',
		'link',
		'gallery',
		'audio',
	) );

	// Add theme support for Custom Logo.
	add_theme_support( 'custom-logo', array(
		'width'       => 250,
		'height'      => 250,
		'flex-width'  => true,
	) );

	// Add theme support for selective refresh for widgets.
	add_theme_support( 'customize-selective-refresh-widgets' );

	/*
	 * This theme styles the visual editor to resemble the theme style,
	 * specifically font, colors, and column width.
 	 */
	add_editor_style( array( 'assets/css/editor-style.css', um_fonts_url() ) );

	// Define and register starter content to showcase the theme on new sites.
	$starter_content = array(
		'widgets' => array(
			// Place three core-defined widgets in the sidebar area.
			'sidebar-1' => array(
				'text_business_info',
				'search',
				'text_about',
			),

			// Add the core-defined business info widget to the footer 1 area.
			'sidebar-2' => array(
				'text_business_info',
			),

			// Put two core-defined widgets in the footer 2 area.
			'sidebar-3' => array(
				'text_about',
				'search',
			),
		),

		// Specify the core-defined pages to create and add custom thumbnails to some of them.
		'posts' => array(
			'home',
			'about' => array(
				'thumbnail' => '{{image-sandwich}}',
			),
			'contact' => array(
				'thumbnail' => '{{image-espresso}}',
			),
			'blog' => array(
				'thumbnail' => '{{image-coffee}}',
			),
			'homepage-section' => array(
				'thumbnail' => '{{image-espresso}}',
			),
		),

		// Create the custom image attachments used as post thumbnails for pages.
		'attachments' => array(
			'image-espresso' => array(
				'post_title' => _x( 'Espresso', 'Theme starter content', 'um' ),
				'file' => 'assets/images/espresso.jpg', // URL relative to the template directory.
			),
			'image-sandwich' => array(
				'post_title' => _x( 'Sandwich', 'Theme starter content', 'um' ),
				'file' => 'assets/images/sandwich.jpg',
			),
			'image-coffee' => array(
				'post_title' => _x( 'Coffee', 'Theme starter content', 'um' ),
				'file' => 'assets/images/coffee.jpg',
			),
		),

		// Default to a static front page and assign the front and posts pages.
		'options' => array(
			'show_on_front' => 'page',
			'page_on_front' => '{{home}}',
			'page_for_posts' => '{{blog}}',
		),

		// Set the front page section theme mods to the IDs of the core-registered pages.
		'theme_mods' => array(
			'panel_1' => '{{homepage-section}}',
			'panel_2' => '{{about}}',
			'panel_3' => '{{blog}}',
			'panel_4' => '{{contact}}',
		),

		// Set up nav menus for each of the two areas registered in the theme.
		'nav_menus' => array(
			// Assign a menu to the "top" location.
			'top' => array(
				'name' => __( 'Top Menu', 'um' ),
				'items' => array(
					'link_home', // Note that the core "home" page is actually a link in case a static front page is not used.
					'page_about',
					'page_blog',
					'page_contact',
				),
			),

			// Assign a menu to the "social" location.
			'social' => array(
				'name' => __( 'Social Links Menu', 'um' ),
				'items' => array(
					'link_yelp',
					'link_facebook',
					'link_twitter',
					'link_instagram',
					'link_email',
				),
			),
		),
	);

	/**
	 * Filters Twenty Seventeen array of starter content.
	 *
	 * @since Twenty Seventeen 1.1
	 *
	 * @param array $starter_content Array of starter content.
	 */
	$starter_content = apply_filters( 'um_starter_content', $starter_content );

	add_theme_support( 'starter-content', $starter_content );
}
add_action( 'after_setup_theme', 'um_setup' );

/**
 * Set the content width in pixels, based on the theme's design and stylesheet.
 *
 * Priority 0 to make it available to lower priority callbacks.
 *
 * @global int $content_width
 */
function um_content_width() {

	$content_width = $GLOBALS['content_width'];

	// Get layout.
	$page_layout = get_theme_mod( 'page_layout' );

	// Check if layout is one column.
	if ( 'one-column' === $page_layout ) {
		if ( um_is_frontpage() ) {
			$content_width = 644;
		} elseif ( is_page() ) {
			$content_width = 740;
		}
	}

	// Check if is single post and there is no sidebar.
	if ( is_single() && ! is_active_sidebar( 'sidebar-1' ) ) {
		$content_width = 740;
	}

	/**
	 * Filter Twenty Seventeen content width of the theme.
	 *
	 * @since Twenty Seventeen 1.0
	 *
	 * @param int $content_width Content width in pixels.
	 */
	$GLOBALS['content_width'] = apply_filters( 'um_content_width', $content_width );
}
add_action( 'template_redirect', 'um_content_width', 0 );

/**
 * Register custom fonts.
 */
function um_fonts_url() {
	$fonts_url = '';

	/*
	 * Translators: If there are characters in your language that are not
	 * supported by Libre Franklin, translate this to 'off'. Do not translate
	 * into your own language.
	 */
	$libre_franklin = _x( 'on', 'Libre Franklin font: on or off', 'um' );

	if ( 'off' !== $libre_franklin ) {
		$font_families = array();

		$font_families[] = 'Libre Franklin:300,300i,400,400i,600,600i,800,800i';

		$query_args = array(
			'family' => urlencode( implode( '|', $font_families ) ),
			'subset' => urlencode( 'latin,latin-ext' ),
		);

		$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
	}

	return esc_url_raw( $fonts_url );
}

/**
 * Add preconnect for Google Fonts.
 *
 * @since Twenty Seventeen 1.0
 *
 * @param array  $urls           URLs to print for resource hints.
 * @param string $relation_type  The relation type the URLs are printed.
 * @return array $urls           URLs to print for resource hints.
 */
function um_resource_hints( $urls, $relation_type ) {
	if ( wp_style_is( 'um-fonts', 'queue' ) && 'preconnect' === $relation_type ) {
		$urls[] = array(
			'href' => 'https://fonts.gstatic.com',
			'crossorigin',
		);
	}

	return $urls;
}
add_filter( 'wp_resource_hints', 'um_resource_hints', 10, 2 );

/**
 * Register widget area.
 *
 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
 */
function um_widgets_init() {
	register_sidebar( array(
		'name'          => __( 'Blog Sidebar', 'um' ),
		'id'            => 'sidebar-1',
		'description'   => __( 'Add widgets here to appear in your sidebar on blog posts and archive pages.', 'um' ),
		'before_widget' => '
',
		'after_widget'  => '
',
		'before_title'  => '
',
		'after_title'   => '
',
	) );

	register_sidebar( array(
		'name'          => __( 'Footer 1', 'um' ),
		'id'            => 'sidebar-2',
		'description'   => __( 'Add widgets here to appear in your footer.', 'um' ),
		'before_widget' => '
',
		'after_widget'  => '
',
		'before_title'  => '
',
		'after_title'   => '
',
	) );

	register_sidebar( array(
		'name'          => __( 'Footer 2', 'um' ),
		'id'            => 'sidebar-3',
		'description'   => __( 'Add widgets here to appear in your footer.', 'um' ),
		'before_widget' => '
',
		'after_widget'  => '
',
		'before_title'  => '
',
		'after_title'   => '
',
	) );
}
add_action( 'widgets_init', 'um_widgets_init' );

/**
 * Replaces "[...]" (appended to automatically generated excerpts) with ... and
 * a 'Continue reading' link.
 *
 * @since Twenty Seventeen 1.0
 *
 * @param string $link Link to single post/page.
 * @return string 'Continue reading' link prepended with an ellipsis.
 */
function um_excerpt_more( $link ) {
	if ( is_admin() ) {
		return $link;
	}

	$link = sprintf( '
%2$s
',
		esc_url( get_permalink( get_the_ID() ) ),
		/* translators: %s: Name of current post */
		sprintf( __( 'Continue reading "%s"', 'um' ), get_the_title( get_the_ID() ) )
	);
	return ' … ' . $link;
}
add_filter( 'excerpt_more', 'um_excerpt_more' );

/**
 * Handles JavaScript detection.
 *
 * Adds a `js` class to the root `<html>` element when JavaScript is detected.
 *
 * @since Twenty Seventeen 1.0
 */
function um_javascript_detection() {
	echo "\n";
}
add_action( 'wp_head', 'um_javascript_detection', 0 );

/**
 * Add a pingback url auto-discovery header for singularly identifiable articles.
 */
function um_pingback_header() {
	if ( is_singular() && pings_open() ) {
		printf( '<link rel="pingback" href="%s">' . "\n", get_bloginfo( 'pingback_url' ) );
	}
}
add_action( 'wp_head', 'um_pingback_header' );

/**
 * Display custom color CSS.
 */
function um_colors_css_wrap() {
	if ( 'custom' !== get_theme_mod( 'colorscheme' ) && ! is_customize_preview() ) {
		return;
	}

	require_once( get_parent_theme_file_path( '/inc/color-patterns.php' ) );
	$hue = absint( get_theme_mod( 'colorscheme_hue', 250 ) );
	?>

<?php }
add_action( 'wp_head', 'um_colors_css_wrap' );

/**
 * Enqueue scripts and styles.
 */
function um_scripts() {
	// Add custom fonts, used in the main stylesheet.
	wp_enqueue_style( 'um-fonts', um_fonts_url(), array(), null );

	// Theme stylesheet.
	wp_enqueue_style( 'um-style', get_stylesheet_uri() );

	// Load the dark colorscheme.
	if ( 'dark' === get_theme_mod( 'colorscheme', 'light' ) || is_customize_preview() ) {
		wp_enqueue_style( 'um-colors-dark', get_theme_file_uri( '/assets/css/colors-dark.css' ), array( 'um-style' ), '1.0' );
	}

	// Load the Internet Explorer 9 specific stylesheet, to fix display issues in the Customizer.
	if ( is_customize_preview() ) {
		wp_enqueue_style( 'um-ie9', get_theme_file_uri( '/assets/css/ie9.css' ), array( 'um-style' ), '1.0' );
		wp_style_add_data( 'um-ie9', 'conditional', 'IE 9' );
	}

	// Load the Internet Explorer 8 specific stylesheet.
	wp_enqueue_style( 'um-ie8', get_theme_file_uri( '/assets/css/ie8.css' ), array( 'um-style' ), '1.0' );
	wp_style_add_data( 'um-ie8', 'conditional', 'lt IE 9' );

	// Load the html5 shiv.
	wp_enqueue_script( 'html5', get_theme_file_uri( '/assets/js/html5.js' ), array(), '3.7.3' );
	wp_script_add_data( 'html5', 'conditional', 'lt IE 9' );

	wp_enqueue_script( 'um-skip-link-focus-fix', get_theme_file_uri( '/assets/js/skip-link-focus-fix.js' ), array(), '1.0', true );

	$um_l10n = array(
		'quote'          => um_get_svg( array( 'icon' => 'quote-right' ) ),
	);

	if ( has_nav_menu( 'top' ) ) {
		wp_enqueue_script( 'um-navigation', get_theme_file_uri( '/assets/js/navigation.js' ), array( 'jquery' ), '1.0', true );
		$um_l10n['expand']         = __( 'Expand child menu', 'um' );
		$um_l10n['collapse']       = __( 'Collapse child menu', 'um' );
		$um_l10n['icon']           = um_get_svg( array( 'icon' => 'angle-down', 'fallback' => true ) );
	}

	wp_enqueue_script( 'um-global', get_theme_file_uri( '/assets/js/global.js' ), array( 'jquery' ), '1.0', true );

	wp_enqueue_script( 'jquery-scrollto', get_theme_file_uri( '/assets/js/jquery.scrollTo.js' ), array( 'jquery' ), '2.1.2', true );

	wp_localize_script( 'um-skip-link-focus-fix', 'umScreenReaderText', $um_l10n );

	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
		wp_enqueue_script( 'comment-reply' );
	}
}
add_action( 'wp_enqueue_scripts', 'um_scripts' );

/**
 * Add custom image sizes attribute to enhance responsive image functionality
 * for content images.
 *
 * @since Twenty Seventeen 1.0
 *
 * @param string $sizes A source size value for use in a 'sizes' attribute.
 * @param array  $size  Image size. Accepts an array of width and height
 *                      values in pixels (in that order).
 * @return string A source size value for use in a content image 'sizes' attribute.
 */
function um_content_image_sizes_attr( $sizes, $size ) {
	$width = $size[0];

	if ( 740 <= $width ) {
		$sizes = '(max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px';
	}

	if ( is_active_sidebar( 'sidebar-1' ) || is_archive() || is_search() || is_home() || is_page() ) {
		if ( ! ( is_page() && 'one-column' === get_theme_mod( 'page_options' ) ) && 767 <= $width ) {
			$sizes = '(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px';
		}
	}

	return $sizes;
}
add_filter( 'wp_calculate_image_sizes', 'um_content_image_sizes_attr', 10, 2 );

/**
 * Filter the `sizes` value in the header image markup.
 *
 * @since Twenty Seventeen 1.0
 *
 * @param string $html   The HTML image tag markup being filtered.
 * @param object $header The custom header object returned by 'get_custom_header()'.
 * @param array  $attr   Array of the attributes for the image tag.
 * @return string The filtered header image HTML.
 */
function um_header_image_tag( $html, $header, $attr ) {
	if ( isset( $attr['sizes'] ) ) {
		$html = str_replace( $attr['sizes'], '100vw', $html );
	}
	return $html;
}
add_filter( 'get_header_image_tag', 'um_header_image_tag', 10, 3 );

/**
 * Add custom image sizes attribute to enhance responsive image functionality
 * for post thumbnails.
 *
 * @since Twenty Seventeen 1.0
 *
 * @param array $attr       Attributes for the image markup.
 * @param int   $attachment Image attachment ID.
 * @param array $size       Registered image size or flat array of height and width dimensions.
 * @return array The filtered attributes for the image markup.
 */
function um_post_thumbnail_sizes_attr( $attr, $attachment, $size ) {
	if ( is_archive() || is_search() || is_home() ) {
		$attr['sizes'] = '(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px';
	} else {
		$attr['sizes'] = '100vw';
	}

	return $attr;
}
add_filter( 'wp_get_attachment_image_attributes', 'um_post_thumbnail_sizes_attr', 10, 3 );

/**
 * Use front-page.php when Front page displays is set to a static page.
 *
 * @since Twenty Seventeen 1.0
 *
 * @param string $template front-page.php.
 *
 * @return string The template to be used: blank if is_home() is true (defaults to index.php), else $template.
 */
function um_front_page_template( $template ) {
	return is_home() ? '' : $template;
}
add_filter( 'frontpage_template',  'um_front_page_template' );

/**
 * Modifies tag cloud widget arguments to display all tags in the same font size
 * and use list format for better accessibility.
 *
 * @since Twenty Seventeen 1.4
 *
 * @param array $args Arguments for tag cloud widget.
 * @return array The filtered arguments for tag cloud widget.
 */
function um_widget_tag_cloud_args( $args ) {
	$args['largest']  = 1;
	$args['smallest'] = 1;
	$args['unit']     = 'em';
	$args['format']   = 'list';

	return $args;
}
add_filter( 'widget_tag_cloud_args', 'um_widget_tag_cloud_args' );

/**
 * Implement the Custom Header feature.
 */
require get_parent_theme_file_path( '/inc/custom-header.php' );

/**
 * Custom template tags for this theme.
 */
require get_parent_theme_file_path( '/inc/template-tags.php' );

/**
 * Additional features to allow styling of the templates.
 */
require get_parent_theme_file_path( '/inc/template-functions.php' );

/**
 * Customizer additions.
 */
require get_parent_theme_file_path( '/inc/customizer.php' );

/**
 * SVG icons functions and filters.
 */
require get_parent_theme_file_path( '/inc/icon-functions.php' );

function get_home_zhuanti($query){
    if($query->is_home() && $query->is_main_query()){
        $query->set('posts_per_page',1);
        $query->set('orderby',"desc");
    }
}
add_action('get_home_zhuanti','get_home_zhuanti',0);

function the_post_desc($length = 0, $echo=true){
    if($length == 0){
        $length = 64;
    }
    $content = get_post()->post_excerpt;
    if(get_locale() == 'en_US'){
        $length *= 2;
    }
    if(!empty($content)){
	    $content = strip_tags($content);
        if(mb_strlen($content) > $length){
	        $content = mb_substr($content,0,$length) . '...';
        }
    }else{
	    $content = get_the_content();
	    if(mb_strlen($content) < $length){
		    $content = strip_tags($content);
	    }else{
		    $content = mb_substr(strip_tags($content),0,$length) . "...";
	    }
    }
    if($echo){
        echo $content;
    }else{
	    return $content;
    }

}

function get_lang_text(){
    $langs = array('zh_CN'=>'EN','en_US'=>'中文');
    $lang = get_locale();
    if(!array_key_exists($lang,$langs)){
        echo '中文';
    }else{
        echo $langs[$lang];
    }
}
function get_lang_url(){
    //  源 => 目标
    $langs = array('zh_CN'=>'en','en_US'=>'zh');
    $lang = get_locale() ;
    $url = $_SERVER['path'];
    parse_str($_SERVER['QUERY_STRING'],$query);
    if(!array_key_exists($lang,$langs)){
        $query['lang'] = 'zh';
    }else{
        $query['lang'] = $langs[$lang];
    }
    return sprintf('%s?%s',$url,http_build_query($query));
}
function get_qrcode(){
    global $qrcodetag;
    $url = $qrcodetag->currentUrl();
    echo $qrcodetag->getQrcodeUrl($url,'125','UTF-8','L','4','version');
}
function create_comment_template($comments,$dom,$pid=0){
    if(empty($comments)){
        $comments = get_comments(array('post_id'=>get_the_ID(),'parent'=>$pid,'meta_key'=>'comment-like',
            'orderby'=>'meta_value_num','order'=>'DESC'));
    }
    foreach($comments as $comment){
        $maindiv = $dom->createElement('div');
        if(is_user_logged_in()){
            $class = "comment-show single-tie";
        }else{
            $class = "single-tie";
        }
        $maindiv->setAttribute('class',$class);
        $maindiv->setAttribute('data-common-id',$comment->comment_ID);
        if(!is_user_logged_in()){
            $maindiv->setAttribute('onclick',"javascript:$('#userinfo_btn').click();");
        }
        $maindiv->appendChild(get_phtot_template($dom,$comment));
        $maindiv->appendChild(get_body_template($dom,$comment));
        $dom->appendChild($maindiv);
    }
    return $dom->saveHtml();
}
function get_body_template($dom,$comment){
    if(get_locale() == 'zh_CN'){
        $d = 'm月d日 H:i';
    }else{
        $d = 'M d H:i';
    }
    //$dom = new DOMDocument('1.0','UTF-8');
    $body_div = $dom->createElement('div');
    $body_div->setAttribute('class','bdy-inner');
    $auther_div = $dom->createElement('div');
    $auther_div->setAttribute('class','tie-author');
    $auther_name = $dom->createElement('a',get_comment_author($comment->comment_ID));
    $auther_name->setAttribute('class','name comment-size-name');
    $auther_name->setAttribute('href','javascript:;');
    $date_span = $dom->createElement('span',get_comment_date($d,$comment->comment_ID));
    $date_span->setAttribute('class','name-desp');
    $pl_text = $dom->createElement('div');
    $pl_text->setAttribute('class','pl-text');
    $pl_text->appendChild($auther_name);
    $pl_text->appendChild($date_span);
    $auther_div->appendChild($pl_text);
    $like_div = $dom->createElement('div');
    $like_div->setAttribute('class','date-dz post-stat');
    $like_child = $dom->createElement('div');
    $like_child->setAttribute('class','date-dz-right');
    $like_span = $dom->createElement('span',(int)get_comment_meta($comment->comment_ID,'comment-like',true));
    $like_span->setAttribute('data-action','comment-ding');
    $like_span->setAttribute('data-comment-id',$comment->comment_ID);
    $class = ['post-like','comment-like'];
    array_push($class,get_common_like_status($comment->comment_ID));
    $like_span->setAttribute('class',join(' ',$class));
    $like_child->appendChild($like_span);
    $comment_count = $dom->createElement('a',(int)get_comment_meta($comment->comment_ID,'comment_count',true));
    if(um_comments_open()){
        $comment_count->setAttribute('href','javascript:;');
        $comment_count->setAttribute('class','post-review date-dz-pl pl-hf hf-con-block pull-left');
    }else{
        $comment_count->setAttribute('href','javascript:alert(\''. __('您无法此操作','um') .'\');');
        $comment_count->setAttribute('class','post-review date-dz-pl  hf-con-block pull-left');
    }
    $comment_count->setAttribute('data-post-id',$comment->comment_post_ID);
    $comment_count->setAttribute('data-pid',$comment->comment_ID);
    $like_child->appendChild($comment_count);
    $like_div->appendChild($like_child);
    $auther_div->appendChild($like_div);
    $content_div = $dom->createElement('div',$comment->comment_content);
    $content_div->setAttribute('class','tie-cnt');
    $body_div->appendChild($auther_div);
    $body_div->appendChild($content_div);
    $children = $comment->get_children(array('meta_key'=>'comment-like','orderby'=>'meta_value_num'));
    if($children){
        $reply_div = $dom->createElement('div');
        $reply_div->setAttribute('class','tie-reply');
        foreach($children as $child){
            $reply_div->appendChild(get_body_template($dom,$child));
        }
        $body_div->appendChild($reply_div);
    }
    return $body_div;
}

function get_phtot_template($dom,$comment){
    //$dom = new DOMDocument('1.0','UTF-8');
    $phodiv = $dom->createElement('div');
    $phodiv->setAttribute('class','photo');
    $default_photo = $dom->createElement('div');
    $default_photo->setAttribute('class','default-photo');
    $img = $dom->createElement('img');
    $avatar = um_get_avatar_url($comment->user_id);
    $img->setAttribute('src',$avatar);
    $default_photo->appendChild($img);
    $phodiv->appendChild($default_photo);
    return $phodiv;
}
add_action('wp_ajax_comment_post','um_comment_post');
function um_comment_post(){
    header('Content-type:application/json');
    nocache_headers();

    $comment = wp_handle_comment_submission( wp_unslash( $_POST ) );
    if(is_wp_error($comment)){
        $ret = array(
            'code' => 0,
            'desc' => $comment->get_error_message(),
            'post-id' => get_the_ID(),
        );
        die(json_encode($ret));
    }
    $count = get_comment_meta($comment->comment_parent,'comment_count',true);
    if(empty($count)){
        $count = 1;
    }else{
        $count ++;
    }
    update_comment_meta($comment->comment_parent,'comment_count',$count);
    update_comment_meta($comment->comment_ID,'comment-like',0);
    $user = wp_get_current_user();
    do_action( 'set_comment_cookies', $comment, $user );
    $dom = new \DOMDocument('1.0','utf8');
    $comments = get_comments(array('post_id'=>$_POST['comment_post_ID'],'parent'=>0,'meta_key'=>'comment-like',
        'orderby'=>'meta_value_num','order'=>'DESC'));
    $GLOBALS['comment'] = $comment;
    $res = create_comment_template($comments,$dom);
    $ret = array(
        'id' => $comment->comment_ID,
        'html' => $res,
        'code' => 1,
        'post-id' => get_the_ID(),
    );
    die(json_encode($ret));
}

function um_parent_comment($comment_id){
    $comment = get_comment($comment_id);
    if($comment->comment_parent){
        $comment = um_parent_comment($comment->comment_parent);
    }
    return $comment;
}

add_action('wp_ajax_nopriv_bigfa_like', 'bigfa_like');
add_action('wp_ajax_bigfa_like', 'bigfa_like');
function bigfa_like(){
    header('Content-type:application/json');
    $ret = array(
        'code' => 1,
        'msg' => '',
        'data'=>'',
    );
    if(!is_user_logged_in()){
        $ret['code'] = 0;
        $ret['msg'] = __('请登录后进行此操作','um');
        die(json_encode($ret));
    }
    if(!um_comments_open() ){
        $ret['code'] = 0;
        $ret['msg'] = __('您无法进行此操作','um');
        die(json_encode($ret));
    }
    $id = $_POST["um_id"];
    $action = $_POST["um_action"];
    if ( $action == 'ding'){
        $bigfa_raters = get_post_meta($id,'bigfa_ding',true);
        $ding_status = get_post_meta($id,'ding_status',true);
        if (!$bigfa_raters || !is_numeric($bigfa_raters)) {
            $bigfa_raters = 1;
            $ding_status[get_current_user_id()] = 1;
        }else {
            if($ding_status[get_current_user_id()]){
                $bigfa_raters--;
                $ding_status[get_current_user_id()] = 0;
            }else{
                $bigfa_raters++;
                $ding_status[get_current_user_id()] = 1;
            }
        }
        update_post_meta($id, 'bigfa_ding', $bigfa_raters);
        update_post_meta($id,'ding_status',$ding_status);
        $ret['data'] = (int)get_post_meta($id,'bigfa_ding',true);
        die(json_encode($ret));
    }else if($action == 'comment-ding'){
	    $bigfa_raters = get_comment_meta($id,'comment-like',true);
	    $ding_status = get_comment_meta($id,'common-like-status',true);
	    if (!$bigfa_raters || !is_numeric($bigfa_raters)) {
            $bigfa_raters = 1;
	    }else {
            $bigfa_raters++;
	    }
	    $user_id = get_current_user_id();
	    if($ding_status[$user_id]){
	        $ret['msg'] = __('您已赞过本评论','um');
	        $ret['code'] = 0;
	        die(json_encode($ret));
        }
        update_comment_meta($id, 'comment-like', $bigfa_raters);
	    $ding_status[$user_id] = 1;
	    update_comment_meta($id,'common-like-status',$ding_status);
        $ret['data'] = (int)get_comment_meta($id,'comment-like',true);
        die(json_encode($ret));
    }
    die;
}
function get_common_like_status($id){
    if(!is_user_logged_in()){
        echo '';
        return;
    }
	$user_id = get_current_user_id();
	$like_status = get_comment_meta($id,'common-like-status',true);
	if(empty($like_status)){
	    return '';
    }
	if($like_status && array_key_exists($user_id,$like_status)){
		return 'done';
	}else{
		return '';
	}
}
function get_like_status(){
    if(!is_user_logged_in()){
        echo '';
        return;
    }
    $user_id = get_current_user_id();
    $id = get_the_ID();
    $ding_status = get_post_meta($id,'ding_status',true);
    if($ding_status && $ding_status[$user_id]){
        echo 'done';
    }else{
        echo '';
    }
}

function um_get_date(){
    if(get_locale() == 'zh_CN'){
        $d = 'm月d日 H:i';
    }else{
        $d = 'M d H:i';
    }
    return get_post_time($d);
}

function um_get_post_time($d=''){
    $post = get_post();
    $cat = $post->post_category;
    if(get_locale() == 'zh_CN'){
        $d = 'm月d日 H:i';
    }else{
        $d = 'M d H:i';
    }
    if(in_array(4,$cat)){
        return um_get_activity_date($d);
    }else{
        return get_post_time($d);
    }
}
function um_get_activity_date($d){

    $id = get_the_ID();
    $start_time =  get_post_meta($id,'um_start_time',true);
    $end_time = get_post_meta($id,'um_end_time',true);
    if(empty($start_time) || empty($end_time)){
        return get_post_time($d);
    }else{
        $format = $d;
        $start_time = mysql2date($format, $start_time, false);
        $end_time = mysql2date($format, $end_time, false);
        $start_time=apply_filters( 'get_post_time', $start_time, $format, false );
        $end_time = apply_filters( 'get_post_time', $end_time, $format, false );
        return $start_time . '-' . $end_time;
    }

}

function nav_select($id){
    $request_id = get_query_var('cat');
    if(empty($request_id)){
        $post = get_post();
        $request_id = $post->post_category[0];
    }
    if($id == $request_id){
        echo ' link--darker ';
    }
}
function p ($arr){
    echo "
";
    print_r($arr);
}
// 后台
add_filter('manage_posts_columns', 'add_new_posts_columns');
function add_new_posts_columns($columns) {
    $new_columns = array();
    if(isset($columns['cb'])) $new_columns['cb'] = '';
    if(isset($columns['title'])) $new_columns['title'] = '';
    if(isset($columns['author'])) $new_columns['author'] = '';
    if(isset($columns['categories'])) $new_columns['categories'] = '';
    if(isset($columns['tags'])) $new_columns['tags'] = '';
    if(isset($columns['language'])) $new_columns['language'] = '';
    $new_columns['hot'] = __('推荐','um');
    return array_merge($new_columns, $columns);
}
add_action('manage_posts_custom_column', 'manage_posts_columns', 10, 2);
function manage_posts_columns($column_name, $id) {
    global $post;
    switch ($column_name) {
        case 'hot':
            echo get_hot_type();
            break;
        default:
            break;
    }
}
add_filter( 'manage_users_columns', 'um_users_columns',9,3);
function um_users_columns($columns){
    $arr = array(
        'cb' => $columns['cb'],
        'username' => $columns['username'],
        'display_name' => '姓名',
        'email' => $columns['email'],
        'role' => $columns['role'],
        'posts' => $columns['posts'],
        'ban' => '拉黑',
    );
    return $arr;
}
add_filter( 'manage_users_custom_column', 'um_users_custom_columns',15,3);
function um_users_custom_columns($value,$column_name,$id){
    if($column_name == 'ban'){
        $ban = get_user_meta($id,'ban',true);
        if($ban){
            return '拉黑';
        }else{
            return '正常';
        }
    }else if($column_name == 'display_name'){
        $user = get_user_by('id',$id);
        return $user->display_name;
    }else{
        return $value;
    }
}

function get_hot_type(){
    $fields = array('hot1' => '推荐1','hot2'=>'推荐2','hot3' => '推荐3','hot4' => '推荐4','hot5' => '推荐5');
    $arr = array();
    foreach($fields as $field => $vo){
        if(get_post_meta(get_the_ID(),$field,true)){
            array_push($arr,$vo);
        }
    }
    return join(',',$arr);
}

function get_hot_home_image(){
    $id = get_the_ID();
    $home_image = get_post_meta($id,'home_image',true);
    if(empty($home_image)){
        return get_the_post_thumbnail_url($id,'full');
    }
    return wp_get_attachment_image_url($home_image,'full');
}

function um_nonce(){
	$post_id = get_the_ID();
	if ( current_user_can( 'unfiltered_html' ) ) {
		wp_nonce_field( 'unfiltered-html-comment_' . $post_id, '_wp_unfiltered_html_comment', false );
	}
}

function um_get_avatar($user_id = 0,$size=96){
    if(empty($user_id)){
        $user_id = get_current_user_id();
    }
    $avatar = get_user_meta($user_id,'wp_user_avatar',true);
    if(empty($avatar)) {
        return get_avatar($user_id,$size);
    }else{
        $h = '';
        return $h;
    }
}
function um_get_avatar_url($user_id = 0){
    if(empty($user_id)){
        $user_id = get_current_user_id();
    }
    $avatar = get_user_meta($user_id,'wp_user_avatar',true);
    if(empty($avatar)){
        $avatar = get_bloginfo('template_url') . "/images/icon_user.png";
    }
    return $avatar;
}

function um_search_query(){
    if(is_search()){
       echo _e('搜索','um');
       echo  ' > ';
       if(have_posts()){
           echo $_GET['s'];
       }else{
           _e('无搜索结果','um');
       };
    }else if(is_tag()){
	    echo _e('标签','um');
	    echo  ' > ';
	    single_tag_title();
    }
}
function um_get_next_posts_page_link($max_page=0){
	global $paged,$wp_query;
	// $url = bloginfo('template_url');
	if ( !is_single() && !is_search() ) {
		if ( !$paged )
			$paged = 1;
		$nextpage = intval($paged) + 1;
		if ( !$max_page || $max_page >= $nextpage )
			return get_pagenum_link($nextpage,false);
	}
}

function custum_fontfamily($initArray){
    $initArray['font_formats'] = '微软雅黑=微软雅黑;宋体=宋体;黑体=黑体;仿宋=仿宋;楷体=楷体;隶书=隶书;幼圆=幼圆;Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats';
    return $initArray;
}
add_filter('tiny_mce_before_init', 'custum_fontfamily');

function custom_fontsize($init){
    $init['fontsize_formats'] = "8px 10px 12px 13px 14px 15px 16px 17px 18px 19px 20px 24px 28px 32px 36px 48px 60px 72px 96px";
    return $init;
}
add_filter('tiny_mce_before_init', 'custom_fontsize');

add_action( 'personal_options_update', 'save_extra_user_profile_fields' );
add_action( 'edit_user_profile_update', 'save_extra_user_profile_fields' );
function save_extra_user_profile_fields( $user_id ) {
    if ( !current_user_can( 'edit_user', $user_id ) ) { return false; }
    update_user_meta( $user_id, 'ban', $_POST['ban'] );
}

add_action( 'show_user_profile', 'extra_user_profile_fields' );
add_action( 'edit_user_profile', 'extra_user_profile_fields' );
function extra_user_profile_fields($user){
    $ban = (int)get_user_meta($user->ID,'ban',true);
    $level = (int)get_user_meta($user->ID,'wp_user_level',true);
    if($level == 0||true):
    ?>

            拉黑

                <input type="radio" name="ban" <?php if($ban){echo 'checked';} ?> id="ban_yes" value="1">
                是
                <input type="radio" name="ban"  <?php if($ban == 0){echo 'checked';} ?> id="ban_no" value="0">
                否

<?php
endif;
}

function um_comments_open(){
    $user_id = get_current_user_id();
    $level = (int)get_user_meta($user_id,'wp_user_level',true);
    $ban = (int)get_user_meta($user_id,'ban',true);
    if($level == 0 && $ban == 1){
        return false;
    }
    return true;
}
function um_get_index_message(){
    $lang = get_locale();
    $lang = substr($lang,0,2);
    $option = 'index_message_'.$lang;
    return get_option($option);
}
function um_get_about_message(){
    $lang = get_locale();
    $lang = substr($lang,0,2);
    $option = 'about_image_font_'.$lang;
    return get_option($option);
}
function um_get_index_dy_message($index=0){
    $lang = get_locale();
    $lang = substr($lang,0,2);
    $option = 'index_dy_message_'.$lang;
    $options = get_option($option);
    $options = explode(',',$options);
    return $options[0];
}
if(is_admin()){
    require_once(__DIR__ . "/admin_function.php");
    $role = get_role('author');
    $role->add_cap('manage_categories');
}
``

?>


text:
'use strict';

// any init stuff


text:
/* global define */
(function(root, pluralize) {
    /* istanbul ignore else */
    if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') {
        // Node.
        module.exports = pluralize();
    } else if (typeof define === 'function' && define.amd) {
        // AMD, registers as an anonymous module.
        define(function() {
            return pluralize();
        });
    } else {
        // Browser global.
        root.pluralize = pluralize();
    }
})(this, function() {

    function pluralize(word, count) {

        count = (typeof count === 'undefined' ? 2 : count);

        // Return the word if we don't need to pluralize
        if (count === 1) return word;

        // Set class variables for use
        pluralize.word = word;
        pluralize.lowercase = word.toLowerCase();
        pluralize.upperCase = word.toUpperCase();
        pluralize.sentenceCase = ucfirst(word);
        pluralize.casing = getCasing();
        pluralize.sibilants = ['x', 's', 'z', 's'];
        pluralize.vowels = ['a', 'e', 'i', 'o', 'u'];
        pluralize.consonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z'];

        // save some time in the case that singular and plural are the same
        if (isUncountable()) return word;

        // check for irregular forms
        var irregular = isIrregular();
        if (irregular) return toCasing(irregular, pluralize.casing);

        // nouns that end in -ch, x, s, z or s-like sounds require an es for the plural:
        if (in_array(suffix(pluralize.lowercase, 1), pluralize.sibilants) || (suffix(pluralize.lowercase, 2) === 'ch')) return toCasing(word + 'es', pluralize.casing);

        // Nouns that end in a vowel + y take the letter s:
        if (in_array(nthLast(pluralize.lowercase, 1), pluralize.vowels) && suffix(pluralize.lowercase, 1) === 'y') return toCasing(word + 's', pluralize.casing);

        // Nouns that end in a consonant + y drop the y and take ies:
        if (in_array(nthLast(pluralize.lowercase, 1), pluralize.consonants) && suffix(pluralize.lowercase, 1) === 'y') return toCasing(sliceFromEnd(word, 1) + 'ies', pluralize.casing);

        // Nouns that end in a consonant + o add s:
        if (in_array(nthLast(pluralize.lowercase, 1), pluralize.consonants) && suffix(pluralize.lowercase, 1) === 'o') return toCasing(word + 's', pluralize.casing);

        // Nouns that end in a vowel + o take the letter s:
        if (in_array(nthLast(pluralize.lowercase, 1), pluralize.vowels) && suffix(pluralize.lowercase, 1) === 'o') return toCasing(word + 's', pluralize.casing);

        // irregular suffixes that cant be pluralized
        if (suffix(pluralize.lowercase, 4) === 'ness' || suffix(pluralize.lowercase, 3) === 'ess') return word;

        // Lastly, change the word based on suffix rules
        var pluralized = autoSuffix(pluralize.lowercase);
        if (pluralized) return toCasing(sliceFromEnd(word, pluralized[0]) + pluralized[1], pluralize.casing);

        return word + 's';
    };

    function isUncountable() {
        var uncountable = [
            'sheep',
            'fish',
            'deer',
            'series',
            'species',
            'money',
            'rice',
            'information',
            'equipment',
            'bison',
            'buffalo',
            'duck',
            'pike',
            'plankton',
            'salmon',
            'squid',
            'swine',
            'trout',
            'moose',
            'aircraft',
            'you',
            'pants',
            'shorts',
            'eyeglasses',
            'scissors',
            'offspring',
            'eries',
            'premises',
            'kudos',
            'corps',
            'heep',
        ];
        return in_array(pluralize.lowercase, uncountable);
    };

    function isIrregular() {
        var irregular = {
            'addendum': 'addenda',
            'alga': 'algae',
            'alumna': 'alumnae',
            'alumnus': 'alumni',
            'analysis': 'analyses',
            'antenna': 'antennae',
            'apparatus': 'apparatuses',
            'appendix': 'appendices',
            'axis': 'axes',
            'bacillus': 'bacilli',
            'bacterium': 'bacteria',
            'basis': 'bases',
            'beau': 'beaux',
            'kilo': 'kilos',
            'bureau': 'bureaus',
            'bus': 'busses',
            'cactus': 'cacti',
            'calf': 'calves',
            'child': 'children',
            'corps': 'corps',
            'corpus': 'corpora',
            'crisis': 'crises',
            'criterion': 'criteria',
            'curriculum': 'curricula',
            'datum': 'data',
            'deer': 'deer',
            'die': 'dice',
            'dwarf': 'dwarves',
            'diagnosis': 'diagnoses',
            'echo': 'echoes',
            'elf': 'elves',
            'ellipsis': 'ellipses',
            'embargo': 'embargoes',
            'emphasis': 'emphases',
            'erratum': 'errata',
            'fireman': 'firemen',
            'fish': 'fish',
            'focus': 'focuses',
            'foot': 'feet',
            'formula': 'formulas',
            'fungus': 'fungi',
            'genus': 'genera',
            'goose': 'geese',
            'half': 'halves',
            'hero': 'heroes',
            'hippopotamus': 'hippopotami',
            'hoof': 'hooves',
            'hypothesis': 'hypotheses',
            'index': 'indices',
            'knife': 'knives',
            'leaf': 'leaves',
            'life': 'lives',
            'loaf': 'loaves',
            'louse': 'lice',
            'man': 'men',
            'matrix': 'matrices',
            'means': 'means',
            'medium': 'media',
            'memorandum': 'memoranda',
            'millennium': 'millenniums',
            'moose': 'moose',
            'mosquito': 'mosquitoes',
            'mouse': 'mice',
            'my': 'our',
            'nebula': 'nebulae',
            'neurosis': 'neuroses',
            'nucleus': 'nuclei',
            'neurosis': 'neuroses',
            'nucleus': 'nuclei',
            'oasis': 'oases',
            'octopus': 'octopi',
            'ovum': 'ova',
            'ox': 'oxen',
            'paralysis': 'paralyses',
            'parenthesis': 'parentheses',
            'person': 'people',
            'phenomenon': 'phenomena',
            'potato': 'potatoes',
            'radius': 'radii',
            'scarf': 'scarfs',
            'self': 'selves',
            'series': 'series',
            'sheep': 'sheep',
            'shelf': 'shelves',
            'scissors': 'scissors',
            'species': 'species',
            'stimulus': 'stimuli',
            'stratum': 'strata',
            'syllabus': 'syllabi',
            'symposium': 'symposia',
            'synthesis': 'syntheses',
            'synopsis': 'synopses',
            'tableau': 'tableaux',
            'that': 'those',
            'thesis': 'theses',
            'thief': 'thieves',
            'this': 'these',
            'tomato': 'tomatoes',
            'tooth': 'teeth',
            'torpedo': 'torpedoes',
            'vertebra': 'vertebrae',
            'veto': 'vetoes',
            'vita': 'vitae',
            'watch': 'watches',
            'wife': 'wives',
            'wolf': 'wolves',
            'woman': 'women',
            'is': 'are',
            'was': 'were',
            'he': 'they',
            'she': 'they',
            'i': 'we',
            'zero': 'zeroes',
        };

        if (isset(irregular[pluralize.lowercase])) return irregular[pluralize.lowercase];

        return false;
    };

    function autoSuffix() {

        var suffix1 = suffix(pluralize.lowercase, 1);
        var suffix2 = suffix(pluralize.lowercase, 2);
        var suffix3 = suffix(pluralize.lowercase, 3);

        if (suffix(pluralize.lowercase, 4) === 'zoon') return [4, 'zoa'];

        if (suffix3 === 'eau') return [3, 'eaux'];
        if (suffix3 === 'ieu') return [3, 'ieux'];
        if (suffix3 === 'ion') return [3, 'ia'];
        if (suffix3 === 'oof') return [3, 'ooves'];

        if (suffix2 === 'an') return [2, 'en'];
        if (suffix2 === 'ch') return [2, 'ches'];
        if (suffix2 === 'en') return [2, 'ina'];
        if (suffix2 === 'ex') return [2, 'exes'];
        if (suffix2 === 'is') return [2, 'ises'];
        if (suffix2 === 'ix') return [2, 'ices'];
        if (suffix2 === 'nx') return [2, 'nges'];
        if (suffix2 === 'nx') return [2, 'nges'];
        if (suffix2 === 'fe') return [2, 'ves'];
        if (suffix2 === 'on') return [2, 'a'];
        if (suffix2 === 'sh') return [2, 'shes'];
        if (suffix2 === 'um') return [2, 'a'];
        if (suffix2 === 'us') return [2, 'i'];
        if (suffix2 === 'x') return [1, 'xes'];
        if (suffix2 === 'y') return [1, 'ies'];

        if (suffix1 === 'a') return [1, 'ae'];
        if (suffix1 === 'o') return [1, 'oes'];
        if (suffix1 === 'f') return [1, 'ves'];

        return false;
    };

    function getCasing() {
        var casing = 'toLowerCase';
        casing = pluralize.lowercase === pluralize.word ? 'lower' : casing;
        casing = pluralize.upperCase === pluralize.word ? 'upper' : casing;
        casing = pluralize.sentenceCase === pluralize.word ? 'sentence' : casing;
        return casing;
    };

    function toCasing(word, casing) {
        if (casing === 'lower') return word.toLowerCase();
        if (casing === 'upper') return word.toUpperCase();
        if (casing === 'sentence') return ucfirst(word);
        return word;
    };

    function suffix(word, count) {
        return word.substr(word.length - count);
    };

    function nthLast(word, count) {
        return word.split('').reverse().join('').charAt(count);
    };

    function sliceFromEnd(word, count) {
        return word.substring(0, word.length - count);
    };

    function ucfirst(string) {
        return string.charAt(0).toUpperCase() + string.slice(1);
    };

    function in_array(needle, haystack, argStrict) {

        var key = '',
            strict = !!argStrict;

        // we prevent the double check (strict && arr[key] === ndl) || (!strict && arr[key] == ndl)
        // in just one for, in order to improve the performance
        //d eciding wich type of comparation will do before walk array
        if (strict) {
            for (key in haystack) {
                if (haystack[key] === needle) return true;
            }
        } else {
            for (key in haystack) {
                if (haystack[key] == needle) return true;
            }
        }

        return false;
    };

    function isset() {
        var a = arguments,
            l = a.length,
            i = 0,
            undef;

        if (l === 0) throw new Error('Empty isset');

        while (i !== l) {
            if (a[i] === undef || a[i] === null) return false;
            i++;
        }
        return true;
    };

    return pluralize;

});


text:
package com.asakusafw.runtime.value;

import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;

import java.io.DataOutput;
import java.io.DataOutputStream;
import java.math.BigDecimal;

import org.apache.hadoop.io.DataInputBuffer;
import org.apache.hadoop.io.IOUtils.NullOutputStream;
import org.junit.Test;

/**
 * Test for {@link DecimalOption}.
 */
@SuppressWarnings("deprecation")
public class DecimalOptionTest extends ValueOptionTestRoot {

    /**
     * test for initial state.
     */
    @Test
    public void init() {
        DecimalOption option = new DecimalOption();
        assertThat(option.isNull(), is(true));
    }

    /**
     * test for get.
     */
    @Test
    public void get() {
        DecimalOption option = new DecimalOption();
        option.modify(decimal(100));
        assertThat(option.get(), is(decimal(100)));
        assertThat(option.isNull(), is(false));
    }

    /**
     * test for or w/ null.
     */
    @Test
    public void or() {
        DecimalOption option = new DecimalOption();
        assertThat(option.or(decimal(30)), is(decimal(30)));
        assertThat(option.isNull(), is(true));
    }

    /**
     * test for or w/ present value.
     */
    @Test
    public void orNotNull() {
        DecimalOption option = new DecimalOption();
        option.modify(decimal(100));
        assertThat(option.or(decimal(30)), is(decimal(100)));
    }

    /**
     * test for copyFrom.
     */
    @Test
    public void copy() {
        DecimalOption option = new DecimalOption();
        DecimalOption other = new DecimalOption();
        other.modify(decimal(50));
        option.copyFrom(other);
        assertThat(option.get(), is(decimal(50)));

        option.modify(decimal(0));
        assertThat(other.get(), is(decimal(50)));
    }

    /**
     * test for copyFrom w/ null.
     */
    @Test
    public void copyNull() {
        DecimalOption option = new DecimalOption();
        option.modify(decimal(100));

        DecimalOption other = new DecimalOption();
        option.copyFrom(other);
        assertThat(option.isNull(), is(true));
        option.modify(decimal(100));

        option.copyFrom(null);
        assertThat(option.isNull(), is(true));
    }

    /**
     * test for comapre.
     */
    @Test
    public void compareTo() {
        DecimalOption a = new DecimalOption();
        DecimalOption b = new DecimalOption();
        DecimalOption c = new DecimalOption();
        DecimalOption d = new DecimalOption();
        DecimalOption e = new DecimalOption();

        a.modify(decimal(-10));
        b.modify(decimal(0));
        c.modify(decimal(50));
        d.modify(decimal(-10));
        e.modify(decimal(-30));

        assertThat(compare(a, b), lessThan(0));
        assertThat(compare(b, c), lessThan(0));
        assertThat(compare(c, a), greaterThan(0));
        assertThat(compare(a, c), lessThan(0));
        assertThat(compare(b, a), greaterThan(0));
        assertThat(compare(c, b), greaterThan(0));
        assertThat(compare(a, d), is(0));
        assertThat(compare(a, e), greaterThan(0));
    }

    /**
     * test for compare w/ different scales.
     */
    @Test
    public void compareTo_scale() {
        DecimalOption a1 = new DecimalOption();
        DecimalOption a2 = new DecimalOption();
        DecimalOption b1 = new DecimalOption();
        DecimalOption b2 = new DecimalOption();
        DecimalOption c1 = new DecimalOption();
        DecimalOption c2 = new DecimalOption();
        DecimalOption d1 = new DecimalOption();
        DecimalOption d2 = new DecimalOption();

        a1.modify(decimal("10000000."));
        a2.modify(decimal("10000000.0"));

        b1.modify(decimal("1."));
        b2.modify(decimal("1.0000000"));

        c1.modify(decimal("0.0000001"));
        c2.modify(decimal("0.00000010"));

        d1.modify(decimal("-1."));
        d2.modify(decimal("-1.0000000"));

        assertThat(compare(a1, a2), equalTo(0));
        assertThat(compare(b1, b2), equalTo(0));
        assertThat(compare(c1, c2), equalTo(0));
        assertThat(compare(d1, d2), equalTo(0));

        assertThat(compare(a1, b1), greaterThan(0));
        assertThat(compare(a1, b2), greaterThan(0));
        assertThat(compare(a1, c1), greaterThan(0));
        assertThat(compare(a1, c2), greaterThan(0));
        assertThat(compare(b1, c1), greaterThan(0));
        assertThat(compare(b1, c2), greaterThan(0));

        assertThat(compare(b1, a1), lessThan(0));
        assertThat(compare(b1, a2), lessThan(0));
        assertThat(compare(c1, a1), lessThan(0));
        assertThat(compare(c1, a2), lessThan(0));
        assertThat(compare(c1, b1), lessThan(0));
        assertThat(compare(c1, b2), lessThan(0));
    }

    /**
     * test for compare w/ null.
     */
    @Test
    public void compareNull() {
        DecimalOption a = new DecimalOption();
        DecimalOption b = new DecimalOption();
        DecimalOption c = new DecimalOption();

        a.modify(decimal(Long.MIN_VALUE));

        assertThat(compare(a, b), greaterThan(0));
        assertThat(compare(b, a), lessThan(0));
        assertThat(compare(b, c), is(0));
    }

    /**
     * test for Writable.
     */
    @Test
    public void write() {
        DecimalOption option = new DecimalOption();
        option.modify(decimal("3.14"));
        DecimalOption restored = restore(option);
        assertThat(restored.get(), is(option.get()));
    }

    /**
     * test for Writable w/ max.
     */
    @Test
    public void write_max() {
        DecimalOption option = new DecimalOption();
        option.modify(decimal(Long.MAX_VALUE).add(decimal(Long.MAX_VALUE)));
        DecimalOption restored = restore(option);
        assertThat(restored.get(), is(option.get()));
    }

    /**
     * test for Writable w/ min.
     */
    @Test
    public void write_min() {
        DecimalOption option = new DecimalOption();
        option.modify(decimal(Long.MIN_VALUE).add(decimal(Long.MAX_VALUE)));
        DecimalOption restored = restore(option);
        assertThat(restored.get(), is(option.get()));
    }

    /**
     * test for Writable w/ null.
     */
    @Test
    public void writeNull() {
        DecimalOption option = new DecimalOption();
        DecimalOption restored = restore(option);
        assertThat(restored.isNull(), is(true));
    }

    /**
     * heavy write.
     * @throws Exception if failed
     */
    @Test
    public void stress_write() throws Exception {
        int count = 10000000;
        DecimalOption option = new DecimalOption(new BigDecimal("3.14"));
        DataOutput out = new DataOutputStream(new NullOutputStream());
        for (int i = 0; i < count; i++) {
            option.write(out);
        }
    }

    /**
     * heavy read.
     * @throws Exception if failed
     */
    @Test
    public void stress_read() throws Exception {
        int count = 10000000;
        DecimalOption value = new DecimalOption(new BigDecimal("3.14"));
        byte[] bytes = toBytes(value);
        DecimalOption buf = new DecimalOption();
        DataInputBuffer in = new DataInputBuffer();
        for (int i = 0; i < count; i++) {
            in.reset(bytes, bytes.length);
            buf.readFields(in);
            if (i == 0) {
                assertThat(buf, is(value));
            }
        }
    }

    /**
     * heavy read.
     * @throws Exception if failed
     */
    @Test
    public void stress_read_large() throws Exception {
        int count = 10000000;
        DecimalOption value = new DecimalOption(new BigDecimal(Long.MAX_VALUE).multiply(BigDecimal.TEN));
        byte[] bytes = toBytes(value);
        DecimalOption buf = new DecimalOption();
        DataInputBuffer in = new DataInputBuffer();
        for (int i = 0; i < count; i++) {
            in.reset(bytes, bytes.length);
            buf.readFields(in);
            if (i == 0) {
                assertThat(buf, is(value));
            }
        }
    }

    /**
     * heavy restore.
     * @throws Exception if failed
     */
    @Test
    public void stress_restore() throws Exception {
        int count = 10000000;
        DecimalOption value = new DecimalOption(new BigDecimal("3.14"));
        byte[] bytes = toBytes(value);
        DecimalOption buf = new DecimalOption();
        for (int i = 0; i < count; i++) {
            buf.restore(bytes, 0, bytes.length);
            if (i == 0) {
                assertThat(buf, is(value));
            }
        }
    }

    /**
     * heavy restore.
     * @throws Exception if failed
     */
    @Test
    public void stress_restore_large() throws Exception {
        int count = 10000000;
        DecimalOption value = new DecimalOption(new BigDecimal(Long.MAX_VALUE).multiply(BigDecimal.TEN));
        byte[] bytes = toBytes(value);
        DecimalOption buf = new DecimalOption();
        for (int i = 0; i < count; i++) {
            buf.restore(bytes, 0, bytes.length);
            if (i == 0) {
                assertThat(buf, is(value));
            }
        }
    }

    /**
     * heavy compare bytes.
     * @throws Exception if failed
     */
    @Test
    public void stress_compareBytes_same_scale() throws Exception {
        int count = 10000000;
        byte[] a = toBytes(new DecimalOption(new BigDecimal("3.14")));
        byte[] b = toBytes(new DecimalOption(new BigDecimal("1.41")));
        for (int i = 0; i < count; i++) {
            DecimalOption.compareBytes(a, 0, a.length, b, 0, b.length);
        }
    }

    /**
     * heavy compare bytes.
     * @throws Exception if failed
     */
    @Test
    public void stress_compareBytes_diff_scale() throws Exception {
        int count = 10000000;
        byte[] a = toBytes(new DecimalOption(new BigDecimal("3.14")));
        byte[] b = toBytes(new DecimalOption(new BigDecimal("1.414")));
        for (int i = 0; i < count; i++) {
            DecimalOption.compareBytes(a, 0, a.length, b, 0, b.length);
        }
    }

    private BigDecimal decimal(long value) {
        return new BigDecimal(value);
    }

    private BigDecimal decimal(String value) {
        return new BigDecimal(value);
    }
}


text: export {default} from './Tooltip'