public function doRegister(Request $request)
 {
     $validator = Validator::make($data = $request->all(), Admin::$rules, Admin::$messages);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     if ($validator->passes()) {
         $confirmation_code = Str::quickRandom(30);
         $admin = new Admin();
         $admin->fullname = ucwords($request->fullname);
         $admin->mobile_no = $request->mobile_no;
         $admin->email = $request->email;
         $admin->password = bcrypt($request->password);
         $admin->confirmation_code = $confirmation_code;
         $data = ['confirmation_code' => $confirmation_code, 'username' => $request->username, 'password' => $request->password, 'mobile_no' => $request->mobile_no];
         Basehelper::sendSMS($request->mobile_no, 'Hello ' . $request->username . ', you have successfully registere. Your username is ' . $request->username . ' and password is ' . $request->password);
         // Mail::send('emails.verify', $data, function($message) use ($admin, $data){
         // 	$message->from('no-reply@employment_bank', 'Employment Bank');
         //     	$message->to(Input::get('email'), $admin->name)
         //         	->subject('Verify your email address');
         // });
         if (!$admin->save()) {
             return Redirect::back()->with('message', 'Error while creating your account!<br> Please contact Technical Support');
         }
         return Redirect::route('admin.login')->with('message', 'Account has been created!<br>Now Check your email address to verify your account by checking your spam folder or inboxes for verification link after that you can login');
         //sendConfirmation() Will go the email and sms as needed
     } else {
         return Redirect::back()->withInput()->withErrors($validation);
         // ->with('message', 'There were validation errors.');
     }
 }
Exemplo n.º 2
1
function procedure_order_report($pid, $encounter, $cols, $id)
{
    $cols = 1;
    // force always 1 column
    $count = 0;
    $data = sqlQuery("SELECT * " . "FROM procedure_order WHERE " . "procedure_order_id = '{$id}' AND activity = '1'");
    if ($data) {
        print "<table cellpadding='0' cellspacing='0'>\n<tr>\n";
        foreach ($data as $key => $value) {
            if ($key == "procedure_order_id" || $key == "pid" || $key == "user" || $key == "groupname" || $key == "authorized" || $key == "activity" || $key == "date" || $value == "" || $value == "0" || $value == "0.00") {
                continue;
            }
            $key = ucwords(str_replace("_", " ", $key));
            if ($key == "Order Priority") {
                print "<td valign='top'><span class='bold'>" . xl($key) . ": </span><span class='text'>" . generate_display_field(array('data_type' => '1', 'list_id' => 'ord_priority'), $value) . " &nbsp;</span></td>\n";
            } else {
                if ($key == "Order Status") {
                    print "<td valign='top'><span class='bold'>" . xl($key) . ": </span><span class='text'>" . generate_display_field(array('data_type' => '1', 'list_id' => 'ord_status'), $value) . " &nbsp;</span></td>\n";
                } else {
                    print "<td valign='top'><span class='bold'>" . xl($key) . ": </span><span class='text'>{$value} &nbsp;</span></td>\n";
                }
            }
            $count++;
            if ($count == $cols) {
                $count = 0;
                print "</tr>\n<tr>\n";
            }
        }
        print "</tr>\n</table>\n";
    }
}
Exemplo n.º 3
1
function reviewofs_report($pid, $encounter, $cols, $id)
{
    $count = 0;
    $data = formFetch("form_reviewofs", $id);
    if ($data) {
        print "<table><tr>";
        foreach ($data as $key => $value) {
            if ($key == "id" || $key == "pid" || $key == "user" || $key == "groupname" || $key == "authorized" || $key == "activity" || $key == "date" || $value == "" || $value == "0000-00-00 00:00:00") {
                continue;
            }
            if ($value == "on") {
                $value = "yes";
            }
            $key = ucwords(str_replace("_", " ", $key));
            //modified by BM 07-2009 for internationalization
            if ($key == "Additional Notes") {
                print "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . text($value) . "</span></td>";
            } else {
                print "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . xl($value) . "</span></td>";
            }
            $count++;
            if ($count == $cols) {
                $count = 0;
                print "</tr><tr>\n";
            }
        }
    }
    print "</tr></table>";
}
 /**
  * Ajax callback function to search users, used on exclude setting page
  *
  * @uses WP_User_Query WordPress User Query class.
  * @return void
  */
 public static function get_users()
 {
     if (!defined('DOING_AJAX') || !current_user_can(WP_Stream_Admin::SETTINGS_CAP)) {
         return;
     }
     check_ajax_referer('stream_get_users', 'nonce');
     $response = (object) array('status' => false, 'message' => esc_html__('There was an error in the request', 'stream'));
     $search = isset($_POST['find']) ? wp_unslash(trim($_POST['find'])) : '';
     $request = (object) array('find' => $search);
     add_filter('user_search_columns', array(__CLASS__, 'add_display_name_search_columns'), 10, 3);
     $users = new WP_User_Query(array('search' => "*{$request->find}*", 'search_columns' => array('user_login', 'user_nicename', 'user_email', 'user_url'), 'orderby' => 'display_name', 'number' => WP_Stream_Admin::PRELOAD_AUTHORS_MAX));
     remove_filter('user_search_columns', array(__CLASS__, 'add_display_name_search_columns'), 10);
     if (0 === $users->get_total()) {
         wp_send_json_error($response);
     }
     $response->status = true;
     $response->message = '';
     $response->users = array();
     foreach ($users->results as $key => $user) {
         $author = new WP_Stream_Author($user->ID);
         $args = array('id' => $author->ID, 'text' => $author->display_name);
         $args['tooltip'] = esc_attr(sprintf(__("ID: %d\nUser: %s\nEmail: %s\nRole: %s", 'stream'), $author->id, $author->user_login, $author->user_email, ucwords($author->get_role())));
         $args['icon'] = $author->get_avatar_src(32);
         $response->users[] = $args;
     }
     if (empty($search) || preg_match('/wp|cli|system|unknown/i', $search)) {
         $author = new WP_Stream_Author(0);
         $response->users[] = array('id' => $author->id, 'text' => $author->get_display_name(), 'icon' => $author->get_avatar_src(32), 'tooltip' => esc_html__('Actions performed by the system when a user is not logged in (e.g. auto site upgrader, or invoking WP-CLI without --user)', 'stream'));
     }
     wp_send_json_success($response);
 }
