@@ -475,36 +475,36 @@ discard block |
||
| 475 | 475 | |
| 476 | 476 | // vars |
| 477 | 477 | $data = maybe_serialize( $data ); |
| 478 | - $post_status = $extract['active'] ? 'publish' : 'acf-disabled'; |
|
| 478 | + $post_status = $extract['active'] ? 'publish' : 'acf-disabled'; |
|
| 479 | 479 | |
| 480 | 480 | |
| 481 | - // save |
|
| 482 | - $save = array( |
|
| 483 | - 'ID' => $extract['ID'], |
|
| 484 | - 'post_status' => $post_status, |
|
| 485 | - 'post_type' => 'acf-field-group', |
|
| 486 | - 'post_title' => $extract['title'], |
|
| 487 | - 'post_name' => $extract['key'], |
|
| 488 | - 'post_excerpt' => sanitize_title($extract['title']), |
|
| 489 | - 'post_content' => $data, |
|
| 490 | - 'menu_order' => $extract['menu_order'], |
|
| 491 | - ); |
|
| 481 | + // save |
|
| 482 | + $save = array( |
|
| 483 | + 'ID' => $extract['ID'], |
|
| 484 | + 'post_status' => $post_status, |
|
| 485 | + 'post_type' => 'acf-field-group', |
|
| 486 | + 'post_title' => $extract['title'], |
|
| 487 | + 'post_name' => $extract['key'], |
|
| 488 | + 'post_excerpt' => sanitize_title($extract['title']), |
|
| 489 | + 'post_content' => $data, |
|
| 490 | + 'menu_order' => $extract['menu_order'], |
|
| 491 | + ); |
|
| 492 | 492 | |
| 493 | 493 | |
| 494 | - // allow field groups to contain the same name |
|
| 494 | + // allow field groups to contain the same name |
|
| 495 | 495 | add_filter( 'wp_unique_post_slug', 'acf_update_field_group_wp_unique_post_slug', 100, 6 ); |
| 496 | 496 | |
| 497 | 497 | |
| 498 | - // update the field group and update the ID |
|
| 499 | - if( $field_group['ID'] ) { |
|
| 498 | + // update the field group and update the ID |
|
| 499 | + if( $field_group['ID'] ) { |
|
| 500 | 500 | |
| 501 | - wp_update_post( $save ); |
|
| 501 | + wp_update_post( $save ); |
|
| 502 | 502 | |
| 503 | - } else { |
|
| 503 | + } else { |
|
| 504 | 504 | |
| 505 | - $field_group['ID'] = wp_insert_post( $save ); |
|
| 505 | + $field_group['ID'] = wp_insert_post( $save ); |
|
| 506 | 506 | |
| 507 | - } |
|
| 507 | + } |
|
| 508 | 508 | |
| 509 | 509 | |
| 510 | 510 | // action for 3rd party customization |
@@ -517,8 +517,8 @@ discard block |
||
| 517 | 517 | wp_cache_delete("get_field_groups", 'acf'); |
| 518 | 518 | |
| 519 | 519 | |
| 520 | - // return |
|
| 521 | - return $field_group; |
|
| 520 | + // return |
|
| 521 | + return $field_group; |
|
| 522 | 522 | |
| 523 | 523 | } |
| 524 | 524 | |
@@ -1209,69 +1209,69 @@ |
||
| 1209 | 1209 | $data = maybe_serialize( $data ); |
| 1210 | 1210 | |
| 1211 | 1211 | |
| 1212 | - // save |
|
| 1213 | - $save = array( |
|
| 1214 | - 'ID' => $extract['ID'], |
|
| 1215 | - 'post_status' => 'publish', |
|
| 1216 | - 'post_type' => 'acf-field', |
|
| 1217 | - 'post_title' => $extract['label'], |
|
| 1218 | - 'post_name' => $extract['key'], |
|
| 1219 | - 'post_excerpt' => $extract['name'], |
|
| 1220 | - 'post_content' => $data, |
|
| 1221 | - 'post_parent' => $extract['parent'], |
|
| 1222 | - 'menu_order' => $extract['menu_order'], |
|
| 1223 | - ); |
|
| 1212 | + // save |
|
| 1213 | + $save = array( |
|
| 1214 | + 'ID' => $extract['ID'], |
|
| 1215 | + 'post_status' => 'publish', |
|
| 1216 | + 'post_type' => 'acf-field', |
|
| 1217 | + 'post_title' => $extract['label'], |
|
| 1218 | + 'post_name' => $extract['key'], |
|
| 1219 | + 'post_excerpt' => $extract['name'], |
|
| 1220 | + 'post_content' => $data, |
|
| 1221 | + 'post_parent' => $extract['parent'], |
|
| 1222 | + 'menu_order' => $extract['menu_order'], |
|
| 1223 | + ); |
|
| 1224 | 1224 | |
| 1225 | 1225 | |
| 1226 | - // $specific |
|
| 1227 | - if( !empty($specific) ) { |
|
| 1226 | + // $specific |
|
| 1227 | + if( !empty($specific) ) { |
|
| 1228 | 1228 | |
| 1229 | - // prepend ID |
|
| 1230 | - array_unshift( $specific, 'ID' ); |
|
| 1229 | + // prepend ID |
|
| 1230 | + array_unshift( $specific, 'ID' ); |
|
| 1231 | 1231 | |
| 1232 | 1232 | |
| 1233 | - // vars |
|
| 1234 | - $_save = $save; |
|
| 1233 | + // vars |
|
| 1234 | + $_save = $save; |
|
| 1235 | 1235 | |
| 1236 | 1236 | |
| 1237 | - // reset |
|
| 1238 | - $save = array(); |
|
| 1237 | + // reset |
|
| 1238 | + $save = array(); |
|
| 1239 | 1239 | |
| 1240 | 1240 | |
| 1241 | - // appen data |
|
| 1242 | - foreach( $specific as $key ) { |
|
| 1241 | + // appen data |
|
| 1242 | + foreach( $specific as $key ) { |
|
| 1243 | 1243 | |
| 1244 | - $save[ $key ] = $_save[ $key ]; |
|
| 1244 | + $save[ $key ] = $_save[ $key ]; |
|
| 1245 | 1245 | |
| 1246 | - } |
|
| 1246 | + } |
|
| 1247 | 1247 | |
| 1248 | - } |
|
| 1248 | + } |
|
| 1249 | 1249 | |
| 1250 | 1250 | |
| 1251 | - // allow fields to contain the same name |
|
| 1251 | + // allow fields to contain the same name |
|
| 1252 | 1252 | add_filter( 'wp_unique_post_slug', 'acf_update_field_wp_unique_post_slug', 100, 6 ); |
| 1253 | 1253 | |
| 1254 | 1254 | |
| 1255 | - // update the field and update the ID |
|
| 1256 | - if( $field['ID'] ) { |
|
| 1255 | + // update the field and update the ID |
|
| 1256 | + if( $field['ID'] ) { |
|
| 1257 | 1257 | |
| 1258 | - wp_update_post( $save ); |
|
| 1258 | + wp_update_post( $save ); |
|
| 1259 | 1259 | |
| 1260 | - } else { |
|
| 1260 | + } else { |
|
| 1261 | 1261 | |
| 1262 | - $field['ID'] = wp_insert_post( $save ); |
|
| 1262 | + $field['ID'] = wp_insert_post( $save ); |
|
| 1263 | 1263 | |
| 1264 | - } |
|
| 1264 | + } |
|
| 1265 | 1265 | |
| 1266 | 1266 | |
| 1267 | - // clear cache |
|
| 1267 | + // clear cache |
|
| 1268 | 1268 | wp_cache_delete( "get_field/ID={$field['ID']}", 'acf' ); |
| 1269 | 1269 | wp_cache_delete( "get_field/key={$field['key']}", 'acf' ); |
| 1270 | 1270 | wp_cache_delete( "get_fields/parent={$field['parent']}", 'acf' ); |
| 1271 | 1271 | |
| 1272 | 1272 | |
| 1273 | - // return |
|
| 1274 | - return $field; |
|
| 1273 | + // return |
|
| 1274 | + return $field; |
|
| 1275 | 1275 | |
| 1276 | 1276 | } |
| 1277 | 1277 | |
@@ -1475,7 +1475,7 @@ discard block |
||
| 1475 | 1475 | } |
| 1476 | 1476 | |
| 1477 | 1477 | |
| 1478 | - // get bits |
|
| 1478 | + // get bits |
|
| 1479 | 1479 | $glue = 'AND'; |
| 1480 | 1480 | $bits = explode($glue, $sql); |
| 1481 | 1481 | |
@@ -1496,8 +1496,8 @@ discard block |
||
| 1496 | 1496 | $sql = implode($glue, $bits); |
| 1497 | 1497 | |
| 1498 | 1498 | |
| 1499 | - // return |
|
| 1500 | - return $sql; |
|
| 1499 | + // return |
|
| 1500 | + return $sql; |
|
| 1501 | 1501 | |
| 1502 | 1502 | } |
| 1503 | 1503 | |
@@ -1831,60 +1831,60 @@ discard block |
||
| 1831 | 1831 | |
| 1832 | 1832 | |
| 1833 | 1833 | // http://snipplr.com/view.php?codeview&id=60559 |
| 1834 | - $result = ''; |
|
| 1835 | - $pos = 0; |
|
| 1836 | - $strLen = strlen($json); |
|
| 1837 | - $indentStr = " "; |
|
| 1838 | - $newLine = "\n"; |
|
| 1839 | - $prevChar = ''; |
|
| 1840 | - $outOfQuotes = true; |
|
| 1841 | - |
|
| 1842 | - for ($i=0; $i<=$strLen; $i++) { |
|
| 1843 | - |
|
| 1844 | - // Grab the next character in the string. |
|
| 1845 | - $char = substr($json, $i, 1); |
|
| 1846 | - |
|
| 1847 | - // Are we inside a quoted string? |
|
| 1848 | - if ($char == '"' && $prevChar != '\\') { |
|
| 1849 | - $outOfQuotes = !$outOfQuotes; |
|
| 1834 | + $result = ''; |
|
| 1835 | + $pos = 0; |
|
| 1836 | + $strLen = strlen($json); |
|
| 1837 | + $indentStr = " "; |
|
| 1838 | + $newLine = "\n"; |
|
| 1839 | + $prevChar = ''; |
|
| 1840 | + $outOfQuotes = true; |
|
| 1841 | + |
|
| 1842 | + for ($i=0; $i<=$strLen; $i++) { |
|
| 1843 | + |
|
| 1844 | + // Grab the next character in the string. |
|
| 1845 | + $char = substr($json, $i, 1); |
|
| 1846 | + |
|
| 1847 | + // Are we inside a quoted string? |
|
| 1848 | + if ($char == '"' && $prevChar != '\\') { |
|
| 1849 | + $outOfQuotes = !$outOfQuotes; |
|
| 1850 | 1850 | |
| 1851 | - // If this character is the end of an element, |
|
| 1852 | - // output a new line and indent the next line. |
|
| 1853 | - } else if(($char == '}' || $char == ']') && $outOfQuotes) { |
|
| 1854 | - $result .= $newLine; |
|
| 1855 | - $pos --; |
|
| 1856 | - for ($j=0; $j<$pos; $j++) { |
|
| 1857 | - $result .= $indentStr; |
|
| 1858 | - } |
|
| 1859 | - } |
|
| 1851 | + // If this character is the end of an element, |
|
| 1852 | + // output a new line and indent the next line. |
|
| 1853 | + } else if(($char == '}' || $char == ']') && $outOfQuotes) { |
|
| 1854 | + $result .= $newLine; |
|
| 1855 | + $pos --; |
|
| 1856 | + for ($j=0; $j<$pos; $j++) { |
|
| 1857 | + $result .= $indentStr; |
|
| 1858 | + } |
|
| 1859 | + } |
|
| 1860 | 1860 | |
| 1861 | - // Add the character to the result string. |
|
| 1862 | - $result .= $char; |
|
| 1861 | + // Add the character to the result string. |
|
| 1862 | + $result .= $char; |
|
| 1863 | 1863 | |
| 1864 | 1864 | // If this character is ':' adda space after it |
| 1865 | - if($char == ':' && $outOfQuotes) { |
|
| 1866 | - $result .= ' '; |
|
| 1867 | - } |
|
| 1865 | + if($char == ':' && $outOfQuotes) { |
|
| 1866 | + $result .= ' '; |
|
| 1867 | + } |
|
| 1868 | 1868 | |
| 1869 | - // If the last character was the beginning of an element, |
|
| 1870 | - // output a new line and indent the next line. |
|
| 1871 | - if (($char == ',' || $char == '{' || $char == '[') && $outOfQuotes) { |
|
| 1872 | - $result .= $newLine; |
|
| 1873 | - if ($char == '{' || $char == '[') { |
|
| 1874 | - $pos ++; |
|
| 1875 | - } |
|
| 1869 | + // If the last character was the beginning of an element, |
|
| 1870 | + // output a new line and indent the next line. |
|
| 1871 | + if (($char == ',' || $char == '{' || $char == '[') && $outOfQuotes) { |
|
| 1872 | + $result .= $newLine; |
|
| 1873 | + if ($char == '{' || $char == '[') { |
|
| 1874 | + $pos ++; |
|
| 1875 | + } |
|
| 1876 | 1876 | |
| 1877 | - for ($j = 0; $j < $pos; $j++) { |
|
| 1878 | - $result .= $indentStr; |
|
| 1879 | - } |
|
| 1880 | - } |
|
| 1877 | + for ($j = 0; $j < $pos; $j++) { |
|
| 1878 | + $result .= $indentStr; |
|
| 1879 | + } |
|
| 1880 | + } |
|
| 1881 | 1881 | |
| 1882 | - $prevChar = $char; |
|
| 1883 | - } |
|
| 1882 | + $prevChar = $char; |
|
| 1883 | + } |
|
| 1884 | 1884 | |
| 1885 | 1885 | |
| 1886 | 1886 | // return |
| 1887 | - return $result; |
|
| 1887 | + return $result; |
|
| 1888 | 1888 | |
| 1889 | 1889 | } |
| 1890 | 1890 | |
@@ -2035,21 +2035,21 @@ discard block |
||
| 2035 | 2035 | |
| 2036 | 2036 | $dir = opendir( $path ); |
| 2037 | 2037 | |
| 2038 | - while(false !== ( $file = readdir($dir)) ) { |
|
| 2038 | + while(false !== ( $file = readdir($dir)) ) { |
|
| 2039 | 2039 | |
| 2040 | - // only php files |
|
| 2041 | - if( substr($file, -4) !== '.php' ) { |
|
| 2040 | + // only php files |
|
| 2041 | + if( substr($file, -4) !== '.php' ) { |
|
| 2042 | 2042 | |
| 2043 | - continue; |
|
| 2043 | + continue; |
|
| 2044 | 2044 | |
| 2045 | - } |
|
| 2045 | + } |
|
| 2046 | 2046 | |
| 2047 | 2047 | |
| 2048 | - // get version number |
|
| 2049 | - $update_version = substr($file, 0, -4); |
|
| 2048 | + // get version number |
|
| 2049 | + $update_version = substr($file, 0, -4); |
|
| 2050 | 2050 | |
| 2051 | 2051 | |
| 2052 | - // ignore if update is for a future version. May exist for testing |
|
| 2052 | + // ignore if update is for a future version. May exist for testing |
|
| 2053 | 2053 | if( version_compare( $update_version, $plugin_version, '>') ) { |
| 2054 | 2054 | |
| 2055 | 2055 | continue; |
@@ -2064,14 +2064,14 @@ discard block |
||
| 2064 | 2064 | } |
| 2065 | 2065 | |
| 2066 | 2066 | |
| 2067 | - // append |
|
| 2068 | - $updates[] = $update_version; |
|
| 2067 | + // append |
|
| 2068 | + $updates[] = $update_version; |
|
| 2069 | 2069 | |
| 2070 | - } |
|
| 2070 | + } |
|
| 2071 | 2071 | |
| 2072 | 2072 | |
| 2073 | - // return |
|
| 2074 | - return $updates; |
|
| 2073 | + // return |
|
| 2074 | + return $updates; |
|
| 2075 | 2075 | |
| 2076 | 2076 | } |
| 2077 | 2077 | |
@@ -2994,7 +2994,7 @@ discard block |
||
| 2994 | 2994 | |
| 2995 | 2995 | if( $pos !== false ) { |
| 2996 | 2996 | |
| 2997 | - $url = substr_replace($url, '', $pos, $length); |
|
| 2997 | + $url = substr_replace($url, '', $pos, $length); |
|
| 2998 | 2998 | |
| 2999 | 2999 | } |
| 3000 | 3000 | |
@@ -3592,8 +3592,8 @@ discard block |
||
| 3592 | 3592 | function _acf_settings_slug( $v ) { |
| 3593 | 3593 | |
| 3594 | 3594 | $basename = acf_get_setting('basename'); |
| 3595 | - $slug = explode('/', $basename); |
|
| 3596 | - $slug = current($slug); |
|
| 3595 | + $slug = explode('/', $basename); |
|
| 3596 | + $slug = current($slug); |
|
| 3597 | 3597 | |
| 3598 | 3598 | return $slug; |
| 3599 | 3599 | } |
@@ -994,23 +994,23 @@ |
||
| 994 | 994 | if( acf_verify_nonce('acf_form') ) { |
| 995 | 995 | |
| 996 | 996 | // validate data |
| 997 | - if( acf_validate_save_post(true) ) { |
|
| 997 | + if( acf_validate_save_post(true) ) { |
|
| 998 | 998 | |
| 999 | - // form |
|
| 1000 | - $GLOBALS['acf_form'] = acf_extract_var($_POST, '_acf_form'); |
|
| 1001 | - $GLOBALS['acf_form'] = @json_decode(base64_decode($GLOBALS['acf_form']), true); |
|
| 999 | + // form |
|
| 1000 | + $GLOBALS['acf_form'] = acf_extract_var($_POST, '_acf_form'); |
|
| 1001 | + $GLOBALS['acf_form'] = @json_decode(base64_decode($GLOBALS['acf_form']), true); |
|
| 1002 | 1002 | |
| 1003 | 1003 | |
| 1004 | - // validate |
|
| 1005 | - if( empty($GLOBALS['acf_form']) ) { |
|
| 1004 | + // validate |
|
| 1005 | + if( empty($GLOBALS['acf_form']) ) { |
|
| 1006 | 1006 | |
| 1007 | - return; |
|
| 1007 | + return; |
|
| 1008 | 1008 | |
| 1009 | - } |
|
| 1009 | + } |
|
| 1010 | 1010 | |
| 1011 | 1011 | |
| 1012 | - // vars |
|
| 1013 | - $post_id = acf_maybe_get( $GLOBALS['acf_form'], 'post_id', 0 ); |
|
| 1012 | + // vars |
|
| 1013 | + $post_id = acf_maybe_get( $GLOBALS['acf_form'], 'post_id', 0 ); |
|
| 1014 | 1014 | |
| 1015 | 1015 | |
| 1016 | 1016 | // allow for custom save |
@@ -267,7 +267,7 @@ |
||
| 267 | 267 | // add or update |
| 268 | 268 | if( get_option($option) !== false ) { |
| 269 | 269 | |
| 270 | - $return = update_option( $option, $value ); |
|
| 270 | + $return = update_option( $option, $value ); |
|
| 271 | 271 | |
| 272 | 272 | } else { |
| 273 | 273 | |
@@ -125,40 +125,40 @@ |
||
| 125 | 125 | |
| 126 | 126 | $dir = opendir( $path ); |
| 127 | 127 | |
| 128 | - while(false !== ( $file = readdir($dir)) ) { |
|
| 128 | + while(false !== ( $file = readdir($dir)) ) { |
|
| 129 | 129 | |
| 130 | - // only json files |
|
| 131 | - if( strpos($file, '.json') === false ) { |
|
| 130 | + // only json files |
|
| 131 | + if( strpos($file, '.json') === false ) { |
|
| 132 | 132 | |
| 133 | - continue; |
|
| 133 | + continue; |
|
| 134 | 134 | |
| 135 | - } |
|
| 135 | + } |
|
| 136 | 136 | |
| 137 | 137 | |
| 138 | - // read json |
|
| 139 | - $json = file_get_contents("{$path}/{$file}"); |
|
| 138 | + // read json |
|
| 139 | + $json = file_get_contents("{$path}/{$file}"); |
|
| 140 | 140 | |
| 141 | 141 | |
| 142 | - // validate json |
|
| 143 | - if( empty($json) ) { |
|
| 142 | + // validate json |
|
| 143 | + if( empty($json) ) { |
|
| 144 | 144 | |
| 145 | - continue; |
|
| 145 | + continue; |
|
| 146 | 146 | |
| 147 | - } |
|
| 147 | + } |
|
| 148 | 148 | |
| 149 | 149 | |
| 150 | - // decode |
|
| 151 | - $json = json_decode($json, true); |
|
| 150 | + // decode |
|
| 151 | + $json = json_decode($json, true); |
|
| 152 | 152 | |
| 153 | 153 | |
| 154 | - // add local |
|
| 155 | - $json['local'] = 'json'; |
|
| 154 | + // add local |
|
| 155 | + $json['local'] = 'json'; |
|
| 156 | 156 | |
| 157 | 157 | |
| 158 | - // add field group |
|
| 159 | - acf_add_local_field_group( $json ); |
|
| 158 | + // add field group |
|
| 159 | + acf_add_local_field_group( $json ); |
|
| 160 | 160 | |
| 161 | - } |
|
| 161 | + } |
|
| 162 | 162 | |
| 163 | 163 | } |
| 164 | 164 | |
@@ -85,8 +85,8 @@ |
||
| 85 | 85 | |
| 86 | 86 | foreach( $field_groups as $key => $row ) { |
| 87 | 87 | |
| 88 | - $menu_order[ $key ] = $row['menu_order']; |
|
| 89 | - $title[ $key ] = $row['title']; |
|
| 88 | + $menu_order[ $key ] = $row['menu_order']; |
|
| 89 | + $title[ $key ] = $row['title']; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | |
@@ -83,15 +83,15 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | |
| 85 | 85 | // compare |
| 86 | - if( $rule['operator'] == "==" ) { |
|
| 86 | + if( $rule['operator'] == "==" ) { |
|
| 87 | 87 | |
| 88 | - $match = ( $post_type === $rule['value'] ); |
|
| 88 | + $match = ( $post_type === $rule['value'] ); |
|
| 89 | 89 | |
| 90 | - } elseif( $rule['operator'] == "!=" ) { |
|
| 90 | + } elseif( $rule['operator'] == "!=" ) { |
|
| 91 | 91 | |
| 92 | - $match = ( $post_type !== $rule['value'] ); |
|
| 92 | + $match = ( $post_type !== $rule['value'] ); |
|
| 93 | 93 | |
| 94 | - } |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | // return |
@@ -169,13 +169,13 @@ discard block |
||
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | |
| 172 | - // return |
|
| 173 | - return $match; |
|
| 172 | + // return |
|
| 173 | + return $match; |
|
| 174 | 174 | |
| 175 | - } |
|
| 175 | + } |
|
| 176 | 176 | |
| 177 | 177 | |
| 178 | - /* |
|
| 178 | + /* |
|
| 179 | 179 | * rule_match_current_user_role |
| 180 | 180 | * |
| 181 | 181 | * This function will match a location rule and return true or false |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | |
| 205 | 205 | |
| 206 | 206 | // compare |
| 207 | - if( $rule['operator'] == "==" ) { |
|
| 207 | + if( $rule['operator'] == "==" ) { |
|
| 208 | 208 | |
| 209 | 209 | if( $rule['value'] == 'super_admin' ) { |
| 210 | 210 | |
@@ -231,10 +231,10 @@ discard block |
||
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | |
| 234 | - // return |
|
| 235 | - return $match; |
|
| 234 | + // return |
|
| 235 | + return $match; |
|
| 236 | 236 | |
| 237 | - } |
|
| 237 | + } |
|
| 238 | 238 | |
| 239 | 239 | |
| 240 | 240 | /* |
@@ -274,19 +274,19 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | |
| 276 | 276 | // compare |
| 277 | - if( $rule['operator'] == "==") { |
|
| 277 | + if( $rule['operator'] == "==") { |
|
| 278 | 278 | |
| 279 | - $match = ( $options['post_id'] == $rule['value'] ); |
|
| 279 | + $match = ( $options['post_id'] == $rule['value'] ); |
|
| 280 | 280 | |
| 281 | - } elseif( $rule['operator'] == "!=") { |
|
| 281 | + } elseif( $rule['operator'] == "!=") { |
|
| 282 | 282 | |
| 283 | - $match = ( $options['post_id'] != $rule['value'] ); |
|
| 283 | + $match = ( $options['post_id'] != $rule['value'] ); |
|
| 284 | 284 | |
| 285 | - } |
|
| 285 | + } |
|
| 286 | 286 | |
| 287 | 287 | |
| 288 | - // return |
|
| 289 | - return $match; |
|
| 288 | + // return |
|
| 289 | + return $match; |
|
| 290 | 290 | |
| 291 | 291 | } |
| 292 | 292 | |
@@ -371,21 +371,21 @@ discard block |
||
| 371 | 371 | |
| 372 | 372 | |
| 373 | 373 | // compare |
| 374 | - if( $rule['operator'] == "==") { |
|
| 374 | + if( $rule['operator'] == "==") { |
|
| 375 | 375 | |
| 376 | - $match = in_array($term->term_id, $terms); |
|
| 376 | + $match = in_array($term->term_id, $terms); |
|
| 377 | 377 | |
| 378 | - } elseif( $rule['operator'] == "!=") { |
|
| 378 | + } elseif( $rule['operator'] == "!=") { |
|
| 379 | 379 | |
| 380 | - $match = !in_array($term->term_id, $terms); |
|
| 380 | + $match = !in_array($term->term_id, $terms); |
|
| 381 | 381 | |
| 382 | - } |
|
| 382 | + } |
|
| 383 | 383 | |
| 384 | 384 | |
| 385 | - // return |
|
| 386 | - return $match; |
|
| 385 | + // return |
|
| 386 | + return $match; |
|
| 387 | 387 | |
| 388 | - } |
|
| 388 | + } |
|
| 389 | 389 | |
| 390 | 390 | |
| 391 | 391 | /* |
@@ -443,25 +443,25 @@ discard block |
||
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | |
| 446 | - // compare |
|
| 447 | - if( $rule['operator'] == "==") { |
|
| 446 | + // compare |
|
| 447 | + if( $rule['operator'] == "==") { |
|
| 448 | 448 | |
| 449 | - $match = ( $post_format === $rule['value'] ); |
|
| 449 | + $match = ( $post_format === $rule['value'] ); |
|
| 450 | 450 | |
| 451 | - } elseif( $rule['operator'] == "!=") { |
|
| 451 | + } elseif( $rule['operator'] == "!=") { |
|
| 452 | 452 | |
| 453 | - $match = ( $post_format !== $rule['value'] ); |
|
| 453 | + $match = ( $post_format !== $rule['value'] ); |
|
| 454 | 454 | |
| 455 | - } |
|
| 455 | + } |
|
| 456 | 456 | |
| 457 | 457 | |
| 458 | - // return |
|
| 459 | - return $match; |
|
| 458 | + // return |
|
| 459 | + return $match; |
|
| 460 | 460 | |
| 461 | - } |
|
| 461 | + } |
|
| 462 | 462 | |
| 463 | 463 | |
| 464 | - /* |
|
| 464 | + /* |
|
| 465 | 465 | * rule_match_post_status |
| 466 | 466 | * |
| 467 | 467 | * This function will match a location rule and return true or false |
@@ -489,30 +489,30 @@ discard block |
||
| 489 | 489 | $post_status = get_post_status( $options['post_id'] ); |
| 490 | 490 | |
| 491 | 491 | |
| 492 | - // auto-draft = draft |
|
| 493 | - if( $post_status == 'auto-draft' ) { |
|
| 492 | + // auto-draft = draft |
|
| 493 | + if( $post_status == 'auto-draft' ) { |
|
| 494 | 494 | |
| 495 | - $post_status = 'draft'; |
|
| 495 | + $post_status = 'draft'; |
|
| 496 | 496 | |
| 497 | - } |
|
| 497 | + } |
|
| 498 | 498 | |
| 499 | 499 | |
| 500 | - // compare |
|
| 501 | - if( $rule['operator'] == "==") { |
|
| 500 | + // compare |
|
| 501 | + if( $rule['operator'] == "==") { |
|
| 502 | 502 | |
| 503 | - $match = ( $post_status === $rule['value'] ); |
|
| 503 | + $match = ( $post_status === $rule['value'] ); |
|
| 504 | 504 | |
| 505 | - } elseif( $rule['operator'] == "!=") { |
|
| 505 | + } elseif( $rule['operator'] == "!=") { |
|
| 506 | 506 | |
| 507 | - $match = ( $post_status !== $rule['value'] ); |
|
| 507 | + $match = ( $post_status !== $rule['value'] ); |
|
| 508 | 508 | |
| 509 | - } |
|
| 509 | + } |
|
| 510 | 510 | |
| 511 | 511 | |
| 512 | - // return |
|
| 513 | - return $match; |
|
| 512 | + // return |
|
| 513 | + return $match; |
|
| 514 | 514 | |
| 515 | - } |
|
| 515 | + } |
|
| 516 | 516 | |
| 517 | 517 | |
| 518 | 518 | /* |
@@ -544,115 +544,115 @@ discard block |
||
| 544 | 544 | |
| 545 | 545 | |
| 546 | 546 | // compare |
| 547 | - if( $rule['value'] == 'front_page') { |
|
| 547 | + if( $rule['value'] == 'front_page') { |
|
| 548 | 548 | |
| 549 | - // vars |
|
| 550 | - $front_page = (int) get_option('page_on_front'); |
|
| 549 | + // vars |
|
| 550 | + $front_page = (int) get_option('page_on_front'); |
|
| 551 | 551 | |
| 552 | 552 | |
| 553 | - // compare |
|
| 554 | - if( $rule['operator'] == "==" ) { |
|
| 553 | + // compare |
|
| 554 | + if( $rule['operator'] == "==" ) { |
|
| 555 | 555 | |
| 556 | - $match = ( $front_page == $post->ID ); |
|
| 556 | + $match = ( $front_page == $post->ID ); |
|
| 557 | 557 | |
| 558 | - } elseif( $rule['operator'] == "!=" ) { |
|
| 558 | + } elseif( $rule['operator'] == "!=" ) { |
|
| 559 | 559 | |
| 560 | - $match = ( $front_page != $post->ID ); |
|
| 560 | + $match = ( $front_page != $post->ID ); |
|
| 561 | 561 | |
| 562 | - } |
|
| 562 | + } |
|
| 563 | 563 | |
| 564 | - } elseif( $rule['value'] == 'posts_page') { |
|
| 564 | + } elseif( $rule['value'] == 'posts_page') { |
|
| 565 | 565 | |
| 566 | - // vars |
|
| 567 | - $posts_page = (int) get_option('page_for_posts'); |
|
| 566 | + // vars |
|
| 567 | + $posts_page = (int) get_option('page_for_posts'); |
|
| 568 | 568 | |
| 569 | 569 | |
| 570 | - // compare |
|
| 571 | - if( $rule['operator'] == "==" ) { |
|
| 570 | + // compare |
|
| 571 | + if( $rule['operator'] == "==" ) { |
|
| 572 | 572 | |
| 573 | - $match = ( $posts_page == $post->ID ); |
|
| 573 | + $match = ( $posts_page == $post->ID ); |
|
| 574 | 574 | |
| 575 | - } elseif( $rule['operator'] == "!=" ) { |
|
| 575 | + } elseif( $rule['operator'] == "!=" ) { |
|
| 576 | 576 | |
| 577 | - $match = ( $posts_page != $post->ID ); |
|
| 577 | + $match = ( $posts_page != $post->ID ); |
|
| 578 | 578 | |
| 579 | - } |
|
| 579 | + } |
|
| 580 | 580 | |
| 581 | - } elseif( $rule['value'] == 'top_level') { |
|
| 581 | + } elseif( $rule['value'] == 'top_level') { |
|
| 582 | 582 | |
| 583 | - // vars |
|
| 584 | - $post_parent = $post->post_parent; |
|
| 583 | + // vars |
|
| 584 | + $post_parent = $post->post_parent; |
|
| 585 | 585 | |
| 586 | 586 | |
| 587 | - // override |
|
| 588 | - if( $options['page_parent'] ) { |
|
| 587 | + // override |
|
| 588 | + if( $options['page_parent'] ) { |
|
| 589 | 589 | |
| 590 | - $post_parent = $options['page_parent']; |
|
| 590 | + $post_parent = $options['page_parent']; |
|
| 591 | 591 | |
| 592 | - } |
|
| 592 | + } |
|
| 593 | 593 | |
| 594 | 594 | |
| 595 | - // compare |
|
| 596 | - if( $rule['operator'] == "==" ) { |
|
| 595 | + // compare |
|
| 596 | + if( $rule['operator'] == "==" ) { |
|
| 597 | 597 | |
| 598 | - $match = ( $post_parent == 0 ); |
|
| 598 | + $match = ( $post_parent == 0 ); |
|
| 599 | 599 | |
| 600 | - } elseif( $rule['operator'] == "!=" ) { |
|
| 600 | + } elseif( $rule['operator'] == "!=" ) { |
|
| 601 | 601 | |
| 602 | - $match = ( $post_parent != 0 ); |
|
| 602 | + $match = ( $post_parent != 0 ); |
|
| 603 | 603 | |
| 604 | - } |
|
| 604 | + } |
|
| 605 | 605 | |
| 606 | - } elseif( $rule['value'] == 'parent' ) { |
|
| 606 | + } elseif( $rule['value'] == 'parent' ) { |
|
| 607 | 607 | |
| 608 | - // get children |
|
| 609 | - $children = get_pages(array( |
|
| 610 | - 'post_type' => $post->post_type, |
|
| 611 | - 'child_of' => $post->ID, |
|
| 612 | - )); |
|
| 608 | + // get children |
|
| 609 | + $children = get_pages(array( |
|
| 610 | + 'post_type' => $post->post_type, |
|
| 611 | + 'child_of' => $post->ID, |
|
| 612 | + )); |
|
| 613 | 613 | |
| 614 | 614 | |
| 615 | - // compare |
|
| 616 | - if( $rule['operator'] == "==" ) { |
|
| 615 | + // compare |
|
| 616 | + if( $rule['operator'] == "==" ) { |
|
| 617 | 617 | |
| 618 | - $match = ( count($children) > 0 ); |
|
| 618 | + $match = ( count($children) > 0 ); |
|
| 619 | 619 | |
| 620 | - } elseif( $rule['operator'] == "!=" ) { |
|
| 620 | + } elseif( $rule['operator'] == "!=" ) { |
|
| 621 | 621 | |
| 622 | - $match = ( count($children) == 0 ); |
|
| 622 | + $match = ( count($children) == 0 ); |
|
| 623 | 623 | |
| 624 | - } |
|
| 624 | + } |
|
| 625 | 625 | |
| 626 | - } elseif( $rule['value'] == 'child') { |
|
| 626 | + } elseif( $rule['value'] == 'child') { |
|
| 627 | 627 | |
| 628 | - // vars |
|
| 629 | - $post_parent = $post->post_parent; |
|
| 628 | + // vars |
|
| 629 | + $post_parent = $post->post_parent; |
|
| 630 | 630 | |
| 631 | 631 | |
| 632 | - // override |
|
| 633 | - if( $options['page_parent'] ) { |
|
| 632 | + // override |
|
| 633 | + if( $options['page_parent'] ) { |
|
| 634 | 634 | |
| 635 | - $post_parent = $options['page_parent']; |
|
| 635 | + $post_parent = $options['page_parent']; |
|
| 636 | 636 | |
| 637 | - } |
|
| 637 | + } |
|
| 638 | 638 | |
| 639 | 639 | |
| 640 | - // compare |
|
| 641 | - if( $rule['operator'] == "==" ) { |
|
| 640 | + // compare |
|
| 641 | + if( $rule['operator'] == "==" ) { |
|
| 642 | 642 | |
| 643 | - $match = ( $post_parent != 0 ); |
|
| 643 | + $match = ( $post_parent != 0 ); |
|
| 644 | 644 | |
| 645 | - } elseif( $rule['operator'] == "!=" ) { |
|
| 645 | + } elseif( $rule['operator'] == "!=" ) { |
|
| 646 | 646 | |
| 647 | - $match = ( $post_parent == 0 ); |
|
| 647 | + $match = ( $post_parent == 0 ); |
|
| 648 | 648 | |
| 649 | - } |
|
| 649 | + } |
|
| 650 | 650 | |
| 651 | - } |
|
| 651 | + } |
|
| 652 | 652 | |
| 653 | 653 | |
| 654 | - // return |
|
| 655 | - return $match; |
|
| 654 | + // return |
|
| 655 | + return $match; |
|
| 656 | 656 | |
| 657 | 657 | } |
| 658 | 658 | |
@@ -687,27 +687,27 @@ discard block |
||
| 687 | 687 | |
| 688 | 688 | // post parent |
| 689 | 689 | $post_parent = $post->post_parent; |
| 690 | - if( $options['page_parent'] ) { |
|
| 690 | + if( $options['page_parent'] ) { |
|
| 691 | 691 | |
| 692 | - $post_parent = $options['page_parent']; |
|
| 692 | + $post_parent = $options['page_parent']; |
|
| 693 | 693 | |
| 694 | - } |
|
| 694 | + } |
|
| 695 | 695 | |
| 696 | 696 | |
| 697 | - // compare |
|
| 698 | - if( $rule['operator'] == "==" ) { |
|
| 697 | + // compare |
|
| 698 | + if( $rule['operator'] == "==" ) { |
|
| 699 | 699 | |
| 700 | - $match = ( $post_parent == $rule['value'] ); |
|
| 700 | + $match = ( $post_parent == $rule['value'] ); |
|
| 701 | 701 | |
| 702 | - } elseif( $rule['operator'] == "!=" ) { |
|
| 702 | + } elseif( $rule['operator'] == "!=" ) { |
|
| 703 | 703 | |
| 704 | - $match = ( $post_parent != $rule['value'] ); |
|
| 704 | + $match = ( $post_parent != $rule['value'] ); |
|
| 705 | 705 | |
| 706 | - } |
|
| 706 | + } |
|
| 707 | 707 | |
| 708 | 708 | |
| 709 | - // return |
|
| 710 | - return $match; |
|
| 709 | + // return |
|
| 710 | + return $match; |
|
| 711 | 711 | |
| 712 | 712 | } |
| 713 | 713 | |
@@ -760,24 +760,24 @@ discard block |
||
| 760 | 760 | |
| 761 | 761 | |
| 762 | 762 | // compare |
| 763 | - if( $rule['operator'] == "==" ) { |
|
| 763 | + if( $rule['operator'] == "==" ) { |
|
| 764 | 764 | |
| 765 | - $match = ( $page_template === $rule['value'] ); |
|
| 765 | + $match = ( $page_template === $rule['value'] ); |
|
| 766 | 766 | |
| 767 | - } elseif( $rule['operator'] == "!=" ) { |
|
| 767 | + } elseif( $rule['operator'] == "!=" ) { |
|
| 768 | 768 | |
| 769 | - $match = ( $page_template !== $rule['value'] ); |
|
| 769 | + $match = ( $page_template !== $rule['value'] ); |
|
| 770 | 770 | |
| 771 | - } |
|
| 771 | + } |
|
| 772 | 772 | |
| 773 | 773 | |
| 774 | - // return |
|
| 775 | - return $match; |
|
| 774 | + // return |
|
| 775 | + return $match; |
|
| 776 | 776 | |
| 777 | 777 | } |
| 778 | 778 | |
| 779 | 779 | |
| 780 | - /* |
|
| 780 | + /* |
|
| 781 | 781 | * rule_match_user_form |
| 782 | 782 | * |
| 783 | 783 | * This function will match a location rule and return true or false |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | * @return $options (array) |
| 792 | 792 | */ |
| 793 | 793 | |
| 794 | - function rule_match_user_form( $match, $rule, $options ) { |
|
| 794 | + function rule_match_user_form( $match, $rule, $options ) { |
|
| 795 | 795 | |
| 796 | 796 | // vars |
| 797 | 797 | $user_form = $options['user_form']; |
@@ -810,39 +810,39 @@ discard block |
||
| 810 | 810 | |
| 811 | 811 | if( $rule['operator'] == "==" ) { |
| 812 | 812 | |
| 813 | - $match = ( $user_form == $rule['value'] ); |
|
| 813 | + $match = ( $user_form == $rule['value'] ); |
|
| 814 | 814 | |
| 815 | 815 | |
| 816 | - // override for "all" |
|
| 817 | - if( $rule['value'] === 'all' ) { |
|
| 816 | + // override for "all" |
|
| 817 | + if( $rule['value'] === 'all' ) { |
|
| 818 | 818 | |
| 819 | 819 | $match = true; |
| 820 | 820 | |
| 821 | 821 | } |
| 822 | 822 | |
| 823 | - } elseif( $rule['operator'] == "!=" ) { |
|
| 823 | + } elseif( $rule['operator'] == "!=" ) { |
|
| 824 | 824 | |
| 825 | - $match = ( $user_form != $rule['value'] ); |
|
| 825 | + $match = ( $user_form != $rule['value'] ); |
|
| 826 | 826 | |
| 827 | 827 | |
| 828 | - // override for "all" |
|
| 829 | - if( $rule['value'] === 'all' ) { |
|
| 828 | + // override for "all" |
|
| 829 | + if( $rule['value'] === 'all' ) { |
|
| 830 | 830 | |
| 831 | 831 | $match = false; |
| 832 | 832 | |
| 833 | 833 | } |
| 834 | 834 | |
| 835 | - } |
|
| 835 | + } |
|
| 836 | 836 | |
| 837 | 837 | } |
| 838 | 838 | |
| 839 | 839 | |
| 840 | - // return |
|
| 841 | - return $match; |
|
| 842 | - } |
|
| 840 | + // return |
|
| 841 | + return $match; |
|
| 842 | + } |
|
| 843 | 843 | |
| 844 | 844 | |
| 845 | - /* |
|
| 845 | + /* |
|
| 846 | 846 | * rule_match_user_role |
| 847 | 847 | * |
| 848 | 848 | * This function will match a location rule and return true or false |
@@ -868,97 +868,97 @@ discard block |
||
| 868 | 868 | |
| 869 | 869 | if( $rule['operator'] == "==" ) { |
| 870 | 870 | |
| 871 | - if( $user_role === $rule['value'] ) { |
|
| 871 | + if( $user_role === $rule['value'] ) { |
|
| 872 | 872 | |
| 873 | - $match = true; |
|
| 873 | + $match = true; |
|
| 874 | 874 | |
| 875 | - } |
|
| 875 | + } |
|
| 876 | 876 | |
| 877 | 877 | |
| 878 | - // override for "all" |
|
| 879 | - if( $rule['value'] === 'all' ) { |
|
| 878 | + // override for "all" |
|
| 879 | + if( $rule['value'] === 'all' ) { |
|
| 880 | 880 | |
| 881 | 881 | $match = true; |
| 882 | 882 | |
| 883 | 883 | } |
| 884 | 884 | |
| 885 | - } elseif( $rule['operator'] == "!=" ) { |
|
| 885 | + } elseif( $rule['operator'] == "!=" ) { |
|
| 886 | 886 | |
| 887 | - if( $user_role !== $rule['value'] ) { |
|
| 887 | + if( $user_role !== $rule['value'] ) { |
|
| 888 | 888 | |
| 889 | - $match = true; |
|
| 889 | + $match = true; |
|
| 890 | 890 | |
| 891 | - } |
|
| 891 | + } |
|
| 892 | 892 | |
| 893 | 893 | |
| 894 | - // override for "all" |
|
| 895 | - if( $rule['value'] === 'all' ) { |
|
| 894 | + // override for "all" |
|
| 895 | + if( $rule['value'] === 'all' ) { |
|
| 896 | 896 | |
| 897 | 897 | $match = false; |
| 898 | 898 | |
| 899 | 899 | } |
| 900 | 900 | |
| 901 | - } |
|
| 901 | + } |
|
| 902 | 902 | |
| 903 | 903 | } elseif( $user_id ) { |
| 904 | 904 | |
| 905 | 905 | if( $rule['operator'] == "==" ) { |
| 906 | 906 | |
| 907 | - if( $user_id === 'new' ) { |
|
| 907 | + if( $user_id === 'new' ) { |
|
| 908 | 908 | |
| 909 | - // case: add user |
|
| 910 | - $match = ( $rule['value'] == get_option('default_role') ); |
|
| 909 | + // case: add user |
|
| 910 | + $match = ( $rule['value'] == get_option('default_role') ); |
|
| 911 | 911 | |
| 912 | - } else { |
|
| 912 | + } else { |
|
| 913 | 913 | |
| 914 | - // case: edit user |
|
| 915 | - $match = ( user_can($user_id, $rule['value']) ); |
|
| 914 | + // case: edit user |
|
| 915 | + $match = ( user_can($user_id, $rule['value']) ); |
|
| 916 | 916 | |
| 917 | - } |
|
| 917 | + } |
|
| 918 | 918 | |
| 919 | 919 | |
| 920 | - // override for "all" |
|
| 921 | - if( $rule['value'] === 'all' ) { |
|
| 920 | + // override for "all" |
|
| 921 | + if( $rule['value'] === 'all' ) { |
|
| 922 | 922 | |
| 923 | 923 | $match = true; |
| 924 | 924 | |
| 925 | 925 | } |
| 926 | 926 | |
| 927 | - } elseif( $rule['operator'] == "!=" ) { |
|
| 927 | + } elseif( $rule['operator'] == "!=" ) { |
|
| 928 | 928 | |
| 929 | - if( $user_id === 'new' ) { |
|
| 929 | + if( $user_id === 'new' ) { |
|
| 930 | 930 | |
| 931 | - // case: add user |
|
| 932 | - $match = ( $rule['value'] != get_option('default_role') ); |
|
| 931 | + // case: add user |
|
| 932 | + $match = ( $rule['value'] != get_option('default_role') ); |
|
| 933 | 933 | |
| 934 | - } else { |
|
| 934 | + } else { |
|
| 935 | 935 | |
| 936 | - // case: edit user |
|
| 937 | - $match = ( !user_can($user_id, $rule['value']) ); |
|
| 936 | + // case: edit user |
|
| 937 | + $match = ( !user_can($user_id, $rule['value']) ); |
|
| 938 | 938 | |
| 939 | - } |
|
| 939 | + } |
|
| 940 | 940 | |
| 941 | 941 | |
| 942 | - // override for "all" |
|
| 943 | - if( $rule['value'] === 'all' ) { |
|
| 942 | + // override for "all" |
|
| 943 | + if( $rule['value'] === 'all' ) { |
|
| 944 | 944 | |
| 945 | 945 | $match = false; |
| 946 | 946 | |
| 947 | 947 | } |
| 948 | 948 | |
| 949 | - } |
|
| 949 | + } |
|
| 950 | 950 | |
| 951 | 951 | } |
| 952 | 952 | |
| 953 | 953 | |
| 954 | - // return |
|
| 955 | - return $match; |
|
| 954 | + // return |
|
| 955 | + return $match; |
|
| 956 | 956 | |
| 957 | - } |
|
| 957 | + } |
|
| 958 | 958 | |
| 959 | 959 | |
| 960 | 960 | |
| 961 | - /* |
|
| 961 | + /* |
|
| 962 | 962 | * rule_match_taxonomy |
| 963 | 963 | * |
| 964 | 964 | * This function will match a location rule and return true or false |
@@ -989,36 +989,36 @@ discard block |
||
| 989 | 989 | // compare |
| 990 | 990 | if( $rule['operator'] == "==" ) { |
| 991 | 991 | |
| 992 | - $match = ( $taxonomy == $rule['value'] ); |
|
| 992 | + $match = ( $taxonomy == $rule['value'] ); |
|
| 993 | 993 | |
| 994 | - // override for "all" |
|
| 995 | - if( $rule['value'] == "all" ) { |
|
| 994 | + // override for "all" |
|
| 995 | + if( $rule['value'] == "all" ) { |
|
| 996 | 996 | |
| 997 | 997 | $match = true; |
| 998 | 998 | |
| 999 | 999 | } |
| 1000 | 1000 | |
| 1001 | - } elseif( $rule['operator'] == "!=" ) { |
|
| 1001 | + } elseif( $rule['operator'] == "!=" ) { |
|
| 1002 | 1002 | |
| 1003 | - $match = ( $taxonomy != $rule['value'] ); |
|
| 1003 | + $match = ( $taxonomy != $rule['value'] ); |
|
| 1004 | 1004 | |
| 1005 | - // override for "all" |
|
| 1006 | - if( $rule['value'] == "all" ) { |
|
| 1005 | + // override for "all" |
|
| 1006 | + if( $rule['value'] == "all" ) { |
|
| 1007 | 1007 | |
| 1008 | 1008 | $match = false; |
| 1009 | 1009 | |
| 1010 | 1010 | } |
| 1011 | 1011 | |
| 1012 | - } |
|
| 1012 | + } |
|
| 1013 | 1013 | |
| 1014 | 1014 | |
| 1015 | - // return |
|
| 1016 | - return $match; |
|
| 1015 | + // return |
|
| 1016 | + return $match; |
|
| 1017 | 1017 | |
| 1018 | - } |
|
| 1018 | + } |
|
| 1019 | 1019 | |
| 1020 | 1020 | |
| 1021 | - /* |
|
| 1021 | + /* |
|
| 1022 | 1022 | * rule_match_attachment |
| 1023 | 1023 | * |
| 1024 | 1024 | * This function will match a location rule and return true or false |
@@ -1049,37 +1049,37 @@ discard block |
||
| 1049 | 1049 | // compare |
| 1050 | 1050 | if( $rule['operator'] == "==" ) { |
| 1051 | 1051 | |
| 1052 | - $match = ( $attachment == $rule['value'] ); |
|
| 1052 | + $match = ( $attachment == $rule['value'] ); |
|
| 1053 | 1053 | |
| 1054 | - // override for "all" |
|
| 1055 | - if( $rule['value'] == "all" ) { |
|
| 1054 | + // override for "all" |
|
| 1055 | + if( $rule['value'] == "all" ) { |
|
| 1056 | 1056 | |
| 1057 | 1057 | $match = true; |
| 1058 | 1058 | |
| 1059 | 1059 | } |
| 1060 | 1060 | |
| 1061 | - } elseif( $rule['operator'] == "!=" ) { |
|
| 1061 | + } elseif( $rule['operator'] == "!=" ) { |
|
| 1062 | 1062 | |
| 1063 | - $match = ( $attachment != $rule['value'] ); |
|
| 1063 | + $match = ( $attachment != $rule['value'] ); |
|
| 1064 | 1064 | |
| 1065 | - // override for "all" |
|
| 1066 | - if( $rule['value'] == "all" ) { |
|
| 1065 | + // override for "all" |
|
| 1066 | + if( $rule['value'] == "all" ) { |
|
| 1067 | 1067 | |
| 1068 | 1068 | $match = false; |
| 1069 | 1069 | |
| 1070 | 1070 | } |
| 1071 | 1071 | |
| 1072 | - } |
|
| 1072 | + } |
|
| 1073 | 1073 | |
| 1074 | 1074 | |
| 1075 | - // return |
|
| 1076 | - return $match; |
|
| 1075 | + // return |
|
| 1076 | + return $match; |
|
| 1077 | 1077 | |
| 1078 | - } |
|
| 1078 | + } |
|
| 1079 | 1079 | |
| 1080 | 1080 | |
| 1081 | 1081 | |
| 1082 | - /* |
|
| 1082 | + /* |
|
| 1083 | 1083 | * rule_match_comment |
| 1084 | 1084 | * |
| 1085 | 1085 | * This function will match a location rule and return true or false |
@@ -1110,36 +1110,36 @@ discard block |
||
| 1110 | 1110 | // compare |
| 1111 | 1111 | if( $rule['operator'] == "==" ) { |
| 1112 | 1112 | |
| 1113 | - $match = ( $comment == $rule['value'] ); |
|
| 1113 | + $match = ( $comment == $rule['value'] ); |
|
| 1114 | 1114 | |
| 1115 | - // override for "all" |
|
| 1116 | - if( $rule['value'] == "all" ) { |
|
| 1115 | + // override for "all" |
|
| 1116 | + if( $rule['value'] == "all" ) { |
|
| 1117 | 1117 | |
| 1118 | 1118 | $match = true; |
| 1119 | 1119 | |
| 1120 | 1120 | } |
| 1121 | 1121 | |
| 1122 | - } elseif( $rule['operator'] == "!=" ) { |
|
| 1122 | + } elseif( $rule['operator'] == "!=" ) { |
|
| 1123 | 1123 | |
| 1124 | - $match = ( $comment != $rule['value'] ); |
|
| 1124 | + $match = ( $comment != $rule['value'] ); |
|
| 1125 | 1125 | |
| 1126 | - // override for "all" |
|
| 1127 | - if( $rule['value'] == "all" ) { |
|
| 1126 | + // override for "all" |
|
| 1127 | + if( $rule['value'] == "all" ) { |
|
| 1128 | 1128 | |
| 1129 | 1129 | $match = false; |
| 1130 | 1130 | |
| 1131 | 1131 | } |
| 1132 | 1132 | |
| 1133 | - } |
|
| 1133 | + } |
|
| 1134 | 1134 | |
| 1135 | 1135 | |
| 1136 | - // return |
|
| 1137 | - return $match; |
|
| 1136 | + // return |
|
| 1137 | + return $match; |
|
| 1138 | 1138 | |
| 1139 | - } |
|
| 1139 | + } |
|
| 1140 | 1140 | |
| 1141 | 1141 | |
| 1142 | - /* |
|
| 1142 | + /* |
|
| 1143 | 1143 | * rule_match_widget |
| 1144 | 1144 | * |
| 1145 | 1145 | * This function will match a location rule and return true or false |
@@ -1153,7 +1153,7 @@ discard block |
||
| 1153 | 1153 | * @return $options (array) |
| 1154 | 1154 | */ |
| 1155 | 1155 | |
| 1156 | - function rule_match_widget( $match, $rule, $options ) { |
|
| 1156 | + function rule_match_widget( $match, $rule, $options ) { |
|
| 1157 | 1157 | |
| 1158 | 1158 | // vars |
| 1159 | 1159 | $widget = $options['widget']; |
@@ -1170,32 +1170,32 @@ discard block |
||
| 1170 | 1170 | // compare |
| 1171 | 1171 | if( $rule['operator'] == "==" ) { |
| 1172 | 1172 | |
| 1173 | - $match = ( $widget == $rule['value'] ); |
|
| 1173 | + $match = ( $widget == $rule['value'] ); |
|
| 1174 | 1174 | |
| 1175 | - // override for "all" |
|
| 1176 | - if( $rule['value'] == "all" ) { |
|
| 1175 | + // override for "all" |
|
| 1176 | + if( $rule['value'] == "all" ) { |
|
| 1177 | 1177 | |
| 1178 | 1178 | $match = true; |
| 1179 | 1179 | |
| 1180 | 1180 | } |
| 1181 | 1181 | |
| 1182 | - } elseif( $rule['operator'] == "!=" ) { |
|
| 1182 | + } elseif( $rule['operator'] == "!=" ) { |
|
| 1183 | 1183 | |
| 1184 | - $match = ( $widget != $rule['value'] ); |
|
| 1184 | + $match = ( $widget != $rule['value'] ); |
|
| 1185 | 1185 | |
| 1186 | - // override for "all" |
|
| 1187 | - if( $rule['value'] == "all" ) { |
|
| 1186 | + // override for "all" |
|
| 1187 | + if( $rule['value'] == "all" ) { |
|
| 1188 | 1188 | |
| 1189 | 1189 | $match = false; |
| 1190 | 1190 | |
| 1191 | 1191 | } |
| 1192 | 1192 | |
| 1193 | - } |
|
| 1193 | + } |
|
| 1194 | 1194 | |
| 1195 | 1195 | |
| 1196 | - // return |
|
| 1197 | - return $match; |
|
| 1198 | - } |
|
| 1196 | + // return |
|
| 1197 | + return $match; |
|
| 1198 | + } |
|
| 1199 | 1199 | |
| 1200 | 1200 | } |
| 1201 | 1201 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | // do not delete! |
| 44 | - parent::__construct(); |
|
| 44 | + parent::__construct(); |
|
| 45 | 45 | |
| 46 | 46 | } |
| 47 | 47 | |
@@ -79,19 +79,19 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | // localize |
| 82 | - wp_localize_script('wp-color-picker', 'wpColorPickerL10n', array( |
|
| 83 | - 'clear' => __('Clear', 'acf' ), |
|
| 84 | - 'defaultString' => __('Default', 'acf' ), |
|
| 85 | - 'pick' => __('Select Color', 'acf' ), |
|
| 86 | - 'current' => __('Current Color', 'acf' ) |
|
| 87 | - )); |
|
| 82 | + wp_localize_script('wp-color-picker', 'wpColorPickerL10n', array( |
|
| 83 | + 'clear' => __('Clear', 'acf' ), |
|
| 84 | + 'defaultString' => __('Default', 'acf' ), |
|
| 85 | + 'pick' => __('Select Color', 'acf' ), |
|
| 86 | + 'current' => __('Current Color', 'acf' ) |
|
| 87 | + )); |
|
| 88 | 88 | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | |
| 92 | 92 | // enqueue |
| 93 | 93 | wp_enqueue_style('wp-color-picker'); |
| 94 | - wp_enqueue_script('wp-color-picker'); |
|
| 94 | + wp_enqueue_script('wp-color-picker'); |
|
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | } |