ef4fca02 by Jeff Balicki

WW

1 parent f004e919
<?php
namespace Tz\WordPress\Tools\Branding;
use Tz\WordPress\Tools;
require_once('wp-admin-menu-classes.php');
require_once 'wp-admin-menu-classes.php';
call_user_func(function() {
Tools\add_actions(__NAMESPACE__ . '\Actions');
});
call_user_func(function () {
Tools\add_actions(__NAMESPACE__ . '\Actions');
});
class Actions {
class Actions
{
public static function admin_print_styles() {
public static function admin_print_styles()
{
_enqueue_style('branding-style', Tools\url('css/tenzing.css', __FILE__));
}
public static function admin_print_scripts() {
wp_enqueue_script('jquery-alerts', Tools\url('jquery_alerts/jquery.alerts.js', __FILE__), Array('jquery'), '1.1');
wp_enqueue_script('colorbox', Tools\url('scripts/jquery.colorbox.js', __FILE__), Array('jquery'));
public static function admin_print_scripts()
{
wp_enqueue_script('jquery-alerts', Tools\url('jquery_alerts/jquery.alerts.js', __FILE__), array('jquery'), '1.1');
wp_enqueue_script('colorbox', Tools\url('scripts/jquery.colorbox.js', __FILE__), array('jquery'));
wp_enqueue_script('date', Tools\url('scripts/date.js', __FILE__));
wp_enqueue_script('jquery-ui-datepicker');
wp_enqueue_script('jquery-admin-uploadify', Tools\url('uploadify/jquery.uploadify.v2.1.4.js', __FILE__), Array('jquery','swfobject'));
wp_enqueue_script('jquery-admin-uploadify', Tools\url('uploadify/jquery.uploadify.v2.1.4.js', __FILE__), array('jquery', 'swfobject'));
}
public static function admin_head() {
public static function admin_head()
{
?>
<style type="text/css" media="screen">
#toplevel_page_cbvreport .wp-menu-image a img { display:none; }
......@@ -41,37 +46,36 @@ class Actions {
#toplevel_page_cbv_options:hover .wp-menu-image, #menu-posts-POSTTYPE.wp-has-current-submenu .wp-menu-image {
background-position:6px 7px!important;
}
</style>
<?php
/*
global $current_user;
get_currentuserinfo();
global $current_user;
get_currentuserinfo();
include('views/header.php');
*/
include('views/header.php');
*/
}
public static function admin_footer_text() {
public static function admin_footer_text()
{
echo '&copy; ' . date('Y') . ' Tenzing Communications Inc.';
}
public static function login_head() {
public static function login_head()
{
echo '<link rel="stylesheet" type="text/css" href="' . Tools\url('css/tz_login.css', __FILE__) . '" />';
echo '<script src="' . Tools\url('scripts/tz_login.js', __FILE__) . '" ></script>';
}
public static function admin_menu() {
rename_admin_menu_section('Posts','Publications');
swap_admin_menu_sections('CBV Options','Publications');
public static function admin_menu()
{
rename_admin_menu_section('Posts', 'Publications');
swap_admin_menu_sections('CBV Options', 'Publications');
}
}
//Tools\add_actions(__NAMESPACE__ . '\Actions');
//Tools\add_actions(__NAMESPACE__ . '\Actions');
?>
\ No newline at end of file
......
html,
body {
overflow: hidden;
width:100%;
width: 100%;
}
#login {
......@@ -39,9 +39,10 @@ body.login {
}
#login_error, .message {
#login_error,
.message {
position: absolute;
bottom:0;
bottom: 0;
}
.login #nav a {
......@@ -52,15 +53,17 @@ body.login {
text-decoration: underline;
}
@media(min-width:601px) {
#login h1 {
/* display: none; */
font-size: 32px;
position: absolute;
width: auto;
min-height: 250px;
padding: 60px 100px 100px 240px;
margin-left: 32%;
margin-top: 6%;
margin-left: 35%;
margin-top: 9%;
pointer-events: none;
}
}
......@@ -79,39 +82,41 @@ body.login {
@media(max-width:600px) {
#backtoblog:before {
margin-top:39px;
margin-left:-10px;
margin-top: 39px;
margin-left: -10px;
}
}
#login h1 span {
display:block;
position: absolute;
left:0;
font-size:24px;
color:#221D58 !important;
pointer-events: none;
max-width: 220px;
min-width: 220px;
line-height: 1.2;
text-align: center;
h1.login_h1 {
color: #221d58 !important;
text-transform: uppercase;
font-size: 40px;
font-family: "MyanmarMN";
line-height: 50px !important;
text-align: left;
}
h1.login_h1 .dark {
color: #3BA3A2 !important;
}
@media(max-width:1000px) and (min-width:601px) {
#login h1 span {
left:0;
left: 0;
min-width: auto;
}
}
@media(max-width:800px) and (min-width:601px) {
#login h1 span {
left:0;
top:200px;
left: 0;
top: 200px;
}
#login {
padding:10% 0 0;
#login {
padding: 10% 0 0;
}
}
......@@ -229,10 +234,11 @@ label {
}
@media(max-width: 700px) {
#user_pass,
#user_login,
#user_email {
width:250px;
width: 250px;
}
}
......@@ -295,8 +301,8 @@ label {
}
#login h1 {
margin-left:17%;
#login h1 {
margin-left: 17%;
}
#login h1 span {
......@@ -308,36 +314,37 @@ label {
}
@media (max-width: 1000px) {
#login h1 {
margin-left:17%;
#login h1 {
margin-left: 17%;
}
}
@media (max-width: 900px) {
#backtoblog {
top:150px;
top: 150px;
}
#login form {
margin-top: 18%;
width: 40%;
}
#login h1 {
margin-left:20%;
margin-top:20%;
#login h1 {
margin-left: 20%;
margin-top: 20%;
}
}
@media (max-width: 800px) {
#login h1 {
margin-top:0;
#login h1 {
margin-top: 0;
}
}
@media (max-width: 700px) {
#backtoblog {
top:120px;
top: 120px;
}
}
......@@ -404,9 +411,9 @@ label {
}
#login h1 {
width:auto;
width: auto;
position: absolute;
top:120px;
top: 120px;
}
......@@ -432,34 +439,34 @@ label {
}
#login h1 span {
left:0;
top:20px;
#login h1 span {
left: 0;
top: 20px;
min-width: auto;
max-width: none;
white-space: nowrap;
}
#login form {
padding:15% !important;
margin-top:80px !important;
padding: 15% !important;
margin-top: 80px !important;
}
h1 {
margin-left:15% !important;
width:100%;
margin-left: 15% !important;
width: 100%;
}
label {
margin-left:0 !important;
margin-left: 0 !important;
}
#backtoblog {
left:auto;
right:0;
top:0;
left: auto;
right: 0;
top: 0;
}
......@@ -467,7 +474,7 @@ label {
}
@media(max-height:500px){
@media(max-height:500px) {
body.login {
background-position: bottom left !important;
}
......@@ -478,6 +485,7 @@ label {
background: url(../images/LogIn@15x.png) no-repeat -220px;
background-size: auto 100%;
}
#login form {
width: 100%;
background-size: 872px 398px !important;
......@@ -489,9 +497,7 @@ label {
background-size: 100px 55px !important;
}
.login #nav {
}
.login #nav {}
#backtoblog {
top: -10px;
......@@ -501,15 +507,15 @@ label {
#login_error,
.message {
position: relative;
top:80px;
position: relative;
top: 80px;
}
}
@media (max-width: 380px) {
#login form {
width: 140%;
margin-left:0;
margin-left: 0;
background-size: 872px 398px !important;
}
......@@ -519,8 +525,7 @@ label {
background-size: 100px 55px !important;
}
.login #nav {
}
.login #nav {}
#backtoblog {
top: 30px;
......
jQuery(document).ready(function ($) {
var first = $(location).attr('pathname');
if (getUrlVars()["action"]) {
first = 'lostpassword';
}
first.indexOf(1);
first.toLowerCase();
first = first.split("/")[1];
if (first == "wp-login.php") {
$('h1').addClass('login_h1');
$('h1').html('LOG <span class="dark">IN:</span>');
} else if (first = 'lostpassword') {
$('h1').addClass('login_h1');
$('h1').html('RESET</br> <span class="dark">PASSWORD:</span>');
}
function getUrlVars() {
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for (var i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
});
\ No newline at end of file
......@@ -4,7 +4,7 @@ Plugin Name: Tenzing Tools
Version: 0.4b
Description: Various classes and functions to help out with stuff
Author: Tenzing
*/
*/
namespace Tz\WordPress\Tools;
......@@ -13,33 +13,33 @@ use ReflectionClass;
use ReflectionMethod;
use Tz\WordPress\Tools\ShortCodes;
spl_autoload_register(__NAMESPACE__.'\autoloader');
spl_autoload_register(__NAMESPACE__ . '\autoloader');
add_action( 'login_headertext', function($title) {
if($_REQUEST['action'] == 'lostpassword') {
add_action('login_headertext', function ($title) {
if ($_REQUEST['action'] == 'lostpassword') {
return "RESET PASSWORD:";
}
return "LOG IN:";
} );
});
add_filter( 'gettext_with_context', function($translated) {
add_filter('gettext_with_context', function ($translated) {
// Use the text string exactly as it is in the translation file
if ( $translated == "&larr; Back to %s" ) {
if ($translated == "&larr; Back to %s") {
$translated = "Back to %s";
}
return $translated;
} );
});
// Code to prevent PHP from parsing Symlinks
if (defined(__NAMESPACE__.'\DIR')) {
define(__NAMESPACE__.'\OVERRIDE', 1);
if (defined(__NAMESPACE__ . '\DIR')) {
define(__NAMESPACE__ . '\OVERRIDE', 1);
} else {
define(__NAMESPACE__.'\DIR', __DIR__);
define(__NAMESPACE__ . '\DIR', __DIR__);
}
define(__NAMESPACE__.'\FILE', DIR.DIRECTORY_SEPARATOR.basename(__FILE__));
define(__NAMESPACE__ . '\FILE', DIR . DIRECTORY_SEPARATOR . basename(__FILE__));
require_once(DIR.DIRECTORY_SEPARATOR.'wp_functions.php');
require_once DIR . DIRECTORY_SEPARATOR . 'wp_functions.php';
_register_script('addEvent', url('scripts/addEvent.js', FILE));
_register_script('xmlhttpHandler', url('scripts/xmlhttpHandler.js', FILE));
......@@ -55,28 +55,28 @@ if (defined('Tz\DEBUG') && Tz\DEBUG === true) {
function import($com)
{
$dir = DIR.DIRECTORY_SEPARATOR.'com'.DIRECTORY_SEPARATOR.$com.DIRECTORY_SEPARATOR;
$file = $dir.$com.'.php';
$dir = DIR . DIRECTORY_SEPARATOR . 'com' . DIRECTORY_SEPARATOR . $com . DIRECTORY_SEPARATOR;
$file = $dir . $com . '.php';
if (is_dir($dir) && is_file($file)) {
require_once($file);
require_once $file;
Vars::$loaded[$com] = 1;
}
}
function autoloader($class)
{
$a = explode('\\', $class);
$a = explode('\\', $class);
$class = array_pop($a);
$file = DIR.DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.$class.'.php';
$file = DIR . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . $class . '.php';
if (is_file($file)) {
include($file);
include $file;
}
}
function url($script, $base_file = false)
{
if (defined(__NAMESPACE__.'\OVERRIDE')) {
if (defined(__NAMESPACE__ . '\OVERRIDE')) {
$info = [pathinfo(DIR), pathinfo(__DIR__)];
// This should replace link for tz-tools com components
......@@ -86,16 +86,16 @@ function url($script, $base_file = false)
$base_file = str_replace($info[1]['dirname'], $info[0]['dirname'], $base_file, $r);
// This should replace for theme files
$theme_dir = get_theme_root().DIRECTORY_SEPARATOR.get_template();
$theme_dir = get_theme_root() . DIRECTORY_SEPARATOR . get_template();
if (is_link($theme_dir)) {
$base_file = str_replace(readlink($theme_dir), $theme_dir.DIRECTORY_SEPARATOR, $base_file);
$base_file = str_replace(readlink($theme_dir), $theme_dir . DIRECTORY_SEPARATOR, $base_file);
}
// I probably will need to add another replace for plugins (if we use plugins w/ tz-tools, prolly won't come to think of it)
}
$base_dir = (false === $base_file ? DIR : dirname($base_file));
$rel_path = str_replace(ABSPATH, '', $base_dir);
$script = site_url().'/'.$rel_path.'/'.$script;
$script = site_url() . '/' . $rel_path . '/' . $script;
return $script;
}
......@@ -103,7 +103,7 @@ function url($script, $base_file = false)
function tools_url()
{
$args = func_get_args();
call_user_func_array(__NAMESPACE__.'\url', $args);
call_user_func_array(__NAMESPACE__ . '\url', $args);
}
/**
......@@ -161,7 +161,7 @@ function add_actions($class)
throw new Exception("{$class} does not exist");
}
$ref = new ReflectionClass($class);
$ref = new ReflectionClass($class);
$actions = $ref->getMethods(ReflectionMethod::IS_STATIC);
foreach ($actions as $action) {
add_action($action->name, [$class, $action->name]);
......@@ -174,7 +174,7 @@ function add_filters($class)
throw new Exception("{$class} does not exist");
}
$ref = new ReflectionClass($class);
$ref = new ReflectionClass($class);
$methods = $ref->getMethods(ReflectionMethod::IS_STATIC);
foreach ($methods as $method) {
add_filter($method->name, [$class, $method->name]);
......@@ -192,7 +192,7 @@ function add_settings_fields($class, $page = 'general', $section = 'default')
throw new Exception("{$class} does not exist");
}
$ref = new ReflectionClass($class);
$ref = new ReflectionClass($class);
$methods = $ref->getMethods(ReflectionMethod::IS_STATIC);
foreach ($methods as $method) {
add_settings_field(
......@@ -218,12 +218,12 @@ function TzSuperPaginationBar(
$bar = '<div class="TzSuperPaginationBar">';
if ($show_search) {
$bar .= '<div class="pagination-search"><form id="TzPaginationSearch"><input type="hidden" name="post_type" value="'.$post_type.'" /><input name="search_criteria" type="input" /></form></div>';
$bar .= '<div class="pagination-search"><form id="TzPaginationSearch"><input type="hidden" name="post_type" value="' . $post_type . '" /><input name="search_criteria" type="input" /></form></div>';
}
if ($show_advanced) {
$bar .= '<div class="pagination-advanced"><a href="#" onclick="return false;">Advanced</a></div>';
}
$bar .= '<div class="pagination-paging">'.pagination($posts, $pages, $range, $before, $after, false).'</div>';
$bar .= '<div class="pagination-paging">' . pagination($posts, $pages, $range, $before, $after, false) . '</div>';
$bar .= '<div style="clear:both;"></div>';
$bar .= '</div>';
......@@ -251,27 +251,27 @@ function pagination($posts, $pages, $range = 2, $before = '', $after = '', $echo
$p .= $before;
if ($paged > 2 && $paged > $range + 1 && $showitems < $pages) {
$p .= "<a href='".get_pagenum_link(1)."'>&laquo;</a>";
$p .= "<a href='" . get_pagenum_link(1) . "'>&laquo;</a>";
}
if ($paged > 1 && $showitems < $pages) {
$p .= "<a href='".get_pagenum_link($paged - 1)."'>&lsaquo;</a>";
$p .= "<a href='" . get_pagenum_link($paged - 1) . "'>&lsaquo;</a>";
}
for ($i = 1; $i <= $pages; $i++) {
if (1 != $pages && (!($i >= $paged + $range + 1 || $i <= $paged - $range - 1) || $pages <= $showitems)) {
$p .= ($paged == $i)
? "<span class='current'>".$i."</span>"
: "<a href='".get_pagenum_link(
$i
)."' class='inactive' >".$i."</a>";
? "<span class='current'>" . $i . "</span>"
: "<a href='" . get_pagenum_link(
$i
) . "' class='inactive' >" . $i . "</a>";
}
}
if ($paged < $pages && $showitems < $pages) {
$p .= "<a href='".get_pagenum_link($paged + 1)."'>&rsaquo;</a>";
$p .= "<a href='" . get_pagenum_link($paged + 1) . "'>&rsaquo;</a>";
}
if ($paged < $pages - 1 && $paged + $range - 1 < $pages && $showitems < $pages) {
$p .= "<a href='".get_pagenum_link($pages)."'>&raquo;</a>";
$p .= "<a href='" . get_pagenum_link($pages) . "'>&raquo;</a>";
}
$p .= $after;
......@@ -288,5 +288,3 @@ class Vars
{
public static $loaded = [];
}
?>
\ No newline at end of file
......