Exemplo n.º 5
0
 /**
  * Función que genera los archivos de las entidades, dentro de la carpeta generation
  */
 public function generateEntity()
 {
     $tables = $this->getDatabaseTables();
     //dpr($this->)
     $route = CRITERIA_PATH_XML_CLASS_GENERATED;
     foreach ($tables as $key => $table) {
         $writeclass = "<?php\n";
         $writeclass .= "/* Class autogenerated whith PHPCriteria v1.1 */\n\n";
         $tableName = $table['Name'];
         $writeclass .= "/**\n * @Entity(Table=\"{$tableName}\")\n*/\n";
         $entityName = "Entity" . ucwords($tableName);
         $writeclass .= "class " . $entityName . " {\n\n";
         $descTable[$tableName] = $this->getDescTable($tableName);
         foreach ($this->getDescTable($tableName) as $key_t => $column) {
             $writeclass .= "\t/**\n";
             if ($column['Key'] == "PRI") {
                 $writeclass .= "\t * @Id\n";
             }
             $writeclass .= "\t * @Column(Field=\"" . $column['Field'] . "\",Type=\"" . $column['Type'] . "\",Key=\"" . $column['Key'] . "\",Null=\"" . $column['Null'] . "\",Default=\"" . $column['Default'] . "\",Extra=\"" . $column['Extra'] . "\")\n";
             if ($column['Key'] == "MUL") {
                 $fk = self::findFKGenerateEntity($tableName, $column['Field']);
                 if (count($fk) > 0) {
                     $writeclass .= "\t * @JoinColumn(Table=\"" . $fk['REFERENCED_TABLE_NAME'] . "\",Column=\"" . $fk['REFERENCED_COLUMN_NAME'] . "\")\n";
                 }
             }
             $writeclass .= "\t*/\n";
             $writeclass .= "\tpublic \$" . $column['Field'] . ";\n\n";
         }
         $writeclass .= "\tfunction __construct() {}\n";
         $writeclass .= "}\n";
         $writeclass .= "?>";
         $this->escribirArchivo($route . $entityName . ".php", $writeclass, true);
     }
 }
Exemplo n.º 6
0
 public static function addBelongsToInformation($model, $key, $display, $data)
 {
     if (isset($model->belongModels) && array_key_exists($key, $model->belongModels)) {
         $belongData = $model->belongModels[$key];
         if (!isset($belongData["showon"]) || static::isValidView($belongData, $display)) {
             if (!isset($belongData["model"])) {
                 throw new Exception("Model Attribute not Found in belongsModels for {$key}", 1);
             }
             if (!isset($belongData["column"])) {
                 throw new Exception("Column Attribute not Found in belongsModels for {$key}", 1);
             }
             $column = $belongData["column"];
             $modelName = ucwords($belongData["model"]);
             $belongModel = $model->belongs_to("Admin\\{$modelName}", $key)->first();
             if (isset($belongModel)) {
                 $data = $belongModel->{$column};
             } else {
                 if (isset($belongData["alternative_text"])) {
                     $data = $belongData["alternative_text"];
                 }
             }
         }
     }
     return $data;
 }
 /**
  * Retrieve the taxonomy label
  *
  * @return string
  */
 public function getTaxonomyLabel()
 {
     if ($this->getTaxonomy()) {
         return ucwords(str_replace('_', ' ', $this->getTaxonomy()));
     }
     return false;
 }
