Changeset 1172260
- Timestamp:
- 06/01/2015 09:55:32 PM (11 years ago)
- Location:
- genoo/trunk
- Files:
-
- 2 added
- 1 deleted
- 12 edited
-
Genoo.php (modified) (1 diff)
-
GenooInit.php (modified) (1 diff)
-
assets/GenooAdmin.css (modified) (2 diffs)
-
assets/GenooEditPost.js (deleted)
-
assets/GenooEditPosts.js (added)
-
libs/Genoo/Admin.php (modified) (3 diffs)
-
libs/Genoo/Frontend.php (modified) (1 diff)
-
libs/Genoo/HtmlForm.php (modified) (1 diff)
-
libs/Genoo/Table.php (modified) (1 diff)
-
libs/Genoo/Wordpress/Http.php (modified) (8 diffs)
-
libs/Genoo/Wordpress/Metabox.php (modified) (3 diffs)
-
libs/Genoo/Wordpress/MetaboxCTA.php (modified) (2 diffs)
-
libs/Genoo/Wordpress/Settings.php (modified) (2 diffs)
-
libs/Genoo/Wordpress/TableLite.php (added)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
genoo/trunk/Genoo.php
r1148584 r1172260 6 6 Author URI: http://www.genoo.com/ 7 7 Author Email: info@genoo.com 8 Version: 2. 6.88 Version: 2.7 9 9 License: GPLv2 10 10 Text Domain: genoo -
genoo/trunk/GenooInit.php
r1148584 r1172260 52 52 define('GENOO_CACHE', GENOO_ROOT . 'cache' . DIRECTORY_SEPARATOR); 53 53 define('GENOO_DEBUG', get_option('genooDebug')); 54 define('GENOO_REFRESH', sha1('genoo- refresh-javascript-now-please'));54 define('GENOO_REFRESH', sha1('genoo-new-javascript-now-css-too')); 55 55 // start the engine last file to require, rest is auto 56 56 // custom auto loader, PSR-0 Standard -
genoo/trunk/assets/GenooAdmin.css
r1121144 r1172260 50 50 .genooWidgetImage img { padding: 3px; margin: 3px; display: inline-block; max-width: 70%; height: auto; } 51 51 .genooWidgetImage img { border: 2px dashed #c7c7c7; background: #f8f8f8; margin-bottom: 0; margin-top: 5px; } 52 #repeatable_genoo-dynamic-cta th { padding-left: 28px; } 52 53 .genooMetaboxRepeatable td input, 53 54 .genooMetaboxRepeatable td select, 54 .genooMetaboxRepeatable td textarea { width: 100%; } 55 .genooMetaboxRepeatable td textarea { width: 80%; display: inline-block; float: left; margin-left: 20px; } 56 .genooMetaboxRepeatable td { position: relative; } 57 .genooMetaboxRepeatable td .dashicons { width: 20px; height: 20px; display: block; position: absolute; vertical-align: middle; text-align: left; padding-right: 0; } 58 .genooMetaboxRepeatable td .dashicons { max-width: 17%; margin: 0; padding: 0; } 59 .genooMetaboxRepeatable td.invalid select { border-color: #da771e; } 60 .genooMetaboxRepeatable td.invalid .dashicons { color: #da771e; vertical-align: top; width: 20px; text-align: center; } 61 .genooMetaboxRepeatable td.invalid .dashicons:before { content: "x"; } 62 .genooMetaboxRepeatable td.valid select { border-color: #308e1f } 63 .genooMetaboxRepeatable td.valid .dashicons { color: #308e1f; width: 20px; line-height: 30px; } 64 .genooMetaboxRepeatable td.valid .dashicons:before { content: "\f147"; } 65 .version-lower-than-3-8 .genooMetaboxRepeatable td .dashicons { width: 20px; height: 20px; font-size: 20px; line-height: 1; font-family: "Arial", sans-serif; text-decoration: inherit; font-weight: normal; font-style: normal; vertical-align: middle; text-align: center; -webkit-transition: color .1s ease-in 0; transition: color .1s ease-in 0; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } 66 .version-lower-than-3-8 .genooMetaboxRepeatable td.invalid .dashicons:before { content: 'X'; } 67 .version-lower-than-3-8 .genooMetaboxRepeatable td.valid .dashicons:before { content: '\2713'; } 55 68 #genooLog { width: 45%; min-width: 255px; margin: 10px 0; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } 56 69 #genooLog h3 { padding: 0; } … … 62 75 #genooProgressBarText { width: 100%; line-height: 25px; } 63 76 #genooProgressBarBG { position: absolute; z-index: 300; display: block; left: 0; height: 100%; } 64 65 77 66 78 /* prevent flickering */ -
genoo/trunk/libs/Genoo/Admin.php
r1148584 r1172260 86 86 Action::add('admin_notices', array ($this, 'adminNotices')); 87 87 Action::add('admin_enqueue_scripts', array($this, 'adminEnqueueScripts'), 10, 1); 88 // we need this for dashicons fallback 89 Filter::add('admin_body_class', array($this, 'adminBodyClass'), 10, 1); 88 90 } 89 91 … … 111 113 // if post edit or add screeen 112 114 if($hook == 'post-new.php' || $hook == 'post.php'){ 113 wp_enqueue_script('GenooEditPost', GENOO_ASSETS . 'GenooEditPost .js', array('jquery'), GENOO_REFRESH);115 wp_enqueue_script('GenooEditPost', GENOO_ASSETS . 'GenooEditPosts.js', array('jquery'), GENOO_REFRESH); 114 116 } 115 117 // if setup up add vars … … 136 138 TinyMCE::register($this->repositarySettings->getCTAPostTypes()); 137 139 } 140 } 141 142 143 /** 144 * Admin body class 145 * - used to add lower than 3.8, dashicons edit 146 * 147 * @param $classes 148 * @return mixed 149 */ 150 public function adminBodyClass($classes) 151 { 152 global $wp_version; 153 if (version_compare($wp_version, '3.8', '<' )){ 154 // note that admin body classes use string, instead of an array 155 // but that might change one day so ... 156 if(empty($classes)){ 157 $classes = 'version-lower-than-3-8'; 158 } elseif(is_string($classes)){ 159 $classes .= 'version-lower-than-3-8'; 160 } elseif(is_array($classes)) { 161 $classes[] = 'version-lower-than-3-8'; 162 } 163 } 164 return $classes; 138 165 } 139 166 -
genoo/trunk/libs/Genoo/Frontend.php
r1121144 r1172260 87 87 if($post instanceof \WP_Post){ 88 88 // We only run this on single posts 89 if( Post::isSingle() || Post::isPage() && Post::isPostType($post, $this->repositorySettings->getCTAPostTypes())){89 if((Post::isSingle() || Post::isPage()) && Post::isPostType($post, $this->repositorySettings->getCTAPostTypes())){ 90 90 // Dynamic cta 91 91 $cta = new CTADynamic($post); -
genoo/trunk/libs/Genoo/HtmlForm.php
r1121144 r1172260 88 88 if(!empty($this->msg)){ 89 89 // html 90 $html .= '<strong class="'.$strongClass.'">' . htmlspecialchars($msg) . '</strong>';90 $html .= '<strong class="'.$strongClass.'">' . strip_tags($msg, '<br><br/>') . '</strong>'; //htmlspecialchars 91 91 $fragment = $this->dom->createDocumentFragment(); 92 92 $fragment->appendXML($html); -
genoo/trunk/libs/Genoo/Table.php
r1148584 r1172260 16 16 use Genoo\Wordpress\Utils; 17 17 use Genoo\Wordpress\Notice; 18 use Genoo\Wordpress\ WPListTable;18 use Genoo\Wordpress\TableLite; 19 19 20 abstract class Table extends \Genoo\Wordpress\ WPListTable20 abstract class Table extends \Genoo\Wordpress\TableLite 21 21 { 22 22 /** @var array() */ -
genoo/trunk/libs/Genoo/Wordpress/Http.php
r882847 r1172260 28 28 * @param null $url 29 29 */ 30 31 public function __construct($url = null){ $this->url = $url; return $this; } 30 public function __construct($url = null) 31 { 32 $this->url = $url; 33 return $this; 34 } 32 35 33 36 34 37 /** 35 38 * @param array $args 39 * @return $this 36 40 */ 37 38 public function setArgs(array $args = array()){ $this->args = $args; return $this; } 41 public function setArgs(array $args = array()) 42 { 43 $this->args = $args; 44 return $this; 45 } 39 46 40 47 41 48 /** 42 49 * @param string $url 50 * @return $this 43 51 */ 44 45 public function setUrl($url = ''){ $this->url = $url; return $this; } 52 public function setUrl($url = '') 53 { 54 $this->url = $url; 55 return $this; 56 } 46 57 47 58 48 59 /** 49 60 * @param string $body 61 * @return $this 50 62 */ 51 52 public function setBody($body = ''){ $this->args['body'] = $body; return $this; } 53 63 public function setBody($body = '') 64 { 65 $this->args['body'] = $body; 66 return $this; 67 } 54 68 55 69 /** 56 * Get 57 * 58 * @return mixed 70 * @return $this 71 * @throws HttpException 59 72 */ 60 61 public function get(){ $this->response = wp_remote_get($this->url, $this->args); $this->check(); return $this; } 62 73 public function get() 74 { 75 $this->response = \wp_remote_get($this->url, $this->args); 76 $this->check(); 77 return $this; 78 } 63 79 64 80 /** 65 * Post66 * 67 * @ return mixed81 * @param null $body 82 * @param string $method 83 * @throws HttpException 68 84 */ 69 70 85 public function post($body = null, $method = 'POST') 71 86 { … … 82 97 ); 83 98 // go my man 84 $this->response = wp_remote_post($this->url, array_merge($defaults, $this->args));99 $this->response = \wp_remote_post($this->url, array_merge($defaults, $this->args)); 85 100 $this->check(); 86 101 } … … 88 103 89 104 /** 90 * Put91 *92 105 * @param null $body 93 106 */ 94 95 107 public function put($body = null) 96 108 { 97 return$this->post($body, 'PUT');109 $this->post($body, 'PUT'); 98 110 } 99 111 100 112 101 113 /** 102 * Head 103 * 104 * @return mixed 114 * @throws HttpException 105 115 */ 106 107 public function head(){ $this->response = wp_remote_head($this->url, $this->args); $this->check(); } 116 public function head() 117 { 118 $this->response = \wp_remote_head($this->url, $this->args); 119 $this->check(); 120 } 108 121 109 122 … … 113 126 * @throws HttpException 114 127 */ 115 116 128 private function check() 117 129 { … … 124 136 125 137 /** 126 * Get response127 *128 138 * @return mixed 129 139 */ 130 131 public function getResponse(){ return $this->response['response']; } 140 public function getResponse() 141 { 142 return $this->response['response']; 143 } 132 144 133 145 … … 137 149 * @return mixed 138 150 */ 139 140 public function getResponseCode(){ return $this->response['response']['code']; } 151 public function getResponseCode() 152 { 153 return $this->response['response']['code']; 154 } 141 155 142 156 … … 146 160 * @return mixed 147 161 */ 148 149 public function getBody(){ return $this->response['body']; } 162 public function getBody() 163 { 164 return $this->response['body']; 165 } 150 166 151 167 … … 153 169 * Reset 154 170 */ 155 156 171 public function reset() 157 172 { -
genoo/trunk/libs/Genoo/Wordpress/Metabox.php
r1121144 r1172260 134 134 foreach($this->fields as $field){ 135 135 $fieldId = isset($field['id']) ? $field['id'] : str_replace('-', '_', Strings::lower(Strings::webalize($field['label']))); 136 $fieldRow = '<div class="themeMetaboxRow" id="themeMetaboxRow'. $fieldId .'" >'; 137 $fieldValue = get_post_meta($post->ID, $fieldId, true); 138 $fieldLabel = '<label for="' . $fieldId . '">' . $field['label'] . '</label>'; 139 $fieldOptions = isset($field['options']) ? $field['options'] : array(); 140 $fieldAtts = ''; 136 if(isset($field['type']) && (isset($field['label']))){ 137 $fieldRow = '<div class="themeMetaboxRow" id="themeMetaboxRow'. $fieldId .'" >'; 138 $fieldValue = get_post_meta($post->ID, $fieldId, true); 139 $fieldLabel = '<label for="' . $fieldId . '">' . $field['label'] . '</label>'; 140 $fieldOptions = isset($field['options']) ? $field['options'] : array(); 141 $fieldAtts = ''; 142 } 141 143 if(isset($field['atts']) && is_array($field['atts'])){ foreach($field['atts'] as $key => $value){ $fieldAtts .= ' '. $key .'="'. $value .'" '; } } 142 144 switch($field['type']){ … … 189 191 . '</div>'; 190 192 $fieldInput = '<input type="hidden" name="'. $fieldId .'" id="'. $fieldId .'" value="'. $fieldValue .'" />'; 191 $fieldInput .= '<a href="#" onclick="Modal.open(event,this);" '192 . 'id="'. $fieldId . 'Btn' .'" '193 . 'data-current-id="'. $fieldValue .'" '194 . 'data-title="'. $fieldLabelButton .'" '195 . 'data-update-text="'. $fieldLabelButton .'" '196 . 'data-target="'. $fieldTarget .'" '197 . 'data-target-input="'. $fieldId .'" '193 $fieldInput .= '<a href="#" onclick="Modal.open(event,this);" ' 194 . 'id="'. $fieldId . 'Btn' .'" ' 195 . 'data-current-id="'. $fieldValue .'" ' 196 . 'data-title="'. $fieldLabelButton .'" ' 197 . 'data-update-text="'. $fieldLabelButton .'" ' 198 . 'data-target="'. $fieldTarget .'" ' 199 . 'data-target-input="'. $fieldId .'" ' 198 200 . 'class="button">'. $fieldLabelButton .'</a>'; 199 201 $fieldInput .= ' | '; … … 206 208 break; 207 209 } 208 // add elements to a row 209 $fieldRow .= $fieldLabel; 210 $fieldRow .= $fieldInput; 211 $fieldRow .= $metaboxClear; 212 // add row to metabox form 213 $metaboxForm .= $fieldRow . '</div>'; 210 if(isset($field['type']) && (isset($field['label']))){ 211 // add elements to a row 212 $fieldRow .= $fieldLabel; 213 $fieldRow .= $fieldInput; 214 $fieldRow .= $metaboxClear; 215 // add row to metabox form 216 $metaboxForm .= $fieldRow . '</div>'; 217 } 214 218 } 215 219 } -
genoo/trunk/libs/Genoo/Wordpress/MetaboxCTA.php
r1121144 r1172260 144 144 foreach ($savedFields as $field){ ?> 145 145 <tr> 146 <td ><?php echo self::select($this->id . '[cta][]', $fieldCTAs, isset($field['cta']) ? $field['cta'] : false); ?></td>147 <td ><?php echo self::select($this->id . '[sidebar][]', $fieldSidebars, isset($field['cta']) ? $field['sidebar'] : false); ?></td>148 <td ><?php echo self::select($this->id . '[position][]', self::selectPosition(), !empty($field['position']) ? $field['position'] : false); ?></td>149 <td ><a class="button remove-row" href="#">Remove</a></td>146 <td width="40" class="validate valid"><span class="dashicons"></span><?php echo self::select($this->id . '[cta][]', $fieldCTAs, isset($field['cta']) ? $field['cta'] : false); ?></td> 147 <td width="30" class="validate valid"><span class="dashicons"></span><?php echo self::select($this->id . '[sidebar][]', $fieldSidebars, isset($field['cta']) ? $field['sidebar'] : false); ?></td> 148 <td width="20" class="valid"><span class="dashicons"></span><?php echo self::select($this->id . '[position][]', self::selectPosition(), !empty($field['position']) ? $field['position'] : false); ?></td> 149 <td width="10"><a class="button remove-row" href="#">Remove</a></td> 150 150 </tr> 151 151 <?php … … 154 154 ?> 155 155 <tr> 156 <td ><?php echo self::select($this->id . '[cta][]', $fieldCTAs); ?></td>157 <td ><?php echo self::select($this->id . '[sidebar][]', $fieldSidebars); ?></td>158 <td ><?php echo self::select($this->id . '[position][]', self::selectPosition()); ?></td>159 <td ><a class="button remove-row" href="#">Remove</a></td>156 <td width="40" class="validate invalid"><span class="dashicons"></span><?php echo self::select($this->id . '[cta][]', $fieldCTAs); ?></td> 157 <td width="30" class="validate invalid"><span class="dashicons"></span><?php echo self::select($this->id . '[sidebar][]', $fieldSidebars); ?></td> 158 <td width="20" class="valid"><span class="dashicons"></span><?php echo self::select($this->id . '[position][]', self::selectPosition()); ?></td> 159 <td width="10"><a class="button remove-row" href="#">Remove</a></td> 160 160 </tr> 161 161 <?php } ?> 162 162 <tr class="empty-row screen-reader-text"> 163 <td ><?php echo self::select($this->id . '[cta][]', $fieldCTAs, null, 'empty'); ?></td>164 <td ><?php echo self::select($this->id . '[sidebar][]', $fieldSidebars, null, 'empty'); ?></td>165 <td ><?php echo self::select($this->id . '[position][]', self::selectPosition(), null, 'empty'); ?></td>166 <td ><a class="button remove-row" href="#">Remove</a></td>163 <td width="40" class="validate invalid"><span class="dashicons"></span><?php echo self::select($this->id . '[cta][]', $fieldCTAs, null, 'empty'); ?></td> 164 <td width="30" class="validate invalid"><span class="dashicons"></span><?php echo self::select($this->id . '[sidebar][]', $fieldSidebars, null, 'empty'); ?></td> 165 <td width="20" class="valid"><span class="dashicons"></span><?php echo self::select($this->id . '[position][]', self::selectPosition(), null, 'empty'); ?></td> 166 <td width="10"><a class="button remove-row" href="#">Remove</a></td> 167 167 </tr> 168 168 </tbody> -
genoo/trunk/libs/Genoo/Wordpress/Settings.php
r1148584 r1172260 202 202 $fieldHtml .= sprintf('<input type="hidden" name="%1$s[%2$s]" value="off" />', $args['section'], $args['id']); 203 203 $fieldHtml .= sprintf('<input type="checkbox" class="checkbox" id="%1$s-%2$s" name="%1$s[%2$s]" value="on"%4$s %5$s />', $args['section'], $args['id'], $fieldValue, checked($fieldValue, 'on', false), $fieldAttr); 204 $fieldHtml .= sprintf('<label for="%1$s [%2$s]"> %3$s</label>', $args['section'], $args['id'], $args['desc']);204 $fieldHtml .= sprintf('<label for="%1$s-%2$s"> %3$s</label>', $args['section'], $args['id'], $args['desc']); 205 205 break; 206 206 case 'multicheck': … … 208 208 $checked = isset($fieldValueUn[$key]) ? $fieldValueUn[$key] : '0'; 209 209 $fieldHtml .= sprintf('<input type="checkbox" class="checkbox" id="%1$s-%2$s-%3$s" name="%1$s[%2$s][%3$s]" value="%3$s"%4$s />', $args['section'], $args['id'], $key, checked($checked, $key, false)); 210 $fieldHtml .= sprintf('<label for="%1$s [%2$s][%4$s]"> %3$s</label><br />', $args['section'], $args['id'], $label, $key);210 $fieldHtml .= sprintf('<label for="%1$s-%2$s-%4$s"> %3$s</label><br />', $args['section'], $args['id'], $label, $key); 211 211 } 212 212 break; -
genoo/trunk/readme.txt
r1148584 r1172260 6 6 License: GPLv2 or later 7 7 License URI: http://www.gnu.org/licenses/gpl-2.0.html 8 Stable tag: 2. 6.88 Stable tag: 2.7 9 9 10 10 Combine the flexibility of WordPress with the power of Genoo and experience amazing results! … … 64 64 65 65 == Upgrade Notice == 66 * CTA can be enabled for any post-types now 67 * Updated CTA metabox validation 66 68 67 69 == Changelog == 70 71 = 2.8 = 72 * Added dynamic CTA validation 68 73 69 74 = 2.6.8 =
Note: See TracChangeset
for help on using the changeset viewer.