Exemplo n.º 8
0
 public static function camelCase($str, $exclude = array())
 {
     $str = preg_replace('/[^a-z0-9' . implode('', $exclude) . ']+/i', ' ', $str);
     // uppercase the first character of each word
     $str = ucwords(trim($str));
     return lcfirst(str_replace(' ', '', $str));
 }
 /**
  * Build the model class with the given name.
  *
  * @param  string  $name
  * @return string
  */
 protected function buildClass($name)
 {
     $stub = $this->files->get($this->getStub());
     $tableName = strtolower($this->getNameInput());
     $className = 'Create' . ucwords($tableName) . 'Table';
     $schema = $this->option('schema');
     $fields = explode(',', $schema);
     $data = array();
     $x = 0;
     foreach ($fields as $field) {
         $array = explode(':', $field);
         $data[$x]['name'] = trim($array[0]);
         $data[$x]['type'] = trim($array[1]);
         $x++;
     }
     $schemaFields = '';
     foreach ($data as $item) {
         if ($item['type'] == 'string') {
             $schemaFields .= "\$table->string('" . $item['name'] . "');";
         } elseif ($item['type'] == 'text') {
             $schemaFields .= "\$table->text('" . $item['name'] . "');";
         } elseif ($item['type'] == 'integer') {
             $schemaFields .= "\$table->integer('" . $item['name'] . "');";
         } elseif ($item['type'] == 'date') {
             $schemaFields .= "\$table->date('" . $item['name'] . "');";
         } else {
             $schemaFields .= "\$table->string('" . $item['name'] . "');";
         }
     }
     $schemaUp = "\n        Schema::create('" . $tableName . "', function(Blueprint \$table)\n        {\n            \$table->increments('id');\n            " . $schemaFields . "\n            \$table->timestamps();\n        });\n        ";
     $schemaDown = "Schema::drop('" . $tableName . "');";
     return $this->replaceSchemaUp($stub, $schemaUp)->replaceSchemaDown($stub, $schemaDown)->replaceClass($stub, $className);
 }
Exemplo n.º 10
0
 public function ProcessInstructor($Company_Id, $Instructor_Name)
 {
     if (!is_numeric($Instructor_Name)) {
         $Instructor_Name = ucwords($Instructor_Name);
         return $this->MakeInstructorID($Company_Id, $Instructor_Name);
     }
 }
Exemplo n.º 11
0
 /**
  * autoDispatch by Volter9
  * Ability to call controllers in their controller/model/param way
  */
 public static function autoDispatch()
 {
     $uri = parse_url($_SERVER['QUERY_STRING'], PHP_URL_PATH);
     $uri = trim($uri, ' /');
     $uri = ($amp = strpos($uri, '&')) !== false ? substr($uri, 0, $amp) : $uri;
     $parts = explode('/', $uri);
     $controller = array_shift($parts);
     $controller = $controller ? $controller : DEFAULT_CONTROLLER;
     $controller = ucwords($controller);
     $method = array_shift($parts);
     $method = $method ? $method : DEFAULT_METHOD;
     $args = !empty($parts) ? $parts : array();
     // Check for file
     if (!file_exists("app/Controllers/{$controller}.php")) {
         return false;
     }
     $controller = "\\Controllers\\{$controller}";
     $c = new $controller();
     if (method_exists($c, $method)) {
         $c->{$method}($args);
         //found method so stop
         return true;
     }
     return false;
 }
Exemplo n.º 12
0
function hist_exam_plan_report($pid, $encounter, $cols, $id)
{
    $cols = 1;
    // force always 1 column
    $count = 0;
    $data = sqlQuery("SELECT * " . "FROM form_hist_exam_plan WHERE " . "id = '{$id}' AND activity = '1'");
    if ($data) {
        print "<table cellpadding='0' cellspacing='0'>\n<tr>\n";
        foreach ($data as $key => $value) {
            if ($key == "id" || $key == "pid" || $key == "user" || $key == "groupname" || $key == "authorized" || $key == "activity" || $key == "date" || $value == "" || $value == "0" || $value == "0.00") {
                continue;
            }
            if ($value == "on") {
                $value = "yes";
            }
            $key = ucwords(str_replace("_", " ", $key));
            print "<td valign='top'><span class='bold'>{$key}: </span><span class='text'>{$value} &nbsp;</span></td>\n";
            $count++;
            if ($count == $cols) {
                $count = 0;
                print "</tr>\n<tr>\n";
            }
        }
        print "</tr>\n</table>\n";
    }
}
Exemplo n.º 13
0
 public function run(&$_data)
 {
     $engine = strtolower(C('TMPL_ENGINE_TYPE'));
     if ('think' == $engine) {
         //[sae] 采用Think模板引擎
         if ($this->checkCache($_data['file'])) {
             // 缓存有效
             SaeMC::include_file(md5($_data['file']) . C('TMPL_CACHFILE_SUFFIX'), $_data['var']);
         } else {
             $tpl = Think::instance('ThinkTemplate');
             // 编译并加载模板文件
             $tpl->fetch($_data['file'], $_data['var']);
         }
     } else {
         // 调用第三方模板引擎解析和输出
         $class = 'Template' . ucwords($engine);
         if (is_file(CORE_PATH . 'Driver/Template/' . $class . '.class.php')) {
             // 内置驱动
             $path = CORE_PATH;
         } else {
             // 扩展驱动
             $path = EXTEND_PATH;
         }
         if (require_cache($path . 'Driver/Template/' . $class . '.class.php')) {
             $tpl = new $class();
             $tpl->fetch($_data['file'], $_data['var']);
         } else {
             // 类没有定义
             throw_exception(L('_NOT_SUPPERT_') . ': ' . $class);
         }
     }
     //[sae] 添加trace信息。
     trace(array('[SAE]核心缓存' => $_SERVER['HTTP_APPVERSION'] . '/' . RUNTIME_FILE, '[SAE]模板缓存' => $_SERVER['HTTP_APPVERSION'] . '/' . md5($_data['file']) . C('TMPL_CACHFILE_SUFFIX')));
 }
Exemplo n.º 14
0
 public static function factory($options)
 {
     $options = is_array($options) ? $options : array();
     //只实例化一个对象
     if (is_null(self::$cacheFactory)) {
         self::$cacheFactory = new cacheFactory();
     }
     $driver = isset($options['driver']) ? $options['driver'] : C("CACHE_TYPE");
     //静态缓存实例名称
     $driverName = md5_s($options);
     //对象实例存在
     if (isset(self::$cacheFactory->cacheList[$driverName])) {
         return self::$cacheFactory->cacheList[$driverName];
     }
     $class = 'Cache' . ucwords(strtolower($driver));
     //缓存驱动
     $classFile = YY_PATH . 'Cache/' . $class . '.class.php';
     //加载驱动类库文件
     if (!require_array($classFile)) {
         halt("缓存类型指定错误,不存在缓存驱动文件:" . $classFile);
     }
     $cacheObj = new $class($options);
     self::$cacheFactory->cacheList[$driverName] = $cacheObj;
     return self::$cacheFactory->cacheList[$driverName];
 }
Exemplo n.º 15
0
function display_each_ebook($directory, $name)
{
    $check_thumb = check_thumb_exists(urldecode($directory . $name));
    echo '<td id = "thumbnail_container" width = "14%">
			<img rel ="images" id = "' . $directory . $name . '" src = "' . \OCP\Util::linkTo('reader', 'ajax/thumbnail.php') . '&filepath=' . $directory . rtrim($name, 'pdf') . 'png' . '">	
		</td>';
    echo '<td class = "filename svg" width = "86%">
			<a class="name" href="http://localhost' . \OCP\Util::linkTo('files', 'download.php') . '?file=' . $directory . $name . '" title="' . urldecode($name) . '" dir ="' . $directory . $name . '" value  = "' . $check_thumb . '">
				<span class = "nametext">' . htmlspecialchars(urldecode($name)) . '</span>
			</a>
			<div id = "displaybox">';
    $each_row = find_tags_for_ebook(urldecode($directory) . urldecode($name));
    $tags = explode(",", $each_row);
    $tag_count = 1;
    foreach ($tags as $tag) {
        if ($tag_count == 2) {
            echo ", ";
        }
        echo '<a href = "' . \OCP\Util::linkTo('reader', 'fetch_tags.php') . '?tag=' . $tag . '">' . ucwords($tag) . '</a>';
        $tag_count += 1;
    }
    echo '</div>
			<input type="button" class="start" value="Add Tag">
			<div id="contentbox" contenteditable="true"></div>
		</td>';
}
Exemplo n.º 16
0
 /**
  * Mange column data
  *
  * Default Column for listing table
  */
 function column_default($item, $column_name)
 {
     switch ($column_name) {
         case 'seller_store':
             return $item[$column_name];
         case 'curr_user_name':
             return $item[$column_name];
         case 'curr_user_email':
             return $item[$column_name];
         case 'user_rating':
             return $item[$column_name] . ' / 5';
         case 'user_comment':
             return $item[$column_name];
         case 'post_status':
             $seller_review_params = array('seller_review_id' => $item['ID'], 'seller_review_status' => $item['post_status']);
             $seller_review_query = add_query_arg($seller_review_params, admin_url());
             return '<a class="button" href="' . $seller_review_query . '">' . ucwords($item[$column_name]) . '</a>';
         case 'post_date':
             $format = get_option('date_format') . ' ' . get_option('time_format');
             $datetime = !empty($item[$column_name]) ? date_i18n($format, strtotime($item[$column_name])) : '';
             return $datetime;
         default:
             return $item[$column_name];
     }
 }
Exemplo n.º 17
0
 protected function _toHtml()
 {
     $rssObj = Mage::getModel('rss/rss');
     $order = Mage::registry('current_order');
     $title = Mage::helper('rss')->__('Order # %s Notification(s)', $order->getIncrementId());
     $newurl = Mage::getUrl('sales/order/view', array('order_id' => $order->getId()));
     $data = array('title' => $title, 'description' => $title, 'link' => $newurl, 'charset' => 'UTF-8');
     $rssObj->_addHeader($data);
     $resourceModel = Mage::getResourceModel('rss/order');
     $results = $resourceModel->getAllCommentCollection($order->getId());
     if ($results) {
         foreach ($results as $result) {
             $urlAppend = 'view';
             $type = $result['entity_type_code'];
             if ($type && $type != 'order') {
                 $urlAppend = $type;
             }
             $type = Mage::helper('rss')->__(ucwords($type));
             $title = Mage::helper('rss')->__('Details for %s #%s', $type, $result['increment_id']);
             $description = '<p>' . Mage::helper('rss')->__('Notified Date: %s<br/>', $this->formatDate($result['created_at'])) . Mage::helper('rss')->__('Comment: %s<br/>', $result['comment']) . '</p>';
             $url = Mage::getUrl('sales/order/' . $urlAppend, array('order_id' => $order->getId()));
             $data = array('title' => $title, 'link' => $url, 'description' => $description);
             $rssObj->_addEntry($data);
         }
     }
     $title = Mage::helper('rss')->__('Order #%s created at %s', $order->getIncrementId(), $this->formatDate($order->getCreatedAt()));
     $url = Mage::getUrl('sales/order/view', array('order_id' => $order->getId()));
     $description = '<p>' . Mage::helper('rss')->__('Current Status: %s<br/>', $order->getStatusLabel()) . Mage::helper('rss')->__('Total: %s<br/>', $order->formatPrice($order->getGrandTotal())) . '</p>';
     $data = array('title' => $title, 'link' => $url, 'description' => $description);
     $rssObj->_addEntry($data);
     return $rssObj->createRssXml();
 }
Exemplo n.º 18
0
 public function formatTokens($content)
 {
     $upperCaseModelName = ucfirst($this->modelName);
     $field_name = snake_case($this->modelName) . '_name';
     $modelId = $this->formatInstanceVariable() . '->id';
     $modelAttribute = $this->formatInstanceVariable() . '->' . $field_name;
     $createdAt = $this->formatInstanceVariable() . '->created_at';
     $modelRoute = '/' . $this->folderName;
     $dtTableName = snake_case($this->modelName) . '_table';
     $masterPage = $this->masterPage;
     $modelName = $this->modelName;
     $modelsUpperCase = ucwords(str_plural($this->modelName));
     $folderName = $this->folderName;
     $gridName = $this->formatVueGridName() . '-grid';
     $endGridName = '/' . $this->formatVueGridName() . '-grid';
     $vueApiRoute = 'api/' . $this->folderName . '-vue';
     $parent = $this->parent;
     $parentInstance = $this->formatParentInstanceVariable($this->parent);
     $parentInstances = $this->formatParents($this->parent);
     $parent_id = strtolower(snake_case($this->parent)) . '_id';
     $parentFieldName = strtolower(snake_case($this->parent)) . '_name';
     $child = $this->child;
     $slug = $this->slug;
     //create token array using compact
     $tokens = compact('upperCaseModelName', 'field_name', 'modelId', 'modelAttribute', 'createdAt', 'modelRoute', 'dtTableName', 'masterPage', 'modelName', 'modelsUpperCase', 'folderName', 'gridName', 'endGridName', 'vueApiRoute', 'parent', 'parentInstance', 'parentInstances', 'parent_id', 'parentFieldName', 'child', 'slug');
     $content = $this->insertTokensInContent($content, $tokens);
     return $content;
 }
Exemplo n.º 19
0
 public function getList($filter = array())
 {
     $results = array();
     $extensions = $this->getExtensions();
     foreach ($this->fetchExtensionsPath() as $extension_path) {
         $options = $installed = FALSE;
         $basename = basename($extension_path);
         $title = ucwords(str_replace('_module', '', $basename));
         if (isset($extensions[$basename]) and $extension = $extensions[$basename]) {
             if (isset($extension['status']) and $extension['status'] === '1') {
                 $installed = TRUE;
             }
         } else {
             $extension = array();
         }
         // skip loop if not installed and $is_installed is set TRUE
         if (!empty($filter['status']) and $filter['status'] === TRUE and $installed === FALSE) {
             continue;
         }
         $config_items = $this->getConfig($basename);
         $config = (!empty($config_items) and is_array($config_items)) ? TRUE : FALSE;
         $ext_type = isset($config_items['ext_type']) ? $config_items['ext_type'] : 'module';
         if (isset($config_items['admin_options']) and $config_items['admin_options'] === TRUE) {
             $options = file_exists($extension_path . '/controllers/admin_' . $basename . '.php') ? TRUE : FALSE;
         }
         $results[$ext_type][$basename] = array('extension_id' => isset($extension['extension_id']) ? $extension['extension_id'] : 0, 'name' => $basename, 'title' => !empty($extension['title']) ? $extension['title'] : $title, 'type' => $ext_type, 'ext_data' => isset($extension['ext_data']) ? $extension['ext_data'] : '', 'options' => $options, 'config' => $config, 'installed' => $installed);
     }
     if (!empty($filter['type'])) {
         return $results[$filter['type']];
     }
     return $results;
 }
Exemplo n.º 20
0
 function get_tag_meta($keyword = 'blog', $id = 1)
 {
     $this->db->where('tag', $keyword)->where('websites_id', $id);
     $query = $this->db->get('tag_cloud');
     $row = $query->result_array();
     $data['title'] = $data['keywords'] = $data['description'] = $keyword . ' :: Tag';
     foreach ($row as $v) {
         if (!empty($v['meta_title'])) {
             $data['title'] = $v['meta_title'];
         } else {
             $data['title'] = ucwords($v['title']) . ' :: ' . __('Tag');
         }
         if (!empty($v['meta_keyword'])) {
             $data['keywords'] = $v['meta_keyword'];
         } else {
             $data['keywords'] = preg_replace('/\\s+|\\s/', ',', ucwords($v['title'])) . ',Blog,Tag';
         }
         if (!empty($v['meta_description'])) {
             $data['description'] = $v['meta_description'];
         } else {
             $data['description'] = 'TAG: ' . ucwords($v['title']);
         }
     }
     return $data;
 }
 public function run(&$_data)
 {
     $engine = strtolower(C('TMPL_ENGINE_TYPE'));
     if ('think' == $engine) {
         // 采用Think模板引擎
         if ($this->checkCache($_data['file'])) {
             // 缓存有效
             // 分解变量并载入模板缓存
             extract($_data['var'], EXTR_OVERWRITE);
             //载入模版缓存文件
             include C('CACHE_PATH') . md5($_data['file']) . C('TMPL_CACHFILE_SUFFIX');
         } else {
             $tpl = Think::instance('ThinkTemplate');
             // 编译并加载模板文件
             $tpl->fetch($_data['file'], $_data['var']);
         }
     } else {
         // 调用第三方模板引擎解析和输出
         $class = 'Template' . ucwords($engine);
         if (is_file(CORE_PATH . 'Driver/Template/' . $class . '.class.php')) {
             // 内置驱动
             $path = CORE_PATH;
         } else {
             // 扩展驱动
             $path = EXTEND_PATH;
         }
         if (require_cache($path . 'Driver/Template/' . $class . '.class.php')) {
             $tpl = new $class();
             $tpl->fetch($_data['file'], $_data['var']);
         } else {
             // 类没有定义
             throw_exception(L('_NOT_SUPPERT_') . ': ' . $class);
         }
     }
 }
Exemplo n.º 22
0
function add_demo_templates()
{
    $dir = dirname(__FILE__) . '/templates';
    if ($handle = opendir($dir)) {
        while (false !== ($entry = readdir($handle))) {
            if ($entry != "." && $entry != ".." && $entry != ".DS_Store") {
                $template_name = str_replace('.php', '', $entry);
                $template_name = str_replace('-', ' ', $template_name);
                $template_name = ucwords($template_name);
                $template = file_get_contents($dir . '/' . $entry);
                $template_arr = array("name" => stripslashes($template_name), "template" => stripslashes($template));
                $option_name = 'wpb_js_templates';
                $saved_templates = get_option($option_name);
                $template_id = sanitize_title($template_name) . "_" . rand();
                if ($saved_templates == false) {
                    $deprecated = '';
                    $autoload = 'no';
                    //
                    $new_template = array();
                    $new_template[$template_id] = $template_arr;
                    //
                    add_option($option_name, $new_template, $deprecated, $autoload);
                } else {
                    $saved_templates[$template_id] = $template_arr;
                    update_option($option_name, $saved_templates);
                }
            }
        }
        closedir($handle);
    }
    return true;
}
Exemplo n.º 23
0
/**
 * Apply the titlecase filter to a string: removing underscores, uppercasing
 * initial letters, and performing a few common (and not-so-common) word
 * replacements such as initialisms and punctuation.
 *
 * @param string|array $value    The underscored and lowercase string to be
 *                               titlecased, or an array of such strings.
 * @param 'html'|'latex' $format The desired output format.
 * @return string                A properly-typeset title.
 * @todo Get replacement strings from configuration file.
 */
function titlecase($value, $format = 'html')
{
    /**
     * The mapping of words (and initialisms, etc.) to their titlecased
     * counterparts for HTML output.
     * @var array
     */
    $html_replacements = array('id' => 'ID', 'cant' => "can't", 'in' => 'in', 'at' => 'at', 'of' => 'of', 'for' => 'for', 'sql' => 'SQL', 'todays' => "Today's");
    /**
     * The mapping of words (and initialisms, etc.) to their titlecased
     * counterparts for LaTeX output.
     * @var array
     */
    $latex_replacements = array('cant' => "can't");
    /**
     * Marshall the correct replacement strings.
     */
    if ($format == 'latex') {
        $replacements = array_merge($html_replacements, $latex_replacements);
    } else {
        $replacements = $html_replacements;
    }
    /**
     * Recurse if neccessary
     */
    if (is_array($value)) {
        return array_map(array(self, 'titlecase'), $value);
    } else {
        $out = ucwords(preg_replace('|_|', ' ', $value));
        foreach ($replacements as $search => $replacement) {
            $out = preg_replace("|\\b{$search}\\b|i", $replacement, $out);
        }
        return trim($out);
    }
}
Exemplo n.º 24
0
 /**
  * Format package name to CamelCase
  *
  * @param array $vars
  * @return array
  */
 public function inflectPackageVars($vars)
 {
     $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
     $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
     $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
     return $vars;
 }
Exemplo n.º 25
0
function RecursiveCat($pid, $sel)
{
    $db = new myDBC();
    static $level = 0;
    static $strid = "";
    static $strname = "";
    $sql = $db->runQuery("select * from " . CATEGORY . " where parent_id =" . $pid . " ");
    while ($row = $db->getQuery($sql)) {
        $id = $row['page_id'];
        $level--;
        $pad = "";
        for ($p = 1; $p < $level * -1; $p++) {
            $pad .= "&nbsp;&nbsp;&nbsp;> ";
        }
        $ys = '';
        if ($sel == $row['page_id']) {
            $ys = 'selected';
        }
        $strname .= '<option ' . $ys . ' value="' . $row['page_id'] . '">' . $pad . ucwords($row['page_name']) . '</option>';
        $rid = RecursiveCat($id, $sel);
        $strid[] = $row['page_id'];
        $level++;
    }
    return $strname;
}
 public function run(&$_data)
 {
     $engine = strtolower(C('TMPL_ENGINE_TYPE'));
     $_content = empty($_data['content']) ? $_data['file'] : $_data['content'];
     $_data['prefix'] = !empty($_data['prefix']) ? $_data['prefix'] : C('TMPL_CACHE_PREFIX');
     if ('think' == $engine) {
         // 采用Think模板引擎
         if (!empty($_data['content']) && $this->checkContentCache($_data['content'], $_data['prefix']) || $this->checkCache($_data['file'], $_data['prefix'])) {
             // 缓存有效
             //载入模版缓存文件
             Storage::load(C('CACHE_PATH') . $_data['prefix'] . md5($_content) . C('TMPL_CACHFILE_SUFFIX'), $_data['var'], 'tpl');
         } else {
             $tpl = Think::instance('Think\\Template');
             // 编译并加载模板文件
             $tpl->fetch($_content, $_data['var'], $_data['prefix']);
         }
     } else {
         // 调用第三方模板引擎解析和输出
         if (strpos($engine, '\\')) {
             $class = $engine;
         } else {
             $class = 'Think\\Template\\Driver\\' . ucwords($engine);
         }
         if (class_exists($class)) {
             $tpl = new $class();
             $tpl->fetch($_content, $_data['var']);
         } else {
             // 类没有定义
             E(L('_NOT_SUPPORT_') . ': ' . $class);
         }
     }
 }
 /**
  * Output the settings
  */
 public function output()
 {
     global $woocommerce, $woocommerce_settings, $current_section, $current_tab;
     if (!current_user_can('manage_woocommerce')) {
         wp_die(__('You do not have sufficient permissions to access this page.', MAILPOET_WOOCOMMERCE_TEXT_DOMAIN));
     }
     do_action('woocommerce_mailpoet_settings_start');
     $mailpoet_settings = $this->get_settings();
     // Get current section
     $current_section = empty($_REQUEST['section']) ? 'general' : sanitize_text_field(urldecode($_REQUEST['section']));
     $current = $current_section ? '' : ' class="current"';
     // Creates each settings section.
     $mailpoet_section = apply_filters('woocommerce_mailpoet_settings_sections', array('general' => __('General', MAILPOET_WOOCOMMERCE_TEXT_DOMAIN), 'lists' => __('Lists', MAILPOET_WOOCOMMERCE_TEXT_DOMAIN)));
     foreach ($mailpoet_section as $section => $title) {
         $title = ucwords($title);
         $current = $section == $current_section ? ' class="current"' : '';
         $links[] = '<a href="' . add_query_arg('section', $section, admin_url('admin.php?page=woocommerce_settings&tab=mailpoet')) . '"' . $current . '>' . esc_html($title) . '</a>';
     }
     echo '<ul class="subsubsub"><li>' . implode('| </li><li>', $links) . '</li></ul><br class="clear" />';
     woocommerce_admin_fields($mailpoet_settings);
     if ($current_section == 'lists') {
         include_once MailPoet_WooCommerce_Add_on()->plugin_path() . '/includes/admin/settings/settings-newsletters.php';
         $mailpoet_list = mailpoet_lists();
         do_action('woocommerce_mailpoet_list_newsletters', $mailpoet_list);
     }
 }
Exemplo n.º 28
0
 function to_excel($array, $filename)
 {
     header('Content-type: application/vnd.ms-excel');
     header('Content-Disposition: attachment; filename=' . $filename . '.xls');
     //	Filter all keys, they'll be table headers
     $h = array();
     foreach ($array->fields as $row) {
         foreach ($row as $key => $val) {
             if (!in_array($key, $h)) {
                 $h[] = $key;
             }
         }
     }
     //echo the entire table headers
     echo '<table><tr>';
     foreach ($h as $key) {
         $key = ucwords($key);
         echo '<th>' . $key . '</th>';
     }
     echo '</tr>';
     foreach ($array->result_array() as $row) {
         echo '<tr>';
         foreach ($row as $val) {
             $this->writeRow($val);
         }
         echo '</tr>';
         echo '</table>';
     }
 }
Exemplo n.º 29
0
 /**
  * 定义工厂方法
  * param string $type 返回数据类型
  */
 public static function factory($type = self::JSON)
 {
     $type = isset($_GET['format']) ? $_GET['format'] : $type;
     $resultClass = ucwords($type);
     require_once './Response/' . $type . '.php';
     return new $resultClass();
 }
Exemplo n.º 30
0
/**
 * Sets up some variables for upload progress
 *
 * @return array()
 *
 */
function PMA_uploadProgressSetup()
{
    /**
     * constant for differentiating array in $_SESSION variable
     */
    $SESSION_KEY = '__upload_status';
    /**
     * sets default plugin for handling the import process
     */
    $_SESSION[$SESSION_KEY]["handler"] = "";
    /**
     * unique ID for each upload
     */
    $upload_id = uniqid("");
    /**
     * list of available plugins
     *
     * Each plugin has own checkfunction in display_import_ajax.lib.php
     * and own file with functions in upload_#KEY#.php
     */
    $plugins = array("progress", "apc", "noplugin");
    // select available plugin
    foreach ($plugins as $plugin) {
        $check = "PMA_Import_" . $plugin . "Check";
        if ($check()) {
            $upload_class = 'PMA\\libraries\\plugins\\import\\upload\\Upload' . ucwords($plugin);
            $_SESSION[$SESSION_KEY]["handler"] = $upload_class;
            break;
        }
    }
    return array($SESSION_KEY, $upload_id, $plugins);
}